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

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: Always check the available storage. 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 */
30 uiState: { 32 uiState: {
31 type: Number, 33 type: Number,
32 value: 0 34 value: 0
33 }, 35 },
34 36
35 /** 37 /**
36 * Current migration progress in range [0, 1]. Negative value means that 38 * Current migration progress in range [0, 1]. Negative value means that
37 * the progress is unknown. 39 * the progress is unknown.
38 */ 40 */
39 progress: { 41 progress: {
40 type: Number, 42 type: Number,
41 value: -1 43 value: -1
42 }, 44 },
45
46 /**
47 * Whether the current migration is resuming the previous one.
48 */
49 isResuming: {
50 type: Boolean,
51 value: false
52 },
43 }, 53 },
44 54
45 /** 55 /**
46 * Returns true if the migration is in initial state. 56 * Returns true if the migration is in initial state.
47 * @param {EncryptionMigrationUIState} state Current UI state 57 * @param {EncryptionMigrationUIState} state Current UI state
48 * @private 58 * @private
49 */ 59 */
50 isInitial_: function(state) { 60 isInitial_: function(state) {
51 return state == EncryptionMigrationUIState.INITIAL; 61 return state == EncryptionMigrationUIState.INITIAL;
52 }, 62 },
53 63
54 /** 64 /**
65 * Returns true if the migration is ready to start.
66 * @param {EncryptionMigrationUIState} state Current UI state
67 * @private
68 */
69 isReady_: function(state) {
70 return state == EncryptionMigrationUIState.READY;
71 },
72
73 /**
55 * Returns true if the migration is in progress. 74 * Returns true if the migration is in progress.
56 * @param {EncryptionMigrationUIState} state Current UI state 75 * @param {EncryptionMigrationUIState} state Current UI state
57 * @private 76 * @private
58 */ 77 */
59 isMigrating_: function(state) { 78 isMigrating_: function(state) {
60 return state == EncryptionMigrationUIState.MIGRATING; 79 return state == EncryptionMigrationUIState.MIGRATING;
61 }, 80 },
62 81
63 /** 82 /**
64 * Returns true if the migration is finished successfully. 83 * Returns true if the migration is finished successfully.
65 * @param {EncryptionMigrationUIState} state Current UI state 84 * @param {EncryptionMigrationUIState} state Current UI state
66 * @private 85 * @private
67 */ 86 */
68 isMigrationSucceeded_: function(state) { 87 isMigrationSucceeded_: function(state) {
69 return state == EncryptionMigrationUIState.MIGRATION_SUCCEEDED; 88 return state == EncryptionMigrationUIState.MIGRATION_SUCCEEDED;
70 }, 89 },
71 90
72 /** 91 /**
73 * Returns true if the migration failed. 92 * Returns true if the migration failed.
74 * @param {EncryptionMigrationUIState} state Current UI state 93 * @param {EncryptionMigrationUIState} state Current UI state
75 * @private 94 * @private
76 */ 95 */
77 isMigrationFailed_: function(state) { 96 isMigrationFailed_: function(state) {
78 return state == EncryptionMigrationUIState.MIGRATION_FAILED; 97 return state == EncryptionMigrationUIState.MIGRATION_FAILED;
79 }, 98 },
80 99
81 /** 100 /**
101 * Returns true if the available space is not enough to start migration.
102 * @param {EncryptionMigrationUIState} state Current UI state
103 * @private
104 */
105 isNotEnoughSpace_: function(state) {
106 return state == EncryptionMigrationUIState.NOT_ENOUGH_SPACE;
107 },
108
109 /**
82 * Returns true if the current migration progress is unknown. 110 * Returns true if the current migration progress is unknown.
83 * @param {number} progress 111 * @param {number} progress
84 * @private 112 * @private
85 */ 113 */
86 isProgressIndeterminate_: function(progress) { 114 isProgressIndeterminate_: function(progress) {
87 return progress < 0; 115 return progress < 0;
88 }, 116 },
89 117
90 /** 118 /**
91 * Handles tap on UPGRADE button. 119 * Handles tap on UPGRADE button.
(...skipping 12 matching lines...) Expand all
104 }, 132 },
105 133
106 /** 134 /**
107 * Handles tap on RESTART button. 135 * Handles tap on RESTART button.
108 * @private 136 * @private
109 */ 137 */
110 onRestart_: function() { 138 onRestart_: function() {
111 this.fire('restart'); 139 this.fire('restart');
112 }, 140 },
113 }); 141 });
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698