Chromium Code Reviews| Index: chrome/browser/resources/settings/android_apps_page/android_apps_page.js |
| diff --git a/chrome/browser/resources/settings/android_apps_page/android_apps_page.js b/chrome/browser/resources/settings/android_apps_page/android_apps_page.js |
| new file mode 100644 |
| index 0000000000000000000000000000000000000000..b7cc6c16635b1bf55fc6193ce70417669f33c6d3 |
| --- /dev/null |
| +++ b/chrome/browser/resources/settings/android_apps_page/android_apps_page.js |
| @@ -0,0 +1,100 @@ |
| +// Copyright 2016 The Chromium Authors. All rights reserved. |
| +// Use of this source code is governed by a BSD-style license that can be |
| +// found in the LICENSE file. |
| + |
| +/** |
| + * @fileoverview |
| + * '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.
|
| + */ |
| + |
| +Polymer({ |
| + is: 'settings-android-apps-page', |
| + |
| + behaviors: [I18nBehavior, PrefsBehavior], |
| + |
| + properties: { |
| + /** Preferences state. */ |
| + prefs: Object, |
| + |
| + /** @private {!AndroidAppsInfo|undefined} */ |
| + androidAppsInfo_: Object, |
| + }, |
| + |
| + /** @private {?settings.AndroidAppsBrowserProxy} */ |
| + browserProxy_: null, |
| + |
| + /** @override */ |
| + created: function() { |
| + this.browserProxy_ = settings.AndroidAppsBrowserProxyImpl.getInstance(); |
| + }, |
| + |
| + /** @override */ |
| + ready: function() { |
| + cr.addWebUIListener( |
| + 'android-apps-info-update', this.androidAppsInfoUpdate_.bind(this)); |
| + this.browserProxy_.getAndroidAppsInfo().then(function(info) { |
| + this.androidAppsInfoUpdate_(info); |
| + }.bind(this)); |
| + }, |
| + |
| + /** |
| + * @param {AndroidAppsInfo} info |
| + * @private |
| + */ |
| + androidAppsInfoUpdate_: function(info) { |
| + this.androidAppsInfo_ = info; |
| + }, |
| + |
| + /** @private */ |
| + onManageAndroidAppsTap_: function() { |
| + this.browserProxy_.showAndroidAppsSettings(); |
| + }, |
| + |
| + getDialogBody_: function() { |
|
michaelpg
2016/12/01 20:15:34
/** @return {string} */
and @private
stevenjb
2016/12/02 00:39:19
Done.
|
| + return this.i18nAdvanced( |
| + 'androidAppsDisableDialogMessage', {substitutions: [], tags: ['br']}); |
| + }, |
| + |
| + /** |
| + * Handles the change event for the arc.enabled checkbox. Shows a |
| + * confirmation dialog when disabling the preference. |
| + * @param {Event} event |
| + * @private |
| + */ |
| + onArcEnabledChange_: function(event) { |
| + if (event.target.checked) { |
| + /** @type {!SettingsCheckboxElement} */ (event.target).sendPrefChange(); |
| + return; |
| + } |
| + this.$.confirmDisableDialog.showModal(); |
| + }, |
| + |
| + /** |
| + * Handles the shared proxy confirmation dialog 'Confirm' button. |
| + * @private |
| + */ |
| + onConfirmDisableDialogConfirm_: function() { |
| + /** @type {!SettingsCheckboxElement} */ (this.$.enabledCheckbox) |
| + .sendPrefChange(); |
| + this.$.confirmDisableDialog.close(); |
| + }, |
| + |
| + /** |
| + * Handles the shared proxy confirmation dialog 'Cancel' button or a cancel |
| + * event. |
| + * @private |
| + */ |
| + onConfirmDisableDialogCancel_: function() { |
| + /** @type {!SettingsCheckboxElement} */ (this.$.enabledCheckbox) |
| + .resetToPrefValue(); |
| + this.$.confirmDisableDialog.close(); |
| + }, |
| + |
| + /** |
| + * @param {Event} event |
| + * @private |
| + */ |
| + doNothing_: function(event) { |
|
michaelpg
2016/12/01 20:15:34
unused?
stevenjb
2016/12/02 00:39:19
Done.
|
| + event.stopPropagation(); |
| + }, |
| +}); |