| 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 37 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 48 type: Boolean, | 48 type: Boolean, |
| 49 value: false, | 49 value: false, |
| 50 }, | 50 }, |
| 51 | 51 |
| 52 /** @private */ | 52 /** @private */ |
| 53 isGuest_: { | 53 isGuest_: { |
| 54 type: Boolean, | 54 type: Boolean, |
| 55 value: function() { return loadTimeData.getBoolean('isGuest'); } | 55 value: function() { return loadTimeData.getBoolean('isGuest'); } |
| 56 }, | 56 }, |
| 57 | 57 |
| 58 /** @private */ |
| 59 hasDriveCache_: { |
| 60 type: Boolean, |
| 61 value: false |
| 62 }, |
| 63 |
| 58 /** @private {settings.StorageSizeStat} */ | 64 /** @private {settings.StorageSizeStat} */ |
| 59 sizeStat_: Object, | 65 sizeStat_: Object, |
| 60 }, | 66 }, |
| 61 | 67 |
| 62 /** | 68 /** |
| 63 * Timer ID for periodic update. | 69 * Timer ID for periodic update. |
| 64 * @private {number} | 70 * @private {number} |
| 65 */ | 71 */ |
| 66 updateTimerId_: -1, | 72 updateTimerId_: -1, |
| 67 | 73 |
| (...skipping 53 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 121 chrome.send('openDownloads'); | 127 chrome.send('openDownloads'); |
| 122 }, | 128 }, |
| 123 | 129 |
| 124 /** | 130 /** |
| 125 * Handler for tapping the "Offline files" item. | 131 * Handler for tapping the "Offline files" item. |
| 126 * @param {!Event} e | 132 * @param {!Event} e |
| 127 * @private | 133 * @private |
| 128 */ | 134 */ |
| 129 onDriveCacheTap_: function(e) { | 135 onDriveCacheTap_: function(e) { |
| 130 e.preventDefault(); | 136 e.preventDefault(); |
| 131 this.$.storageDriveCache.open(); | 137 if (this.hasDriveCache_) |
| 138 this.$.storageDriveCache.open(); |
| 132 }, | 139 }, |
| 133 | 140 |
| 134 /** | 141 /** |
| 135 * Handler for tapping the "Browsing data" item. | 142 * Handler for tapping the "Browsing data" item. |
| 136 * @private | 143 * @private |
| 137 */ | 144 */ |
| 138 onBrowsingDataTap_: function() { | 145 onBrowsingDataTap_: function() { |
| 139 settings.navigateTo(settings.Route.CLEAR_BROWSER_DATA); | 146 settings.navigateTo(settings.Route.CLEAR_BROWSER_DATA); |
| 140 }, | 147 }, |
| 141 | 148 |
| (...skipping 28 matching lines...) Expand all Loading... |
| 170 * @param {string} size Formatted string representing the size of Downloads. | 177 * @param {string} size Formatted string representing the size of Downloads. |
| 171 * @private | 178 * @private |
| 172 */ | 179 */ |
| 173 handleDownloadsSizeChanged_: function(size) { | 180 handleDownloadsSizeChanged_: function(size) { |
| 174 this.$.downloadsSize.textContent = size; | 181 this.$.downloadsSize.textContent = size; |
| 175 }, | 182 }, |
| 176 | 183 |
| 177 /** | 184 /** |
| 178 * @param {string} size Formatted string representing the size of Offline | 185 * @param {string} size Formatted string representing the size of Offline |
| 179 * files. | 186 * files. |
| 187 * @param {boolean} hasCache True if the device has at least one offline file. |
| 180 * @private | 188 * @private |
| 181 */ | 189 */ |
| 182 handleDriveCacheSizeChanged_: function(size) { | 190 handleDriveCacheSizeChanged_: function(size, hasCache) { |
| 183 if (this.driveEnabled_) | 191 if (this.driveEnabled_) { |
| 184 this.$$('#driveCacheSize').textContent = size; | 192 this.$$('#driveCacheSize').textContent = size; |
| 193 this.hasDriveCache_ = hasCache; |
| 194 } |
| 185 }, | 195 }, |
| 186 | 196 |
| 187 /** | 197 /** |
| 188 * @param {string} size Formatted string representing the size of Browsing | 198 * @param {string} size Formatted string representing the size of Browsing |
| 189 * data. | 199 * data. |
| 190 * @private | 200 * @private |
| 191 */ | 201 */ |
| 192 handleBrowsingDataSizeChanged_: function(size) { | 202 handleBrowsingDataSizeChanged_: function(size) { |
| 193 this.$.browsingDataSize.textContent = size; | 203 this.$.browsingDataSize.textContent = size; |
| 194 }, | 204 }, |
| (...skipping 91 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 286 switch (spaceState) { | 296 switch (spaceState) { |
| 287 case settings.StorageSpaceState.LOW: | 297 case settings.StorageSpaceState.LOW: |
| 288 return 'space-low'; | 298 return 'space-low'; |
| 289 case settings.StorageSpaceState.CRITICALLY_LOW: | 299 case settings.StorageSpaceState.CRITICALLY_LOW: |
| 290 return 'space-critically-low'; | 300 return 'space-critically-low'; |
| 291 default: | 301 default: |
| 292 return ''; | 302 return ''; |
| 293 } | 303 } |
| 294 }, | 304 }, |
| 295 }); | 305 }); |
| OLD | NEW |