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-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({ |
(...skipping 36 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
47 ready: function() { | 47 ready: function() { |
48 cr.addWebUIListener( | 48 cr.addWebUIListener( |
49 'android-apps-info-update', this.androidAppsInfoUpdate_.bind(this)); | 49 'android-apps-info-update', this.androidAppsInfoUpdate_.bind(this)); |
50 this.browserProxy_.requestAndroidAppsInfo(); | 50 this.browserProxy_.requestAndroidAppsInfo(); |
51 }, | 51 }, |
52 /** | 52 /** |
53 * @param {AndroidAppsInfo} info | 53 * @param {AndroidAppsInfo} info |
54 * @private | 54 * @private |
55 */ | 55 */ |
56 androidAppsInfoUpdate_: function(info) { | 56 androidAppsInfoUpdate_: function(info) { |
57 if (!this.parentElement) | |
khmel
2017/05/10 21:48:13
in test this causes multiple listener invocation a
stevenjb
2017/05/10 22:35:44
This is weird, we should avoid it. The test to set
khmel
2017/05/11 00:10:30
settings.navigateToPreviousRoute() is async (windo
stevenjb
2017/05/11 16:58:14
When would that ever happen in practice?
Again, t
khmel
2017/05/11 17:32:22
I described when this happens above. For example o
| |
58 return; | |
59 | |
57 this.androidAppsInfo_ = info; | 60 this.androidAppsInfo_ = info; |
61 if (!this.androidAppsInfo_.playStoreEnabled && | |
62 settings.getCurrentRoute() == settings.Route.ANDROID_APPS_DETAILS) { | |
63 settings.navigateToPreviousRoute(); | |
64 } | |
58 }, | 65 }, |
59 | 66 |
60 /** | 67 /** |
61 * @param {Event} event | 68 * @param {Event} event |
62 * @private | 69 * @private |
63 */ | 70 */ |
64 onEnableTap_: function(event) { | 71 onEnableTap_: function(event) { |
65 this.setPrefValue('arc.enabled', true); | 72 this.setPrefValue('arc.enabled', true); |
66 event.stopPropagation(); | 73 event.stopPropagation(); |
67 }, | 74 }, |
68 | 75 |
69 /** @private */ | 76 /** @private */ |
70 onSubpageTap_: function() { | 77 onSubpageTap_: function() { |
71 if (this.androidAppsInfo_.appReady) | 78 if (this.androidAppsInfo_.playStoreEnabled) |
72 settings.navigateTo(settings.Route.ANDROID_APPS_DETAILS); | 79 settings.navigateTo(settings.Route.ANDROID_APPS_DETAILS); |
73 }, | 80 }, |
74 }); | 81 }); |
OLD | NEW |