| OLD | NEW |
| 1 // Copyright 2016 The Chromium Authors. All rights reserved. | 1 // Copyright 2016 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 * @fileoverview | 6 * @fileoverview |
| 7 * 'settings-storage' is the settings subpage for storage settings. | 7 * 'settings-storage' is the settings subpage for storage settings. |
| 8 */ | 8 */ |
| 9 cr.exportPath('settings'); | 9 cr.exportPath('settings'); |
| 10 | 10 |
| (...skipping 89 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 100 cr.addWebUIListener( | 100 cr.addWebUIListener( |
| 101 'storage-android-enabled-changed', | 101 'storage-android-enabled-changed', |
| 102 this.handleAndroidEnabledChanged_.bind(this)); | 102 this.handleAndroidEnabledChanged_.bind(this)); |
| 103 }, | 103 }, |
| 104 | 104 |
| 105 /** | 105 /** |
| 106 * Overridden from settings.RouteObserverBehavior. | 106 * Overridden from settings.RouteObserverBehavior. |
| 107 * @protected | 107 * @protected |
| 108 */ | 108 */ |
| 109 currentRouteChanged: function() { | 109 currentRouteChanged: function() { |
| 110 if (settings.getCurrentRoute() == settings.Route.STORAGE) | 110 if (settings.getCurrentRoute() == settings.routes.STORAGE) |
| 111 this.onPageShown_(); | 111 this.onPageShown_(); |
| 112 }, | 112 }, |
| 113 | 113 |
| 114 /** @private */ | 114 /** @private */ |
| 115 onPageShown_: function() { | 115 onPageShown_: function() { |
| 116 // Updating storage information can be expensive (e.g. computing directory | 116 // Updating storage information can be expensive (e.g. computing directory |
| 117 // sizes recursively), so we delay this operation until the page is shown. | 117 // sizes recursively), so we delay this operation until the page is shown. |
| 118 chrome.send('updateStorageInfo'); | 118 chrome.send('updateStorageInfo'); |
| 119 // We update the storage usage periodically when the overlay is visible. | 119 // We update the storage usage periodically when the overlay is visible. |
| 120 this.startPeriodicUpdate_(); | 120 this.startPeriodicUpdate_(); |
| (...skipping 16 matching lines...) Expand all Loading... |
| 137 e.preventDefault(); | 137 e.preventDefault(); |
| 138 if (this.hasDriveCache_) | 138 if (this.hasDriveCache_) |
| 139 this.$.storageDriveCache.open(); | 139 this.$.storageDriveCache.open(); |
| 140 }, | 140 }, |
| 141 | 141 |
| 142 /** | 142 /** |
| 143 * Handler for tapping the "Browsing data" item. | 143 * Handler for tapping the "Browsing data" item. |
| 144 * @private | 144 * @private |
| 145 */ | 145 */ |
| 146 onBrowsingDataTap_: function() { | 146 onBrowsingDataTap_: function() { |
| 147 settings.navigateTo(settings.Route.CLEAR_BROWSER_DATA); | 147 settings.navigateTo(settings.routes.CLEAR_BROWSER_DATA); |
| 148 }, | 148 }, |
| 149 | 149 |
| 150 /** | 150 /** |
| 151 * Handler for tapping the "Android storage" item. | 151 * Handler for tapping the "Android storage" item. |
| 152 * @private | 152 * @private |
| 153 */ | 153 */ |
| 154 onAndroidTap_: function() { | 154 onAndroidTap_: function() { |
| 155 chrome.send('openArcStorage'); | 155 chrome.send('openArcStorage'); |
| 156 }, | 156 }, |
| 157 | 157 |
| 158 /** | 158 /** |
| 159 * Handler for tapping the "Other users" item. | 159 * Handler for tapping the "Other users" item. |
| 160 * @private | 160 * @private |
| 161 */ | 161 */ |
| 162 onOtherUsersTap_: function() { | 162 onOtherUsersTap_: function() { |
| 163 settings.navigateTo(settings.Route.ACCOUNTS); | 163 settings.navigateTo(settings.routes.ACCOUNTS); |
| 164 }, | 164 }, |
| 165 | 165 |
| 166 /** | 166 /** |
| 167 * @param {!settings.StorageSizeStat} sizeStat | 167 * @param {!settings.StorageSizeStat} sizeStat |
| 168 * @private | 168 * @private |
| 169 */ | 169 */ |
| 170 handleSizeStatChanged_: function(sizeStat) { | 170 handleSizeStatChanged_: function(sizeStat) { |
| 171 this.sizeStat_ = sizeStat; | 171 this.sizeStat_ = sizeStat; |
| 172 this.$.inUseLabelArea.style.width = (sizeStat.usedRatio * 100) + '%'; | 172 this.$.inUseLabelArea.style.width = (sizeStat.usedRatio * 100) + '%'; |
| 173 this.$.availableLabelArea.style.width = | 173 this.$.availableLabelArea.style.width = |
| (...skipping 66 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 240 }, | 240 }, |
| 241 | 241 |
| 242 /** | 242 /** |
| 243 * Starts periodic update for storage usage. | 243 * Starts periodic update for storage usage. |
| 244 * @private | 244 * @private |
| 245 */ | 245 */ |
| 246 startPeriodicUpdate_: function() { | 246 startPeriodicUpdate_: function() { |
| 247 // We update the storage usage every 5 seconds. | 247 // We update the storage usage every 5 seconds. |
| 248 if (this.updateTimerId_ == -1) { | 248 if (this.updateTimerId_ == -1) { |
| 249 this.updateTimerId_ = window.setInterval(function() { | 249 this.updateTimerId_ = window.setInterval(function() { |
| 250 if (settings.getCurrentRoute() != settings.Route.STORAGE) { | 250 if (settings.getCurrentRoute() != settings.routes.STORAGE) { |
| 251 this.stopPeriodicUpdate_(); | 251 this.stopPeriodicUpdate_(); |
| 252 return; | 252 return; |
| 253 } | 253 } |
| 254 chrome.send('updateStorageInfo'); | 254 chrome.send('updateStorageInfo'); |
| 255 }.bind(this), 5000); | 255 }.bind(this), 5000); |
| 256 } | 256 } |
| 257 }, | 257 }, |
| 258 | 258 |
| 259 /** | 259 /** |
| 260 * Stops periodic update for storage usage. | 260 * Stops periodic update for storage usage. |
| (...skipping 41 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 302 default: | 302 default: |
| 303 return ''; | 303 return ''; |
| 304 } | 304 } |
| 305 }, | 305 }, |
| 306 | 306 |
| 307 /** @private */ | 307 /** @private */ |
| 308 onCloseDriveCacheDialog_: function() { | 308 onCloseDriveCacheDialog_: function() { |
| 309 cr.ui.focusWithoutInk(assert(this.$$('#deleteButton'))); | 309 cr.ui.focusWithoutInk(assert(this.$$('#deleteButton'))); |
| 310 }, | 310 }, |
| 311 }); | 311 }); |
| OLD | NEW |