OLD | NEW |
---|---|
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-subpage' is the settings subpage for managing 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-subpage', | 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, |
stevenjb
2017/05/11 17:46:54
androidAppsInfo: {
type: Object,
observer: 'on
khmel
2017/05/11 19:09:46
Nice, was not aware about this possibility. Done.
| |
21 | 21 |
22 /** @private */ | 22 /** @private */ |
23 dialogBody_: { | 23 dialogBody_: { |
24 type: String, | 24 type: String, |
25 value: function() { | 25 value: function() { |
26 return this.i18nAdvanced( | 26 return this.i18nAdvanced( |
27 'androidAppsDisableDialogMessage', | 27 'androidAppsDisableDialogMessage', |
28 {substitutions: [], tags: ['br']}); | 28 {substitutions: [], tags: ['br']}); |
29 } | 29 } |
30 } | 30 } |
31 }, | 31 }, |
32 | 32 |
33 /** @private {?settings.AndroidAppsBrowserProxy} */ | 33 /** @private {?settings.AndroidAppsBrowserProxy} */ |
34 browserProxy_: null, | 34 browserProxy_: null, |
35 | 35 |
36 /** @override */ | 36 /** @override */ |
37 created: function() { | 37 created: function() { |
38 this.browserProxy_ = settings.AndroidAppsBrowserProxyImpl.getInstance(); | 38 this.browserProxy_ = settings.AndroidAppsBrowserProxyImpl.getInstance(); |
39 }, | 39 }, |
40 | 40 |
41 /** @override */ | |
42 ready: function() { | |
43 cr.addWebUIListener( | |
44 'android-apps-info-update', this.androidAppsInfoUpdate_.bind(this)); | |
45 }, | |
stevenjb
2017/05/11 17:46:54
No need for this.
khmel
2017/05/11 19:09:46
Done.
| |
46 | |
47 /** | |
48 * @param {AndroidAppsInfo} info | |
49 * @private | |
50 */ | |
51 androidAppsInfoUpdate_: function(info) { | |
stevenjb
2017/05/11 17:46:54
onAndroidAppsInfoUpdate_: function() {
khmel
2017/05/11 19:09:46
Done. However I have to discard root app element f
| |
52 if (!info.playStoreEnabled && | |
stevenjb
2017/05/11 17:46:54
if (this.androidAppsInfo.playStoreEnabled &&
khmel
2017/05/11 19:09:46
Done.
| |
53 settings.getCurrentRoute() == settings.Route.ANDROID_APPS_DETAILS) { | |
stevenjb
2017/05/11 17:46:54
This test should no longer be necessary since the
khmel
2017/05/11 19:09:46
Good point, right.
| |
54 settings.navigateToPreviousRoute(); | |
55 } | |
56 }, | |
57 | |
41 /** | 58 /** |
42 * @param {Event} event | 59 * @param {Event} event |
43 * @private | 60 * @private |
44 */ | 61 */ |
45 onManageAndroidAppsKeydown_: function(event) { | 62 onManageAndroidAppsKeydown_: function(event) { |
46 if (event.key != 'Enter' && event.key != ' ') | 63 if (event.key != 'Enter' && event.key != ' ') |
47 return; | 64 return; |
48 this.browserProxy_.showAndroidAppsSettings(true /** keyboardAction */); | 65 this.browserProxy_.showAndroidAppsSettings(true /** keyboardAction */); |
49 event.stopPropagation(); | 66 event.stopPropagation(); |
50 }, | 67 }, |
(...skipping 21 matching lines...) Expand all Loading... | |
72 this.$.confirmDisableDialog.showModal(); | 89 this.$.confirmDisableDialog.showModal(); |
73 }, | 90 }, |
74 | 91 |
75 /** | 92 /** |
76 * Handles the shared proxy confirmation dialog 'Confirm' button. | 93 * Handles the shared proxy confirmation dialog 'Confirm' button. |
77 * @private | 94 * @private |
78 */ | 95 */ |
79 onConfirmDisableDialogConfirm_: function() { | 96 onConfirmDisableDialogConfirm_: function() { |
80 this.setPrefValue('arc.enabled', false); | 97 this.setPrefValue('arc.enabled', false); |
81 this.$.confirmDisableDialog.close(); | 98 this.$.confirmDisableDialog.close(); |
82 settings.navigateToPreviousRoute(); | 99 settings.navigateToPreviousRoute(); |
stevenjb
2017/05/11 17:46:54
This should already be navigate back when we disab
khmel
2017/05/11 19:09:46
This goes back only in case when ARC is disabled f
stevenjb
2017/05/11 19:40:43
Ah, OK, that is the use case I was missing.
| |
83 }, | 100 }, |
84 | 101 |
85 /** | 102 /** |
86 * Handles the shared proxy confirmation dialog 'Cancel' button or a cancel | 103 * Handles the shared proxy confirmation dialog 'Cancel' button or a cancel |
87 * event. | 104 * event. |
88 * @private | 105 * @private |
89 */ | 106 */ |
90 onConfirmDisableDialogCancel_: function() { | 107 onConfirmDisableDialogCancel_: function() { |
91 this.$.confirmDisableDialog.close(); | 108 this.$.confirmDisableDialog.close(); |
92 }, | 109 }, |
93 | 110 |
94 /** @private */ | 111 /** @private */ |
95 onConfirmDisableDialogClose_: function() { | 112 onConfirmDisableDialogClose_: function() { |
96 cr.ui.focusWithoutInk(assert(this.$$('#remove button'))); | 113 cr.ui.focusWithoutInk(assert(this.$$('#remove button'))); |
97 }, | 114 }, |
98 }); | 115 }); |
OLD | NEW |