| 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 // This variable is checked in SelectFileDialogExtensionBrowserTest. | 5 // This variable is checked in SelectFileDialogExtensionBrowserTest. |
| 6 var JSErrorCount = 0; | 6 var JSErrorCount = 0; |
| 7 | 7 |
| 8 /** | 8 /** |
| 9 * Count uncaught exceptions. | 9 * Count uncaught exceptions. |
| 10 */ | 10 */ |
| (...skipping 1297 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1308 tracker.exceptInitialChange = true; | 1308 tracker.exceptInitialChange = true; |
| 1309 tracker.start(); | 1309 tracker.start(); |
| 1310 if (!this.isDriveEnabled()) { | 1310 if (!this.isDriveEnabled()) { |
| 1311 if (pageLoading) | 1311 if (pageLoading) |
| 1312 this.show_(); | 1312 this.show_(); |
| 1313 var leafName = path.substr(path.indexOf('/') + 1); | 1313 var leafName = path.substr(path.indexOf('/') + 1); |
| 1314 path = this.directoryModel_.getDefaultDirectory() + '/' + leafName; | 1314 path = this.directoryModel_.getDefaultDirectory() + '/' + leafName; |
| 1315 this.finishSetupCurrentDirectory_(path, invokeHandlers); | 1315 this.finishSetupCurrentDirectory_(path, invokeHandlers); |
| 1316 return; | 1316 return; |
| 1317 } | 1317 } |
| 1318 var drivePath = RootDirectory.DRIVE; | 1318 if (this.volumeManager_.isMounted(RootDirectory.DRIVE)) { |
| 1319 if (this.volumeManager_.isMounted(drivePath)) { | |
| 1320 this.finishSetupCurrentDirectory_(path, invokeHandlers); | 1319 this.finishSetupCurrentDirectory_(path, invokeHandlers); |
| 1321 return; | 1320 return; |
| 1322 } | 1321 } |
| 1323 if (pageLoading) | 1322 if (pageLoading) |
| 1324 this.delayShow_(500); | 1323 this.delayShow_(500); |
| 1325 // Reflect immediatelly in the UI we are on Drive and display | 1324 // Reflect immediatelly in the UI we are on Drive and display |
| 1326 // mounting UI. | 1325 // mounting UI. |
| 1327 this.directoryModel_.setupPath(drivePath); | 1326 this.directoryModel_.setupPath(RootDirectory.DRIVE); |
| 1328 | 1327 |
| 1329 if (!this.isOnDrive()) { | 1328 if (!this.isOnDrive()) { |
| 1330 // Since DRIVE is not mounted it should be resolved synchronously | 1329 // Since DRIVE is not mounted it should be resolved synchronously |
| 1331 // (no need in asynchronous calls to filesystem API). It is important | 1330 // (no need in asynchronous calls to filesystem API). It is important |
| 1332 // to prevent race condition. | 1331 // to prevent race condition. |
| 1333 console.error('Expected path set up synchronously'); | 1332 console.error('Expected path set up synchronously'); |
| 1334 } | 1333 } |
| 1335 | 1334 |
| 1336 var self = this; | 1335 var self = this; |
| 1337 this.volumeManager_.mountDrive(function() { | 1336 this.volumeManager_.mountDrive(function() { |
| (...skipping 754 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2092 */ | 2091 */ |
| 2093 FileManager.prototype.onDirectoryChanged_ = function(event) { | 2092 FileManager.prototype.onDirectoryChanged_ = function(event) { |
| 2094 this.selectionHandler_.onFileSelectionChanged(); | 2093 this.selectionHandler_.onFileSelectionChanged(); |
| 2095 this.updateSearchBoxOnDirChange_(); | 2094 this.updateSearchBoxOnDirChange_(); |
| 2096 if (this.dialogType == DialogType.FULL_PAGE) | 2095 if (this.dialogType == DialogType.FULL_PAGE) |
| 2097 this.table_.showOfflineColumn(this.shouldShowOfflineColumn()); | 2096 this.table_.showOfflineColumn(this.shouldShowOfflineColumn()); |
| 2098 | 2097 |
| 2099 util.updateAppState(event.initial, this.getCurrentDirectory()); | 2098 util.updateAppState(event.initial, this.getCurrentDirectory()); |
| 2100 | 2099 |
| 2101 if (this.closeOnUnmount_ && !event.initial && | 2100 if (this.closeOnUnmount_ && !event.initial && |
| 2102 PathUtil.getRootPath(event.previousDirEntry.fullPath) != | 2101 PathUtil.getRootPath(event.previousDirEntry.fullPath) != |
| 2103 PathUtil.getRootPath(event.newDirEntry.fullPath)) { | 2102 PathUtil.getRootPath(event.newDirEntry.fullPath)) { |
| 2104 this.closeOnUnmount_ = false; | 2103 this.closeOnUnmount_ = false; |
| 2105 } | 2104 } |
| 2106 | 2105 |
| 2107 this.updateUnformattedDriveStatus_(); | 2106 this.updateUnformattedDriveStatus_(); |
| 2108 this.updateTitle_(); | 2107 this.updateTitle_(); |
| 2109 this.updateGearMenu_(); | 2108 this.updateGearMenu_(); |
| 2110 }; | 2109 }; |
| 2111 | 2110 |
| 2111 // TODO(haruki): Rename this method. "Drive" here does not refer |
| 2112 // "Google Drive". |
| 2112 FileManager.prototype.updateUnformattedDriveStatus_ = function() { | 2113 FileManager.prototype.updateUnformattedDriveStatus_ = function() { |
| 2113 var volumeInfo = this.volumeManager_.getVolumeInfo_( | 2114 var volumeInfo = this.volumeManager_.getVolumeInfo_( |
| 2114 this.directoryModel_.getCurrentRootPath()); | 2115 PathUtil.getRootPath(this.directoryModel_.getCurrentRootPath())); |
| 2115 | 2116 |
| 2116 if (volumeInfo.error) { | 2117 if (volumeInfo.error) { |
| 2117 this.dialogDom_.setAttribute('unformatted', ''); | 2118 this.dialogDom_.setAttribute('unformatted', ''); |
| 2118 | 2119 |
| 2119 var errorNode = this.dialogDom_.querySelector('#format-panel > .error'); | 2120 var errorNode = this.dialogDom_.querySelector('#format-panel > .error'); |
| 2120 if (volumeInfo.error == VolumeManager.Error.UNSUPPORTED_FILESYSTEM) { | 2121 if (volumeInfo.error == VolumeManager.Error.UNSUPPORTED_FILESYSTEM) { |
| 2121 errorNode.textContent = str('UNSUPPORTED_FILESYSTEM_WARNING'); | 2122 errorNode.textContent = str('UNSUPPORTED_FILESYSTEM_WARNING'); |
| 2122 } else { | 2123 } else { |
| 2123 errorNode.textContent = str('UNKNOWN_FILESYSTEM_WARNING'); | 2124 errorNode.textContent = str('UNKNOWN_FILESYSTEM_WARNING'); |
| 2124 } | 2125 } |
| (...skipping 1038 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 3163 callback(this.preferences_); | 3164 callback(this.preferences_); |
| 3164 return; | 3165 return; |
| 3165 } | 3166 } |
| 3166 | 3167 |
| 3167 chrome.fileBrowserPrivate.getPreferences(function(prefs) { | 3168 chrome.fileBrowserPrivate.getPreferences(function(prefs) { |
| 3168 this.preferences_ = prefs; | 3169 this.preferences_ = prefs; |
| 3169 callback(prefs); | 3170 callback(prefs); |
| 3170 }.bind(this)); | 3171 }.bind(this)); |
| 3171 }; | 3172 }; |
| 3172 })(); | 3173 })(); |
| OLD | NEW |