Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(1808)

Unified Diff: chrome/browser/resources/settings/default_browser_page/default_browser_page.js

Issue 2317693003: [MD settings] display message about secondary install in default browser settings (Closed)
Patch Set: Created 4 years, 3 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
Index: chrome/browser/resources/settings/default_browser_page/default_browser_page.js
diff --git a/chrome/browser/resources/settings/default_browser_page/default_browser_page.js b/chrome/browser/resources/settings/default_browser_page/default_browser_page.js
index 7f100022c5a5bfb8c47da8acc0c5881018764045..311b801043c21a65796dee674914151e5ff0743a 100644
--- a/chrome/browser/resources/settings/default_browser_page/default_browser_page.js
+++ b/chrome/browser/resources/settings/default_browser_page/default_browser_page.js
@@ -10,76 +10,61 @@
Polymer({
is: 'settings-default-browser-page',
+ behaviors: [WebUIListenerBehavior],
+
properties: {
- /**
- * A message about whether Chrome is the default browser.
- */
- message_: {
- type: String,
- },
+ /** @private */
+ isDefault_: Boolean,
- /**
- * Indicates if the next updateDefaultBrowserState_ invocation is following
- * a call to SettingsDefaultBrowser.setAsDefaultBrowser().
- */
- startedSetAsDefault_: {
- type: Boolean,
- value: false,
- },
+ /** @private */
+ isSecondaryInstall_: Boolean,
- /**
- * Show or hide an error indicator showing whether SetAsDefault succeeded.
- */
- showError_: {
- type: Boolean,
- value: false,
- },
+ /** @private */
+ isUnknownError_: Boolean,
- /**
- * Only show the SetAsDefault button if we have permission to set it.
- */
- showButton_: {
- type: Boolean,
- },
+ /** @private */
+ showButton_: Boolean,
+ },
+
+ /** @private {settings.DefaultBrowserBrowserProxy} */
+ browserProxy_: null,
+
+ /** @override */
+ created: function() {
+ this.browserProxy_ = settings.DefaultBrowserBrowserProxyImpl.getInstance();
},
ready: function() {
- var self = this;
- cr.define('Settings', function() {
- return {
- updateDefaultBrowserState: function() {
- return self.updateDefaultBrowserState_.apply(self, arguments);
- },
- };
- });
- chrome.send('SettingsDefaultBrowser.requestDefaultBrowserState');
+ this.addWebUIListener('settings.updateDefaultBrowserState',
+ this.updateDefaultBrowserState_.bind(this));
+
+ this.browserProxy_.requestDefaultBrowserState().then(
+ this.updateDefaultBrowserState_.bind(this));
},
/**
- * @param {boolean} isDefault Whether Chrome is currently the user's default
- * browser.
- * @param {boolean} canBeDefault Whether Chrome can be the default browser on
- * this system.
+ * @param {!DefaultBrowserInfo} defaultBrowserState
* @private
*/
- updateDefaultBrowserState_: function(isDefault, canBeDefault) {
- if (this.startedSetAsDefault_ && !isDefault) {
- this.startedSetAsDefault_ = false;
- this.showError_ = true;
- } else {
- this.showError_ = false;
- }
+ updateDefaultBrowserState_: function(defaultBrowserState) {
+ this.isDefault_ = false;
+ this.isSecondaryInstall_ = false;
+ this.isUnknownError_ = false;
+ this.showButton_ = false;
- this.showButton_ = !isDefault && canBeDefault;
- if (!this.showButton_) {
- this.message_ = loadTimeData.getString(
- canBeDefault ? 'defaultBrowserDefault' : 'defaultBrowserUnknown');
- }
+ if (defaultBrowserState.isDefault)
+ this.isDefault_ = true;
+ else if (!defaultBrowserState.canBeDefault)
+ this.isSecondaryInstall_ = true;
+ else if (!defaultBrowserState.isDisabledByPolicy &&
+ !defaultBrowserState.isUnknownError)
+ this.showButton_ = true;
+ else
+ this.isUnknownError_ = true;
},
/** @private */
onSetDefaultBrowserTap_: function() {
- this.startedSetAsDefault_ = true;
- chrome.send('SettingsDefaultBrowser.setAsDefaultBrowser');
+ this.browserProxy_.setAsDefaultBrowser();
},
});

Powered by Google App Engine
This is Rietveld 408576698