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

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

Issue 2785013003: MD Settings: Google Play Store: Add subpage and polish (Closed)
Patch Set: 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-subpage' is the settings subpage for managing android apps.
8 */ 8 */
9 9
10 Polymer({ 10 Polymer({
11 is: 'settings-android-apps-page', 11 is: 'settings-android-apps-subpage',
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: Object,
18 18
19 /** @private {!AndroidAppsInfo|undefined} */ 19 /** @private {!AndroidAppsInfo|undefined} */
20 androidAppsInfo_: Object, 20 androidAppsInfo: Object,
21 }, 21 },
22 22
23 /** @private {?settings.AndroidAppsBrowserProxy} */ 23 /** @private {?settings.AndroidAppsBrowserProxy} */
24 browserProxy_: null, 24 browserProxy_: null,
25 25
26 /** @override */ 26 /** @override */
27 created: function() { 27 created: function() {
28 this.browserProxy_ = settings.AndroidAppsBrowserProxyImpl.getInstance(); 28 this.browserProxy_ = settings.AndroidAppsBrowserProxyImpl.getInstance();
29 }, 29 },
30 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 /** 31 /**
47 * @param {Event} event 32 * @param {Event} event
48 * @private 33 * @private
49 */ 34 */
50 onManageAndroidAppsKeydown_: function(event) { 35 onManageAndroidAppsKeydown_: function(event) {
51 if (event.key != 'Enter' && event.key != ' ') 36 if (event.key != 'Enter' && event.key != ' ')
52 return; 37 return;
53 this.browserProxy_.showAndroidAppsSettings(true /** keyboardAction */); 38 this.browserProxy_.showAndroidAppsSettings(true /** keyboardAction */);
54 event.stopPropagation(); 39 event.stopPropagation();
55 }, 40 },
56 41
57 /** @private */ 42 /** @private */
58 onManageAndroidAppsTap_: function(event) { 43 onManageAndroidAppsTap_: function(event) {
59 this.browserProxy_.showAndroidAppsSettings(false /** keyboardAction */); 44 this.browserProxy_.showAndroidAppsSettings(false /** keyboardAction */);
60 }, 45 },
61 46
62 /** 47 /**
48 * @return {boolean}
49 * @private
50 */
51 allowRemove_() {
Dan Beam 2017/03/30 13:24:22 also using ES6
stevenjb 2017/03/30 23:05:37 Done.
52 return this.prefs.arc.enabled.enforcement !=
Dan Beam 2017/03/30 13:24:22 i don't think this will work with closure. you mi
stevenjb 2017/03/30 23:05:37 It does. Since prefs.arc.enabled will always exis
53 chrome.settingsPrivate.Enforcement.ENFORCED;
54 },
55
56 /**
57 * Shows a confirmation dialog when disabling android apps.
58 * @param {Event} event
59 * @private
60 */
61 onRemoveTap_: function(event) {
62 this.$.confirmDisableDialog.showModal();
63 },
64
Dan Beam 2017/03/30 13:24:22 extra \n
stevenjb 2017/03/30 23:05:37 Done.
65
66 /**
63 * @return {string} 67 * @return {string}
64 * @private 68 * @private
65 */ 69 */
66 getDialogBody_: function() { 70 getDialogBody_: function() {
67 return this.i18nAdvanced( 71 return this.i18nAdvanced('androidAppsDisableDialogMessage', {});
Dan Beam 2017/03/30 13:24:22 is this equivalent to i18n()?
stevenjb 2017/03/30 23:05:37 Done.
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 }, 72 },
84 73
85 /** 74 /**
86 * Handles the shared proxy confirmation dialog 'Confirm' button. 75 * Handles the shared proxy confirmation dialog 'Confirm' button.
87 * @private 76 * @private
88 */ 77 */
89 onConfirmDisableDialogConfirm_: function() { 78 onConfirmDisableDialogConfirm_: function() {
90 /** @type {!SettingsCheckboxElement} */ (this.$.enabled).sendPrefChange(); 79 this.setPrefValue('arc.enabled', false);
91 this.$.confirmDisableDialog.close(); 80 this.$.confirmDisableDialog.close();
81 settings.navigateToPreviousRoute();
92 }, 82 },
93 83
94 /** 84 /**
95 * Handles the shared proxy confirmation dialog 'Cancel' button or a cancel 85 * Handles the shared proxy confirmation dialog 'Cancel' button or a cancel
96 * event. 86 * event.
97 * @private 87 * @private
98 */ 88 */
99 onConfirmDisableDialogCancel_: function() { 89 onConfirmDisableDialogCancel_: function() {
100 /** @type {!SettingsCheckboxElement} */ (this.$.enabled).resetToPrefValue();
101 this.$.confirmDisableDialog.close(); 90 this.$.confirmDisableDialog.close();
102 }, 91 },
103
104 /**
105 * @param {!Event} e
106 * @private
107 */
108 stopPropagation_: function(e) {
109 e.stopPropagation();
110 },
111 }); 92 });
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698