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

Side by Side 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: excluding from chromeos 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 unified diff | Download patch
OLDNEW
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({
11 is: 'settings-default-browser-page', 11 is: 'settings-default-browser-page',
12 12
13 behaviors: [WebUIListenerBehavior],
14
13 properties: { 15 properties: {
14 /** 16 /** @private */
15 * A message about whether Chrome is the default browser. 17 isDefault_: Boolean,
16 */
17 message_: {
18 type: String,
19 },
20 18
21 /** 19 /** @private */
22 * Indicates if the next updateDefaultBrowserState_ invocation is following 20 isSecondaryInstall_: Boolean,
23 * a call to SettingsDefaultBrowser.setAsDefaultBrowser().
24 */
25 startedSetAsDefault_: {
26 type: Boolean,
27 value: false,
28 },
29 21
30 /** 22 /** @private */
31 * Show or hide an error indicator showing whether SetAsDefault succeeded. 23 isUnknownError_: Boolean,
32 */
33 showError_: {
34 type: Boolean,
35 value: false,
36 },
37 24
38 /** 25 /** @private */
39 * Only show the SetAsDefault button if we have permission to set it. 26 maySetDefaultBrowser_: Boolean,
40 */ 27 },
41 showButton_: { 28
42 type: Boolean, 29 /** @private {settings.DefaultBrowserBrowserProxy} */
43 }, 30 browserProxy_: null,
31
32 /** @override */
33 created: function() {
34 this.browserProxy_ = settings.DefaultBrowserBrowserProxyImpl.getInstance();
44 }, 35 },
45 36
46 ready: function() { 37 ready: function() {
47 var self = this; 38 this.addWebUIListener('settings.updateDefaultBrowserState',
48 cr.define('Settings', function() { 39 this.updateDefaultBrowserState_.bind(this));
49 return { 40
50 updateDefaultBrowserState: function() { 41 this.browserProxy_.requestDefaultBrowserState().then(
51 return self.updateDefaultBrowserState_.apply(self, arguments); 42 this.updateDefaultBrowserState_.bind(this));
52 },
53 };
54 });
55 chrome.send('SettingsDefaultBrowser.requestDefaultBrowserState');
56 }, 43 },
57 44
58 /** 45 /**
59 * @param {boolean} isDefault Whether Chrome is currently the user's default 46 * @param {!DefaultBrowserInfo} defaultBrowserState
60 * browser.
61 * @param {boolean} canBeDefault Whether Chrome can be the default browser on
62 * this system.
63 * @private 47 * @private
64 */ 48 */
65 updateDefaultBrowserState_: function(isDefault, canBeDefault) { 49 updateDefaultBrowserState_: function(defaultBrowserState) {
66 if (this.startedSetAsDefault_ && !isDefault) { 50 this.isDefault_ = false;
67 this.startedSetAsDefault_ = false; 51 this.isSecondaryInstall_ = false;
68 this.showError_ = true; 52 this.isUnknownError_ = false;
69 } else { 53 this.maySetDefaultBrowser_ = false;
70 this.showError_ = false;
71 }
72 54
73 this.showButton_ = !isDefault && canBeDefault; 55 if (defaultBrowserState.isDefault)
74 if (!this.showButton_) { 56 this.isDefault_ = true;
75 this.message_ = loadTimeData.getString( 57 else if (!defaultBrowserState.canBeDefault)
76 canBeDefault ? 'defaultBrowserDefault' : 'defaultBrowserUnknown'); 58 this.isSecondaryInstall_ = true;
77 } 59 else if (!defaultBrowserState.isDisabledByPolicy &&
60 !defaultBrowserState.isUnknownError)
61 this.maySetDefaultBrowser_ = true;
62 else
63 this.isUnknownError_ = true;
78 }, 64 },
79 65
80 /** @private */ 66 /** @private */
81 onSetDefaultBrowserTap_: function() { 67 onSetDefaultBrowserTap_: function() {
82 this.startedSetAsDefault_ = true; 68 this.browserProxy_.setAsDefaultBrowser();
83 chrome.send('SettingsDefaultBrowser.setAsDefaultBrowser');
84 }, 69 },
85 }); 70 });
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698