Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(209)

Side by Side Diff: chrome/browser/resources/chromeos/login/oobe_screen_reset_confirmation_overlay.js

Issue 904163003: Reset Screen moved to ScreenContext. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: User actions introduced. Created 5 years, 10 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
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_POWERWASH_PRESSED = 'powerwash-pressed';
8 var CONTEXT_KEY_IS_CONFIRMATIONAL_VIEW = 'is-confirmational-view';
7 /** 9 /**
8 * ResetScreenConfirmationOverlay class 10 * ResetScreenConfirmationOverlay class
9 * Encapsulated handling of the 'Confirm reset device' overlay OOBE page. 11 * Encapsulated handling of the 'Confirm reset device' overlay OOBE page.
10 * @class 12 * @class
11 */ 13 */
12 function ConfirmResetOverlay() { 14 function ConfirmResetOverlay() {
13 } 15 }
14 16
15 cr.addSingletonGetter(ConfirmResetOverlay); 17 cr.addSingletonGetter(ConfirmResetOverlay);
16 18
17 ConfirmResetOverlay.prototype = { 19 ConfirmResetOverlay.prototype = {
18 /** 20 /**
19 * Initialize the page. 21 * Initialize the page.
20 */ 22 */
21 initializePage: function() { 23 initializePage: function() {
22 var overlay = $('reset-confirm-overlay'); 24 var overlay = $('reset-confirm-overlay');
23 overlay.addEventListener('cancelOverlay', this.handleDismiss_.bind(this)); 25 overlay.addEventListener('cancelOverlay', this.handleDismiss_.bind(this));
24 26
25 $('reset-confirm-dismiss').addEventListener('click', this.handleDismiss_); 27 $('reset-confirm-dismiss').addEventListener('click', this.handleDismiss_);
26 $('reset-confirm-commit').addEventListener('click', this.handleCommit_); 28 $('reset-confirm-commit').addEventListener('click', this.handleCommit_);
27 29
28 $('overlay-reset').removeAttribute('hidden'); 30 $('overlay-reset').removeAttribute('hidden');
29 }, 31 },
30 32
31 /** 33 /**
32 * Handles a click on the dismiss button. 34 * Handles a click on the dismiss button.
33 * @param {Event} e The click event. 35 * @param {Event} e The click event.
34 */ 36 */
35 handleDismiss_: function(e) { 37 handleDismiss_: function(e) {
36 $('reset').isConfirmational = false; 38 $('reset').context.set(CONTEXT_KEY_IS_CONFIRMATIONAL_VIEW, false);
39 $('reset').commitContextChanges();
37 $('overlay-reset').setAttribute('hidden', true); 40 $('overlay-reset').setAttribute('hidden', true);
38 e.stopPropagation(); 41 e.stopPropagation();
39 }, 42 },
40 43
41 /** 44 /**
42 * Handles a click on the commit button. 45 * Handles a click on the commit button.
43 * @param {Event} e The click event. 46 * @param {Event} e The click event.
44 */ 47 */
45 handleCommit_: function(e) { 48 handleCommit_: function(e) {
46 $('reset').isConfirmational = false; 49 $('reset').context.set(CONTEXT_KEY_IS_CONFIRMATIONAL_VIEW, false);
47 chrome.send('powerwashOnReset', [$('reset').rollbackChecked]); 50 $('reset').commitContextChanges();
51 $('reset').send(login.Screen.CALLBACK_USER_ACTED,
52 USER_ACTION_POWERWASH_PRESSED);
48 $('overlay-reset').setAttribute('hidden', true); 53 $('overlay-reset').setAttribute('hidden', true);
49 e.stopPropagation(); 54 e.stopPropagation();
50 }, 55 },
51 }; 56 };
52 57
53 // Export 58 // Export
54 return { 59 return {
55 ConfirmResetOverlay: ConfirmResetOverlay 60 ConfirmResetOverlay: ConfirmResetOverlay
56 }; 61 };
57 }); 62 });
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698