OLD | NEW |
(Empty) | |
| 1 // Copyright 2016 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 /** |
| 6 * @fileoverview |
| 7 * 'android-apps-page' is the settings page for enabling android apps. |
| 8 */ |
| 9 |
| 10 Polymer({ |
| 11 is: 'settings-android-apps-page', |
| 12 |
| 13 behaviors: [I18nBehavior, PrefsBehavior], |
| 14 |
| 15 properties: { |
| 16 /** Preferences state. */ |
| 17 prefs: Object, |
| 18 |
| 19 /** @private {!AndroidAppsInfo|undefined} */ |
| 20 androidAppsInfo_: Object, |
| 21 }, |
| 22 |
| 23 /** @private {?settings.AndroidAppsBrowserProxy} */ |
| 24 browserProxy_: null, |
| 25 |
| 26 /** @override */ |
| 27 created: function() { |
| 28 this.browserProxy_ = settings.AndroidAppsBrowserProxyImpl.getInstance(); |
| 29 }, |
| 30 |
| 31 /** @override */ |
| 32 ready: function() { |
| 33 cr.addWebUIListener( |
| 34 'android-apps-info-update', this.androidAppsInfoUpdate_.bind(this)); |
| 35 this.browserProxy_.requestAndroidAppsInfo(); |
| 36 }, |
| 37 |
| 38 /** |
| 39 * @param {AndroidAppsInfo} info |
| 40 * @private |
| 41 */ |
| 42 androidAppsInfoUpdate_: function(info) { |
| 43 this.androidAppsInfo_ = info; |
| 44 }, |
| 45 |
| 46 /** |
| 47 * @param {Event} event |
| 48 * @private |
| 49 */ |
| 50 onManageAndroidAppsKeydown_: function(event) { |
| 51 if (event.key != 'Enter' && event.key != ' ') |
| 52 return; |
| 53 this.browserProxy_.showAndroidAppsSettings(true /** keyboardAction */); |
| 54 event.stopPropagation(); |
| 55 }, |
| 56 |
| 57 /** @private */ |
| 58 onManageAndroidAppsTap_: function(event) { |
| 59 this.browserProxy_.showAndroidAppsSettings(false /** keyboardAction */); |
| 60 }, |
| 61 |
| 62 /** |
| 63 * @return {string} |
| 64 * @private |
| 65 */ |
| 66 getDialogBody_: function() { |
| 67 return this.i18nAdvanced( |
| 68 'androidAppsDisableDialogMessage', {substitutions: [], tags: ['br']}); |
| 69 }, |
| 70 |
| 71 /** |
| 72 * Handles the change event for the arc.enabled checkbox. Shows a |
| 73 * confirmation dialog when disabling the preference. |
| 74 * @param {Event} event |
| 75 * @private |
| 76 */ |
| 77 onArcEnabledChange_: function(event) { |
| 78 if (event.target.checked) { |
| 79 /** @type {!SettingsCheckboxElement} */ (event.target).sendPrefChange(); |
| 80 return; |
| 81 } |
| 82 this.$.confirmDisableDialog.showModal(); |
| 83 }, |
| 84 |
| 85 /** |
| 86 * Handles the shared proxy confirmation dialog 'Confirm' button. |
| 87 * @private |
| 88 */ |
| 89 onConfirmDisableDialogConfirm_: function() { |
| 90 /** @type {!SettingsCheckboxElement} */ (this.$.enabledCheckbox) |
| 91 .sendPrefChange(); |
| 92 this.$.confirmDisableDialog.close(); |
| 93 }, |
| 94 |
| 95 /** |
| 96 * Handles the shared proxy confirmation dialog 'Cancel' button or a cancel |
| 97 * event. |
| 98 * @private |
| 99 */ |
| 100 onConfirmDisableDialogCancel_: function() { |
| 101 /** @type {!SettingsCheckboxElement} */ (this.$.enabledCheckbox) |
| 102 .resetToPrefValue(); |
| 103 this.$.confirmDisableDialog.close(); |
| 104 }, |
| 105 }); |
OLD | NEW |