OLD | NEW |
1 // Copyright 2014 The Chromium Authors. All rights reserved. | 1 // Copyright 2014 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 cr.define('options', function() { | 5 cr.define('options', function() { |
6 var Page = cr.ui.pageManager.Page; | 6 var Page = cr.ui.pageManager.Page; |
7 var PageManager = cr.ui.pageManager.PageManager; | 7 var PageManager = cr.ui.pageManager.PageManager; |
8 | 8 |
9 // UI state of the turn off overlay. | 9 // UI state of the turn off overlay. |
10 // @enum {string} | 10 // @enum {string} |
11 var UIState = { | 11 var UIState = { |
12 UNKNOWN: 'unknown', | 12 UNKNOWN: 'unknown', |
13 OFFLINE: 'offline', | 13 OFFLINE: 'offline', |
14 IDLE: 'idle', | 14 IDLE: 'idle', |
15 PENDING: 'pending', | 15 PENDING: 'pending', |
16 SERVER_ERROR: 'server-error', | 16 SERVER_ERROR: 'server-error', |
17 }; | 17 }; |
18 | 18 |
19 /** | 19 /** |
20 * EasyUnlockTurnOffOverlay class | 20 * EasyUnlockTurnOffOverlay class |
21 * Encapsulated handling of the Factory Reset confirmation overlay page. | 21 * Encapsulated handling of the Factory Reset confirmation overlay page. |
22 * @class | 22 * @class |
23 */ | 23 */ |
24 function EasyUnlockTurnOffOverlay() { | 24 function EasyUnlockTurnOffOverlay() { |
25 Page.call(this, 'easyUnlockTurnOffOverlay', | 25 Page.call( |
26 loadTimeData.getString('easyUnlockTurnOffTitle'), | 26 this, 'easyUnlockTurnOffOverlay', |
27 'easy-unlock-turn-off-overlay'); | 27 loadTimeData.getString('easyUnlockTurnOffTitle'), |
| 28 'easy-unlock-turn-off-overlay'); |
28 } | 29 } |
29 | 30 |
30 cr.addSingletonGetter(EasyUnlockTurnOffOverlay); | 31 cr.addSingletonGetter(EasyUnlockTurnOffOverlay); |
31 | 32 |
32 EasyUnlockTurnOffOverlay.prototype = { | 33 EasyUnlockTurnOffOverlay.prototype = { |
33 // Inherit EasyUnlockTurnOffOverlay from Page. | 34 // Inherit EasyUnlockTurnOffOverlay from Page. |
34 __proto__: Page.prototype, | 35 __proto__: Page.prototype, |
35 | 36 |
36 /** Current UI state */ | 37 /** Current UI state */ |
37 uiState_: UIState.UNKNOWN, | 38 uiState_: UIState.UNKNOWN, |
(...skipping 12 matching lines...) Expand all Loading... |
50 case UIState.IDLE: | 51 case UIState.IDLE: |
51 this.setUpTurnOffUI_(false); | 52 this.setUpTurnOffUI_(false); |
52 break; | 53 break; |
53 case UIState.PENDING: | 54 case UIState.PENDING: |
54 this.setUpTurnOffUI_(true); | 55 this.setUpTurnOffUI_(true); |
55 break; | 56 break; |
56 case UIState.SERVER_ERROR: | 57 case UIState.SERVER_ERROR: |
57 this.setUpServerErrorUI_(); | 58 this.setUpServerErrorUI_(); |
58 break; | 59 break; |
59 default: | 60 default: |
60 console.error('Unknow Easy unlock turn off UI state: ' + | 61 console.error( |
61 this.uiState_); | 62 'Unknow Easy unlock turn off UI state: ' + this.uiState_); |
62 this.setUpTurnOffUI_(false); | 63 this.setUpTurnOffUI_(false); |
63 break; | 64 break; |
64 } | 65 } |
65 }, | 66 }, |
66 | 67 |
67 /** @override */ | 68 /** @override */ |
68 initializePage: function() { | 69 initializePage: function() { |
69 Page.prototype.initializePage.call(this); | 70 Page.prototype.initializePage.call(this); |
70 | 71 |
71 $('easy-unlock-turn-off-dismiss').onclick = function(event) { | 72 $('easy-unlock-turn-off-dismiss').onclick = function(event) { |
(...skipping 108 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
180 | 181 |
181 /** | 182 /** |
182 * Update UI to reflect the turn off operation status. | 183 * Update UI to reflect the turn off operation status. |
183 * @param {string} newState The UIState string representing the new state. | 184 * @param {string} newState The UIState string representing the new state. |
184 */ | 185 */ |
185 EasyUnlockTurnOffOverlay.updateUIState = function(newState) { | 186 EasyUnlockTurnOffOverlay.updateUIState = function(newState) { |
186 EasyUnlockTurnOffOverlay.getInstance().uiState = newState; | 187 EasyUnlockTurnOffOverlay.getInstance().uiState = newState; |
187 }; | 188 }; |
188 | 189 |
189 // Export | 190 // Export |
190 return { | 191 return {EasyUnlockTurnOffOverlay: EasyUnlockTurnOffOverlay}; |
191 EasyUnlockTurnOffOverlay: EasyUnlockTurnOffOverlay | |
192 }; | |
193 }); | 192 }); |
OLD | NEW |