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

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

Issue 1378053004: Simplify FileTasks in Files app. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Rebased. Created 5 years, 3 months 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/main_window_component.js
diff --git a/ui/file_manager/file_manager/foreground/js/main_window_component.js b/ui/file_manager/file_manager/foreground/js/main_window_component.js
index c96af6af926afbd063a796e5712e80812243618b..c861a10e3ea8811fc418aaf21fc11b2280e77536 100644
--- a/ui/file_manager/file_manager/foreground/js/main_window_component.js
+++ b/ui/file_manager/file_manager/foreground/js/main_window_component.js
@@ -188,11 +188,35 @@ MainWindowComponent.prototype.onDetailClick_ = function(event) {
this.directoryModel_.changeDirectoryEntry(
/** @type {!DirectoryEntry} */ (entry));
} else {
- this.taskController_.executeSelectionTask();
+ this.acceptSelection_();
}
};
/**
+ * Accepts the current selection depending on the mode.
+ * @private
+ */
+MainWindowComponent.prototype.acceptSelection_ = function() {
+ var selection = this.selectionHandler_.selection;
+ if (this.dialogType_ == DialogType.FULL_PAGE) {
+ this.taskController_.getFileTasks()
+ .then(function(tasks) {
+ tasks.executeDefault();
+ })
+ .catch(function(error) {
+ if (error)
+ console.error(error.stack || error);
+ });
+ return true;
+ }
+ if (!this.ui_.dialogFooter.okButton.disabled) {
+ this.ui_.dialogFooter.okButton.click();
+ return true;
+ }
+ return false;
+}
+
+/**
* Handles click event on the toggle-view button.
* @param {Event} event Click event.
* @private
@@ -282,7 +306,7 @@ MainWindowComponent.prototype.onListKeyDown_ = function(event) {
this.directoryModel_.changeDirectoryEntry(
/** @type {!DirectoryEntry} */ (selection.entries[0]));
}
- } else if (this.taskController_.executeSelectionTask()) {
+ } else if (this.acceptSelection_()) {
event.preventDefault();
}
break;

Powered by Google App Engine
This is Rietveld 408576698