OLD | NEW |
1 // Copyright 2015 The Chromium Authors. All rights reserved. | 1 // Copyright 2015 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 * 'settings-default-browser-page' is the settings page that contains | 7 * 'settings-default-browser-page' is the settings page that contains |
8 * settings to change the default browser (i.e. which the OS will open). | 8 * settings to change the default browser (i.e. which the OS will open). |
9 */ | 9 */ |
10 Polymer({ | 10 Polymer({ |
(...skipping 18 matching lines...) Expand all Loading... |
29 /** @private {settings.DefaultBrowserBrowserProxy} */ | 29 /** @private {settings.DefaultBrowserBrowserProxy} */ |
30 browserProxy_: null, | 30 browserProxy_: null, |
31 | 31 |
32 /** @override */ | 32 /** @override */ |
33 created: function() { | 33 created: function() { |
34 this.browserProxy_ = settings.DefaultBrowserBrowserProxyImpl.getInstance(); | 34 this.browserProxy_ = settings.DefaultBrowserBrowserProxyImpl.getInstance(); |
35 }, | 35 }, |
36 | 36 |
37 /** @override */ | 37 /** @override */ |
38 ready: function() { | 38 ready: function() { |
39 this.addWebUIListener('settings.updateDefaultBrowserState', | 39 this.addWebUIListener( |
| 40 'settings.updateDefaultBrowserState', |
40 this.updateDefaultBrowserState_.bind(this)); | 41 this.updateDefaultBrowserState_.bind(this)); |
41 | 42 |
42 this.browserProxy_.requestDefaultBrowserState().then( | 43 this.browserProxy_.requestDefaultBrowserState().then( |
43 this.updateDefaultBrowserState_.bind(this)); | 44 this.updateDefaultBrowserState_.bind(this)); |
44 }, | 45 }, |
45 | 46 |
46 /** | 47 /** |
47 * @param {!DefaultBrowserInfo} defaultBrowserState | 48 * @param {!DefaultBrowserInfo} defaultBrowserState |
48 * @private | 49 * @private |
49 */ | 50 */ |
50 updateDefaultBrowserState_: function(defaultBrowserState) { | 51 updateDefaultBrowserState_: function(defaultBrowserState) { |
51 this.isDefault_ = false; | 52 this.isDefault_ = false; |
52 this.isSecondaryInstall_ = false; | 53 this.isSecondaryInstall_ = false; |
53 this.isUnknownError_ = false; | 54 this.isUnknownError_ = false; |
54 this.maySetDefaultBrowser_ = false; | 55 this.maySetDefaultBrowser_ = false; |
55 | 56 |
56 if (defaultBrowserState.isDefault) | 57 if (defaultBrowserState.isDefault) |
57 this.isDefault_ = true; | 58 this.isDefault_ = true; |
58 else if (!defaultBrowserState.canBeDefault) | 59 else if (!defaultBrowserState.canBeDefault) |
59 this.isSecondaryInstall_ = true; | 60 this.isSecondaryInstall_ = true; |
60 else if (!defaultBrowserState.isDisabledByPolicy && | 61 else if ( |
| 62 !defaultBrowserState.isDisabledByPolicy && |
61 !defaultBrowserState.isUnknownError) | 63 !defaultBrowserState.isUnknownError) |
62 this.maySetDefaultBrowser_ = true; | 64 this.maySetDefaultBrowser_ = true; |
63 else | 65 else |
64 this.isUnknownError_ = true; | 66 this.isUnknownError_ = true; |
65 }, | 67 }, |
66 | 68 |
67 /** @private */ | 69 /** @private */ |
68 onSetDefaultBrowserTap_: function() { | 70 onSetDefaultBrowserTap_: function() { |
69 this.browserProxy_.setAsDefaultBrowser(); | 71 this.browserProxy_.setAsDefaultBrowser(); |
70 }, | 72 }, |
71 }); | 73 }); |
OLD | NEW |