Chromium Code Reviews| Index: ui/file_manager/file_manager/background/js/file_operation_manager.js |
| diff --git a/ui/file_manager/file_manager/background/js/file_operation_manager.js b/ui/file_manager/file_manager/background/js/file_operation_manager.js |
| index d66e782f3dc890eb0aa30751daf3c47aab17695d..8accaff949748a98505e0ef43644afbb05830d80 100644 |
| --- a/ui/file_manager/file_manager/background/js/file_operation_manager.js |
| +++ b/ui/file_manager/file_manager/background/js/file_operation_manager.js |
| @@ -1184,9 +1184,12 @@ FileOperationManager.prototype.requestTaskCancel = function(taskId) { |
| * directory. |
| * @param {boolean} isMove True if the operation is "move", otherwise (i.e. |
| * if the operation is "copy") false. |
| + * @param {string} optTaskId If the corresponding item has already created |
| + * at another places, we need to specify the ID of the item. If the |
| + * item is not created, FileOperationManager generates new ID. |
| */ |
| FileOperationManager.prototype.paste = function( |
| - sourceEntries, targetEntry, isMove) { |
| + sourceEntries, targetEntry, isMove, optTaskId) { |
|
hirono
2014/09/17 03:33:20
nit: The type name should be string= since it is o
iseki
2014/09/17 04:08:47
Done.
|
| // Do nothing if sourceEntries is empty. |
| if (sourceEntries.length === 0) |
| return; |
| @@ -1220,7 +1223,7 @@ FileOperationManager.prototype.paste = function( |
| if (filteredEntries.length === 0) |
| return; |
| - this.queueCopy_(targetEntry, filteredEntries, isMove); |
| + this.queueCopy_(targetEntry, filteredEntries, isMove, optTaskId); |
| }.bind(this)); |
| }; |
| @@ -1231,10 +1234,13 @@ FileOperationManager.prototype.paste = function( |
| * @param {DirectoryEntry} targetDirEntry Target directory. |
| * @param {Array.<Entry>} entries Entries to copy. |
| * @param {boolean} isMove In case of move. |
| + * @param {string} optTaskId If the corresponding item has already created |
| + * at another places, we need to specify the ID of the item. If the |
| + * item is not created, FileOperationManager generates new ID. |
| * @private |
| */ |
| FileOperationManager.prototype.queueCopy_ = function( |
| - targetDirEntry, entries, isMove) { |
| + targetDirEntry, entries, isMove, optTaskId) { |
| var task; |
| if (isMove) { |
| // When moving between different volumes, moving is implemented as a copy |
| @@ -1250,7 +1256,7 @@ FileOperationManager.prototype.queueCopy_ = function( |
| task = new FileOperationManager.CopyTask(entries, targetDirEntry, false); |
| } |
| - task.taskId = this.generateTaskId_(); |
| + task.taskId = optTaskId || this.generateTaskId_(); |
| this.eventRouter_.sendProgressEvent('BEGIN', task.getStatus(), task.taskId); |
| task.initialize(function() { |
| this.copyTasks_.push(task); |