1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
|
// Copyright 2013 The Chromium Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
/**
* @fileoverview Oobe reset screen implementation.
*/
login.createScreen('KioskEnableScreen', 'kiosk-enable', function() {
return {
EXTERNAL_API: ['enableKioskForTesting',
'onCompleted'],
/**
* Header text of the screen.
* @type {string}
*/
get header() {
return loadTimeData.getString('kioskEnableTitle');
},
/**
* Buttons in oobe wizard's button strip.
* @type {array} Array of Buttons.
*/
get buttons() {
var buttons = [];
var confirmButton = this.ownerDocument.createElement('button');
confirmButton.id = 'kiosk-enable-button';
confirmButton.textContent =
loadTimeData.getString('kioskEnableButton');
confirmButton.addEventListener('click', function(e) {
chrome.send('kioskOnEnable');
e.stopPropagation();
});
buttons.push(confirmButton);
var cancelButton = this.ownerDocument.createElement('button');
cancelButton.id = 'kiosk-cancel-button';
cancelButton.textContent =
loadTimeData.getString('kioskCancelButton');
cancelButton.addEventListener('click', function(e) {
chrome.send('kioskOnClose');
e.stopPropagation();
});
buttons.push(cancelButton);
var okButton = this.ownerDocument.createElement('button');
okButton.id = 'kiosk-ok-button';
okButton.hidden = true;
okButton.textContent =
loadTimeData.getString('kioskOKButton');
okButton.addEventListener('click', function(e) {
chrome.send('kioskOnClose');
e.stopPropagation();
});
buttons.push(okButton);
return buttons;
},
/**
* Event handler invoked when the page is shown and ready.
*/
onBeforeShow: function() {
$('kiosk-enable-button').hidden = false;
$('kiosk-cancel-button').hidden = false;
$('kiosk-ok-button').hidden = true;
$('kiosk-enable-details').textContent =
loadTimeData.getString('kioskEnableWarningDetails');
},
/**
* Returns a control which should receive an initial focus.
*/
get defaultControl() {
return $('kiosk-cancel-button');
},
/**
* Cancels the reset and drops the user back to the login screen.
*/
cancel: function() {
chrome.send('kioskOnClose');
},
/**
* Initiates enable/cancel response for testing.
* @param {boolean} confirm True if the screen should confirm auto-launch.
*/
enableKioskForTesting: function(confirm) {
var button = confirm ? $('kiosk-enable-button') :
$('kiosk-cancel-button');
var clickEvent = cr.doc.createEvent('Event');
clickEvent.initEvent('click', true, true);
button.dispatchEvent(clickEvent);
},
/**
* Updates completion message on the screen.
* @param {boolean} success True if consumer kiosk was successfully enabled.
*/
onCompleted: function(success) {
$('kiosk-enable-button').hidden = true;
$('kiosk-cancel-button').hidden = true;
$('kiosk-ok-button').hidden = false;
$('kiosk-enable-details').textContent =
loadTimeData.getString(success ? 'kioskEnableSuccessMsg' :
'kioskEnableErrorMsg');
}
};
});
|