| 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 /** | 5 /** |
| 6 * FileManager constructor. | 6 * FileManager constructor. |
| 7 * | 7 * |
| 8 * FileManager objects encapsulate the functionality of the file selector | 8 * FileManager objects encapsulate the functionality of the file selector |
| 9 * dialogs, as well as the full screen file manager application (though the | 9 * dialogs, as well as the full screen file manager application (though the |
| 10 * latter is not yet implemented). | 10 * latter is not yet implemented). |
| 11 * | 11 * |
| 12 * @constructor | 12 * @constructor |
| 13 * @param {HTMLElement} dialogDom The DOM node containing the prototypical | 13 * @param {HTMLElement} dialogDom The DOM node containing the prototypical |
| 14 * dialog UI. | 14 * dialog UI. |
| 15 */ | 15 */ |
| 16 function FileManager(dialogDom) { | 16 function FileManager(dialogDom) { |
| 17 this.dialogDom_ = dialogDom; | 17 this.dialogDom_ = dialogDom; |
| 18 this.filesystem_ = null; | 18 this.filesystem_ = null; |
| 19 this.params_ = location.search ? | 19 this.params_ = location.search ? |
| 20 JSON.parse(decodeURIComponent(location.search.substr(1))) : | 20 JSON.parse(decodeURIComponent(location.search.substr(1))) : |
| 21 {}; | 21 {}; |
| 22 if (this.params_.defaultPath && this.params_.defaultPath.indexOf('/') != 0) |
| 23 this.params_.defaultPath = '/' + this.params_.defaultPath; |
| 22 | 24 |
| 23 this.listType_ = null; | 25 this.listType_ = null; |
| 24 this.showDelayTimeout_ = null; | 26 this.showDelayTimeout_ = null; |
| 25 | 27 |
| 26 this.selection = null; | 28 this.selection = null; |
| 27 | 29 |
| 28 this.butterTimer_ = null; | 30 this.butterTimer_ = null; |
| 29 this.currentButter_ = null; | 31 this.currentButter_ = null; |
| 30 this.butterLastShowTime_ = 0; | 32 this.butterLastShowTime_ = 0; |
| 31 | 33 |
| (...skipping 4120 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 4152 if (cancelled) return; | 4154 if (cancelled) return; |
| 4153 cleanup(); | 4155 cleanup(); |
| 4154 selection.urls = resolvedUrls; | 4156 selection.urls = resolvedUrls; |
| 4155 // Call next method on a timeout, as it's unsafe to | 4157 // Call next method on a timeout, as it's unsafe to |
| 4156 // close a window from a callback. | 4158 // close a window from a callback. |
| 4157 setTimeout(this.callSelectFilesApiAndClose_.bind(this, selection), 0); | 4159 setTimeout(this.callSelectFilesApiAndClose_.bind(this, selection), 0); |
| 4158 }.bind(this); | 4160 }.bind(this); |
| 4159 | 4161 |
| 4160 var onProperties = function(properties) { | 4162 var onProperties = function(properties) { |
| 4161 for (var i = 0; i < properties.length; i++) { | 4163 for (var i = 0; i < properties.length; i++) { |
| 4162 if (properties[i].present) { | 4164 if (!properties[i] || properties[i].present) { |
| 4163 // For files already in GCache, we don't get any transfer updates. | 4165 // For files already in GCache, we don't get any transfer updates. |
| 4164 filesTotal--; | 4166 filesTotal--; |
| 4165 } | 4167 } |
| 4166 } | 4168 } |
| 4167 this.resolveSelectResults_(selection.urls, onResolved); | 4169 this.resolveSelectResults_(selection.urls, onResolved); |
| 4168 }.bind(this); | 4170 }.bind(this); |
| 4169 | 4171 |
| 4170 setup(); | 4172 setup(); |
| 4171 this.metadataCache_.get(selection.urls, 'gdata', onProperties); | 4173 this.metadataCache_.get(selection.urls, 'gdata', onProperties); |
| 4172 }; | 4174 }; |
| (...skipping 407 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 4580 function closeBanner() { | 4582 function closeBanner() { |
| 4581 self.cleanupGDataWelcome_(); | 4583 self.cleanupGDataWelcome_(); |
| 4582 // Stop showing the welcome banner. | 4584 // Stop showing the welcome banner. |
| 4583 localStorage[WELCOME_HEADER_COUNTER_KEY] = WELCOME_HEADER_COUNTER_LIMIT; | 4585 localStorage[WELCOME_HEADER_COUNTER_KEY] = WELCOME_HEADER_COUNTER_LIMIT; |
| 4584 } | 4586 } |
| 4585 | 4587 |
| 4586 return maybeShowBanner; | 4588 return maybeShowBanner; |
| 4587 }; | 4589 }; |
| 4588 })(); | 4590 })(); |
| 4589 | 4591 |
| OLD | NEW |