1 // Copyright 2013 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file.
6 * @fileoverview Oobe reset screen implementation.
9 login.createScreen('KioskEnableScreen', 'kiosk-enable', function() {
11 EXTERNAL_API: ['enableKioskForTesting',
14 * Header text of the screen.
18 return loadTimeData.getString('kioskEnableTitle');
22 * Buttons in oobe wizard's button strip.
23 * @type {array} Array of Buttons.
28 var confirmButton = this.ownerDocument.createElement('button');
29 confirmButton.id = 'kiosk-enable-button';
30 confirmButton.textContent =
31 loadTimeData.getString('kioskEnableButton');
32 confirmButton.addEventListener('click', function(e) {
33 chrome.send('kioskOnEnable');
36 buttons.push(confirmButton);
38 var cancelButton = this.ownerDocument.createElement('button');
39 cancelButton.id = 'kiosk-cancel-button';
40 cancelButton.textContent =
41 loadTimeData.getString('kioskCancelButton');
42 cancelButton.addEventListener('click', function(e) {
43 chrome.send('kioskOnClose');
46 buttons.push(cancelButton);
48 var okButton = this.ownerDocument.createElement('button');
49 okButton.id = 'kiosk-ok-button';
50 okButton.hidden = true;
51 okButton.textContent =
52 loadTimeData.getString('kioskOKButton');
53 okButton.addEventListener('click', function(e) {
54 chrome.send('kioskOnClose');
57 buttons.push(okButton);
62 * Event handler invoked when the page is shown and ready.
64 onBeforeShow: function() {
65 $('kiosk-enable-button').hidden = false;
66 $('kiosk-cancel-button').hidden = false;
67 $('kiosk-ok-button').hidden = true;
68 $('kiosk-enable-details').textContent =
69 loadTimeData.getString('kioskEnableWarningDetails');
73 * Returns a control which should receive an initial focus.
75 get defaultControl() {
76 return $('kiosk-cancel-button');
80 * Cancels the reset and drops the user back to the login screen.
83 chrome.send('kioskOnClose');
87 * Initiates enable/cancel response for testing.
88 * @param {boolean} confirm True if the screen should confirm auto-launch.
90 enableKioskForTesting: function(confirm) {
91 var button = confirm ? $('kiosk-enable-button') :
92 $('kiosk-cancel-button');
93 var clickEvent = cr.doc.createEvent('Event');
94 clickEvent.initEvent('click', true, true);
95 button.dispatchEvent(clickEvent);
99 * Updates completion message on the screen.
100 * @param {boolean} success True if consumer kiosk was successfully enabled.
102 onCompleted: function(success) {
103 $('kiosk-enable-button').hidden = true;
104 $('kiosk-cancel-button').hidden = true;
105 $('kiosk-ok-button').hidden = false;
106 $('kiosk-enable-details').textContent =
107 loadTimeData.getString(success ? 'kioskEnableSuccessMsg' :
108 'kioskEnableErrorMsg');