OLD | NEW |
| (Empty) |
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 | |
3 // found in the LICENSE file. | |
4 | |
5 /** | |
6 * @fileoverview | |
7 * 'android-apps-subpage' is the settings subpage for managing android apps. | |
8 */ | |
9 | |
10 Polymer({ | |
11 is: 'settings-android-apps-subpage', | |
12 | |
13 behaviors: [I18nBehavior, PrefsBehavior], | |
14 | |
15 properties: { | |
16 /** Preferences state. */ | |
17 prefs: Object, | |
18 | |
19 /** @private {!AndroidAppsInfo|undefined} */ | |
20 androidAppsInfo: Object, | |
21 | |
22 /** @private */ | |
23 dialogBody_: { | |
24 type: String, | |
25 value: function() { | |
26 return this.i18nAdvanced( | |
27 'androidAppsDisableDialogMessage', | |
28 {substitutions: [], tags: ['br']}); | |
29 } | |
30 } | |
31 }, | |
32 | |
33 /** @private {?settings.AndroidAppsBrowserProxy} */ | |
34 browserProxy_: null, | |
35 | |
36 /** @override */ | |
37 created: function() { | |
38 this.browserProxy_ = settings.AndroidAppsBrowserProxyImpl.getInstance(); | |
39 }, | |
40 | |
41 /** | |
42 * @param {Event} event | |
43 * @private | |
44 */ | |
45 onManageAndroidAppsKeydown_: function(event) { | |
46 if (event.key != 'Enter' && event.key != ' ') | |
47 return; | |
48 this.browserProxy_.showAndroidAppsSettings(true /** keyboardAction */); | |
49 event.stopPropagation(); | |
50 }, | |
51 | |
52 /** @private */ | |
53 onManageAndroidAppsTap_: function(event) { | |
54 this.browserProxy_.showAndroidAppsSettings(false /** keyboardAction */); | |
55 }, | |
56 | |
57 /** | |
58 * @return {boolean} | |
59 * @private | |
60 */ | |
61 allowRemove_: function() { | |
62 return this.prefs.arc.enabled.enforcement != | |
63 chrome.settingsPrivate.Enforcement.ENFORCED; | |
64 }, | |
65 | |
66 /** | |
67 * Shows a confirmation dialog when disabling android apps. | |
68 * @param {Event} event | |
69 * @private | |
70 */ | |
71 onRemoveTap_: function(event) { | |
72 this.$.confirmDisableDialog.showModal(); | |
73 }, | |
74 | |
75 /** | |
76 * Handles the shared proxy confirmation dialog 'Confirm' button. | |
77 * @private | |
78 */ | |
79 onConfirmDisableDialogConfirm_: function() { | |
80 this.setPrefValue('arc.enabled', false); | |
81 this.$.confirmDisableDialog.close(); | |
82 settings.navigateToPreviousRoute(); | |
83 }, | |
84 | |
85 /** | |
86 * Handles the shared proxy confirmation dialog 'Cancel' button or a cancel | |
87 * event. | |
88 * @private | |
89 */ | |
90 onConfirmDisableDialogCancel_: function() { | |
91 this.$.confirmDisableDialog.close(); | |
92 }, | |
93 }); | |
OLD | NEW |