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

Side by Side Diff: chrome/browser/resources/settings/default_browser_page/default_browser_page.js

Issue 1388353003: [MD settings] adding DefaultBrowser settings page (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: review changes Created 5 years, 2 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 unified diff | Download patch
OLDNEW
(Empty)
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
3 // found in the LICENSE file.
4
5 /**
6 * @fileoverview
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).
9 *
10 * Example:
11 *
12 * <iron-animated-pages>
13 * <settings-default-browser-page>
14 * </settings-default-browser-page>
15 * ... other pages ...
16 * </iron-animated-pages>
17 *
18 * @group Chrome Settings Elements
19 * @element settings-default-browser-page
20 */
21 Polymer({
22 is: 'settings-default-browser-page',
23
24 properties: {
25 /**
26 * The current active route.
27 */
28 currentRoute: {
29 type: Object,
30 notify: true,
31 },
32
33 /**
34 * A message about whether Chrome is the default browser.
35 */
36 message_: {
37 type: String,
38 },
39
40 /**
41 * Show or hide an error indicator showing whether SetAsDefault succeeded.
42 */
43 showError_: {
44 type: Boolean,
45 value: false,
46 },
47
48 /**
49 * Only show the SetAsDefault button if we have permission to set it.
50 */
51 showButton_: {
52 type: Boolean,
53 },
54 },
55
56 behaviors: [
57 I18nBehavior,
58 ],
59
60 ready: function() {
61 var self = this;
62 cr.define('Settings', function() {
63 return {
64 setAsDefaultConcluded: function() {
65 return self.setAsDefaultConcluded_.apply(self, arguments);
66 },
67 updateDefaultBrowserState: function() {
68 return self.updateDefaultBrowserState_.apply(self, arguments);
69 },
70 };
71 });
72 chrome.send('SettingsDefaultBrowser.requestDefaultBrowserState');
73 },
74
75 /**
76 * @param {boolean} succeeded
77 * @private
78 */
79 setAsDefaultConcluded_: function(succeeded) {
80 this.showError_ = !succeeded;
81 },
82
83 /**
84 * @param {boolean} isDefault Whether Chrome is currently the user's default
85 * browser.
86 * @param {boolean} canBeDefault Whether Chrome can be the default browser on
87 * this system.
88 * @private
89 */
90 updateDefaultBrowserState_: function(isDefault, canBeDefault) {
91 this.showButton_ = !isDefault && canBeDefault;
92 if (canBeDefault) {
93 this.message_ = loadTimeData.getString(isDefault ?
94 'defaultBroswerDefault' :
95 'defaultBroswerNotDefault');
96 } else {
97 this.message_ = loadTimeData.getString('defaultBroswerUnknown');
98 }
99 },
100
101 /** @private */
102 onSetDefaultBrowserTap_: function() {
103 chrome.send('SettingsDefaultBrowser.setAsDefaultBrowser');
104 },
105 });
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698