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