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

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
« no previous file with comments | « ui/file_manager/file_manager/foreground/js/file_manager.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/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..32e14d3c8e008cf74b9234af0da47641dcc0e83f 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
@@ -21,6 +21,7 @@ var DRAG_AND_DROP_GLOBAL_DATA = '__drag_and_drop_global_data';
* @param {VolumeManagerWrapper} volumeManager Volume manager instance.
* @param {MultiProfileShareDialog} multiProfileShareDialog Share dialog to be
* used to share files from another profile.
+ * @param {ProgressCenter} progressCenter To notify starting copy operation.
* @constructor
*/
function FileTransferController(doc,
@@ -28,13 +29,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 +50,12 @@ function FileTransferController(doc,
this.onSelectionChanged_.bind(this));
/**
+ * The array of pending task ID.
+ * @type {Array.<string>}
+ */
+ this.pendingTaskIds = [];
+
+ /**
* 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 +84,13 @@ function FileTransferController(doc,
* @private
*/
this.touching_ = false;
+
+ /**
+ * Task ID counter.
+ * @type {number}
+ * @private
+ */
+ this.taskIdCounter_ = 0;
}
/**
@@ -333,11 +349,21 @@ FileTransferController.prototype = {
opt_destinationEntry || this.currentDirectoryContentEntry;
var entries;
var failureUrls;
+ var taskId = this.fileOperationManager_.generateTaskId();
util.URLsToEntries(sourceURLs).
then(function(result) {
+ this.pendingTaskIds.push(taskId);
entries = result.entries;
failureUrls = result.failureUrls;
+ var item = new ProgressCenterItem();
+ item.id = taskId;
+ item.type = ProgressItemType.COPY;
+ if (result.entries.length === 1)
+ item.message = strf('COPY_FILE_NAME', result.entries[0].name);
+ else
+ item.message = strf('COPY_ITEMS_REMAINING', result.entries.length);
+ this.progressCenter_.updateItem(item);
// Check if cross share is needed or not.
return this.getMultiProfileShareEntries_(entries);
}.bind(this)).
@@ -369,7 +395,8 @@ FileTransferController.prototype = {
then(function() {
// Start the pasting operation.
this.fileOperationManager_.paste(
- entries, destinationEntry, toMove);
+ entries, destinationEntry, toMove, taskId);
+ this.pendingTaskIds.splice(this.pendingTaskIds.indexOf(taskId), 1);
// Publish events for failureUrls.
for (var i = 0; i < failureUrls.length; i++) {
« no previous file with comments | « ui/file_manager/file_manager/foreground/js/file_manager.js ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698