Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(230)

Unified Diff: chrome/browser/resources/settings/android_apps_page/android_apps_page.js

Issue 2541923002: MD Settings: Add Google Play Store (Arc++) section (Closed)
Patch Set: Fix tests Created 4 years ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
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..44ece83b48f8618a2d34fe5a8d954d5285bb9d82
--- /dev/null
+++ b/chrome/browser/resources/settings/android_apps_page/android_apps_page.js
@@ -0,0 +1,105 @@
+// 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
+ * 'android-apps-page' is the settings page for enabling android apps.
+ */
+
+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_.requestAndroidAppsInfo();
+ },
+
+ /**
+ * @param {AndroidAppsInfo} info
+ * @private
+ */
+ androidAppsInfoUpdate_: function(info) {
+ this.androidAppsInfo_ = info;
+ },
+
+ /**
+ * @param {Event} event
+ * @private
+ */
+ onManageAndroidAppsKeydown_: function(event) {
+ if (event.key != 'Enter' && event.key != ' ')
+ return;
+ this.browserProxy_.showAndroidAppsSettings(true /** keyboardAction */);
+ event.stopPropagation();
+ },
+
+ /** @private */
+ onManageAndroidAppsTap_: function(event) {
+ this.browserProxy_.showAndroidAppsSettings(false /** keyboardAction */);
+ },
+
+ /**
+ * @return {string}
+ * @private
+ */
+ getDialogBody_: function() {
+ 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();
+ },
+});

Powered by Google App Engine
This is Rietveld 408576698