| 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 * FileManager constructor. | 8 * FileManager constructor. |
| 9 * | 9 * |
| 10 * FileManager objects encapsulate the functionality of the file selector | 10 * FileManager objects encapsulate the functionality of the file selector |
| (...skipping 2265 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2276 }.bind(this)); | 2276 }.bind(this)); |
| 2277 }; | 2277 }; |
| 2278 | 2278 |
| 2279 /** | 2279 /** |
| 2280 * Update the UI when the current directory changes. | 2280 * Update the UI when the current directory changes. |
| 2281 * | 2281 * |
| 2282 * @param {Event} event The directory-changed event. | 2282 * @param {Event} event The directory-changed event. |
| 2283 * @private | 2283 * @private |
| 2284 */ | 2284 */ |
| 2285 FileManager.prototype.onDirectoryChanged_ = function(event) { | 2285 FileManager.prototype.onDirectoryChanged_ = function(event) { |
| 2286 var newCurrentVolumeInfo = this.volumeManager_.getVolumeInfo( |
| 2287 event.newDirEntry); |
| 2288 |
| 2289 // If volume has changed, then update the gear menu. |
| 2290 if (this.currentVolumeInfo_ !== newCurrentVolumeInfo) { |
| 2291 this.updateGearMenu_(); |
| 2292 // If the volume has changed, and it was previously set, then do not |
| 2293 // close on unmount anymore. |
| 2294 if (this.currentVolumeInfo_) |
| 2295 this.closeOnUnmount_ = false; |
| 2296 } |
| 2297 |
| 2298 // Remember the current volume info. |
| 2299 this.currentVolumeInfo_ = newCurrentVolumeInfo; |
| 2300 |
| 2286 this.selectionHandler_.onFileSelectionChanged(); | 2301 this.selectionHandler_.onFileSelectionChanged(); |
| 2287 this.ui_.searchBox.clear(); | 2302 this.ui_.searchBox.clear(); |
| 2288 // TODO(mtomasz): Use Entry.toURL() instead of fullPath. | 2303 // TODO(mtomasz): Use Entry.toURL() instead of fullPath. |
| 2289 // TODO(mtomasz): Consider remembering the selection. | 2304 // TODO(mtomasz): Consider remembering the selection. |
| 2290 util.updateAppState( | 2305 util.updateAppState( |
| 2291 this.getCurrentDirectoryEntry() ? | 2306 this.getCurrentDirectoryEntry() ? |
| 2292 this.getCurrentDirectoryEntry().fullPath : '', | 2307 this.getCurrentDirectoryEntry().fullPath : '', |
| 2293 '' /* selectionPath */, | 2308 '' /* selectionPath */, |
| 2294 '' /* opt_param */); | 2309 '' /* opt_param */); |
| 2295 | 2310 |
| 2296 if (this.commandHandler) | 2311 if (this.commandHandler) |
| 2297 this.commandHandler.updateAvailability(); | 2312 this.commandHandler.updateAvailability(); |
| 2298 | 2313 |
| 2299 this.updateUnformattedVolumeStatus_(); | 2314 this.updateUnformattedVolumeStatus_(); |
| 2300 this.updateTitle_(); | 2315 this.updateTitle_(); |
| 2301 var newCurrentVolumeInfo = this.volumeManager_.getVolumeInfo( | |
| 2302 event.newDirEntry); | |
| 2303 | |
| 2304 // If volume has changed, then update the gear menu. | |
| 2305 if (this.currentVolumeInfo_ !== newCurrentVolumeInfo) { | |
| 2306 this.updateGearMenu_(); | |
| 2307 // If the volume has changed, and it was previously set, then do not | |
| 2308 // close on unmount anymore. | |
| 2309 if (this.currentVolumeInfo_) | |
| 2310 this.closeOnUnmount_ = false; | |
| 2311 } | |
| 2312 | 2316 |
| 2313 var currentEntry = this.getCurrentDirectoryEntry(); | 2317 var currentEntry = this.getCurrentDirectoryEntry(); |
| 2314 this.previewPanel_.currentEntry = util.isFakeEntry(currentEntry) ? | 2318 this.previewPanel_.currentEntry = util.isFakeEntry(currentEntry) ? |
| 2315 null : currentEntry; | 2319 null : currentEntry; |
| 2316 | |
| 2317 // Remember the current volume info. | |
| 2318 this.currentVolumeInfo_ = newCurrentVolumeInfo; | |
| 2319 }; | 2320 }; |
| 2320 | 2321 |
| 2321 FileManager.prototype.updateUnformattedVolumeStatus_ = function() { | 2322 FileManager.prototype.updateUnformattedVolumeStatus_ = function() { |
| 2322 var volumeInfo = this.volumeManager_.getVolumeInfo( | 2323 var volumeInfo = this.volumeManager_.getVolumeInfo( |
| 2323 this.directoryModel_.getCurrentDirEntry()); | 2324 this.directoryModel_.getCurrentDirEntry()); |
| 2324 | 2325 |
| 2325 if (volumeInfo && volumeInfo.error) { | 2326 if (volumeInfo && volumeInfo.error) { |
| 2326 this.dialogDom_.setAttribute('unformatted', ''); | 2327 this.dialogDom_.setAttribute('unformatted', ''); |
| 2327 | 2328 |
| 2328 var errorNode = this.dialogDom_.querySelector('#format-panel > .error'); | 2329 var errorNode = this.dialogDom_.querySelector('#format-panel > .error'); |
| (...skipping 1353 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 3682 callback(this.preferences_); | 3683 callback(this.preferences_); |
| 3683 return; | 3684 return; |
| 3684 } | 3685 } |
| 3685 | 3686 |
| 3686 chrome.fileBrowserPrivate.getPreferences(function(prefs) { | 3687 chrome.fileBrowserPrivate.getPreferences(function(prefs) { |
| 3687 this.preferences_ = prefs; | 3688 this.preferences_ = prefs; |
| 3688 callback(prefs); | 3689 callback(prefs); |
| 3689 }.bind(this)); | 3690 }.bind(this)); |
| 3690 }; | 3691 }; |
| 3691 })(); | 3692 })(); |
| OLD | NEW |