Chromium Code Reviews| Index: chrome/browser/resources/options/chromeos/storage_manager.js |
| diff --git a/chrome/browser/resources/options/chromeos/storage_manager.js b/chrome/browser/resources/options/chromeos/storage_manager.js |
| index 15d1b7389510e587446a3efe6b3c8cacf6a1157d..5dca9d49f62c8a64f673e657fcfe714d718b9489 100644 |
| --- a/chrome/browser/resources/options/chromeos/storage_manager.js |
| +++ b/chrome/browser/resources/options/chromeos/storage_manager.js |
| @@ -2,6 +2,16 @@ |
| // Use of this source code is governed by a BSD-style license that can be |
| // found in the LICENSE file. |
| +/** |
| + * @typedef {{ |
| + * totalSize: string, |
| + * availableSize: string, |
| + * usedSize: string, |
| + * usedRatio: number |
| + * }} |
| + */ |
| +options.StorageSizeStat; |
| + |
| cr.define('options', function() { |
| var Page = cr.ui.pageManager.Page; |
| var PageManager = cr.ui.pageManager.PageManager; |
| @@ -21,12 +31,50 @@ cr.define('options', function() { |
| initializePage: function() { |
| Page.prototype.initializePage.call(this); |
| + $('storage-manager-label-downloads').onclick = function() { |
| + chrome.send('openDownloads'); |
| + }; |
| + |
| $('storage-confirm').onclick = function() { |
| PageManager.closeOverlay(); |
| }; |
| - } |
| + }, |
| + |
| + /** @override */ |
| + didShowPage: function() { |
| + // Updating storage information can be expensive (e.g. computing directory |
| + // sizes recursively), so we delay this operation until the page is shown. |
| + chrome.send('updateStorageInfo'); |
| + }, |
| + |
| + /** |
| + * Updates the size information (total/used/available) of the internal |
| + * storage. |
| + * @param {!options.StorageSizeStat} sizeStat |
| + * @private |
| + */ |
| + setSizeStat_: function(sizeStat) { |
| + $('storage-manager-size-capacity').innerHTML = sizeStat.totalSize; |
|
Dan Beam
2016/06/09 04:49:40
can you use textContent instead?
fukino
2016/06/09 15:39:38
Done.
|
| + $('storage-manager-size-in-use').innerHTML = sizeStat.usedSize; |
| + $('storage-manager-size-available').innerHTML = sizeStat.availableSize; |
| + }, |
| + |
| + /** |
| + * Updates the size Downloads directory. |
| + * @param {string} size Formatted string of the size of Downloads. |
| + * @private |
| + */ |
| + setDownloadsSize_: function(size) { |
| + $('storage-manager-size-downloads').innerHTML = size; |
| + }, |
| }; |
| + // Forward public APIs to private implementations. |
| + cr.makePublic(StorageManager, [ |
| + 'setSizeStat', |
| + 'setDownloadsSize', |
| + ]); |
| + |
| return { |
| StorageManager: StorageManager |
| }; |