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} |
(...skipping 74 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
85 } else { | 85 } else { |
86 this.uiState = UIState.OFFLINE; | 86 this.uiState = UIState.OFFLINE; |
87 } | 87 } |
88 }, | 88 }, |
89 | 89 |
90 /** @override */ | 90 /** @override */ |
91 didClosePage: function() { | 91 didClosePage: function() { |
92 chrome.send('easyUnlockTurnOffOverlayDismissed'); | 92 chrome.send('easyUnlockTurnOffOverlayDismissed'); |
93 }, | 93 }, |
94 | 94 |
| 95 /** @override */ |
| 96 handleCancel: function() { |
| 97 // Make sure keyboard dismiss uses the word around as well. |
| 98 // TODO(xiyuan): Remove the workaround. See http://crbug.com/405250 |
| 99 EasyUnlockTurnOffOverlay.dismiss(); |
| 100 }, |
| 101 |
95 /** | 102 /** |
96 * Returns the button strip element. | 103 * Returns the button strip element. |
97 * @return {HTMLDivElement} The container div of action buttons. | 104 * @return {HTMLDivElement} The container div of action buttons. |
98 */ | 105 */ |
99 get buttonStrip() { | 106 get buttonStrip() { |
100 return this.pageDiv.querySelector('.button-strip'); | 107 return this.pageDiv.querySelector('.button-strip'); |
101 }, | 108 }, |
102 | 109 |
103 /** | 110 /** |
104 * Set visibility of action buttons in button strip. | 111 * Set visibility of action buttons in button strip. |
(...skipping 63 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
168 this.setSpinnerVisible_(false); | 175 this.setSpinnerVisible_(false); |
169 $('easy-unlock-turn-off-confirm').disabled = false; | 176 $('easy-unlock-turn-off-confirm').disabled = false; |
170 $('easy-unlock-turn-off-dismiss').hidden = true; | 177 $('easy-unlock-turn-off-dismiss').hidden = true; |
171 }, | 178 }, |
172 }; | 179 }; |
173 | 180 |
174 /** | 181 /** |
175 * Closes the Easy unlock turn off overlay. | 182 * Closes the Easy unlock turn off overlay. |
176 */ | 183 */ |
177 EasyUnlockTurnOffOverlay.dismiss = function() { | 184 EasyUnlockTurnOffOverlay.dismiss = function() { |
178 PageManager.closeOverlay(); | 185 // TODO(xiyuan): Remove the workaround and call closeOverly directly. |
| 186 // See http://crbug.com/405250 |
| 187 $('easy-unlock-turn-off-spinner').hidden = true; |
| 188 window.setTimeout(function() { |
| 189 PageManager.closeOverlay(); |
| 190 }, 100); |
179 }; | 191 }; |
180 | 192 |
181 /** | 193 /** |
182 * Update UI to reflect the turn off operation status. | 194 * Update UI to reflect the turn off operation status. |
183 * @param {string} newState The UIState string representing the new state. | 195 * @param {string} newState The UIState string representing the new state. |
184 */ | 196 */ |
185 EasyUnlockTurnOffOverlay.updateUIState = function(newState) { | 197 EasyUnlockTurnOffOverlay.updateUIState = function(newState) { |
186 EasyUnlockTurnOffOverlay.getInstance().uiState = newState; | 198 EasyUnlockTurnOffOverlay.getInstance().uiState = newState; |
187 }; | 199 }; |
188 | 200 |
189 // Export | 201 // Export |
190 return { | 202 return { |
191 EasyUnlockTurnOffOverlay: EasyUnlockTurnOffOverlay | 203 EasyUnlockTurnOffOverlay: EasyUnlockTurnOffOverlay |
192 }; | 204 }; |
193 }); | 205 }); |
OLD | NEW |