| 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 * The current selection object. | 8 * The current selection object. |
| 9 * | 9 * |
| 10 * @param {FileManager} fileManager FileManager instance. | 10 * @param {FileManager} fileManager FileManager instance. |
| (...skipping 50 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 61 * | 61 * |
| 62 * @param {function} callback The callback. | 62 * @param {function} callback The callback. |
| 63 */ | 63 */ |
| 64 FileSelection.prototype.createTasks = function(callback) { | 64 FileSelection.prototype.createTasks = function(callback) { |
| 65 if (!this.fileManager_.isOnDrive()) { | 65 if (!this.fileManager_.isOnDrive()) { |
| 66 this.tasks.init(this.entries); | 66 this.tasks.init(this.entries); |
| 67 callback(); | 67 callback(); |
| 68 return; | 68 return; |
| 69 } | 69 } |
| 70 | 70 |
| 71 this.fileManager_.metadataCache_.get(this.entries, 'drive', function(props) { | 71 this.fileManager_.metadataCache_.get( |
| 72 var present = props.filter(function(p) { return p && p.availableOffline }); | 72 this.entries, 'external', function(props) { |
| 73 this.allDriveFilesPresent = present.length == props.length; | 73 var present = props.filter(function(p) { |
| 74 return p && p.availableOffline |
| 75 }); |
| 76 this.allDriveFilesPresent = present.length == props.length; |
| 74 | 77 |
| 75 // Collect all of the mime types and push that info into the selection. | 78 // Collect all of the mime types and push that info into the selection. |
| 76 this.mimeTypes = props.map(function(value) { | 79 this.mimeTypes = props.map(function(value) { |
| 77 return (value && value.contentMimeType) || ''; | 80 return (value && value.contentMimeType) || ''; |
| 78 }); | 81 }); |
| 79 | 82 |
| 80 this.tasks.init(this.entries, this.mimeTypes); | 83 this.tasks.init(this.entries, this.mimeTypes); |
| 81 callback(); | 84 callback(); |
| 82 }.bind(this)); | 85 }.bind(this)); |
| 83 }; | 86 }; |
| 84 | 87 |
| 85 /** | 88 /** |
| 86 * Computes the total size of selected files. | 89 * Computes the total size of selected files. |
| 87 * | 90 * |
| 88 * @param {function} callback Completion callback. Not called when cancelled, | 91 * @param {function} callback Completion callback. Not called when cancelled, |
| 89 * or a new call has been invoked in the meantime. | 92 * or a new call has been invoked in the meantime. |
| 90 */ | 93 */ |
| 91 FileSelection.prototype.computeBytes = function(callback) { | 94 FileSelection.prototype.computeBytes = function(callback) { |
| 92 if (this.entries.length == 0) { | 95 if (this.entries.length == 0) { |
| (...skipping 260 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 353 | 356 |
| 354 // Sync the commands availability. | 357 // Sync the commands availability. |
| 355 if (this.fileManager_.commandHandler) | 358 if (this.fileManager_.commandHandler) |
| 356 this.fileManager_.commandHandler.updateAvailability(); | 359 this.fileManager_.commandHandler.updateAvailability(); |
| 357 | 360 |
| 358 // Inform tests it's OK to click buttons now. | 361 // Inform tests it's OK to click buttons now. |
| 359 if (selection.totalCount > 0) { | 362 if (selection.totalCount > 0) { |
| 360 util.testSendMessage('selection-change-complete'); | 363 util.testSendMessage('selection-change-complete'); |
| 361 } | 364 } |
| 362 }; | 365 }; |
| OLD | NEW |