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

Unified Diff: ash/system/tray_update.cc

Issue 614363002: Added Aura notification that relaunch and powerwash is required in case of downgrade. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: More fixes to StstemTrayDelegateWin. Created 6 years, 3 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/tray_update.cc
diff --git a/ash/system/tray_update.cc b/ash/system/tray_update.cc
index 79a3ad6abefb430150298aa8be2500745b0b0f21..92bd12c35924d483be06cfcfc96e28ef485e25c9 100644
--- a/ash/system/tray_update.cc
+++ b/ash/system/tray_update.cc
@@ -37,21 +37,21 @@ const int kUpdateNaggingTimeSeconds = 24 * 60 * 60;
// How long should the nag reminder be displayed?
const int kShowUpdateNaggerForSeconds = 15;
-int DecideResource(ash::UpdateObserver::UpdateSeverity severity, bool dark) {
+int DecideResource(ash::UpdateInfo::UpdateSeverity severity, bool dark) {
switch (severity) {
- case ash::UpdateObserver::UPDATE_NORMAL:
+ case ash::UpdateInfo::UPDATE_NORMAL:
return dark ? IDR_AURA_UBER_TRAY_UPDATE_DARK:
IDR_AURA_UBER_TRAY_UPDATE;
- case ash::UpdateObserver::UPDATE_LOW_GREEN:
+ case ash::UpdateInfo::UPDATE_LOW_GREEN:
return dark ? IDR_AURA_UBER_TRAY_UPDATE_DARK_GREEN :
IDR_AURA_UBER_TRAY_UPDATE_GREEN;
- case ash::UpdateObserver::UPDATE_HIGH_ORANGE:
+ case ash::UpdateInfo::UPDATE_HIGH_ORANGE:
return dark ? IDR_AURA_UBER_TRAY_UPDATE_DARK_ORANGE :
IDR_AURA_UBER_TRAY_UPDATE_ORANGE;
- case ash::UpdateObserver::UPDATE_SEVERE_RED:
+ case ash::UpdateInfo::UPDATE_SEVERE_RED:
return dark ? IDR_AURA_UBER_TRAY_UPDATE_DARK_RED :
IDR_AURA_UBER_TRAY_UPDATE_RED;
}
@@ -62,7 +62,7 @@ int DecideResource(ash::UpdateObserver::UpdateSeverity severity, bool dark) {
class UpdateView : public ash::ActionableView {
public:
- explicit UpdateView(ash::UpdateObserver::UpdateSeverity severity) {
+ explicit UpdateView(const ash::UpdateInfo& info) {
SetLayoutManager(new
views::BoxLayout(views::BoxLayout::kHorizontal,
ash::kTrayPopupPaddingHorizontal, 0,
@@ -71,13 +71,18 @@ class UpdateView : public ash::ActionableView {
ui::ResourceBundle& bundle = ui::ResourceBundle::GetSharedInstance();
views::ImageView* image =
new ash::FixedSizedImageView(0, ash::kTrayPopupItemHeight);
- image->SetImage(bundle.GetImageNamed(DecideResource(severity, true)).
+ image->SetImage(bundle.GetImageNamed(DecideResource(info.severity, true)).
ToImageSkia());
AddChildView(image);
- AddChildView(new views::Label(
- bundle.GetLocalizedString(IDS_ASH_STATUS_TRAY_UPDATE)));
- SetAccessibleName(bundle.GetLocalizedString(IDS_ASH_STATUS_TRAY_UPDATE));
+
+ base::string16 label =
+ info.is_factory_reset_required
+ ? bundle.GetLocalizedString(
+ IDS_ASH_STATUS_TRAY_RESTART_AND_POWERWASH_TO_UPDATE)
+ : bundle.GetLocalizedString(IDS_ASH_STATUS_TRAY_RESTART_TO_UPDATE);
+ AddChildView(new views::Label(label));
+ SetAccessibleName(label);
}
virtual ~UpdateView() {}
@@ -156,7 +161,7 @@ class UpdateNagger : public ui::LayerAnimationObserver {
TrayUpdate::TrayUpdate(SystemTray* system_tray)
: TrayImageItem(system_tray, IDR_AURA_UBER_TRAY_UPDATE),
- severity_(UpdateObserver::UPDATE_NORMAL) {
+ severity_(UpdateInfo::UPDATE_NORMAL) {
Shell::GetInstance()->system_tray_notifier()->AddUpdateObserver(this);
}
@@ -165,13 +170,17 @@ TrayUpdate::~TrayUpdate() {
}
bool TrayUpdate::GetInitialVisibility() {
- return Shell::GetInstance()->system_tray_delegate()->SystemShouldUpgrade();
+ return Shell::GetInstance()->system_tray_delegate()->SystemShouldUpgrade(
+ NULL);
}
views::View* TrayUpdate::CreateDefaultView(user::LoginStatus status) {
- if (!Shell::GetInstance()->system_tray_delegate()->SystemShouldUpgrade())
+ UpdateInfo info;
+ if (!Shell::GetInstance()->system_tray_delegate()->SystemShouldUpgrade(
+ &info)) {
return NULL;
- return new UpdateView(severity_);
+ }
+ return new UpdateView(info);
}
views::View* TrayUpdate::CreateDetailedView(user::LoginStatus status) {
@@ -188,8 +197,8 @@ void TrayUpdate::DestroyDetailedView() {
}
}
-void TrayUpdate::OnUpdateRecommended(UpdateObserver::UpdateSeverity severity) {
- severity_ = severity;
+void TrayUpdate::OnUpdateRecommended(const UpdateInfo& info) {
+ severity_ = info.severity;
SetImageFromResourceId(DecideResource(severity_, false));
tray_view()->SetVisible(true);
if (!Shell::GetPrimaryRootWindowController()->shelf()->IsVisible() &&

Powered by Google App Engine
This is Rietveld 408576698