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

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

Issue 1997453006: MD Settings: About page, updating buttons based on current update status. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@about_page_main3
Patch Set: Nits. Created 4 years, 7 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 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 4bcac8cc686f37c9b957259808b84096f843b37f..c1d6b03422b267e8141d770b367fb8cd613748c4 100644
--- a/chrome/browser/resources/settings/about_page/about_page.js
+++ b/chrome/browser/resources/settings/about_page/about_page.js
@@ -24,11 +24,11 @@ Polymer({
currentUpdateStatusEvent_: Object,
<if expr="chromeos">
- /**
- * Whether the current and target channel is different.
- * @private
- */
- channelsDiffer_: Boolean,
+ /** private */
+ hasCheckedForUpdates_: Boolean,
+
+ /** @private {!BrowserChannel} */
+ currentChannel_: String,
/** @private {!BrowserChannel} */
targetChannel_: String,
@@ -55,8 +55,9 @@ Polymer({
this.browserProxy_.getCurrentChannel(),
this.browserProxy_.getTargetChannel(),
]).then(function(channels) {
+ this.currentChannel_ = channels[0];
this.targetChannel_ = channels[1];
- this.channelsDiffer_ = channels[0] != this.targetChannel_;
+
this.startListening_();
}.bind(this));
</if>
@@ -69,14 +70,24 @@ Polymer({
startListening_: function() {
this.addWebUIListener(
'update-status-changed',
- /** @param {!UpdateStatusChangedEvent} event */
- function(event) {
- this.currentUpdateStatusEvent_ = event;
- }.bind(this));
+ this.onUpdateStatusChanged_.bind(this));
this.browserProxy_.refreshUpdateStatus();
+ window.setUpdateStatus = this.onUpdateStatusChanged_.bind(this);
tommycli 2016/05/20 22:53:19 Was this a leftover also?
dpapad 2016/05/20 23:25:36 Ah yes. Removed.
},
- /** @override */
+ /**
+ * @param {!UpdateStatusChangedEvent} event
+ * @private
+ */
+ onUpdateStatusChanged_: function(event) {
+<if expr="chromeos">
+ if (event.status == UpdateStatus.CHECKING)
+ this.hasCheckedForUpdates_ = true;
+</if>
+ this.currentUpdateStatusEvent_ = event;
+ },
+
+ /** @override */
attached: function() {
this.scroller = this.parentElement;
},
@@ -86,6 +97,11 @@ Polymer({
this.browserProxy_.openHelpPage();
},
+ /** @private */
+ onRelaunchTap_: function() {
+ this.browserProxy_.relaunchNow();
+ },
+
/**
* @return {boolean}
* @private
@@ -95,6 +111,23 @@ Polymer({
},
/**
+ * @return {boolean}
+ * @private
+ */
+ shouldShowRelaunch_: function() {
+ var shouldShow = false;
+<if expr="not chromeos">
+ shouldShow =
+ this.currentUpdateStatusEvent_.status == UpdateStatus.NEARLY_UPDATED;
+</if>
+<if expr="chromeos">
+ shouldShow = !this.isTargetChannelMoreStable_() &&
+ this.currentUpdateStatusEvent_.status == UpdateStatus.NEARLY_UPDATED;
+</if>
+ return shouldShow;
+ },
+
+ /**
* @return {string}
* @private
*/
@@ -104,7 +137,7 @@ Polymer({
return this.i18n('aboutUpgradeCheckStarted');
case UpdateStatus.NEARLY_UPDATED:
<if expr="chromeos">
- if (this.channelsDiffer_)
+ if (this.currentChannel_ != this.targetChannel_)
return this.i18n('aboutUpgradeSuccessChannelSwitch');
</if>
return this.i18n('aboutUpgradeRelaunch');
@@ -112,14 +145,14 @@ Polymer({
return this.i18n('aboutUpgradeUpToDate');
case UpdateStatus.UPDATING:
<if expr="chromeos">
- if (this.channelsDiffer_) {
+ if (this.currentChannel_ != this.targetChannel_) {
return this.i18n('aboutUpgradeUpdatingChannelSwitch',
this.i18n(settings.browserChannelToI18nId(this.targetChannel_)));
}
</if>
return this.i18n('aboutUpgradeUpdating');
default:
- return this.currentUpdateStatusEvent_.message;
+ return this.currentUpdateStatusEvent_.message || '';
}
},
@@ -156,12 +189,57 @@ Polymer({
},
<if expr="chromeos">
+ /**
+ * @return {boolean}
+ * @private
+ */
+ isTargetChannelMoreStable_: function() {
+ // List of channels in increasing stability order.
+ var channelList = [
+ BrowserChannel.DEV,
+ BrowserChannel.BETA,
+ BrowserChannel.STABLE,
+ ];
+ var currentIndex = channelList.indexOf(this.currentChannel_);
+ var targetIndex = channelList.indexOf(this.targetChannel_);
+ return currentIndex < targetIndex;
+ },
+
/** @private */
onDetailedBuildInfoTap_: function() {
var animatedPages = /** @type {!SettingsAnimatedPagesElement} */ (
this.$.pages);
animatedPages.setSubpageChain(['detailed-build-info']);
},
+
+ /** @private */
+ onRelaunchAndPowerwashTap_: function() {
+ // TODO(dpapad): Implement this.
+ },
+
+ /**
+ * @return {boolean}
+ * @private
+ */
+ shouldShowRelaunchAndPowerwash_: function() {
+ return this.isTargetChannelMoreStable_() &&
+ this.currentUpdateStatusEvent_.status == UpdateStatus.NEARLY_UPDATED;
+ },
+
+ /** @private */
+ onCheckUpdatesTap_: function() {
+ this.onUpdateStatusChanged_({status: UpdateStatus.CHECKING});
+ this.browserProxy_.requestUpdate();
+ },
+
+ /**
+ * @return {boolean}
+ * @private
+ */
+ shouldShowCheckUpdates_: function() {
+ return !this.hasCheckedForUpdates_ ||
+ this.currentUpdateStatusEvent_.status == UpdateStatus.FAILED;
+ },
</if>
<if expr="_google_chrome">

Powered by Google App Engine
This is Rietveld 408576698