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

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

Issue 2011703002: MD Settings: About page, hooking up channel switcher dialog. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@about_regulatory_info
Patch Set: Nit. Created 4 years, 6 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 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-about-page' contains version and OS related 6 * @fileoverview 'settings-about-page' contains version and OS related
7 * information. 7 * information.
8 */ 8 */
9 Polymer({ 9 Polymer({
10 is: 'settings-about-page', 10 is: 'settings-about-page',
(...skipping 36 matching lines...) Expand 10 before | Expand all | Expand 10 after
47 * is fixed. 47 * is fixed.
48 */ 48 */
49 sectionSelector: 'settings-section', 49 sectionSelector: 'settings-section',
50 50
51 /** @override */ 51 /** @override */
52 ready: function() { 52 ready: function() {
53 this.browserProxy_ = settings.AboutPageBrowserProxyImpl.getInstance(); 53 this.browserProxy_ = settings.AboutPageBrowserProxyImpl.getInstance();
54 this.browserProxy_.pageReady(); 54 this.browserProxy_.pageReady();
55 55
56 <if expr="chromeos"> 56 <if expr="chromeos">
57 this.addEventListener('target-channel-changed', function(e) {
58 this.targetChannel_ = e.detail;
59 }.bind(this));
dschuyler 2016/05/27 22:16:21 Just a suggestion: I've sometimes had trouble with
dpapad 2016/05/27 23:32:17 Moved it to attached.
60
57 Promise.all([ 61 Promise.all([
58 this.browserProxy_.getCurrentChannel(), 62 this.browserProxy_.getCurrentChannel(),
59 this.browserProxy_.getTargetChannel(), 63 this.browserProxy_.getTargetChannel(),
60 ]).then(function(channels) { 64 ]).then(function(channels) {
61 this.currentChannel_ = channels[0]; 65 this.currentChannel_ = channels[0];
62 this.targetChannel_ = channels[1]; 66 this.targetChannel_ = channels[1];
63 67
64 this.startListening_(); 68 this.startListening_();
65 }.bind(this)); 69 }.bind(this));
66 70
(...skipping 49 matching lines...) Expand 10 before | Expand all | Expand 10 after
116 return this.currentUpdateStatusEvent_.status != UpdateStatus.DISABLED; 120 return this.currentUpdateStatusEvent_.status != UpdateStatus.DISABLED;
117 }, 121 },
118 122
119 /** 123 /**
120 * @return {boolean} 124 * @return {boolean}
121 * @private 125 * @private
122 */ 126 */
123 shouldShowRelaunch_: function() { 127 shouldShowRelaunch_: function() {
124 var shouldShow = false; 128 var shouldShow = false;
125 <if expr="not chromeos"> 129 <if expr="not chromeos">
126 shouldShow = 130 shouldShow = this.checkStatus_(UpdateStatus.NEARLY_UPDATED);
127 this.currentUpdateStatusEvent_.status == UpdateStatus.NEARLY_UPDATED;
128 </if> 131 </if>
129 <if expr="chromeos"> 132 <if expr="chromeos">
130 shouldShow = !this.isTargetChannelMoreStable_() && 133 shouldShow = this.checkStatus_(UpdateStatus.NEARLY_UPDATED) &&
131 this.currentUpdateStatusEvent_.status == UpdateStatus.NEARLY_UPDATED; 134 !this.isTargetChannelMoreStable_();
132 </if> 135 </if>
133 return shouldShow; 136 return shouldShow;
134 }, 137 },
135 138
136 /** 139 /**
137 * @return {string} 140 * @return {string}
138 * @private 141 * @private
139 */ 142 */
140 getUpdateStatusMessage_: function() { 143 getUpdateStatusMessage_: function() {
141 switch (this.currentUpdateStatusEvent_.status) { 144 switch (this.currentUpdateStatusEvent_.status) {
(...skipping 45 matching lines...) Expand 10 before | Expand all | Expand 10 after
187 getIconSrc_: function() { 190 getIconSrc_: function() {
188 switch (this.currentUpdateStatusEvent_.status) { 191 switch (this.currentUpdateStatusEvent_.status) {
189 case UpdateStatus.CHECKING: 192 case UpdateStatus.CHECKING:
190 case UpdateStatus.UPDATING: 193 case UpdateStatus.UPDATING:
191 return 'chrome://resources/images/throbber_small.svg'; 194 return 'chrome://resources/images/throbber_small.svg';
192 default: 195 default:
193 return null; 196 return null;
194 } 197 }
195 }, 198 },
196 199
200 /**
201 * @param {!UpdateStatus} status
202 * @return {boolean}
203 * @private
204 */
205 checkStatus_: function(status) {
206 return this.currentUpdateStatusEvent_.status == status;
207 },
208
197 <if expr="chromeos"> 209 <if expr="chromeos">
198 /** 210 /**
199 * @return {boolean} 211 * @return {boolean}
200 * @private 212 * @private
201 */ 213 */
202 isTargetChannelMoreStable_: function() { 214 isTargetChannelMoreStable_: function() {
203 assert(this.currentChannel_.length > 0); 215 assert(this.currentChannel_.length > 0);
204 assert(this.targetChannel_.length > 0); 216 assert(this.targetChannel_.length > 0);
205 return settings.isTargetChannelMoreStable( 217 return settings.isTargetChannelMoreStable(
206 this.currentChannel_, this.targetChannel_); 218 this.currentChannel_, this.targetChannel_);
207 }, 219 },
208 220
209 /** @private */ 221 /** @private */
210 onDetailedBuildInfoTap_: function() { 222 onDetailedBuildInfoTap_: function() {
211 var animatedPages = /** @type {!SettingsAnimatedPagesElement} */ ( 223 var animatedPages = /** @type {!SettingsAnimatedPagesElement} */ (
212 this.$.pages); 224 this.$.pages);
213 animatedPages.setSubpageChain(['detailed-build-info']); 225 animatedPages.setSubpageChain(['detailed-build-info']);
214 }, 226 },
215 227
216 /** @private */ 228 /** @private */
217 onRelaunchAndPowerwashTap_: function() { 229 onRelaunchAndPowerwashTap_: function() {
218 // TODO(dpapad): Implement this. 230 // TODO(dpapad): Implement this.
219 }, 231 },
220 232
221 /** 233 /**
222 * @return {boolean} 234 * @return {boolean}
223 * @private 235 * @private
224 */ 236 */
225 shouldShowRelaunchAndPowerwash_: function() { 237 shouldShowRelaunchAndPowerwash_: function() {
226 return this.isTargetChannelMoreStable_() && 238 return this.checkStatus_(UpdateStatus.NEARLY_UPDATED) &&
227 this.currentUpdateStatusEvent_.status == UpdateStatus.NEARLY_UPDATED; 239 this.isTargetChannelMoreStable_();
228 }, 240 },
229 241
230 /** @private */ 242 /** @private */
231 onCheckUpdatesTap_: function() { 243 onCheckUpdatesTap_: function() {
232 this.onUpdateStatusChanged_({status: UpdateStatus.CHECKING}); 244 this.onUpdateStatusChanged_({status: UpdateStatus.CHECKING});
233 this.browserProxy_.requestUpdate(); 245 this.browserProxy_.requestUpdate();
234 }, 246 },
235 247
236 /** 248 /**
237 * @return {boolean} 249 * @return {boolean}
238 * @private 250 * @private
239 */ 251 */
240 shouldShowCheckUpdates_: function() { 252 shouldShowCheckUpdates_: function() {
241 return !this.hasCheckedForUpdates_ || 253 return !this.hasCheckedForUpdates_ ||
242 this.currentUpdateStatusEvent_.status == UpdateStatus.FAILED; 254 this.checkStatus_(UpdateStatus.FAILED);
243 }, 255 },
244 256
245 /** 257 /**
246 * @return {boolean} 258 * @return {boolean}
247 * @private 259 * @private
248 */ 260 */
249 shouldShowRegulatoryInfo_: function() { 261 shouldShowRegulatoryInfo_: function() {
250 return this.regulatoryInfo_ !== null; 262 return this.regulatoryInfo_ !== null;
251 }, 263 },
252 </if> 264 </if>
253 265
254 <if expr="_google_chrome"> 266 <if expr="_google_chrome">
255 /** @private */ 267 /** @private */
256 onReportIssueTap_: function() { 268 onReportIssueTap_: function() {
257 this.browserProxy_.openFeedbackDialog(); 269 this.browserProxy_.openFeedbackDialog();
258 }, 270 },
259 </if> 271 </if>
260 }); 272 });
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698