| 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 * @typedef {{ | 6 * @typedef {{ |
| 7 * totalSize: string, | 7 * totalSize: string, |
| 8 * availableSize: string, | 8 * availableSize: string, |
| 9 * usedSize: string, | 9 * usedSize: string, |
| 10 * usedRatio: number | 10 * usedRatio: number, |
| 11 * isSpaceLow: boolean, |
| 12 * isSpaceCriticallyLow: boolean |
| 11 * }} | 13 * }} |
| 12 */ | 14 */ |
| 13 options.StorageSizeStat; | 15 options.StorageSizeStat; |
| 14 | 16 |
| 15 cr.define('options', function() { | 17 cr.define('options', function() { |
| 16 var Page = cr.ui.pageManager.Page; | 18 var Page = cr.ui.pageManager.Page; |
| 17 var PageManager = cr.ui.pageManager.PageManager; | 19 var PageManager = cr.ui.pageManager.PageManager; |
| 18 | 20 |
| 19 function StorageManager() { | 21 function StorageManager() { |
| 20 Page.call(this, 'storage', | 22 Page.call(this, 'storage', |
| (...skipping 32 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 53 /** | 55 /** |
| 54 * Updates the size information (total/used/available) of the internal | 56 * Updates the size information (total/used/available) of the internal |
| 55 * storage. | 57 * storage. |
| 56 * @param {!options.StorageSizeStat} sizeStat | 58 * @param {!options.StorageSizeStat} sizeStat |
| 57 * @private | 59 * @private |
| 58 */ | 60 */ |
| 59 setSizeStat_: function(sizeStat) { | 61 setSizeStat_: function(sizeStat) { |
| 60 $('storage-manager-size-capacity').textContent = sizeStat.totalSize; | 62 $('storage-manager-size-capacity').textContent = sizeStat.totalSize; |
| 61 $('storage-manager-size-in-use').textContent = sizeStat.usedSize; | 63 $('storage-manager-size-in-use').textContent = sizeStat.usedSize; |
| 62 $('storage-manager-size-available').textContent = sizeStat.availableSize; | 64 $('storage-manager-size-available').textContent = sizeStat.availableSize; |
| 65 $('storage-bar-progress').style.width = sizeStat.usedRatio * 100 + '%'; |
| 66 $('storageManagerPage').classList.toggle('critically-low-space', |
| 67 sizeStat.isSpaceCriticallyLow); |
| 68 $('storageManagerPage').classList.toggle('low-space', |
| 69 sizeStat.isSpaceLow && !sizeStat.isSpaceCriticallyLow); |
| 63 }, | 70 }, |
| 64 | 71 |
| 65 /** | 72 /** |
| 66 * Updates the size Downloads directory. | 73 * Updates the size Downloads directory. |
| 67 * @param {string} size Formatted string of the size of Downloads. | 74 * @param {string} size Formatted string of the size of Downloads. |
| 68 * @private | 75 * @private |
| 69 */ | 76 */ |
| 70 setDownloadsSize_: function(size) { | 77 setDownloadsSize_: function(size) { |
| 71 $('storage-manager-size-downloads').textContent = size; | 78 $('storage-manager-size-downloads').textContent = size; |
| 72 }, | 79 }, |
| (...skipping 23 matching lines...) Expand all Loading... |
| 96 'setArcSize', | 103 'setArcSize', |
| 97 'setDownloadsSize', | 104 'setDownloadsSize', |
| 98 'setSizeStat', | 105 'setSizeStat', |
| 99 'showArcItem', | 106 'showArcItem', |
| 100 ]); | 107 ]); |
| 101 | 108 |
| 102 return { | 109 return { |
| 103 StorageManager: StorageManager | 110 StorageManager: StorageManager |
| 104 }; | 111 }; |
| 105 }); | 112 }); |
| OLD | NEW |