OLD | NEW |
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('EncryptionMigrationScreen', 'encryption-migration', |
6 function() { | 6 function() { |
7 return { | 7 return { |
8 EXTERNAL_API: [ | 8 EXTERNAL_API: [ |
| 9 'setUIState', |
| 10 'setMigrationProgress', |
9 ], | 11 ], |
10 | 12 |
11 /** | 13 /** |
12 * Ignore any accelerators the user presses on this screen. | 14 * Ignore any accelerators the user presses on this screen. |
13 */ | 15 */ |
14 ignoreAccelerators: true, | 16 ignoreAccelerators: true, |
15 | 17 |
16 /** @override */ | 18 /** @override */ |
17 decorate: function() { | 19 decorate: function() { |
| 20 var encryptionMigration = $('encryption-migration-element'); |
| 21 encryptionMigration.addEventListener('upgrade', function() { |
| 22 chrome.send('startMigration'); |
| 23 }); |
| 24 encryptionMigration.addEventListener('restart', function() { |
| 25 chrome.send('requestRestart'); |
| 26 }); |
18 }, | 27 }, |
19 | 28 |
20 /** | 29 /** |
21 * Event handler that is invoked just before the screen in shown. | 30 * Event handler that is invoked just before the screen in shown. |
22 */ | 31 */ |
23 onBeforeShow: function() { | 32 onBeforeShow: function() { |
24 $('progress-dots').hidden = true; | 33 $('progress-dots').hidden = true; |
25 var headerBar = $('login-header-bar'); | 34 var headerBar = $('login-header-bar'); |
26 headerBar.allowCancel = false; | 35 headerBar.allowCancel = false; |
27 headerBar.showGuestButton = false; | 36 headerBar.showGuestButton = false; |
28 headerBar.showCreateSupervisedButton = false; | 37 headerBar.showCreateSupervisedButton = false; |
29 headerBar.signinUIState = SIGNIN_UI_STATE.HIDDEN; | 38 headerBar.signinUIState = SIGNIN_UI_STATE.HIDDEN; |
30 }, | 39 }, |
| 40 |
| 41 /** |
| 42 * Updates the migration screen by specifying a state which corresponds to |
| 43 * a sub step in the migration process. |
| 44 * @param {number} state The UI state to identify a sub step in migration. |
| 45 */ |
| 46 setUIState: function(state) { |
| 47 $('encryption-migration-element').uiState = state; |
| 48 }, |
| 49 |
| 50 /** |
| 51 * Updates the migration progress. |
| 52 * @param {number} progress The progress of migration in range [0, 1]. |
| 53 */ |
| 54 setMigrationProgress: function(progress) { |
| 55 $('encryption-migration-element').progress = progress; |
| 56 }, |
31 }; | 57 }; |
32 }); | 58 }); |
OLD | NEW |