| OLD | NEW |
| (Empty) |
| 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. | |
| 4 | |
| 5 cr.define('options', function() { | |
| 6 /** @const */ var OptionsPage = options.OptionsPage; | |
| 7 | |
| 8 /** | |
| 9 * A confirmation overlay for disabling kiosk app bailout shortcut. | |
| 10 * @extends {options.OptionsPage} | |
| 11 * @constructor | |
| 12 */ | |
| 13 function KioskDisableBailoutConfirm() { | |
| 14 OptionsPage.call(this, | |
| 15 'kioskDisableBailoutConfirm', | |
| 16 '', | |
| 17 'kiosk-disable-bailout-confirm-overlay'); | |
| 18 } | |
| 19 | |
| 20 cr.addSingletonGetter(KioskDisableBailoutConfirm); | |
| 21 | |
| 22 KioskDisableBailoutConfirm.prototype = { | |
| 23 __proto__: OptionsPage.prototype, | |
| 24 | |
| 25 /** @override */ | |
| 26 initializePage: function() { | |
| 27 OptionsPage.prototype.initializePage.call(this); | |
| 28 | |
| 29 var el = $('kiosk-disable-bailout-shortcut'); | |
| 30 el.customChangeHandler = this.handleDisableBailoutShortcutChange_; | |
| 31 | |
| 32 $('kiosk-disable-bailout-confirm-button').onclick = function(e) { | |
| 33 OptionsPage.closeOverlay(); | |
| 34 Preferences.setBooleanPref( | |
| 35 'cros.accounts.deviceLocalAccountAutoLoginBailoutEnabled', | |
| 36 false, true); | |
| 37 }; | |
| 38 $('kiosk-disable-bailout-cancel-button').onclick = this.handleCancel; | |
| 39 }, | |
| 40 | |
| 41 /** @override */ | |
| 42 handleCancel: function() { | |
| 43 OptionsPage.closeOverlay(); | |
| 44 $('kiosk-disable-bailout-shortcut').checked = false; | |
| 45 }, | |
| 46 | |
| 47 /** | |
| 48 * Custom change handler for the disable bailout shortcut checkbox. | |
| 49 * It blocks the underlying pref being changed and brings up confirmation | |
| 50 * alert to user. | |
| 51 * @private | |
| 52 */ | |
| 53 handleDisableBailoutShortcutChange_: function() { | |
| 54 // Let default processing happening if user un-checks the box. | |
| 55 if (!$('kiosk-disable-bailout-shortcut').checked) | |
| 56 return false; | |
| 57 | |
| 58 // Otherwise, show the confirmation overlay. | |
| 59 OptionsPage.showPageByName('kioskDisableBailoutConfirm', false); | |
| 60 return true; | |
| 61 } | |
| 62 }; | |
| 63 | |
| 64 // Export | |
| 65 return { | |
| 66 KioskDisableBailoutConfirm: KioskDisableBailoutConfirm | |
| 67 }; | |
| 68 }); | |
| 69 | |
| OLD | NEW |