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

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

Issue 1987813004: MD Settings: About page, implementing update status. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Update test, after changing "=" to "$=" 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 44da2984db37bcaad55952fe8a64205d4ebaae3e..4bcac8cc686f37c9b957259808b84096f843b37f 100644
--- a/chrome/browser/resources/settings/about_page/about_page.js
+++ b/chrome/browser/resources/settings/about_page/about_page.js
@@ -9,7 +9,7 @@
Polymer({
is: 'settings-about-page',
- behaviors: [RoutableBehavior],
+ behaviors: [WebUIListenerBehavior, RoutableBehavior, I18nBehavior],
properties: {
/**
@@ -19,6 +19,20 @@ Polymer({
type: Object,
notify: true,
},
+
+ /** @private {?UpdateStatusChangedEvent} */
+ currentUpdateStatusEvent_: Object,
+
+<if expr="chromeos">
+ /**
+ * Whether the current and target channel is different.
+ * @private
+ */
+ channelsDiffer_: Boolean,
+
+ /** @private {!BrowserChannel} */
+ targetChannel_: String,
+</if>
},
/** @private {?settings.AboutPageBrowserProxy} */
@@ -34,6 +48,32 @@ Polymer({
/** @override */
ready: function() {
this.browserProxy_ = settings.AboutPageBrowserProxyImpl.getInstance();
+ this.browserProxy_.pageReady();
+
+<if expr="chromeos">
+ Promise.all([
+ this.browserProxy_.getCurrentChannel(),
+ this.browserProxy_.getTargetChannel(),
+ ]).then(function(channels) {
+ this.targetChannel_ = channels[1];
+ this.channelsDiffer_ = channels[0] != this.targetChannel_;
+ this.startListening_();
+ }.bind(this));
+</if>
+<if expr="not chromeos">
+ this.startListening_();
+</if>
+ },
+
+ /** @private */
+ startListening_: function() {
+ this.addWebUIListener(
+ 'update-status-changed',
+ /** @param {!UpdateStatusChangedEvent} event */
+ function(event) {
+ this.currentUpdateStatusEvent_ = event;
+ }.bind(this));
+ this.browserProxy_.refreshUpdateStatus();
},
/** @override */
@@ -46,6 +86,75 @@ Polymer({
this.browserProxy_.openHelpPage();
},
+ /**
+ * @return {boolean}
+ * @private
+ */
+ shouldShowUpdateStatus_: function() {
+ return this.currentUpdateStatusEvent_.status != UpdateStatus.DISABLED;
+ },
+
+ /**
+ * @return {string}
+ * @private
+ */
+ getUpdateStatusMessage_: function() {
+ switch (this.currentUpdateStatusEvent_.status) {
+ case UpdateStatus.CHECKING:
+ return this.i18n('aboutUpgradeCheckStarted');
+ case UpdateStatus.NEARLY_UPDATED:
+<if expr="chromeos">
+ if (this.channelsDiffer_)
+ return this.i18n('aboutUpgradeSuccessChannelSwitch');
+</if>
+ return this.i18n('aboutUpgradeRelaunch');
+ case UpdateStatus.UPDATED:
+ return this.i18n('aboutUpgradeUpToDate');
+ case UpdateStatus.UPDATING:
+<if expr="chromeos">
+ if (this.channelsDiffer_) {
+ return this.i18n('aboutUpgradeUpdatingChannelSwitch',
+ this.i18n(settings.browserChannelToI18nId(this.targetChannel_)));
+ }
+</if>
+ return this.i18n('aboutUpgradeUpdating');
+ default:
+ return this.currentUpdateStatusEvent_.message;
+ }
+ },
+
+ /**
+ * @return {?string}
+ * @private
+ */
+ getIcon_: function() {
+ switch (this.currentUpdateStatusEvent_.status) {
+ case UpdateStatus.DISABLED_BY_ADMIN:
+ return 'cr:domain';
+ case UpdateStatus.FAILED:
+ return 'settings:error';
+ case UpdateStatus.UPDATED:
+ case UpdateStatus.NEARLY_UPDATED:
+ return 'settings:check-circle';
+ default:
+ return null;
+ }
+ },
+
+ /**
+ * @return {?string}
+ * @private
+ */
+ getIconSrc_: function() {
+ switch (this.currentUpdateStatusEvent_.status) {
+ case UpdateStatus.CHECKING:
+ case UpdateStatus.UPDATING:
+ return 'chrome://resources/images/throbber_small.svg';
+ default:
+ return null;
+ }
+ },
+
<if expr="chromeos">
/** @private */
onDetailedBuildInfoTap_: function() {

Powered by Google App Engine
This is Rietveld 408576698