Index: ui/file_manager/file_manager/foreground/js/dialog_action_controller.js |
diff --git a/ui/file_manager/file_manager/foreground/js/dialog_action_controller.js b/ui/file_manager/file_manager/foreground/js/dialog_action_controller.js |
index 369161c98e681909b5b7b66b4ce7d5feec582ae6..b71cb5e84037c4e88e5f89488427e1f19bd8cbb0 100644 |
--- a/ui/file_manager/file_manager/foreground/js/dialog_action_controller.js |
+++ b/ui/file_manager/file_manager/foreground/js/dialog_action_controller.js |
@@ -116,7 +116,8 @@ function DialogActionController( |
dialogFooter.filenameInput.addEventListener( |
'input', this.updateOkButton_.bind(this)); |
fileSelectionHandler.addEventListener( |
- 'change', this.onFileSelectionChanged_.bind(this)); |
+ FileSelectionHandler.EventType.CHANGE_THROTTLED, |
+ this.onFileSelectionChanged_.bind(this)); |
dialogFooter.initFileTypeFilter( |
this.fileTypes_, launchParam.includeAllFiles); |
@@ -411,7 +412,13 @@ DialogActionController.prototype.onFileSelectionChanged_ = function() { |
this.dialogFooter_.filenameInput.value = selection.entries[0].name; |
} |
- this.updateOkButton_(); |
+ selection.completeInit().then(function() { |
+ if (this.fileSelectionHandler_.selection !== selection) |
+ return; |
+ this.updateOkButton_(); |
+ if (!this.dialogFooter_.okButton.disable) |
+ util.testSendMessage('dialog-ready'); |
+ }.bind(this)); |
}; |
/** |
@@ -442,27 +449,19 @@ DialogActionController.prototype.updateOkButton_ = function() { |
return; |
} |
- var isDriveOffline = |
- this.volumeManager_.getDriveConnectionState().type === |
- VolumeManagerCommon.DriveConnectionType.OFFLINE; |
- var filesAvailable = |
- !this.directoryModel_.isOnDrive() || |
- !isDriveOffline || |
- selection.allDriveFilesPresent; |
- |
if (this.dialogType_ === DialogType.SELECT_OPEN_FILE) { |
this.dialogFooter_.okButton.disabled = |
- !filesAvailable || |
selection.directoryCount !== 0 || |
- selection.fileCount !== 1; |
+ selection.fileCount !== 1 || |
+ !this.fileSelectionHandler_.isAvailable(); |
return; |
} |
if (this.dialogType_ === DialogType.SELECT_OPEN_MULTI_FILE) { |
this.dialogFooter_.okButton.disabled = |
- !filesAvailable || |
selection.directoryCount !== 0 || |
- selection.fileCount === 0; |
+ selection.fileCount === 0 || |
+ !this.fileSelectionHandler_.isAvailable(); |
return; |
} |