| 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 37 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 48 */ | 48 */ |
| 49 showButton_: { | 49 showButton_: { |
| 50 type: Boolean, | 50 type: Boolean, |
| 51 }, | 51 }, |
| 52 }, | 52 }, |
| 53 | 53 |
| 54 ready: function() { | 54 ready: function() { |
| 55 var self = this; | 55 var self = this; |
| 56 cr.define('Settings', function() { | 56 cr.define('Settings', function() { |
| 57 return { | 57 return { |
| 58 setAsDefaultConcluded: function() { | |
| 59 return self.setAsDefaultConcluded_.apply(self, arguments); | |
| 60 }, | |
| 61 updateDefaultBrowserState: function() { | 58 updateDefaultBrowserState: function() { |
| 62 return self.updateDefaultBrowserState_.apply(self, arguments); | 59 return self.updateDefaultBrowserState_.apply(self, arguments); |
| 63 }, | 60 }, |
| 64 }; | 61 }; |
| 65 }); | 62 }); |
| 66 chrome.send('SettingsDefaultBrowser.requestDefaultBrowserState'); | 63 chrome.send('SettingsDefaultBrowser.requestDefaultBrowserState'); |
| 67 }, | 64 }, |
| 68 | 65 |
| 69 /** | 66 /** |
| 70 * @param {boolean} isDefault Whether Chrome is currently the user's default | 67 * @param {boolean} isDefault Whether Chrome is currently the user's default |
| 71 * browser. | 68 * browser. |
| 72 * @param {boolean} canBeDefault Whether Chrome can be the default browser on | 69 * @param {boolean} canBeDefault Whether Chrome can be the default browser on |
| 73 * this system. | 70 * this system. |
| 74 * @private | 71 * @private |
| 75 */ | 72 */ |
| 76 updateDefaultBrowserState_: function(isDefault, canBeDefault) { | 73 updateDefaultBrowserState_: function(isDefault, canBeDefault) { |
| 77 if (this.startedSetAsDefault_ && !isDefault) { | 74 if (this.startedSetAsDefault_ && !isDefault) { |
| 78 this.startedSetAsDefault_ = false; | 75 this.startedSetAsDefault_ = false; |
| 79 this.showError_ = true; | 76 this.showError_ = true; |
| 80 } else { | 77 } else { |
| 81 this.showError_ = false; | 78 this.showError_ = false; |
| 82 } | 79 } |
| 83 | 80 |
| 84 this.showButton_ = !isDefault && canBeDefault; | 81 this.showButton_ = !isDefault && canBeDefault; |
| 85 if (!this.showButton) { | 82 if (!this.showButton_) { |
| 86 this.message_ = loadTimeData.getString( | 83 this.message_ = loadTimeData.getString( |
| 87 canBeDefault ? 'defaultBrowserDefault' : 'defaultBrowserUnknown'); | 84 canBeDefault ? 'defaultBrowserDefault' : 'defaultBrowserUnknown'); |
| 88 } | 85 } |
| 89 }, | 86 }, |
| 90 | 87 |
| 91 /** @private */ | 88 /** @private */ |
| 92 onSetDefaultBrowserTap_: function() { | 89 onSetDefaultBrowserTap_: function() { |
| 93 this.startedSetAsDefault_ = true; | 90 this.startedSetAsDefault_ = true; |
| 94 chrome.send('SettingsDefaultBrowser.setAsDefaultBrowser'); | 91 chrome.send('SettingsDefaultBrowser.setAsDefaultBrowser'); |
| 95 }, | 92 }, |
| 96 }); | 93 }); |
| OLD | NEW |