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

Side by Side Diff: chrome/browser/resources/settings/android_apps_page/android_apps_page.js

Issue 2796783005: MD Settings: Google Play Store: Add subpage and polish (Take 2) (Closed)
Patch Set: Fix test and simplify Created 3 years, 8 months 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 unified diff | Download patch
OLDNEW
1 // Copyright 2016 The Chromium Authors. All rights reserved. 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 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 /** 5 /**
6 * @fileoverview 6 * @fileoverview
7 * 'android-apps-page' is the settings page for enabling android apps. 7 * 'android-apps-page' is the settings page for enabling android apps.
8 */ 8 */
9 9
10 Polymer({ 10 Polymer({
11 is: 'settings-android-apps-page', 11 is: 'settings-android-apps-page',
12 12
13 behaviors: [I18nBehavior, PrefsBehavior], 13 behaviors: [I18nBehavior, PrefsBehavior],
14 14
15 properties: { 15 properties: {
16 /** Preferences state. */ 16 /** Preferences state. */
17 prefs: Object, 17 prefs: {
18 type: Object,
19 notify: true,
20 },
18 21
19 /** @private {!AndroidAppsInfo|undefined} */ 22 /** @private {!AndroidAppsInfo|undefined} */
20 androidAppsInfo_: Object, 23 androidAppsInfo_: Object,
21 }, 24 },
22 25
23 /** @private {?settings.AndroidAppsBrowserProxy} */ 26 /** @private {?settings.AndroidAppsBrowserProxy} */
24 browserProxy_: null, 27 browserProxy_: null,
25 28
26 /** @override */ 29 /** @override */
27 created: function() { 30 created: function() {
28 this.browserProxy_ = settings.AndroidAppsBrowserProxyImpl.getInstance(); 31 this.browserProxy_ = settings.AndroidAppsBrowserProxyImpl.getInstance();
29 }, 32 },
30 33
31 /** @override */ 34 /** @override */
32 ready: function() { 35 ready: function() {
33 cr.addWebUIListener( 36 cr.addWebUIListener(
34 'android-apps-info-update', this.androidAppsInfoUpdate_.bind(this)); 37 'android-apps-info-update', this.androidAppsInfoUpdate_.bind(this));
35 this.browserProxy_.requestAndroidAppsInfo(); 38 this.browserProxy_.requestAndroidAppsInfo();
36 }, 39 },
37
38 /** 40 /**
39 * @param {AndroidAppsInfo} info 41 * @param {AndroidAppsInfo} info
40 * @private 42 * @private
41 */ 43 */
42 androidAppsInfoUpdate_: function(info) { 44 androidAppsInfoUpdate_: function(info) {
43 this.androidAppsInfo_ = info; 45 this.androidAppsInfo_ = info;
44 }, 46 },
45 47
46 /** 48 /**
47 * @param {Event} event 49 * @param {Event} event
48 * @private 50 * @private
49 */ 51 */
50 onManageAndroidAppsKeydown_: function(event) { 52 onEnableTap_: function(event) {
51 if (event.key != 'Enter' && event.key != ' ') 53 this.setPrefValue('arc.enabled', true);
52 return;
53 this.browserProxy_.showAndroidAppsSettings(true /** keyboardAction */);
54 event.stopPropagation(); 54 event.stopPropagation();
55 }, 55 },
56 56
57 /** @private */ 57 /** @private */
58 onManageAndroidAppsTap_: function(event) { 58 onSubpageTap_: function() {
59 this.browserProxy_.showAndroidAppsSettings(false /** keyboardAction */); 59 if (!this.androidAppsInfo_.appReady)
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; 60 return;
81 } 61 settings.navigateTo(settings.Route.ANDROID_APPS_DETAILS);
Dan Beam 2017/04/04 23:23:34 nit: if (this.androidAppsInfo_.appReady) se
stevenjb 2017/04/05 16:43:23 Done.
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.$.enabled).sendPrefChange();
91 this.$.confirmDisableDialog.close();
92 },
93
94 /**
95 * Handles the shared proxy confirmation dialog 'Cancel' button or a cancel
96 * event.
97 * @private
98 */
99 onConfirmDisableDialogCancel_: function() {
100 /** @type {!SettingsCheckboxElement} */ (this.$.enabled).resetToPrefValue();
101 this.$.confirmDisableDialog.close();
102 },
103
104 /**
105 * @param {!Event} e
106 * @private
107 */
108 stopPropagation_: function(e) {
109 e.stopPropagation();
110 }, 62 },
111 }); 63 });
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698