1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
|
// 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-subpage' is the settings subpage for managing android apps.
*/
Polymer({
is: 'settings-android-apps-subpage',
behaviors: [I18nBehavior, PrefsBehavior],
properties: {
/** Preferences state. */
prefs: Object,
/** @private {!AndroidAppsInfo|undefined} */
androidAppsInfo: {
type: Object,
},
/** @private */
playStoreEnabled_: {
type: Boolean,
computed: 'computePlayStoreEnabled_(androidAppsInfo)',
observer: 'onPlayStoreEnabledChanged_'
},
/** @private */
dialogBody_: {
type: String,
value: function() {
return this.i18nAdvanced(
'androidAppsDisableDialogMessage',
{substitutions: [], tags: ['br']});
}
}
},
/** @private */
onPlayStoreEnabledChanged_: function(enabled) {
if (!enabled &&
settings.getCurrentRoute() == settings.routes.ANDROID_APPS_DETAILS) {
settings.navigateToPreviousRoute();
}
},
/**
* @return {boolean}
* @private
*/
computePlayStoreEnabled_: function() {
return this.androidAppsInfo.playStoreEnabled;
},
/**
* @return {boolean}
* @private
*/
allowRemove_: function() {
return this.prefs.arc.enabled.enforcement !=
chrome.settingsPrivate.Enforcement.ENFORCED;
},
/**
* Shows a confirmation dialog when disabling android apps.
* @param {!Event} event
* @private
*/
onRemoveTap_: function(event) {
this.$.confirmDisableDialog.showModal();
},
/**
* Handles the shared proxy confirmation dialog 'Confirm' button.
* @private
*/
onConfirmDisableDialogConfirm_: function() {
this.setPrefValue('arc.enabled', false);
this.$.confirmDisableDialog.close();
// Sub-page will be closed in onAndroidAppsInfoUpdate_ call.
},
/**
* Handles the shared proxy confirmation dialog 'Cancel' button or a cancel
* event.
* @private
*/
onConfirmDisableDialogCancel_: function() {
this.$.confirmDisableDialog.close();
},
/** @private */
onConfirmDisableDialogClose_: function() {
cr.ui.focusWithoutInk(assert(this.$$('#remove')));
},
/**
* @param {!MouseEvent} event
* @private
*/
onManageAndroidAppsTap_: function(event) {
// |event.detail| is the click count. Keyboard events will have 0 clicks.
const isKeyboardAction = event.detail == 0;
settings.AndroidAppsBrowserProxyImpl.getInstance().showAndroidAppsSettings(
isKeyboardAction);
},
});
|