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

Side by Side Diff: chrome/browser/resources/chromeos/login/encryption_migration.js

Issue 2819613003: cros: Update design of encryption migration UI for ext4 dircrypto. (Closed)
Patch Set: Address review comments. Created 3 years, 8 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 2017 The Chromium Authors. All rights reserved. 1 // Copyright 2017 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 Polymer element for displaying encryption migration screen. 6 * @fileoverview Polymer element for displaying encryption migration screen.
7 */ 7 */
8 8
9 /** 9 /**
10 * Enum for the UI states corresponding to sub steps inside migration screen. 10 * Enum for the UI states corresponding to sub steps inside migration screen.
11 * These values must be kept in sync with 11 * These values must be kept in sync with
12 * EncryptionMigrationScreenHandler::UIState in C++ code. 12 * EncryptionMigrationScreenHandler::UIState in C++ code.
13 * @enum {number} 13 * @enum {number}
14 */ 14 */
15 var EncryptionMigrationUIState = { 15 var EncryptionMigrationUIState = {
16 INITIAL: 0, 16 INITIAL: 0,
17 READY: 1, 17 READY: 1,
18 MIGRATING: 2, 18 MIGRATING: 2,
19 MIGRATION_SUCCEEDED: 3, 19 MIGRATION_FAILED: 3,
20 MIGRATION_FAILED: 4, 20 NOT_ENOUGH_SPACE: 4
21 NOT_ENOUGH_SPACE: 5
22 }; 21 };
23 22
24 Polymer({ 23 Polymer({
25 is: 'encryption-migration', 24 is: 'encryption-migration',
26 25
26 behaviors: [I18nBehavior],
27
27 properties: { 28 properties: {
28 /** 29 /**
29 * Current UI state which corresponds to a sub step in migration process. 30 * Current UI state which corresponds to a sub step in migration process.
30 * @type {EncryptionMigrationUIState} 31 * @type {EncryptionMigrationUIState}
31 */ 32 */
32 uiState: { 33 uiState: {
33 type: Number, 34 type: Number,
34 value: 0 35 value: 0
35 }, 36 },
36 37
(...skipping 24 matching lines...) Expand all
61 62
62 /** 63 /**
63 * True if the battery level is enough to start migration. 64 * True if the battery level is enough to start migration.
64 */ 65 */
65 isEnoughBattery: { 66 isEnoughBattery: {
66 type: Boolean, 67 type: Boolean,
67 value: true 68 value: true
68 }, 69 },
69 70
70 /** 71 /**
72 * True if the device is charging.
73 */
74 isCharging: {
75 type: Boolean,
76 value: false
77 },
78
79 /**
71 * True if the user already accepted the migration. 80 * True if the user already accepted the migration.
72 */ 81 */
73 isMigrationAccepted: { 82 isMigrationAccepted: {
74 type: Boolean, 83 type: Boolean,
75 value: false 84 value: false
76 }, 85 },
86
87 /**
88 * Formatted string of the current available space size.
89 */
90 availableSpaceInString: {
91 type: String,
92 value: ''
93 },
94
95 /**
96 * Formatted string of the necessary space size for migration.
97 */
98 necessarySpaceInString: {
99 type: String,
100 value: ''
101 },
77 }, 102 },
78 103
79 /** 104 /**
80 * Returns true if the migration is in initial state. 105 * Returns true if the migration is in initial state.
81 * @param {EncryptionMigrationUIState} state Current UI state 106 * @param {EncryptionMigrationUIState} state Current UI state
82 * @private 107 * @private
83 */ 108 */
84 isInitial_: function(state) { 109 isInitial_: function(state) {
85 return state == EncryptionMigrationUIState.INITIAL; 110 return state == EncryptionMigrationUIState.INITIAL;
86 }, 111 },
(...skipping 10 matching lines...) Expand all
97 /** 122 /**
98 * Returns true if the migration is in progress. 123 * Returns true if the migration is in progress.
99 * @param {EncryptionMigrationUIState} state Current UI state 124 * @param {EncryptionMigrationUIState} state Current UI state
100 * @private 125 * @private
101 */ 126 */
102 isMigrating_: function(state) { 127 isMigrating_: function(state) {
103 return state == EncryptionMigrationUIState.MIGRATING; 128 return state == EncryptionMigrationUIState.MIGRATING;
104 }, 129 },
105 130
106 /** 131 /**
107 * Returns true if the migration is finished successfully.
108 * @param {EncryptionMigrationUIState} state Current UI state
109 * @private
110 */
111 isMigrationSucceeded_: function(state) {
112 return state == EncryptionMigrationUIState.MIGRATION_SUCCEEDED;
113 },
114
115 /**
116 * Returns true if the migration failed. 132 * Returns true if the migration failed.
117 * @param {EncryptionMigrationUIState} state Current UI state 133 * @param {EncryptionMigrationUIState} state Current UI state
118 * @private 134 * @private
119 */ 135 */
120 isMigrationFailed_: function(state) { 136 isMigrationFailed_: function(state) {
121 return state == EncryptionMigrationUIState.MIGRATION_FAILED; 137 return state == EncryptionMigrationUIState.MIGRATION_FAILED;
122 }, 138 },
123 139
124 /** 140 /**
125 * Returns true if the available space is not enough to start migration. 141 * Returns true if the available space is not enough to start migration.
126 * @param {EncryptionMigrationUIState} state Current UI state 142 * @param {EncryptionMigrationUIState} state Current UI state
127 * @private 143 * @private
128 */ 144 */
129 isNotEnoughSpace_: function(state) { 145 isNotEnoughSpace_: function(state) {
130 return state == EncryptionMigrationUIState.NOT_ENOUGH_SPACE; 146 return state == EncryptionMigrationUIState.NOT_ENOUGH_SPACE;
131 }, 147 },
132 148
133 /** 149 /**
134 * Returns true if the current migration progress is unknown. 150 * Returns true if the current migration progress is unknown.
135 * @param {number} progress 151 * @param {number} progress
136 * @private 152 * @private
137 */ 153 */
138 isProgressIndeterminate_: function(progress) { 154 isProgressIndeterminate_: function(progress) {
139 return progress < 0; 155 return progress < 0;
140 }, 156 },
141 157
142 /** 158 /**
159 * Computes the label shown under progress bar.
160 * @param {number} progress
161 * @return {string}
162 * @private
163 */
164 computeProgressLabel_: function(progress) {
165 return this.i18n('migrationProgressLabel', Math.floor(progress * 100));
166 },
167
168 /**
169 * Computes the warning label when battery level is not enough.
170 * @param {number} batteryPercent
171 * @return {string}
172 * @private
173 */
174 computeBatteryWarningLabel_: function(batteryPercent) {
175 return this.i18n('migrationBatteryWarningLabel', batteryPercent);
176 },
177
178 /**
179 * Computes the label to show the necessary battery level for migration.
180 * @return {string}
181 * @private
182 */
183 computeNecessaryBatteryLevelLabel_: function() {
184 return this.i18n('migrationNecessaryBatteryLevelLabel', 30);
185 },
186
187 /**
188 * Computes the label to show the current available space.
189 * @param {string} availableSpaceInString
190 * @return {string}
191 * @private
192 */
193 computeAvailableSpaceLabel_: function(availableSpaceInString) {
194 return this.i18n('migrationAvailableSpaceLabel', availableSpaceInString);
195 },
196
197 /**
198 * Computes the label to show the necessary space to start migration.
199 * @param {string} necessarySpaceInString
200 * @return {string}
201 * @private
202 */
203 computeNecessarySpaceLabel_: function(necessarySpaceInString) {
204 return this.i18n('migrationNecessarySpaceLabel', necessarySpaceInString);
205 },
206
207 /**
143 * Handles tap on UPGRADE button. 208 * Handles tap on UPGRADE button.
144 * @private 209 * @private
145 */ 210 */
146 onUpgrade_: function() { 211 onUpgrade_: function() {
147 this.isMigrationAccepted = true; 212 this.isMigrationAccepted = true;
148 this.fire('upgrade'); 213 this.fire('upgrade');
149 }, 214 },
150 215
151 /** 216 /**
152 * Handles tap on SKIP button. 217 * Handles tap on SKIP button.
153 * @private 218 * @private
154 */ 219 */
155 onSkip_: function() { 220 onSkip_: function() {
156 this.fire('skip'); 221 this.fire('skip');
157 }, 222 },
158 223
159 /** 224 /**
160 * Handles tap on RESTART button. 225 * Handles tap on RESTART button.
161 * @private 226 * @private
162 */ 227 */
163 onRestart_: function() { 228 onRestart_: function() {
164 this.fire('restart'); 229 this.fire('restart');
165 }, 230 },
166 }); 231 });
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698