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

Side by Side Diff: chrome/browser/resources/settings/about_page/channel_switcher_dialog.js

Issue 2538043006: Settings: About: Fix cros channel info. (Closed)
Patch Set: . Created 4 years 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 2016 The Chromium Authors. All rights reserved. 1 // Copyright 2016 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 'settings-channel-switcher-dialog' is a component allowing the 6 * @fileoverview 'settings-channel-switcher-dialog' is a component allowing the
7 * user to switch between release channels (dev, beta, stable). A 7 * user to switch between release channels (dev, beta, stable). A
8 * |target-channel-changed| event is fired if the user does select a different 8 * |target-channel-changed| event is fired if the user does select a different
9 * release channel to notify parents of this dialog. 9 * release channel to notify parents of this dialog.
10 */ 10 */
11 Polymer({ 11 Polymer({
12 is: 'settings-channel-switcher-dialog', 12 is: 'settings-channel-switcher-dialog',
13 13
14 behaviors: [I18nBehavior], 14 behaviors: [I18nBehavior],
15 15
16 properties: { 16 properties: {
17 /** @private */ 17 /** @private */
18 browserChannelEnum_: { 18 browserChannelEnum_: {
19 type: Object, 19 type: Object,
20 value: BrowserChannel, 20 value: BrowserChannel,
21 }, 21 },
22 22
23 /** @private {!BrowserChannel} */ 23 /** @private {!BrowserChannel} */
24 currentChannel_: String, 24 targetChannel_: String,
25 25
26 /** 26 /**
27 * Controls which of the two action buttons is visible. 27 * Controls which of the two action buttons is visible.
28 * @private {?{changeChannel: boolean, changeChannelAndPowerwash: boolean}} 28 * @private {?{changeChannel: boolean, changeChannelAndPowerwash: boolean}}
29 */ 29 */
30 shouldShowButtons_: { 30 shouldShowButtons_: {
31 type: Object, 31 type: Object,
32 value: null, 32 value: null,
33 }, 33 },
34 34
35 /** @private {?{title: string, description: string}} */ 35 /** @private {?{title: string, description: string}} */
36 warning_: { 36 warning_: {
37 type: Object, 37 type: Object,
38 value: null, 38 value: null,
39 }, 39 },
40 }, 40 },
41 41
42 /** @private {?settings.AboutPageBrowserProxy} */ 42 /** @private {?settings.AboutPageBrowserProxy} */
43 browserProxy_: null, 43 browserProxy_: null,
44 44
45 /** @override */ 45 /** @override */
46 ready: function() { 46 ready: function() {
47 this.browserProxy_ = settings.AboutPageBrowserProxyImpl.getInstance(); 47 this.browserProxy_ = settings.AboutPageBrowserProxyImpl.getInstance();
48 48
49 this.browserProxy_.getCurrentChannel().then(function(channel) { 49 this.browserProxy_.getTargetChannel().then(function(channel) {
50 this.currentChannel_ = channel; 50 this.targetChannel_ = channel;
51 // Pre-populate radio group with current channel. 51 // Pre-populate radio group with target channel.
52 this.$$('paper-radio-group').select(channel); 52 this.$$('paper-radio-group').select(channel);
53 }.bind(this)); 53 }.bind(this));
54 }, 54 },
55 55
56 /** @override */ 56 /** @override */
57 attached: function() { 57 attached: function() {
58 this.$.dialog.showModal(); 58 this.$.dialog.showModal();
59 }, 59 },
60 60
61 /** @private */ 61 /** @private */
(...skipping 49 matching lines...) Expand 10 before | Expand all | Expand 10 after
111 this.shouldShowButtons_ = { 111 this.shouldShowButtons_ = {
112 changeChannel: changeChannel, 112 changeChannel: changeChannel,
113 changeChannelAndPowerwash: changeChannelAndPowerwash, 113 changeChannelAndPowerwash: changeChannelAndPowerwash,
114 }; 114 };
115 }, 115 },
116 116
117 /** @private */ 117 /** @private */
118 onChannelSelectionChanged_: function() { 118 onChannelSelectionChanged_: function() {
119 var selectedChannel = this.$$('paper-radio-group').selected; 119 var selectedChannel = this.$$('paper-radio-group').selected;
120 120
121 if (selectedChannel == this.currentChannel_) { 121 if (selectedChannel == this.targetChannel_) {
122 this.shouldShowButtons_ = null; 122 this.shouldShowButtons_ = null;
123 this.warning_ = null; 123 this.warning_ = null;
124 return; 124 return;
125 } 125 }
126 126
127 if (settings.isTargetChannelMoreStable( 127 if (settings.isTargetChannelMoreStable(
128 this.currentChannel_, selectedChannel)) { 128 this.targetChannel_, selectedChannel)) {
dpapad 2016/12/02 23:27:12 I am confused by the currentChannel -> targetChann
dpapad 2016/12/02 23:29:43 Also see equivalent logic in the old page, https:/
stevenjb 2016/12/02 23:54:39 We want to show the *target* channel as selected i
dpapad 2016/12/03 00:02:32 Ok. In case it helps, this is my understanding (wh
stevenjb 2016/12/06 20:38:02 OK, I think I have the logic correct now. We do ne
129 if (loadTimeData.getBoolean('aboutEnterpriseManaged')) { 129 if (loadTimeData.getBoolean('aboutEnterpriseManaged')) {
130 this.updateWarning_( 130 this.updateWarning_(
131 'aboutDelayedWarningTitle', 131 'aboutDelayedWarningTitle',
132 'aboutDelayedWarningMessage', 132 'aboutDelayedWarningMessage',
133 'aboutProductTitle'); 133 'aboutProductTitle');
134 this.updateButtons_(true, false); 134 this.updateButtons_(true, false);
135 } else { 135 } else {
136 this.updateWarning_( 136 this.updateWarning_(
137 'aboutPowerwashWarningTitle', 'aboutPowerwashWarningMessage'); 137 'aboutPowerwashWarningTitle', 'aboutPowerwashWarningMessage');
138 this.updateButtons_(false, true); 138 this.updateButtons_(false, true);
139 } 139 }
140 } else { 140 } else {
141 this.updateWarning_( 141 this.updateWarning_(
142 'aboutUnstableWarningTitle', 142 'aboutUnstableWarningTitle',
143 'aboutUnstableWarningMessage', 143 'aboutUnstableWarningMessage',
144 'aboutProductTitle'); 144 'aboutProductTitle');
145 this.updateButtons_(true, false); 145 this.updateButtons_(true, false);
146 } 146 }
147 }, 147 },
148 148
149 /** 149 /**
150 * @return {boolean} 150 * @return {boolean}
151 * @private 151 * @private
152 */ 152 */
153 shouldShowWarning_: function() { 153 shouldShowWarning_: function() {
154 return this.warning_ !== null; 154 return this.warning_ !== null;
155 }, 155 },
156 }); 156 });
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698