| 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 17 matching lines...) Expand all Loading... |
| 28 | 28 |
| 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 ready: function() { | 37 ready: function() { |
| 38 this.addWebUIListener('settings.updateDefaultBrowserState', | 38 this.addWebUIListener( |
| 39 'settings.updateDefaultBrowserState', |
| 39 this.updateDefaultBrowserState_.bind(this)); | 40 this.updateDefaultBrowserState_.bind(this)); |
| 40 | 41 |
| 41 this.browserProxy_.requestDefaultBrowserState().then( | 42 this.browserProxy_.requestDefaultBrowserState().then( |
| 42 this.updateDefaultBrowserState_.bind(this)); | 43 this.updateDefaultBrowserState_.bind(this)); |
| 43 }, | 44 }, |
| 44 | 45 |
| 45 /** | 46 /** |
| 46 * @param {!DefaultBrowserInfo} defaultBrowserState | 47 * @param {!DefaultBrowserInfo} defaultBrowserState |
| 47 * @private | 48 * @private |
| 48 */ | 49 */ |
| 49 updateDefaultBrowserState_: function(defaultBrowserState) { | 50 updateDefaultBrowserState_: function(defaultBrowserState) { |
| 50 this.isDefault_ = false; | 51 this.isDefault_ = false; |
| 51 this.isSecondaryInstall_ = false; | 52 this.isSecondaryInstall_ = false; |
| 52 this.isUnknownError_ = false; | 53 this.isUnknownError_ = false; |
| 53 this.maySetDefaultBrowser_ = false; | 54 this.maySetDefaultBrowser_ = false; |
| 54 | 55 |
| 55 if (defaultBrowserState.isDefault) | 56 if (defaultBrowserState.isDefault) |
| 56 this.isDefault_ = true; | 57 this.isDefault_ = true; |
| 57 else if (!defaultBrowserState.canBeDefault) | 58 else if (!defaultBrowserState.canBeDefault) |
| 58 this.isSecondaryInstall_ = true; | 59 this.isSecondaryInstall_ = true; |
| 59 else if (!defaultBrowserState.isDisabledByPolicy && | 60 else if ( |
| 61 !defaultBrowserState.isDisabledByPolicy && |
| 60 !defaultBrowserState.isUnknownError) | 62 !defaultBrowserState.isUnknownError) |
| 61 this.maySetDefaultBrowser_ = true; | 63 this.maySetDefaultBrowser_ = true; |
| 62 else | 64 else |
| 63 this.isUnknownError_ = true; | 65 this.isUnknownError_ = true; |
| 64 }, | 66 }, |
| 65 | 67 |
| 66 /** @private */ | 68 /** @private */ |
| 67 onSetDefaultBrowserTap_: function() { | 69 onSetDefaultBrowserTap_: function() { |
| 68 this.browserProxy_.setAsDefaultBrowser(); | 70 this.browserProxy_.setAsDefaultBrowser(); |
| 69 }, | 71 }, |
| 70 }); | 72 }); |
| OLD | NEW |