Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(224)

Side by Side Diff: chrome/browser/resources/options/chromeos/storage_manager.js

Issue 2078153002: Storage manager: Add conditional messages for disk low situation and update design. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Use svg. Created 4 years, 6 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
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 * Enumeration for device state about remaining space.
7 * These values must be kept in sync with
8 * StorageManagerHandler::StorageSpaceState in C++ code.
9 * @enum {number}
10 * @const
11 */
12 options.StorageSpaceState = {
13 STORAGE_SPACE_NORMAL: 0,
14 STORAGE_SPACE_LOW: 1,
15 STORAGE_SPACE_CRITICALLY_LOW: 2
16 };
17
18 /**
6 * @typedef {{ 19 * @typedef {{
7 * totalSize: string, 20 * totalSize: string,
8 * availableSize: string, 21 * availableSize: string,
9 * usedSize: string, 22 * usedSize: string,
10 * usedRatio: number 23 * usedRatio: number,
24 * spaceState: options.StorageSpaceState,
11 * }} 25 * }}
12 */ 26 */
13 options.StorageSizeStat; 27 options.StorageSizeStat;
14 28
15 cr.define('options', function() { 29 cr.define('options', function() {
16 var Page = cr.ui.pageManager.Page; 30 var Page = cr.ui.pageManager.Page;
17 var PageManager = cr.ui.pageManager.PageManager; 31 var PageManager = cr.ui.pageManager.PageManager;
18 32
19 function StorageManager() { 33 function StorageManager() {
20 Page.call(this, 'storage', 34 Page.call(this, 'storage',
(...skipping 35 matching lines...) Expand 10 before | Expand all | Expand 10 after
56 /** 70 /**
57 * Updates the size information (total/used/available) of the internal 71 * Updates the size information (total/used/available) of the internal
58 * storage. 72 * storage.
59 * @param {!options.StorageSizeStat} sizeStat 73 * @param {!options.StorageSizeStat} sizeStat
60 * @private 74 * @private
61 */ 75 */
62 setSizeStat_: function(sizeStat) { 76 setSizeStat_: function(sizeStat) {
63 $('storage-manager-size-capacity').textContent = sizeStat.totalSize; 77 $('storage-manager-size-capacity').textContent = sizeStat.totalSize;
64 $('storage-manager-size-in-use').textContent = sizeStat.usedSize; 78 $('storage-manager-size-in-use').textContent = sizeStat.usedSize;
65 $('storage-manager-size-available').textContent = sizeStat.availableSize; 79 $('storage-manager-size-available').textContent = sizeStat.availableSize;
80 $('storage-bar-progress').setAttribute('value', sizeStat.usedRatio);
81 $('storageManagerPage').classList.toggle('low-space',
82 sizeStat.spaceState ===
83 options.StorageSpaceState.STORAGE_SPACE_LOW);
84 $('storageManagerPage').classList.toggle('critically-low-space',
85 sizeStat.spaceState ===
86 options.StorageSpaceState.STORAGE_SPACE_CRITICALLY_LOW);
66 }, 87 },
67 88
68 /** 89 /**
69 * Updates the size Downloads directory. 90 * Updates the size Downloads directory.
70 * @param {string} size Formatted string of the size of Downloads. 91 * @param {string} size Formatted string of the size of Downloads.
71 * @private 92 * @private
72 */ 93 */
73 setDownloadsSize_: function(size) { 94 setDownloadsSize_: function(size) {
74 $('storage-manager-size-downloads').textContent = size; 95 $('storage-manager-size-downloads').textContent = size;
75 }, 96 },
(...skipping 34 matching lines...) Expand 10 before | Expand all | Expand 10 after
110 'setDownloadsSize', 131 'setDownloadsSize',
111 'setDriveCacheSize', 132 'setDriveCacheSize',
112 'setSizeStat', 133 'setSizeStat',
113 'showArcItem', 134 'showArcItem',
114 ]); 135 ]);
115 136
116 return { 137 return {
117 StorageManager: StorageManager 138 StorageManager: StorageManager
118 }; 139 };
119 }); 140 });
OLDNEW
« no previous file with comments | « chrome/browser/resources/options/chromeos/storage_manager.html ('k') | chrome/browser/resources/options/options.html » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698