Chromium Code Reviews| 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 * 'androuid-apps-page' is the settings page for enabling android apps. | |
|
michaelpg
2016/12/01 20:15:34
android
stevenjb
2016/12/02 00:39:19
Done.
| |
| 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_.getAndroidAppsInfo().then(function(info) { | |
| 36 this.androidAppsInfoUpdate_(info); | |
| 37 }.bind(this)); | |
| 38 }, | |
| 39 | |
| 40 /** | |
| 41 * @param {AndroidAppsInfo} info | |
| 42 * @private | |
| 43 */ | |
| 44 androidAppsInfoUpdate_: function(info) { | |
| 45 this.androidAppsInfo_ = info; | |
| 46 }, | |
| 47 | |
| 48 /** @private */ | |
| 49 onManageAndroidAppsTap_: function() { | |
| 50 this.browserProxy_.showAndroidAppsSettings(); | |
| 51 }, | |
| 52 | |
| 53 getDialogBody_: function() { | |
|
michaelpg
2016/12/01 20:15:34
/** @return {string} */
and @private
stevenjb
2016/12/02 00:39:19
Done.
| |
| 54 return this.i18nAdvanced( | |
| 55 'androidAppsDisableDialogMessage', {substitutions: [], tags: ['br']}); | |
| 56 }, | |
| 57 | |
| 58 /** | |
| 59 * Handles the change event for the arc.enabled checkbox. Shows a | |
| 60 * confirmation dialog when disabling the preference. | |
| 61 * @param {Event} event | |
| 62 * @private | |
| 63 */ | |
| 64 onArcEnabledChange_: function(event) { | |
| 65 if (event.target.checked) { | |
| 66 /** @type {!SettingsCheckboxElement} */ (event.target).sendPrefChange(); | |
| 67 return; | |
| 68 } | |
| 69 this.$.confirmDisableDialog.showModal(); | |
| 70 }, | |
| 71 | |
| 72 /** | |
| 73 * Handles the shared proxy confirmation dialog 'Confirm' button. | |
| 74 * @private | |
| 75 */ | |
| 76 onConfirmDisableDialogConfirm_: function() { | |
| 77 /** @type {!SettingsCheckboxElement} */ (this.$.enabledCheckbox) | |
| 78 .sendPrefChange(); | |
| 79 this.$.confirmDisableDialog.close(); | |
| 80 }, | |
| 81 | |
| 82 /** | |
| 83 * Handles the shared proxy confirmation dialog 'Cancel' button or a cancel | |
| 84 * event. | |
| 85 * @private | |
| 86 */ | |
| 87 onConfirmDisableDialogCancel_: function() { | |
| 88 /** @type {!SettingsCheckboxElement} */ (this.$.enabledCheckbox) | |
| 89 .resetToPrefValue(); | |
| 90 this.$.confirmDisableDialog.close(); | |
| 91 }, | |
| 92 | |
| 93 /** | |
| 94 * @param {Event} event | |
| 95 * @private | |
| 96 */ | |
| 97 doNothing_: function(event) { | |
|
michaelpg
2016/12/01 20:15:34
unused?
stevenjb
2016/12/02 00:39:19
Done.
| |
| 98 event.stopPropagation(); | |
| 99 }, | |
| 100 }); | |
| OLD | NEW |