OLD | NEW |
1 // Copyright 2013 The Chromium Authors. All rights reserved. | 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 | 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('extensions', function() { | 5 cr.define('extensions', function() { |
6 /** | 6 /** |
7 * Encapsulated handling of ChromeOS kiosk apps options page. | 7 * Encapsulated handling of ChromeOS kiosk apps options page. |
8 * @constructor | 8 * @constructor |
9 */ | 9 */ |
10 function KioskAppsOverlay() { | 10 function KioskAppsOverlay() {} |
11 } | |
12 | 11 |
13 cr.addSingletonGetter(KioskAppsOverlay); | 12 cr.addSingletonGetter(KioskAppsOverlay); |
14 | 13 |
15 KioskAppsOverlay.prototype = { | 14 KioskAppsOverlay.prototype = { |
16 /** | 15 /** |
17 * Clear error timer id. | 16 * Clear error timer id. |
18 * @type {?number} | 17 * @type {?number} |
19 */ | 18 */ |
20 clearErrorTimer_: null, | 19 clearErrorTimer_: null, |
21 | 20 |
22 /** | 21 /** |
23 * Initialize the page. | 22 * Initialize the page. |
24 */ | 23 */ |
25 initialize: function() { | 24 initialize: function() { |
26 chrome.send('initializeKioskAppSettings'); | 25 chrome.send('initializeKioskAppSettings'); |
27 extensions.KioskAppList.decorate($('kiosk-app-list')); | 26 extensions.KioskAppList.decorate($('kiosk-app-list')); |
28 | 27 |
29 var overlay = $('kiosk-apps-page'); | 28 var overlay = $('kiosk-apps-page'); |
30 cr.ui.overlay.setupOverlay(overlay); | 29 cr.ui.overlay.setupOverlay(overlay); |
31 cr.ui.overlay.globalInitialization(); | 30 cr.ui.overlay.globalInitialization(); |
32 overlay.addEventListener('cancelOverlay', this.handleDismiss_.bind(this)); | 31 overlay.addEventListener('cancelOverlay', this.handleDismiss_.bind(this)); |
33 | 32 |
34 $('kiosk-options-overlay-confirm').onclick = | 33 $('kiosk-options-overlay-confirm').onclick = |
35 this.handleDismiss_.bind(this); | 34 this.handleDismiss_.bind(this); |
36 $('kiosk-app-id-edit').addEventListener('keypress', | 35 $('kiosk-app-id-edit') |
37 this.handleAppIdInputKeyPressed_.bind(this)); | 36 .addEventListener( |
| 37 'keypress', this.handleAppIdInputKeyPressed_.bind(this)); |
38 $('kiosk-app-add').onclick = this.handleAddButtonClick_.bind(this); | 38 $('kiosk-app-add').onclick = this.handleAddButtonClick_.bind(this); |
39 }, | 39 }, |
40 | 40 |
41 /* | 41 /* |
42 * Invoked when the page is shown. | 42 * Invoked when the page is shown. |
43 */ | 43 */ |
44 didShowPage: function() { | 44 didShowPage: function() { |
45 chrome.send('getKioskAppSettings'); | 45 chrome.send('getKioskAppSettings'); |
46 $('kiosk-app-id-edit').focus(); | 46 $('kiosk-app-id-edit').focus(); |
47 }, | 47 }, |
(...skipping 83 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
131 * @param {!{kioskEnabled: boolean, autoLaunchEnabled: boolean}} params | 131 * @param {!{kioskEnabled: boolean, autoLaunchEnabled: boolean}} params |
132 */ | 132 */ |
133 KioskAppsOverlay.enableKiosk = function(params) { | 133 KioskAppsOverlay.enableKiosk = function(params) { |
134 $('add-kiosk-app').hidden = !params.kioskEnabled; | 134 $('add-kiosk-app').hidden = !params.kioskEnabled; |
135 $('kiosk-disable-bailout-shortcut').parentNode.hidden = | 135 $('kiosk-disable-bailout-shortcut').parentNode.hidden = |
136 !params.autoLaunchEnabled; | 136 !params.autoLaunchEnabled; |
137 $('kiosk-app-list').setAutoLaunchEnabled(params.autoLaunchEnabled); | 137 $('kiosk-app-list').setAutoLaunchEnabled(params.autoLaunchEnabled); |
138 }; | 138 }; |
139 | 139 |
140 // Export | 140 // Export |
141 return { | 141 return {KioskAppsOverlay: KioskAppsOverlay}; |
142 KioskAppsOverlay: KioskAppsOverlay | |
143 }; | |
144 }); | 142 }); |
145 | 143 |
146 // <include src="kiosk_app_list.js"> | 144 // <include src="kiosk_app_list.js"> |
147 // <include src="kiosk_app_disable_bailout_confirm.js"> | 145 // <include src="kiosk_app_disable_bailout_confirm.js"> |
OLD | NEW |