| 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
|
| new file mode 100644
|
| index 0000000000000000000000000000000000000000..a47ad889293174e5c929a07c8bcd4b8cd566bcfe
|
| --- /dev/null
|
| +++ b/chrome/browser/resources/settings/default_browser_page/default_browser_page.js
|
| @@ -0,0 +1,105 @@
|
| +// Copyright 2015 The Chromium Authors. All rights reserved.
|
| +// Use of this source code is governed by a BSD-style license that can be
|
| +// found in the LICENSE file.
|
| +
|
| +/**
|
| + * @fileoverview
|
| + * 'settings-default-browser-page' is the settings page that contains
|
| + * settings to change the default browser (i.e. which the OS will open).
|
| + *
|
| + * Example:
|
| + *
|
| + * <iron-animated-pages>
|
| + * <settings-default-browser-page>
|
| + * </settings-default-browser-page>
|
| + * ... other pages ...
|
| + * </iron-animated-pages>
|
| + *
|
| + * @group Chrome Settings Elements
|
| + * @element settings-default-browser-page
|
| + */
|
| +Polymer({
|
| + is: 'settings-default-browser-page',
|
| +
|
| + properties: {
|
| + /**
|
| + * The current active route.
|
| + */
|
| + currentRoute: {
|
| + type: Object,
|
| + notify: true,
|
| + },
|
| +
|
| + /**
|
| + * A message about whether Chrome is the default browser.
|
| + */
|
| + message_: {
|
| + type: String,
|
| + },
|
| +
|
| + /**
|
| + * Show or hide an error indicator showing whether SetAsDefault succeeded.
|
| + */
|
| + showError_: {
|
| + type: Boolean,
|
| + value: false,
|
| + },
|
| +
|
| + /**
|
| + * Only show the SetAsDefault button if we have permission to set it.
|
| + */
|
| + showButton_: {
|
| + type: Boolean,
|
| + },
|
| + },
|
| +
|
| + behaviors: [
|
| + I18nBehavior,
|
| + ],
|
| +
|
| + ready: function() {
|
| + var self = this;
|
| + cr.define('Settings', function() {
|
| + return {
|
| + setAsDefaultConcluded: function() {
|
| + return self.setAsDefaultConcluded_.apply(self, arguments);
|
| + },
|
| + updateDefaultBrowserState: function() {
|
| + return self.updateDefaultBrowserState_.apply(self, arguments);
|
| + },
|
| + };
|
| + });
|
| + chrome.send('SettingsDefaultBrowser.requestDefaultBrowserState');
|
| + },
|
| +
|
| + /**
|
| + * @param {boolean} succeeded
|
| + * @private
|
| + */
|
| + setAsDefaultConcluded_: function(succeeded) {
|
| + this.showError_ = !succeeded;
|
| + },
|
| +
|
| + /**
|
| + * @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.
|
| + * @private
|
| + */
|
| + updateDefaultBrowserState_: function(isDefault, canBeDefault) {
|
| + this.showButton_ = !isDefault && canBeDefault;
|
| + if (canBeDefault) {
|
| + this.message_ = loadTimeData.getString(isDefault ?
|
| + 'defaultBroswerDefault' :
|
| + 'defaultBroswerNotDefault');
|
| + } else {
|
| + this.message_ = loadTimeData.getString('defaultBroswerUnknown');
|
| + }
|
| + },
|
| +
|
| + /** @private */
|
| + onSetDefaultBrowserTap_: function() {
|
| + chrome.send('SettingsDefaultBrowser.setAsDefaultBrowser');
|
| + },
|
| +});
|
|
|