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

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

Issue 2811713002: Check the available storage size before starting encryption migration. (Closed)
Patch Set: . 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 MIGRATING: 1, 17 READY: 1,
18 MIGRATION_SUCCEEDED: 2, 18 MIGRATING: 2,
19 MIGRATION_FAILED: 3 19 MIGRATION_SUCCEEDED: 3,
20 MIGRATION_FAILED: 4,
21 NOT_ENOUGH_SPACE: 5
20 }; 22 };
21 23
22 Polymer({ 24 Polymer({
23 is: 'encryption-migration', 25 is: 'encryption-migration',
24 26
25 properties: { 27 properties: {
26 /** 28 /**
27 * Current UI state which corresponds to a sub step in migration process. 29 * Current UI state which corresponds to a sub step in migration process.
28 * @type {EncryptionMigrationUIState} 30 * @type {EncryptionMigrationUIState}
29 */ 31 */
(...skipping 15 matching lines...) Expand all
45 /** 47 /**
46 * Returns true if the migration is in initial state. 48 * Returns true if the migration is in initial state.
47 * @param {EncryptionMigrationUIState} state Current UI state 49 * @param {EncryptionMigrationUIState} state Current UI state
48 * @private 50 * @private
49 */ 51 */
50 isInitial_: function(state) { 52 isInitial_: function(state) {
51 return state == EncryptionMigrationUIState.INITIAL; 53 return state == EncryptionMigrationUIState.INITIAL;
52 }, 54 },
53 55
54 /** 56 /**
57 * Returns true if the migration is ready to start.
58 * @param {EncryptionMigrationUIState} state Current UI state
59 * @private
60 */
61 isReady_: function(state) {
62 return state == EncryptionMigrationUIState.READY;
63 },
64
65 /**
55 * Returns true if the migration is in progress. 66 * Returns true if the migration is in progress.
56 * @param {EncryptionMigrationUIState} state Current UI state 67 * @param {EncryptionMigrationUIState} state Current UI state
57 * @private 68 * @private
58 */ 69 */
59 isMigrating_: function(state) { 70 isMigrating_: function(state) {
60 return state == EncryptionMigrationUIState.MIGRATING; 71 return state == EncryptionMigrationUIState.MIGRATING;
61 }, 72 },
62 73
63 /** 74 /**
64 * Returns true if the migration is finished successfully. 75 * Returns true if the migration is finished successfully.
65 * @param {EncryptionMigrationUIState} state Current UI state 76 * @param {EncryptionMigrationUIState} state Current UI state
66 * @private 77 * @private
67 */ 78 */
68 isMigrationSucceeded_: function(state) { 79 isMigrationSucceeded_: function(state) {
69 return state == EncryptionMigrationUIState.MIGRATION_SUCCEEDED; 80 return state == EncryptionMigrationUIState.MIGRATION_SUCCEEDED;
70 }, 81 },
71 82
72 /** 83 /**
73 * Returns true if the migration failed. 84 * Returns true if the migration failed.
74 * @param {EncryptionMigrationUIState} state Current UI state 85 * @param {EncryptionMigrationUIState} state Current UI state
75 * @private 86 * @private
76 */ 87 */
77 isMigrationFailed_: function(state) { 88 isMigrationFailed_: function(state) {
78 return state == EncryptionMigrationUIState.MIGRATION_FAILED; 89 return state == EncryptionMigrationUIState.MIGRATION_FAILED;
79 }, 90 },
80 91
81 /** 92 /**
93 * Returns true if the available space is not enough to start migration.
94 * @param {EncryptionMigrationUIState} state Current UI state
95 * @private
96 */
97 isNotEnoughSpace_: function(state) {
98 return state == EncryptionMigrationUIState.NOT_ENOUGH_SPACE;
99 },
100
101 /**
82 * Returns true if the current migration progress is unknown. 102 * Returns true if the current migration progress is unknown.
83 * @param {number} progress 103 * @param {number} progress
84 * @private 104 * @private
85 */ 105 */
86 isProgressIndeterminate_: function(progress) { 106 isProgressIndeterminate_: function(progress) {
87 return progress < 0; 107 return progress < 0;
88 }, 108 },
89 109
90 /** 110 /**
91 * Handles tap on UPGRADE button. 111 * Handles tap on UPGRADE button.
(...skipping 12 matching lines...) Expand all
104 }, 124 },
105 125
106 /** 126 /**
107 * Handles tap on RESTART button. 127 * Handles tap on RESTART button.
108 * @private 128 * @private
109 */ 129 */
110 onRestart_: function() { 130 onRestart_: function() {
111 this.fire('restart'); 131 this.fire('restart');
112 }, 132 },
113 }); 133 });
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698