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

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

Issue 571343002: Add notification before getMultiProfileShareEntries_. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 6 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/file_transfer_controller.js
diff --git a/ui/file_manager/file_manager/foreground/js/file_transfer_controller.js b/ui/file_manager/file_manager/foreground/js/file_transfer_controller.js
index 13edd5f6f45ab2c948d5411f1f7fdc101883b1e1..aaafaa0eb99de5a60e687b6dea1604f5aafc8909 100644
--- a/ui/file_manager/file_manager/foreground/js/file_transfer_controller.js
+++ b/ui/file_manager/file_manager/foreground/js/file_transfer_controller.js
@@ -28,13 +28,15 @@ function FileTransferController(doc,
metadataCache,
directoryModel,
volumeManager,
- multiProfileShareDialog) {
+ multiProfileShareDialog,
+ progressCenter) {
this.document_ = doc;
this.fileOperationManager_ = fileOperationManager;
this.metadataCache_ = metadataCache;
this.directoryModel_ = directoryModel;
this.volumeManager_ = volumeManager;
this.multiProfileShareDialog_ = multiProfileShareDialog;
+ this.progressCenter_ = progressCenter;
this.directoryModel_.getFileList().addEventListener(
'change', function(event) {
@@ -47,6 +49,12 @@ function FileTransferController(doc,
this.onSelectionChanged_.bind(this));
/**
+ * The array of pending task id.
+ * @type {Array.<string>}
+ */
+ this.pendingTaskId = [];
hirono 2014/09/16 08:12:56 nit: pendingTaskIDs ?
iseki 2014/09/16 08:44:21 Done.
+
+ /**
* Promise to be fulfilled with the thumbnail image of selected file in drag
* operation. Used if only one element is selected.
* @type {Promise}
@@ -75,6 +83,13 @@ function FileTransferController(doc,
* @private
*/
this.touching_ = false;
+
+ /**
+ * Task id counter.
+ * @type {int}
hirono 2014/09/16 08:12:56 We don't use int. Instead, please use number.
iseki 2014/09/16 08:44:21 Done.
+ * @private
+ */
+ this.taskIdCounter_ = 0;
}
/**
@@ -333,11 +348,18 @@ FileTransferController.prototype = {
opt_destinationEntry || this.currentDirectoryContentEntry;
var entries;
var failureUrls;
+ var taskId = this.generateTaskId_();
util.URLsToEntries(sourceURLs).
then(function(result) {
+ this.pendingTaskId.push(taskId);
entries = result.entries;
failureUrls = result.failureUrls;
+ var item = new ProgressCenterItem();
+ item.id = taskId;
+ item.type = ProgressItemType.COPY;
+ item.message = strf('CHECK_FILES_ARE_SHARED');
+ this.progressCenter_.updateItem(item);
// Check if cross share is needed or not.
return this.getMultiProfileShareEntries_(entries);
}.bind(this)).
@@ -369,7 +391,8 @@ FileTransferController.prototype = {
then(function() {
// Start the pasting operation.
this.fileOperationManager_.paste(
- entries, destinationEntry, toMove);
+ entries, destinationEntry, toMove, taskId);
+ this.pendingTaskId.splice(this.pendingTaskId.find(taskId), 1);
hirono 2014/09/16 08:12:56 Array does not have 'find' method.
iseki 2014/09/16 08:44:21 Done.
// Publish events for failureUrls.
for (var i = 0; i < failureUrls.length; i++) {
@@ -1068,4 +1091,14 @@ FileTransferController.prototype = {
}
return 'copy';
},
+
+ /**
+ * Generates new task ID.
+ *
+ * @return {string} New task ID.
+ * @private
+ */
+ generateTaskId_: function() {
+ return 'file-operation-from-transfer-controller' + this.taskIdCounter_++;
+ },
};

Powered by Google App Engine
This is Rietveld 408576698