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

Unified Diff: ash/system/update/tray_update.cc

Issue 2882933002: Add update available icon in system tray (Closed)
Patch Set: Delay RequestUpdateCheck until the aboutChromeOS page is loaded Created 3 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: ash/system/update/tray_update.cc
diff --git a/ash/system/update/tray_update.cc b/ash/system/update/tray_update.cc
index a88ae9c671d86f174fbb3b2a2568b7e6361fe6a6..b4a186f42377082d211ac6d1829208c1702e23a0 100644
--- a/ash/system/update/tray_update.cc
+++ b/ash/system/update/tray_update.cc
@@ -60,6 +60,9 @@ bool TrayUpdate::update_required_ = false;
mojom::UpdateSeverity TrayUpdate::severity_ = mojom::UpdateSeverity::NONE;
// static
bool TrayUpdate::factory_reset_required_ = false;
+// static
+bool TrayUpdate::update_over_cellular_available_ = false;
+
mojom::UpdateType TrayUpdate::update_type_ = mojom::UpdateType::SYSTEM;
// The "restart to update" item in the system tray menu.
@@ -85,6 +88,10 @@ class TrayUpdate::UpdateView : public ActionableView {
IDS_ASH_STATUS_TRAY_RESTART_AND_POWERWASH_TO_UPDATE);
} else if (owner->update_type_ == mojom::UpdateType::FLASH) {
label_text = bundle.GetLocalizedString(IDS_ASH_STATUS_TRAY_UPDATE_FLASH);
+ } else if (!owner->update_required_ &&
+ owner->update_over_cellular_available_) {
+ label_text = bundle.GetLocalizedString(
+ IDS_ASH_STATUS_TRAY_UPDATE_OVER_CELLULAR_AVAILABLE);
} else {
label_text = bundle.GetLocalizedString(IDS_ASH_STATUS_TRAY_UPDATE);
}
@@ -106,10 +113,17 @@ class TrayUpdate::UpdateView : public ActionableView {
private:
// Overridden from ActionableView.
- bool PerformAction(const ui::Event& event) override {
- Shell::Get()->system_tray_controller()->RequestRestartForUpdate();
- ShellPort::Get()->RecordUserMetricsAction(
- UMA_STATUS_AREA_OS_UPDATE_DEFAULT_SELECTED);
+ bool PerformAction(const ui::Event& /* event */) override {
+ DCHECK(update_required_ || update_over_cellular_available_);
+ if (update_required_) {
+ Shell::Get()->system_tray_controller()->RequestRestartForUpdate();
+ ShellPort::Get()->RecordUserMetricsAction(
+ UMA_STATUS_AREA_OS_UPDATE_DEFAULT_SELECTED);
+ } else {
+ // Opens about Chrome OS page, after which checks for update.
+ Shell::Get()->system_tray_controller()->ShowAboutChromeOS();
+ Shell::Get()->system_tray_controller()->RequestUpdateCheck();
+ }
CloseSystemBubble();
return true;
}
@@ -125,11 +139,11 @@ TrayUpdate::~TrayUpdate() {}
bool TrayUpdate::GetInitialVisibility() {
// If chrome tells ash there is an update available before this item's system
// tray is constructed then show the icon.
- return update_required_;
+ return update_required_ || update_over_cellular_available_;
}
views::View* TrayUpdate::CreateDefaultView(LoginStatus status) {
- if (update_required_) {
+ if (update_required_ || update_over_cellular_available_) {
update_view_ = new UpdateView(this);
return update_view_;
}
@@ -158,4 +172,14 @@ views::Label* TrayUpdate::GetLabelForTesting() {
return update_view_ ? update_view_->update_label_ : nullptr;
}
+void TrayUpdate::ShowUpdateOverCellularAvailableIcon() {
+ update_over_cellular_available_ = true;
+
+ // TODO(weidongg/691108): adjust severity according the amount of time passing
+ // after update is available over cellular connection.
+ // Use low severity for update available over cellular connection.
+ SetIconColor(IconColorForUpdateSeverity(mojom::UpdateSeverity::LOW, false));
+ tray_view()->SetVisible(true);
+}
+
} // namespace ash

Powered by Google App Engine
This is Rietveld 408576698