Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(546)

Unified Diff: ui/file_manager/file_manager/foreground/js/dialog_action_controller.js

Issue 736663002: Refoctoring FileSelection and FileSelectionHandler. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 6 years, 1 month ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
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;
}

Powered by Google App Engine
This is Rietveld 408576698