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.
5 cr.define('extensions', function() {
7 * A confirmation overlay for disabling kiosk app bailout shortcut.
10 function KioskDisableBailoutConfirm() {
13 cr.addSingletonGetter(KioskDisableBailoutConfirm);
15 KioskDisableBailoutConfirm.prototype = {
17 * Initialize the page.
19 initialize: function() {
20 var overlay = $('kiosk-disable-bailout-confirm-overlay');
21 cr.ui.overlay.setupOverlay(overlay);
22 cr.ui.overlay.globalInitialization();
23 overlay.addEventListener('cancelOverlay', this.handleCancel);
25 var el = $('kiosk-disable-bailout-shortcut');
26 el.addEventListener('change', this.handleDisableBailoutShortcutChange_);
28 $('kiosk-disable-bailout-confirm-button').onclick = function(e) {
29 extensions.ExtensionSettings.showOverlay($('kiosk-apps-page'));
30 chrome.send('setDisableBailoutShortcut', [true]);
32 $('kiosk-disable-bailout-cancel-button').onclick = this.handleCancel;
35 /** Handles overlay being canceled. */
36 handleCancel: function() {
37 extensions.ExtensionSettings.showOverlay($('kiosk-apps-page'));
38 $('kiosk-disable-bailout-shortcut').checked = false;
42 * Custom change handler for the disable bailout shortcut checkbox.
43 * It blocks the underlying pref being changed and brings up confirmation
47 handleDisableBailoutShortcutChange_: function() {
48 // Just set the pref if user un-checks the box.
49 if (!$('kiosk-disable-bailout-shortcut').checked) {
50 chrome.send('setDisableBailoutShortcut', [false]);
54 // Otherwise, show the confirmation overlay.
55 extensions.ExtensionSettings.showOverlay($(
56 'kiosk-disable-bailout-confirm-overlay'));
63 KioskDisableBailoutConfirm: KioskDisableBailoutConfirm