Chromium Code Reviews| Index: chrome/browser/resources/settings/about_page/about_page.js |
| diff --git a/chrome/browser/resources/settings/about_page/about_page.js b/chrome/browser/resources/settings/about_page/about_page.js |
| index 966bee8e2b605b9cc5428fc902e22d02d78e5ed7..a3c304a5398ebab5129a357973a3ce78ce816394 100644 |
| --- a/chrome/browser/resources/settings/about_page/about_page.js |
| +++ b/chrome/browser/resources/settings/about_page/about_page.js |
| @@ -20,7 +20,10 @@ Polymer({ |
| <if expr="chromeos"> |
| /** @private */ |
| - hasCheckedForUpdates_: Boolean, |
| + hasCheckedForUpdates_: { |
| + type: Boolean, |
| + value: false, |
| + }, |
| /** @private {!BrowserChannel} */ |
| currentChannel_: String, |
| @@ -42,8 +45,51 @@ Polymer({ |
| }; |
| }, |
| }, |
| + |
| + /** @private */ |
| + showUpdateStatus_: Boolean, |
| + |
| + /** @private */ |
| + showButtonContainer_: Boolean, |
| + |
| + /** @private */ |
| + showRelaunch_: Boolean, |
| + |
| +<if expr="chromeos"> |
| + /** @private */ |
| + showRelaunchAndPowerwash_: { |
| + type: Boolean, |
| + computed: 'computeShowRelaunchAndPowerwash_(' + |
| + 'currentUpdateStatusEvent_, targetChannel_)', |
| + }, |
| + |
| + /** @private */ |
| + showCheckUpdates_: { |
| + type: Boolean, |
| + computed: 'computeShowCheckUpdates_(currentUpdateStatusEvent_)', |
| + }, |
| +</if> |
| }, |
| + observers: [ |
|
dschuyler
2016/12/06 19:41:21
Maybe a comment about why this is done this way?
dpapad
2016/12/06 21:54:00
I tried to think of a helpful comment here, but ev
|
| +<if expr="not chromeos"> |
| + 'updateShowUpdateStatus_(' + |
| + 'obsoleteSystemInfo_, currentUpdateStatusEvent_)', |
| + 'updateShowRelaunch_(currentUpdateStatusEvent_)', |
| + 'updateShowButtonContainer_(showRelaunch_)', |
| +</if> |
| + |
| +<if expr="chromeos"> |
| + 'updateShowUpdateStatus_(' + |
| + 'obsoleteSystemInfo_, currentUpdateStatusEvent_,' + |
| + 'hasCheckedForUpdates_)', |
| + 'updateShowRelaunch_(currentUpdateStatusEvent_, targetChannel_)', |
| + 'updateShowButtonContainer_(' + |
| + 'showRelaunch_, showRelaunchAndPowerwash_,showCheckUpdates_)', |
|
dschuyler
2016/12/06 19:41:21
nit: space after comma
dpapad
2016/12/06 21:54:00
Done.
|
| +</if> |
| + ], |
| + |
| + |
| /** @private {?settings.AboutPageBrowserProxy} */ |
| aboutBrowserProxy_: null, |
| @@ -112,38 +158,45 @@ Polymer({ |
| this.lifetimeBrowserProxy_.relaunch(); |
| }, |
| - /** |
| - * @return {boolean} |
| - * @private |
| - */ |
| - shouldShowUpdateStatusMessage_: function() { |
| - return this.currentUpdateStatusEvent_.status != UpdateStatus.DISABLED && |
| + /** @private */ |
| + updateShowUpdateStatus_: function() { |
| +<if expr="chromeos"> |
| + // Assume the "updated" status is stale if we haven't checked yet. |
| + if (this.currentUpdateStatusEvent_.status == UpdateStatus.UPDATED && |
| + !this.hasCheckedForUpdates_) { |
| + this.showUpdateStatus_ = false; |
| + return; |
| + } |
| +</if> |
| + this.showUpdateStatus_ = |
| + this.currentUpdateStatusEvent_.status != UpdateStatus.DISABLED && |
| !this.obsoleteSystemInfo_.endOfLine; |
| }, |
| /** |
| - * @return {boolean} |
| + * Hide the button container if all buttons are hidden, otherwise the |
| + * container displayes an unwanted border (see secondary-action class). |
| * @private |
| */ |
| - shouldShowUpdateStatusIcon_: function() { |
| - return this.currentUpdateStatusEvent_.status != UpdateStatus.DISABLED || |
| - this.obsoleteSystemInfo_.endOfLine; |
| + updateShowButtonContainer_: function() { |
| +<if expr="not chromeos"> |
| + this.showButtonContainer_ = this.showRelaunch_; |
| +</if> |
| +<if expr="chromeos"> |
| + this.showButtonContainer_ = this.showRelaunch_ || |
| + this.showRelaunchAndPowerwash_ || this.showCheckUpdates_; |
| +</if> |
| }, |
| - /** |
| - * @return {boolean} |
| - * @private |
| - */ |
| - shouldShowRelaunch_: function() { |
| - var shouldShow = false; |
| + /** @private */ |
| + updateShowRelaunch_: function() { |
| <if expr="not chromeos"> |
| - shouldShow = this.checkStatus_(UpdateStatus.NEARLY_UPDATED); |
| + this.showRelaunch_ = this.checkStatus_(UpdateStatus.NEARLY_UPDATED); |
| </if> |
| <if expr="chromeos"> |
| - shouldShow = this.checkStatus_(UpdateStatus.NEARLY_UPDATED) && |
| + this.showRelaunch_ = this.checkStatus_(UpdateStatus.NEARLY_UPDATED) && |
| !this.isTargetChannelMoreStable_(); |
| </if> |
|
Dan Beam
2016/12/06 19:10:20
i would argue that this is still more duplicative
|
| - return shouldShow; |
| }, |
| /** |
| @@ -265,7 +318,7 @@ Polymer({ |
| * @return {boolean} |
| * @private |
| */ |
| - shouldShowRelaunchAndPowerwash_: function() { |
| + computeShowRelaunchAndPowerwash_: function() { |
| return this.checkStatus_(UpdateStatus.NEARLY_UPDATED) && |
| this.isTargetChannelMoreStable_(); |
| }, |
| @@ -280,7 +333,7 @@ Polymer({ |
| * @return {boolean} |
| * @private |
| */ |
| - shouldShowCheckUpdates_: function() { |
| + computeShowCheckUpdates_: function() { |
| return !this.hasCheckedForUpdates_ || |
| this.checkStatus_(UpdateStatus.FAILED); |
| }, |