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

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

Issue 2944703004: Run clang-format on .js files in c/b/r/chromeos (Closed)
Patch Set: Created 3 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 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 login.createScreen('EncryptionMigrationScreen', 'encryption-migration', 5 login.createScreen(
6 function() { 6 'EncryptionMigrationScreen', 'encryption-migration', function() {
7 return { 7 return {
8 EXTERNAL_API: [ 8 EXTERNAL_API: [
9 'setUIState', 9 'setUIState',
10 'setMigrationProgress', 10 'setMigrationProgress',
11 'setIsResuming', 11 'setIsResuming',
12 'setBatteryState', 12 'setBatteryState',
13 'setAvailableSpaceInString', 13 'setAvailableSpaceInString',
14 'setNecessarySpaceInString', 14 'setNecessarySpaceInString',
15 ], 15 ],
16 16
17 /** 17 /**
18 * Ignore any accelerators the user presses on this screen. 18 * Ignore any accelerators the user presses on this screen.
19 */ 19 */
20 ignoreAccelerators: true, 20 ignoreAccelerators: true,
21 21
22 /** @override */ 22 /** @override */
23 decorate: function() { 23 decorate: function() {
24 var encryptionMigration = $('encryption-migration-element'); 24 var encryptionMigration = $('encryption-migration-element');
25 encryptionMigration.addEventListener('upgrade', function() { 25 encryptionMigration.addEventListener('upgrade', function() {
26 chrome.send('startMigration'); 26 chrome.send('startMigration');
27 });
28 encryptionMigration.addEventListener('skip', function() {
29 chrome.send('skipMigration');
30 });
31 encryptionMigration.addEventListener(
32 'restart-on-low-storage', function() {
33 chrome.send('requestRestartOnLowStorage');
34 }); 27 });
35 encryptionMigration.addEventListener('restart-on-failure', function() { 28 encryptionMigration.addEventListener('skip', function() {
36 chrome.send('requestRestartOnFailure'); 29 chrome.send('skipMigration');
37 }); 30 });
38 encryptionMigration.addEventListener('openFeedbackDialog', function() { 31 encryptionMigration.addEventListener(
39 chrome.send('openFeedbackDialog'); 32 'restart-on-low-storage', function() {
40 }); 33 chrome.send('requestRestartOnLowStorage');
41 }, 34 });
35 encryptionMigration.addEventListener(
36 'restart-on-failure', function() {
37 chrome.send('requestRestartOnFailure');
38 });
39 encryptionMigration.addEventListener(
40 'openFeedbackDialog', function() {
41 chrome.send('openFeedbackDialog');
42 });
43 },
42 44
43 /** 45 /**
44 * Event handler that is invoked just before the screen in shown. 46 * Event handler that is invoked just before the screen in shown.
45 */ 47 */
46 onBeforeShow: function() { 48 onBeforeShow: function() {
47 $('progress-dots').hidden = true; 49 $('progress-dots').hidden = true;
48 var headerBar = $('login-header-bar'); 50 var headerBar = $('login-header-bar');
49 headerBar.allowCancel = false; 51 headerBar.allowCancel = false;
50 headerBar.showGuestButton = false; 52 headerBar.showGuestButton = false;
51 headerBar.showCreateSupervisedButton = false; 53 headerBar.showCreateSupervisedButton = false;
52 headerBar.signinUIState = SIGNIN_UI_STATE.HIDDEN; 54 headerBar.signinUIState = SIGNIN_UI_STATE.HIDDEN;
53 }, 55 },
54 56
55 /** 57 /**
56 * Updates the migration screen by specifying a state which corresponds to 58 * Updates the migration screen by specifying a state which corresponds
57 * a sub step in the migration process. 59 * to a sub step in the migration process.
58 * @param {EncryptionMigrationUIState} state The UI state to identify a sub 60 * @param {EncryptionMigrationUIState} state The UI state to identify a sub
59 * step in migration. 61 * step in migration.
60 */ 62 */
61 setUIState: function(state) { 63 setUIState: function(state) {
62 $('encryption-migration-element').uiState = state; 64 $('encryption-migration-element').uiState = state;
63 65
64 // Hide "Shut down" button during migration. 66 // Hide "Shut down" button during migration.
65 $('login-header-bar').showShutdownButton = 67 $('login-header-bar').showShutdownButton =
66 state != EncryptionMigrationUIState.MIGRATING; 68 state != EncryptionMigrationUIState.MIGRATING;
67 }, 69 },
68 70
69 /** 71 /**
70 * Updates the migration progress. 72 * Updates the migration progress.
71 * @param {number} progress The progress of migration in range [0, 1]. 73 * @param {number} progress The progress of migration in range [0, 1].
72 */ 74 */
73 setMigrationProgress: function(progress) { 75 setMigrationProgress: function(progress) {
74 $('encryption-migration-element').progress = progress; 76 $('encryption-migration-element').progress = progress;
75 }, 77 },
76 78
77 /** 79 /**
78 * Updates the migration screen based on whether the migration process is 80 * Updates the migration screen based on whether the migration process
79 * resuming the previous one. 81 * is resuming the previous one.
80 * @param {boolean} isResuming 82 * @param {boolean} isResuming
81 */ 83 */
82 setIsResuming: function(isResuming) { 84 setIsResuming: function(isResuming) {
83 $('encryption-migration-element').isResuming = isResuming; 85 $('encryption-migration-element').isResuming = isResuming;
84 }, 86 },
85 87
86 /** 88 /**
87 * Updates battery level of the device. 89 * Updates battery level of the device.
88 * @param {number} batteryPercent Battery level in percent. 90 * @param {number} batteryPercent Battery level in percent.
89 * @param {boolean} isEnoughBattery True if the battery is enough. 91 * @param {boolean} isEnoughBattery True if the battery is enough.
90 * @param {boolena} isCharging True if the device is connected to power. 92 * @param {boolena} isCharging True if the device is connected to power.
91 */ 93 */
92 setBatteryState: function(batteryPercent, isEnoughBattery, isCharging) { 94 setBatteryState: function(batteryPercent, isEnoughBattery, isCharging) {
93 var element = $('encryption-migration-element'); 95 var element = $('encryption-migration-element');
94 element.batteryPercent = Math.floor(batteryPercent); 96 element.batteryPercent = Math.floor(batteryPercent);
95 element.isEnoughBattery = isEnoughBattery; 97 element.isEnoughBattery = isEnoughBattery;
96 element.isCharging = isCharging; 98 element.isCharging = isCharging;
97 }, 99 },
98 100
99 /** 101 /**
100 * Updates the string representation of available space size. 102 * Updates the string representation of available space size.
101 * @param {string} space 103 * @param {string} space
102 */ 104 */
103 setAvailableSpaceInString: function(space) { 105 setAvailableSpaceInString: function(space) {
104 $('encryption-migration-element').availableSpaceInString = space; 106 $('encryption-migration-element').availableSpaceInString = space;
105 }, 107 },
106 108
107 /** 109 /**
108 * Updates the string representation of necessary space size. 110 * Updates the string representation of necessary space size.
109 * @param {string} space 111 * @param {string} space
110 */ 112 */
111 setNecessarySpaceInString: function(space) { 113 setNecessarySpaceInString: function(space) {
112 $('encryption-migration-element').necessarySpaceInString = space; 114 $('encryption-migration-element').necessarySpaceInString = space;
113 }, 115 },
114 }; 116 };
115 }); 117 });
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698