| 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 * A confirmation overlay for disabling kiosk app bailout shortcut. | 7 * A confirmation overlay for disabling kiosk app bailout shortcut. |
| 8 * @constructor | 8 * @constructor |
| 9 */ | 9 */ |
| 10 function KioskDisableBailoutConfirm() { | 10 function KioskDisableBailoutConfirm() { |
| 11 } | 11 } |
| 12 | 12 |
| 13 cr.addSingletonGetter(KioskDisableBailoutConfirm); | 13 cr.addSingletonGetter(KioskDisableBailoutConfirm); |
| 14 | 14 |
| 15 KioskDisableBailoutConfirm.prototype = { | 15 KioskDisableBailoutConfirm.prototype = { |
| 16 /** | 16 /** |
| 17 * Initialize the page. | 17 * Initialize the page. |
| 18 */ | 18 */ |
| 19 initialize: function() { | 19 initialize: function() { |
| 20 var overlay = $('kiosk-disable-bailout-confirm-overlay'); | 20 var overlay = $('kiosk-disable-bailout-confirm-overlay'); |
| 21 cr.ui.overlay.setupOverlay(overlay); | 21 cr.ui.overlay.setupOverlay(overlay); |
| 22 cr.ui.overlay.globalInitialization(); | 22 cr.ui.overlay.globalInitialization(); |
| 23 overlay.addEventListener('cancelOverlay', this.handleCancel); | 23 overlay.addEventListener('cancelOverlay', this.handleCancel); |
| 24 | 24 |
| 25 var el = $('kiosk-disable-bailout-shortcut'); | 25 var el = $('kiosk-disable-bailout-shortcut'); |
| 26 el.addEventListener('change', this.handleDisableBailoutShortcutChange_); | 26 el.addEventListener('change', this.handleDisableBailoutShortcutChange_); |
| 27 | 27 |
| 28 $('kiosk-disable-bailout-confirm-button').onclick = function(e) { | 28 $('kiosk-disable-bailout-confirm-button').onclick = function(e) { |
| 29 ExtensionSettings.showOverlay($('kiosk-apps-page')); | 29 extensions.ExtensionSettings.showOverlay($('kiosk-apps-page')); |
| 30 chrome.send('setDisableBailoutShortcut', [true]); | 30 chrome.send('setDisableBailoutShortcut', [true]); |
| 31 }; | 31 }; |
| 32 $('kiosk-disable-bailout-cancel-button').onclick = this.handleCancel; | 32 $('kiosk-disable-bailout-cancel-button').onclick = this.handleCancel; |
| 33 }, | 33 }, |
| 34 | 34 |
| 35 /** Handles overlay being canceled. */ | 35 /** Handles overlay being canceled. */ |
| 36 handleCancel: function() { | 36 handleCancel: function() { |
| 37 ExtensionSettings.showOverlay($('kiosk-apps-page')); | 37 extensions.ExtensionSettings.showOverlay($('kiosk-apps-page')); |
| 38 $('kiosk-disable-bailout-shortcut').checked = false; | 38 $('kiosk-disable-bailout-shortcut').checked = false; |
| 39 }, | 39 }, |
| 40 | 40 |
| 41 /** | 41 /** |
| 42 * Custom change handler for the disable bailout shortcut checkbox. | 42 * Custom change handler for the disable bailout shortcut checkbox. |
| 43 * It blocks the underlying pref being changed and brings up confirmation | 43 * It blocks the underlying pref being changed and brings up confirmation |
| 44 * alert to user. | 44 * alert to user. |
| 45 * @private | 45 * @private |
| 46 */ | 46 */ |
| 47 handleDisableBailoutShortcutChange_: function() { | 47 handleDisableBailoutShortcutChange_: function() { |
| 48 // Just set the pref if user un-checks the box. | 48 // Just set the pref if user un-checks the box. |
| 49 if (!$('kiosk-disable-bailout-shortcut').checked) { | 49 if (!$('kiosk-disable-bailout-shortcut').checked) { |
| 50 chrome.send('setDisableBailoutShortcut', [false]); | 50 chrome.send('setDisableBailoutShortcut', [false]); |
| 51 return false; | 51 return false; |
| 52 } | 52 } |
| 53 | 53 |
| 54 // Otherwise, show the confirmation overlay. | 54 // Otherwise, show the confirmation overlay. |
| 55 ExtensionSettings.showOverlay($('kiosk-disable-bailout-confirm-overlay')); | 55 extensions.ExtensionSettings.showOverlay($( |
| 56 'kiosk-disable-bailout-confirm-overlay')); |
| 56 return true; | 57 return true; |
| 57 } | 58 } |
| 58 }; | 59 }; |
| 59 | 60 |
| 60 // Export | 61 // Export |
| 61 return { | 62 return { |
| 62 KioskDisableBailoutConfirm: KioskDisableBailoutConfirm | 63 KioskDisableBailoutConfirm: KioskDisableBailoutConfirm |
| 63 }; | 64 }; |
| 64 }); | 65 }); |
| 65 | 66 |
| OLD | NEW |