| OLD | NEW |
| 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. |
| 2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
| 3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
| 4 | 4 |
| 5 'use strict'; | 5 'use strict'; |
| 6 | 6 |
| 7 /** | 7 /** |
| 8 * Global (placed in the window object) variable name to hold internal | 8 * Global (placed in the window object) variable name to hold internal |
| 9 * file dragging information. Needed to show visual feedback while dragging | 9 * file dragging information. Needed to show visual feedback while dragging |
| 10 * since DataTransfer object is in protected state. Reachable from other | 10 * since DataTransfer object is in protected state. Reachable from other |
| (...skipping 245 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 256 var promises = dirs.map(processDirectoryEntry); | 256 var promises = dirs.map(processDirectoryEntry); |
| 257 if (files.length > 0) | 257 if (files.length > 0) |
| 258 promises.push(processFileEntries(files)); | 258 promises.push(processFileEntries(files)); |
| 259 return Promise.all(promises).then(concatArrays); | 259 return Promise.all(promises).then(concatArrays); |
| 260 }; | 260 }; |
| 261 | 261 |
| 262 // Check all file entries and keeps only those need sharing operation. | 262 // Check all file entries and keeps only those need sharing operation. |
| 263 var processFileEntries = function(entries) { | 263 var processFileEntries = function(entries) { |
| 264 return new Promise(function(callback) { | 264 return new Promise(function(callback) { |
| 265 var urls = util.entriesToURLs(entries); | 265 var urls = util.entriesToURLs(entries); |
| 266 chrome.fileBrowserPrivate.getEntryProperties(urls, callback); | 266 chrome.fileManagerPrivate.getEntryProperties(urls, callback); |
| 267 }). | 267 }). |
| 268 then(function(metadatas) { | 268 then(function(metadatas) { |
| 269 return entries.filter(function(entry, i) { | 269 return entries.filter(function(entry, i) { |
| 270 var metadata = metadatas[i]; | 270 var metadata = metadatas[i]; |
| 271 return metadata && metadata.isHosted && !metadata.sharedWithMe; | 271 return metadata && metadata.isHosted && !metadata.sharedWithMe; |
| 272 }); | 272 }); |
| 273 }); | 273 }); |
| 274 }; | 274 }; |
| 275 | 275 |
| 276 // Check child entries. | 276 // Check child entries. |
| (...skipping 68 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 345 return this.multiProfileShareDialog_.show(shareEntries.length > 1). | 345 return this.multiProfileShareDialog_.show(shareEntries.length > 1). |
| 346 then(function(dialogResult) { | 346 then(function(dialogResult) { |
| 347 if (dialogResult === 'cancel') | 347 if (dialogResult === 'cancel') |
| 348 return Promise.reject('ABORT'); | 348 return Promise.reject('ABORT'); |
| 349 // Do cross share. | 349 // Do cross share. |
| 350 // TODO(hirono): Make the loop cancellable. | 350 // TODO(hirono): Make the loop cancellable. |
| 351 var requestDriveShare = function(index) { | 351 var requestDriveShare = function(index) { |
| 352 if (index >= shareEntries.length) | 352 if (index >= shareEntries.length) |
| 353 return; | 353 return; |
| 354 return new Promise(function(fulfill) { | 354 return new Promise(function(fulfill) { |
| 355 chrome.fileBrowserPrivate.requestDriveShare( | 355 chrome.fileManagerPrivate.requestDriveShare( |
| 356 shareEntries[index].toURL(), | 356 shareEntries[index].toURL(), |
| 357 dialogResult, | 357 dialogResult, |
| 358 function() { | 358 function() { |
| 359 // TODO(hirono): Check chrome.runtime.lastError here. | 359 // TODO(hirono): Check chrome.runtime.lastError here. |
| 360 fulfill(); | 360 fulfill(); |
| 361 }); | 361 }); |
| 362 }).then(requestDriveShare.bind(null, index + 1)); | 362 }).then(requestDriveShare.bind(null, index + 1)); |
| 363 }; | 363 }; |
| 364 return requestDriveShare(0); | 364 return requestDriveShare(0); |
| 365 }); | 365 }); |
| (...skipping 694 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1060 !event.ctrlKey) { | 1060 !event.ctrlKey) { |
| 1061 return 'move'; | 1061 return 'move'; |
| 1062 } | 1062 } |
| 1063 if (event.shiftKey) { | 1063 if (event.shiftKey) { |
| 1064 return 'move'; | 1064 return 'move'; |
| 1065 } | 1065 } |
| 1066 } | 1066 } |
| 1067 return 'copy'; | 1067 return 'copy'; |
| 1068 }, | 1068 }, |
| 1069 }; | 1069 }; |
| OLD | NEW |