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

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

Issue 2966163005: Revert of Reuse FileTasks when entries are not changed. (Closed)
Patch Set: Created 3 years, 5 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
« no previous file with comments | « ui/file_manager/file_manager/foreground/js/file_tasks.js ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: ui/file_manager/file_manager/foreground/js/task_controller.js
diff --git a/ui/file_manager/file_manager/foreground/js/task_controller.js b/ui/file_manager/file_manager/foreground/js/task_controller.js
index 8126570201a14582b44a6b63f40207c61487fe51..a703d14c00d7f9c8d5a5109887dd38fb1940e018 100644
--- a/ui/file_manager/file_manager/foreground/js/task_controller.js
+++ b/ui/file_manager/file_manager/foreground/js/task_controller.js
@@ -262,6 +262,7 @@
* @private
*/
TaskController.prototype.onSelectionChanged_ = function() {
+ this.tasks_ = null;
var selection = this.selectionHandler_.selection;
// Caller of update context menu task items.
// FileSelectionHandler.EventType.CHANGE
@@ -285,36 +286,15 @@
var selection = this.selectionHandler_.selection;
if (this.dialogType_ === DialogType.FULL_PAGE &&
(selection.directoryCount > 0 || selection.fileCount > 0)) {
- var previousFileTasksInvalidatePromise = new Promise(function(resolve) {
- if (this.tasks_) {
- this.getFileTasks()
- .then(function(tasks) {
- if (!util.isSameEntries(tasks.entries, selection.entries)) {
- this.tasks_ = null;
- }
- resolve();
- }.bind(this))
- .catch(function(error) {
- if (error)
- console.log(error.stack || error);
- this.tasks_ = null;
- resolve();
- }.bind(this));
- } else {
- resolve();
- }
- }.bind(this));
- previousFileTasksInvalidatePromise.then(function() {
- this.getFileTasks()
- .then(function(tasks) {
- tasks.display(this.ui_.taskMenuButton);
- this.updateContextMenuTaskItems_(tasks.getTaskItems());
- }.bind(this))
- .catch(function(error) {
- if (error)
- console.error(error.stack || error);
- });
- }.bind(this));
+ this.getFileTasks()
+ .then(function(tasks) {
+ tasks.display(this.ui_.taskMenuButton);
+ this.updateContextMenuTaskItems_(tasks.getTaskItems());
+ }.bind(this))
+ .catch(function(error) {
+ if (error)
+ console.error(error.stack || error);
+ });
} else {
this.ui_.taskMenuButton.hidden = true;
}
@@ -329,21 +309,19 @@
return this.tasks_;
var selection = this.selectionHandler_.selection;
- return this.tasks_ =
- selection.computeAdditional(this.metadataModel_).then(function() {
- if (this.selectionHandler_.selection !== selection)
- return Promise.reject();
- return FileTasks
- .create(
- this.volumeManager_, this.metadataModel_,
- this.directoryModel_, this.ui_, selection.entries,
- assert(selection.mimeTypes))
- .then(function(tasks) {
- if (this.selectionHandler_.selection !== selection)
- return Promise.reject();
- return tasks;
- }.bind(this));
- }.bind(this));
+ return selection.computeAdditional(this.metadataModel_).then(
+ function() {
+ if (this.selectionHandler_.selection !== selection)
+ return Promise.reject();
+ return FileTasks.create(
+ this.volumeManager_, this.metadataModel_, this.directoryModel_,
+ this.ui_, selection.entries, assert(selection.mimeTypes)).
+ then(function(tasks) {
+ if (this.selectionHandler_.selection !== selection)
+ return Promise.reject();
+ return tasks;
+ }.bind(this));
+ }.bind(this));
};
/**
« no previous file with comments | « ui/file_manager/file_manager/foreground/js/file_tasks.js ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698