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

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: moved upstream branch to master 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 prefs="{{prefs}}">
14 * </settings-default-browser-page>
15 * ... other pages ...
16 * </iron-animated-pages>
Dan Beam 2015/10/09 01:41:52 why is this 3\s indented?
dschuyler 2015/10/09 02:20:38 Other examples in settings use that indentation.
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 * Preferences state.
27 */
28 prefs: {
29 type: Object,
30 notify: true,
31 },
Dan Beam 2015/10/09 01:41:52 where is prefs used?
dschuyler 2015/10/09 02:20:38 It's not used. Done.
32
33 /**
34 * The current active route.
35 */
36 currentRoute: {
37 type: Object,
38 notify: true,
39 },
40
41 /**
42 * A message about whether Chrome is the default browser.
43 */
44 message_: {
45 type: String,
46 },
47
48 /**
49 * Show or hide an error indicator showing whether SetAsDefault succeeded.
50 */
51 showError_: {
52 type: Boolean,
53 value: false,
54 },
55
56 /**
57 * Only show the SetAsDefault button if we have permission to set it.
58 */
59 showButton_: {
60 type: Boolean,
61 },
62 },
63
64 behaviors: [
65 I18nBehavior,
66 ],
67
68 ready: function() {
69 var self = this;
70 cr.define('Settings', function() {
71 return {
72 setAsDefaultConcluded: function() {
73 return self.setAsDefaultConcluded_.apply(self, arguments);
74 },
75 updateDefaultBrowserState: function() {
76 return self.updateDefaultBrowserState_.apply(self, arguments);
77 },
78 };
79 });
80 chrome.send('SettingsDefaultBrowser.requestDefaultBrowserState');
81 },
82
83 /**
84 * @param {boolean} succeeded
85 * @private
86 */
87 setAsDefaultConcluded_: function(succeeded) {
88 this.showError_ = !succeeded;
89 },
90
91 /**
92 * @param {boolean} isDefault Whether Chrome is currently the user's default
93 * browser.
94 * @param {boolean} canBeDefault Whether Chrome can be the default browser on
95 * this system.
96 * @private
97 */
98 updateDefaultBrowserState_: function(isDefault, canBeDefault) {
99 this.showButton_ = !isDefault && canBeDefault;
100 if (canBeDefault) {
101 this.message_ = loadTimeData.getString(isDefault ?
102 'defaultBroswerDefault' :
103 'defaultBroswerNotDefault');
104 } else {
105 this.message_ = loadTimeData.getString('defaultBroswerUnknown');
106 }
107 },
108
109 /** @private */
110 onSetDefaultBrowserTap_: function() {
111 chrome.send('SettingsDefaultBrowser.setAsDefaultBrowser');
112 },
113 });
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698