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

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

Issue 2784273003: Implement a basic UI flow for cryptohome encryption migration. (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
(Empty)
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
3 // found in the LICENSE file.
4
5 /**
6 * @fileoverview Polymer element for displaying encryption migration screen.
7 */
8
9 /**
10 * Enum for the UI states corresponding to sub steps inside migration screen.
11 * These values must be kept in sync with
12 * EncryptionMigrationScreenHandler::UIState in C++ code.
13 * @enum {number}
14 */
15 var EncryptionMigrationUIState = {
16 INITIAL: 0,
17 MIGRATING: 1,
18 MIGRATION_SUCCEEDED: 2,
19 MIGRATION_FAILED: 3
20 };
21
22 Polymer({
23 is: 'encryption-migration',
24
25 properties: {
26 /**
27 * Current UI state which corresponds to a sub step in migration process.
28 * @type {EncryptionMigrationUIState}
29 */
30 uiState: {
31 type: Number,
32 value: 0
33 },
34
35 /**
36 * Current migration progress in range [0, 1]. Negative value means that
37 * the progress is unknown.
38 */
39 progress: {
40 type: Number,
41 value: -1
42 },
43 },
44
45 /**
46 * Returns true if the migration is in initial state.
47 * @param {EncryptionMigrationUIState} state Current UI state
48 * @private
49 */
50 isInitial_: function(state) {
51 return state == EncryptionMigrationUIState.INITIAL;
52 },
53
54 /**
55 * Returns true if the migration is in progress.
56 * @param {EncryptionMigrationUIState} state Current UI state
57 * @private
58 */
59 isMigrating_: function(state) {
60 return state == EncryptionMigrationUIState.MIGRATING;
61 },
62
63 /**
64 * Returns true if the migration is finished successfully.
65 * @param {EncryptionMigrationUIState} state Current UI state
66 * @private
67 */
68 isMigrationSucceeded_: function(state) {
69 return state == EncryptionMigrationUIState.MIGRATION_SUCCEEDED;
70 },
71
72 /**
73 * Returns true if the migration failed.
74 * @param {EncryptionMigrationUIState} state Current UI state
75 * @private
76 */
77 isMigrationFailed_: function(state) {
78 return state == EncryptionMigrationUIState.MIGRATION_FAILED;
79 },
80
81 /**
82 * Returns true if the current migration progress is unknown.
83 * @param {number} progress
84 * @private
85 */
86 isProgressIndeterminate_: function(progress) {
87 return progress < 0;
88 },
89
90 /**
91 * Handles tap on UPGRADE button.
92 * @private
93 */
94 onUpgrade_: function() {
95 this.fire('upgrade');
96 },
97
98 /**
99 * Handles tap on SKIP button.
100 * @private
101 */
102 onSkip_: function() {
103 this.fire('skip');
104 },
105
106 /**
107 * Handles tap on RESTART button.
108 * @private
109 */
110 onRestart_: function() {
111 this.fire('restart');
112 },
113 });
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698