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

Unified Diff: chrome/browser/resources/settings/about_page/about_page.js

Issue 2538283002: MD Settings: Fix "Check for updates" button regression. (Closed)
Patch Set: Use observers. 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 side-by-side diff with in-line comments
Download patch
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..df954057054e52b86f23d5d07219e201ffa8e8d7 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,60 @@ 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: [
+<if expr="not chromeos">
+ 'updateShowUpdateStatus_(' +
+ 'obsoleteSystemInfo_, currentUpdateStatusEvent_)',
+</if>
+<if expr="chromeos">
+ 'updateShowUpdateStatus_(' +
+ 'obsoleteSystemInfo_, currentUpdateStatusEvent_,' +
+ 'hasCheckedForUpdates_)',
+</if>
+
+<if expr="not chromeos">
+ 'updateShowRelaunch_(currentUpdateStatusEvent_)',
+</if>
+<if expr="chromeos">
+ 'updateShowRelaunch_(currentUpdateStatusEvent_, targetChannel_)',
+</if>
+
+<if expr="not chromeos">
+ 'updateShowButtonContainer_(showRelaunch_)',
+</if>
+<if expr="chromeos">
+ 'updateShowButtonContainer_(' +
+ 'showRelaunch_, showRelaunchAndPowerwash_,showCheckUpdates_)',
+</if>
Dan Beam 2016/12/06 02:03:18 can put each observer into a single if here? i.e.
dpapad 2016/12/06 17:00:40 Done.
+ ],
+
+
/** @private {?settings.AboutPageBrowserProxy} */
aboutBrowserProxy_: null,
@@ -112,38 +167,43 @@ 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() {
+ this.showButtonContainer_ = this.showRelaunch_;
+<if expr="chromeos">
+ this.showButtonContainer_ = this.showButtonContainer_ ||
+ this.showRelaunchAndPowerwash_ || this.showCheckUpdates_;
Dan Beam 2016/12/06 02:03:18 can you avoid setting this twice for the sake of o
dpapad 2016/12/06 17:00:40 Done (avoided setting it twice) , but in a simpler
+</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 02:03:18 var showRelaunch = this.checkStatus_(UpdateStatus.
dpapad 2016/12/06 17:00:40 Acknowledged. I think that completely separating t
- return shouldShow;
},
/**
@@ -265,7 +325,7 @@ Polymer({
* @return {boolean}
* @private
*/
- shouldShowRelaunchAndPowerwash_: function() {
+ computeShowRelaunchAndPowerwash_: function() {
return this.checkStatus_(UpdateStatus.NEARLY_UPDATED) &&
this.isTargetChannelMoreStable_();
},
@@ -280,7 +340,7 @@ Polymer({
* @return {boolean}
* @private
*/
- shouldShowCheckUpdates_: function() {
+ computeShowCheckUpdates_: function() {
return !this.hasCheckedForUpdates_ ||
this.checkStatus_(UpdateStatus.FAILED);
},
« no previous file with comments | « chrome/browser/resources/settings/about_page/about_page.html ('k') | chrome/test/data/webui/settings/about_page_tests.js » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698