| 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'; |
| 7 /** | 8 /** |
| 8 * ResetScreenConfirmationOverlay class | 9 * ResetScreenConfirmationOverlay class |
| 9 * Encapsulated handling of the 'Confirm reset device' overlay OOBE page. | 10 * Encapsulated handling of the 'Confirm reset device' overlay OOBE page. |
| 10 * @class | 11 * @class |
| 11 */ | 12 */ |
| 12 function ConfirmResetOverlay() { | 13 function ConfirmResetOverlay() { |
| 13 } | 14 } |
| 14 | 15 |
| 15 cr.addSingletonGetter(ConfirmResetOverlay); | 16 cr.addSingletonGetter(ConfirmResetOverlay); |
| 16 | 17 |
| 17 ConfirmResetOverlay.prototype = { | 18 ConfirmResetOverlay.prototype = { |
| 18 /** | 19 /** |
| 19 * Initialize the page. | 20 * Initialize the page. |
| 20 */ | 21 */ |
| 21 initializePage: function() { | 22 initializePage: function() { |
| 22 var overlay = $('reset-confirm-overlay'); | 23 var overlay = $('reset-confirm-overlay'); |
| 23 overlay.addEventListener('cancelOverlay', this.handleDismiss_.bind(this)); | 24 overlay.addEventListener('cancelOverlay', function(e) { |
| 24 | 25 $('reset').send(login.Screen.CALLBACK_USER_ACTED, |
| 25 $('reset-confirm-dismiss').addEventListener('click', this.handleDismiss_); | 26 USER_ACTION_RESET_CONFIRM_DISMISSED); |
| 26 $('reset-confirm-commit').addEventListener('click', this.handleCommit_); | 27 e.stopPropagation(); |
| 27 | 28 }); |
| 28 $('overlay-reset').removeAttribute('hidden'); | 29 $('overlay-reset').removeAttribute('hidden'); |
| 29 }, | 30 }, |
| 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 }, | |
| 51 }; | 31 }; |
| 52 | 32 |
| 53 // Export | 33 // Export |
| 54 return { | 34 return { |
| 55 ConfirmResetOverlay: ConfirmResetOverlay | 35 ConfirmResetOverlay: ConfirmResetOverlay |
| 56 }; | 36 }; |
| 57 }); | 37 }); |
| OLD | NEW |