diff options
author | mtomasz <mtomasz@chromium.org> | 2015-11-02 19:06:44 -0800 |
---|---|---|
committer | Commit bot <commit-bot@chromium.org> | 2015-11-03 03:07:23 +0000 |
commit | cae35362d0eb16d27adeb8a07786b52152d68e55 (patch) | |
tree | 0aa4b25371274e640ccb9aef5bd1ea706e1fb557 /ui | |
parent | 98e16135a63acbf3e6a1737d3767824dc20608bd (diff) | |
download | chromium_src-cae35362d0eb16d27adeb8a07786b52152d68e55.zip chromium_src-cae35362d0eb16d27adeb8a07786b52152d68e55.tar.gz chromium_src-cae35362d0eb16d27adeb8a07786b52152d68e55.tar.bz2 |
Fix code style for pasting in Files app.
TEST=All current tests pass.
BUG=None
Review URL: https://codereview.chromium.org/1398963002
Cr-Commit-Position: refs/heads/master@{#357520}
Diffstat (limited to 'ui')
-rw-r--r-- | ui/file_manager/file_manager/foreground/js/file_transfer_controller.js | 64 |
1 files changed, 34 insertions, 30 deletions
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 f47f6ad..eb9eda8 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 @@ -529,6 +529,7 @@ FileTransferController.prototype.paste = /** @type {DirectoryEntry} */ (this.directoryModel_.getCurrentDirEntry()); var entries = []; var failureUrls; + var shareEntries; var taskId = this.fileOperationManager_.generateTaskId(); FileTransferController.URLsToEntriesWithAccess(sourceURLs) @@ -575,43 +576,46 @@ FileTransferController.prototype.paste = }.bind(this)) .then( /** - * @param {!Array<Entry>} shareEntries + * @param {!Array<Entry>} inShareEntries * @this {FileTransferController} - * @return {!Promise<Array<Entry>>|undefined} + * @return {!Promise<Array<Entry>>} */ - function(shareEntries) { + function(inShareEntries) { + shareEntries = inShareEntries; if (shareEntries.length === 0) - return; + return Promise.resolve(null); return this.multiProfileShareDialog_. - showMultiProfileShareDialog(shareEntries.length > 1).then( - /** - * @param {string} dialogResult - * @return {!Promise<undefined>|undefined} - */ - function(dialogResult) { - if (dialogResult === 'cancel') - return Promise.reject('ABORT'); - // Do cross share. - // TODO(hirono): Make the loop cancellable. - var requestDriveShare = function(index) { - if (index >= shareEntries.length) - return; - return new Promise(function(fulfill) { - chrome.fileManagerPrivate.requestDriveShare( - shareEntries[index], - dialogResult, - function() { - // TODO(hirono): Check chrome.runtime.lastError - // here. - fulfill(undefined); - }); - }).then(requestDriveShare.bind(null, index + 1)); - }; - return requestDriveShare(0); - }); + showMultiProfileShareDialog(shareEntries.length > 1); }.bind(this)) .then( /** + * @param {?string} dialogResult + * @return {!Promise<undefined>|undefined} + */ + function(dialogResult) { + if (dialogResult === null) + return; // No dialog was shown, skip this step. + if (dialogResult === 'cancel') + return Promise.reject('ABORT'); + // Do cross share. + // TODO(hirono): Make the loop cancellable. + var requestDriveShare = function(index) { + if (index >= shareEntries.length) + return; + return new Promise(function(fulfill) { + chrome.fileManagerPrivate.requestDriveShare( + shareEntries[index], + assert(dialogResult), + function() { + // TODO(hirono): Check chrome.runtime.lastError here. + fulfill(); + }); + }).then(requestDriveShare.bind(null, index + 1)); + }; + return requestDriveShare(0); + }) + .then( + /** * @this {FileTransferController} */ function() { |