| 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('reset', function() { | 5 cr.define('reset', function() { |
| 6 | 6 |
| 7 var USER_ACTION_RESET_CONFIRM_DISMISSED = 'reset-confirm-dismissed'; | |
| 8 /** | 7 /** |
| 9 * ResetScreenConfirmationOverlay class | 8 * ResetScreenConfirmationOverlay class |
| 10 * Encapsulated handling of the 'Confirm reset device' overlay OOBE page. | 9 * Encapsulated handling of the 'Confirm reset device' overlay OOBE page. |
| 11 * @class | 10 * @class |
| 12 */ | 11 */ |
| 13 function ConfirmResetOverlay() { | 12 function ConfirmResetOverlay() { |
| 14 } | 13 } |
| 15 | 14 |
| 16 cr.addSingletonGetter(ConfirmResetOverlay); | 15 cr.addSingletonGetter(ConfirmResetOverlay); |
| 17 | 16 |
| 18 ConfirmResetOverlay.prototype = { | 17 ConfirmResetOverlay.prototype = { |
| 19 /** | 18 /** |
| 20 * Initialize the page. | 19 * Initialize the page. |
| 21 */ | 20 */ |
| 22 initializePage: function() { | 21 initializePage: function() { |
| 23 var overlay = $('reset-confirm-overlay'); | 22 var overlay = $('reset-confirm-overlay'); |
| 24 overlay.addEventListener('cancelOverlay', function(e) { | 23 overlay.addEventListener('cancelOverlay', this.handleDismiss_.bind(this)); |
| 25 $('reset').send(login.Screen.CALLBACK_USER_ACTED, | 24 |
| 26 USER_ACTION_RESET_CONFIRM_DISMISSED); | 25 $('reset-confirm-dismiss').addEventListener('click', this.handleDismiss_); |
| 27 e.stopPropagation(); | 26 $('reset-confirm-commit').addEventListener('click', this.handleCommit_); |
| 28 }); | 27 |
| 29 $('overlay-reset').removeAttribute('hidden'); | 28 $('overlay-reset').removeAttribute('hidden'); |
| 30 }, | 29 }, |
| 30 |
| 31 /** |
| 32 * Handles a click on the dismiss button. |
| 33 * @param {Event} e The click event. |
| 34 */ |
| 35 handleDismiss_: function(e) { |
| 36 $('reset').isConfirmational = false; |
| 37 $('overlay-reset').setAttribute('hidden', true); |
| 38 e.stopPropagation(); |
| 39 }, |
| 40 |
| 41 /** |
| 42 * Handles a click on the commit button. |
| 43 * @param {Event} e The click event. |
| 44 */ |
| 45 handleCommit_: function(e) { |
| 46 $('reset').isConfirmational = false; |
| 47 chrome.send('powerwashOnReset', [$('reset').rollbackChecked]); |
| 48 $('overlay-reset').setAttribute('hidden', true); |
| 49 e.stopPropagation(); |
| 50 }, |
| 31 }; | 51 }; |
| 32 | 52 |
| 33 // Export | 53 // Export |
| 34 return { | 54 return { |
| 35 ConfirmResetOverlay: ConfirmResetOverlay | 55 ConfirmResetOverlay: ConfirmResetOverlay |
| 36 }; | 56 }; |
| 37 }); | 57 }); |
| OLD | NEW |