Chromium Code Reviews| OLD | NEW |
|---|---|
| 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', |
| 11 | 11 |
| 12 behaviors: [WebUIListenerBehavior, MainPageBehavior, I18nBehavior], | 12 behaviors: [WebUIListenerBehavior, MainPageBehavior, I18nBehavior], |
| 13 | 13 |
| 14 properties: { | 14 properties: { |
| 15 /** @private {?UpdateStatusChangedEvent} */ | 15 /** @private {?UpdateStatusChangedEvent} */ |
| 16 currentUpdateStatusEvent_: { | 16 currentUpdateStatusEvent_: { |
| 17 type: Object, | 17 type: Object, |
| 18 value: {message: '', progress: 0, status: UpdateStatus.DISABLED}, | 18 value: {message: '', progress: 0, status: UpdateStatus.DISABLED}, |
| 19 }, | 19 }, |
| 20 | 20 |
| 21 <if expr="chromeos"> | 21 <if expr="chromeos"> |
| 22 /** @private */ | 22 /** @private */ |
| 23 hasCheckedForUpdates_: Boolean, | 23 hasCheckedForUpdates_: { |
| 24 type: Boolean, | |
| 25 value: false, | |
| 26 }, | |
| 24 | 27 |
| 25 /** @private {!BrowserChannel} */ | 28 /** @private {!BrowserChannel} */ |
| 26 currentChannel_: String, | 29 currentChannel_: String, |
| 27 | 30 |
| 28 /** @private {!BrowserChannel} */ | 31 /** @private {!BrowserChannel} */ |
| 29 targetChannel_: String, | 32 targetChannel_: String, |
| 30 | 33 |
| 31 /** @private {?RegulatoryInfo} */ | 34 /** @private {?RegulatoryInfo} */ |
| 32 regulatoryInfo_: Object, | 35 regulatoryInfo_: Object, |
| 33 </if> | 36 </if> |
| 34 | 37 |
| 35 /** @private {!{obsolete: boolean, endOfLine: boolean}} */ | 38 /** @private {!{obsolete: boolean, endOfLine: boolean}} */ |
| 36 obsoleteSystemInfo_: { | 39 obsoleteSystemInfo_: { |
| 37 type: Object, | 40 type: Object, |
| 38 value: function() { | 41 value: function() { |
| 39 return { | 42 return { |
| 40 obsolete: loadTimeData.getBoolean('aboutObsoleteNowOrSoon'), | 43 obsolete: loadTimeData.getBoolean('aboutObsoleteNowOrSoon'), |
| 41 endOfLine: loadTimeData.getBoolean('aboutObsoleteEndOfTheLine'), | 44 endOfLine: loadTimeData.getBoolean('aboutObsoleteEndOfTheLine'), |
| 42 }; | 45 }; |
| 43 }, | 46 }, |
| 44 }, | 47 }, |
| 48 | |
| 49 /** @private */ | |
| 50 showUpdateStatus_: { | |
| 51 type: Boolean, | |
| 52 computed: (function() { | |
|
dpapad
2016/12/05 23:59:47
This is unfortunately necessary to make the Closur
Dan Beam
2016/12/06 00:16:51
why can't you just make different member names, i.
Dan Beam
2016/12/06 00:17:26
we also talked about this: https://gist.github.com
dpapad
2016/12/06 00:23:41
If I understand the suggestion, that would defeat
Dan Beam
2016/12/06 00:29:44
then make them observers instead of computed prope
| |
| 53 var binding = null; | |
| 54 <if expr="not chromeos"> | |
| 55 binding = 'computeShowUpdateStatus_(' + | |
| 56 'obsoleteSystemInfo_, currentUpdateStatusEvent_)'; | |
| 57 </if> | |
| 58 <if expr="chromeos"> | |
| 59 binding = 'computeShowUpdateStatus_(' + | |
| 60 'obsoleteSystemInfo_, currentUpdateStatusEvent_,' + | |
| 61 'hasCheckedForUpdates_)'; | |
| 62 </if> | |
| 63 return binding; | |
| 64 })(), | |
| 65 }, | |
| 66 | |
| 67 /** @private */ | |
| 68 showRelaunch_: { | |
| 69 type: Boolean, | |
| 70 computed: (function() { | |
| 71 var binding = null; | |
| 72 <if expr="not chromeos"> | |
| 73 binding = 'computeShowRelaunch_(currentUpdateStatusEvent_)'; | |
| 74 </if> | |
| 75 <if expr="chromeos"> | |
| 76 binding = 'computeShowRelaunch_(' + | |
| 77 'currentUpdateStatusEvent_, targetChannel_)'; | |
| 78 </if> | |
| 79 return binding; | |
| 80 })(), | |
| 81 }, | |
| 82 | |
| 83 <if expr="chromeos"> | |
| 84 /** @private */ | |
| 85 showRelaunchAndPowerwash_: { | |
| 86 type: Boolean, | |
| 87 computed: 'computeShowRelaunchAndPowerwash_(' + | |
| 88 'currentUpdateStatusEvent_, targetChannel_)', | |
| 89 }, | |
| 90 | |
| 91 /** @private */ | |
| 92 showCheckUpdates_: { | |
| 93 type: Boolean, | |
| 94 computed: 'computeShowCheckUpdates_(currentUpdateStatusEvent_)', | |
| 95 }, | |
| 96 </if> | |
| 97 | |
| 98 /** @private */ | |
| 99 showButtonContainer_: { | |
| 100 type: Boolean, | |
| 101 computed: (function() { | |
| 102 var binding = null; | |
| 103 <if expr="not chromeos"> | |
| 104 binding = 'computeShowButtonContainer_(showRelaunch_)'; | |
| 105 </if> | |
| 106 <if expr="chromeos"> | |
| 107 binding = 'computeShowButtonContainer_(' + | |
| 108 'showRelaunch_, showRelaunchAndPowerwash_, showCheckUpdates_)'; | |
| 109 </if> | |
| 110 return binding; | |
| 111 })(), | |
| 112 }, | |
| 45 }, | 113 }, |
| 46 | 114 |
| 47 /** @private {?settings.AboutPageBrowserProxy} */ | 115 /** @private {?settings.AboutPageBrowserProxy} */ |
| 48 aboutBrowserProxy_: null, | 116 aboutBrowserProxy_: null, |
| 49 | 117 |
| 50 /** @private {?settings.LifetimeBrowserProxy} */ | 118 /** @private {?settings.LifetimeBrowserProxy} */ |
| 51 lifetimeBrowserProxy_: null, | 119 lifetimeBrowserProxy_: null, |
| 52 | 120 |
| 53 /** @override */ | 121 /** @override */ |
| 54 attached: function() { | 122 attached: function() { |
| (...skipping 54 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 109 | 177 |
| 110 /** @private */ | 178 /** @private */ |
| 111 onRelaunchTap_: function() { | 179 onRelaunchTap_: function() { |
| 112 this.lifetimeBrowserProxy_.relaunch(); | 180 this.lifetimeBrowserProxy_.relaunch(); |
| 113 }, | 181 }, |
| 114 | 182 |
| 115 /** | 183 /** |
| 116 * @return {boolean} | 184 * @return {boolean} |
| 117 * @private | 185 * @private |
| 118 */ | 186 */ |
| 119 shouldShowUpdateStatusMessage_: function() { | 187 computeShowUpdateStatus_: function() { |
| 188 <if expr="chromeos"> | |
| 189 // Assume the "updated" status is stale if we haven't checked yet. | |
| 190 if (this.currentUpdateStatusEvent_.status == UpdateStatus.UPDATED && | |
| 191 !this.hasCheckedForUpdates_) { | |
| 192 return false; | |
| 193 } | |
| 194 </if> | |
| 120 return this.currentUpdateStatusEvent_.status != UpdateStatus.DISABLED && | 195 return this.currentUpdateStatusEvent_.status != UpdateStatus.DISABLED && |
| 121 !this.obsoleteSystemInfo_.endOfLine; | 196 !this.obsoleteSystemInfo_.endOfLine; |
| 122 }, | 197 }, |
| 123 | 198 |
| 124 /** | 199 /** |
| 200 * Hide the button container if all buttons are hidden, otherwise the | |
| 201 * container displayes an unwanted border (see secondary-action class). | |
| 202 * @return {boolean} | |
| 203 * @private | |
| 204 */ | |
| 205 computeShowButtonContainer_: function() { | |
| 206 var shouldShow = this.showRelaunch_; | |
| 207 <if expr="chromeos"> | |
| 208 shouldShow = shouldShow || this.showRelaunchAndPowerwash_ || | |
| 209 this.showCheckUpdates_; | |
| 210 </if> | |
| 211 return shouldShow; | |
| 212 }, | |
| 213 | |
| 214 /** | |
| 125 * @return {boolean} | 215 * @return {boolean} |
| 126 * @private | 216 * @private |
| 127 */ | 217 */ |
| 128 shouldShowUpdateStatusIcon_: function() { | 218 computeShowRelaunch_: function() { |
| 129 return this.currentUpdateStatusEvent_.status != UpdateStatus.DISABLED || | |
| 130 this.obsoleteSystemInfo_.endOfLine; | |
| 131 }, | |
| 132 | |
| 133 /** | |
| 134 * @return {boolean} | |
| 135 * @private | |
| 136 */ | |
| 137 shouldShowRelaunch_: function() { | |
| 138 var shouldShow = false; | 219 var shouldShow = false; |
| 139 <if expr="not chromeos"> | 220 <if expr="not chromeos"> |
| 140 shouldShow = this.checkStatus_(UpdateStatus.NEARLY_UPDATED); | 221 shouldShow = this.checkStatus_(UpdateStatus.NEARLY_UPDATED); |
| 141 </if> | 222 </if> |
| 142 <if expr="chromeos"> | 223 <if expr="chromeos"> |
| 143 shouldShow = this.checkStatus_(UpdateStatus.NEARLY_UPDATED) && | 224 shouldShow = this.checkStatus_(UpdateStatus.NEARLY_UPDATED) && |
| 144 !this.isTargetChannelMoreStable_(); | 225 !this.isTargetChannelMoreStable_(); |
| 145 </if> | 226 </if> |
| 146 return shouldShow; | 227 return shouldShow; |
| 147 }, | 228 }, |
| (...skipping 110 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 258 | 339 |
| 259 /** @private */ | 340 /** @private */ |
| 260 onRelaunchAndPowerwashTap_: function() { | 341 onRelaunchAndPowerwashTap_: function() { |
| 261 this.lifetimeBrowserProxy_.factoryReset(); | 342 this.lifetimeBrowserProxy_.factoryReset(); |
| 262 }, | 343 }, |
| 263 | 344 |
| 264 /** | 345 /** |
| 265 * @return {boolean} | 346 * @return {boolean} |
| 266 * @private | 347 * @private |
| 267 */ | 348 */ |
| 268 shouldShowRelaunchAndPowerwash_: function() { | 349 computeShowRelaunchAndPowerwash_: function() { |
| 269 return this.checkStatus_(UpdateStatus.NEARLY_UPDATED) && | 350 return this.checkStatus_(UpdateStatus.NEARLY_UPDATED) && |
| 270 this.isTargetChannelMoreStable_(); | 351 this.isTargetChannelMoreStable_(); |
| 271 }, | 352 }, |
| 272 | 353 |
| 273 /** @private */ | 354 /** @private */ |
| 274 onCheckUpdatesTap_: function() { | 355 onCheckUpdatesTap_: function() { |
| 275 this.onUpdateStatusChanged_({status: UpdateStatus.CHECKING}); | 356 this.onUpdateStatusChanged_({status: UpdateStatus.CHECKING}); |
| 276 this.aboutBrowserProxy_.requestUpdate(); | 357 this.aboutBrowserProxy_.requestUpdate(); |
| 277 }, | 358 }, |
| 278 | 359 |
| 279 /** | 360 /** |
| 280 * @return {boolean} | 361 * @return {boolean} |
| 281 * @private | 362 * @private |
| 282 */ | 363 */ |
| 283 shouldShowCheckUpdates_: function() { | 364 computeShowCheckUpdates_: function() { |
| 284 return !this.hasCheckedForUpdates_ || | 365 return !this.hasCheckedForUpdates_ || |
| 285 this.checkStatus_(UpdateStatus.FAILED); | 366 this.checkStatus_(UpdateStatus.FAILED); |
| 286 }, | 367 }, |
| 287 | 368 |
| 288 /** | 369 /** |
| 289 * @return {boolean} | 370 * @return {boolean} |
| 290 * @private | 371 * @private |
| 291 */ | 372 */ |
| 292 shouldShowRegulatoryInfo_: function() { | 373 shouldShowRegulatoryInfo_: function() { |
| 293 return this.regulatoryInfo_ !== null; | 374 return this.regulatoryInfo_ !== null; |
| (...skipping 10 matching lines...) Expand all Loading... | |
| 304 }); | 385 }); |
| 305 }, | 386 }, |
| 306 | 387 |
| 307 <if expr="_google_chrome"> | 388 <if expr="_google_chrome"> |
| 308 /** @private */ | 389 /** @private */ |
| 309 onReportIssueTap_: function() { | 390 onReportIssueTap_: function() { |
| 310 this.aboutBrowserProxy_.openFeedbackDialog(); | 391 this.aboutBrowserProxy_.openFeedbackDialog(); |
| 311 }, | 392 }, |
| 312 </if> | 393 </if> |
| 313 }); | 394 }); |
| OLD | NEW |