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

Unified Diff: ash/system/tray_update.cc

Issue 10915214: ash: Update system update notification behaviour. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: . Created 8 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
« no previous file with comments | « ash/system/tray_update.h ('k') | ash/system/user/update_observer.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: ash/system/tray_update.cc
diff --git a/ash/system/tray_update.cc b/ash/system/tray_update.cc
index 29e55120161a6b53fcf343496e6545786c2c3b88..899dce20f51498e2b4aea906fad42f8b1b8342fc 100644
--- a/ash/system/tray_update.cc
+++ b/ash/system/tray_update.cc
@@ -33,9 +33,32 @@ 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) {
+ switch (severity) {
+ case ash::UpdateObserver::UPDATE_NORMAL:
+ return dark ? IDR_AURA_UBER_TRAY_UPDATE_DARK:
+ IDR_AURA_UBER_TRAY_UPDATE;
+
+ case ash::UpdateObserver::UPDATE_LOW_GREEN:
+ return dark ? IDR_AURA_UBER_TRAY_UPDATE_DARK_GREEN :
+ IDR_AURA_UBER_TRAY_UPDATE_GREEN;
+
+ case ash::UpdateObserver::UPDATE_HIGH_ORANGE:
+ return dark ? IDR_AURA_UBER_TRAY_UPDATE_DARK_ORANGE :
+ IDR_AURA_UBER_TRAY_UPDATE_ORANGE;
+
+ case ash::UpdateObserver::UPDATE_SEVERE_RED:
+ return dark ? IDR_AURA_UBER_TRAY_UPDATE_DARK_RED :
+ IDR_AURA_UBER_TRAY_UPDATE_RED;
+ }
+
+ NOTREACHED() << "Unknown update severity level.";
+ return 0;
+}
+
class UpdateView : public ash::internal::ActionableView {
public:
- UpdateView() {
+ explicit UpdateView(ash::UpdateObserver::UpdateSeverity severity) {
SetLayoutManager(new
views::BoxLayout(views::BoxLayout::kHorizontal,
ash::kTrayPopupPaddingHorizontal, 0,
@@ -44,7 +67,7 @@ class UpdateView : public ash::internal::ActionableView {
ui::ResourceBundle& bundle = ui::ResourceBundle::GetSharedInstance();
views::ImageView* image =
new ash::internal::FixedSizedImageView(0, ash::kTrayPopupItemHeight);
- image->SetImage(bundle.GetImageNamed(IDR_AURA_UBER_TRAY_UPDATE_DARK).
+ image->SetImage(bundle.GetImageNamed(DecideResource(severity, true)).
ToImageSkia());
AddChildView(image);
@@ -123,7 +146,8 @@ class UpdateNagger : public ui::LayerAnimationObserver {
} // namespace tray
TrayUpdate::TrayUpdate()
- : TrayImageItem(IDR_AURA_UBER_TRAY_UPDATE) {
+ : TrayImageItem(IDR_AURA_UBER_TRAY_UPDATE),
+ severity_(UpdateObserver::UPDATE_NORMAL) {
}
TrayUpdate::~TrayUpdate() {}
@@ -135,7 +159,7 @@ bool TrayUpdate::GetInitialVisibility() {
views::View* TrayUpdate::CreateDefaultView(user::LoginStatus status) {
if (!Shell::GetInstance()->tray_delegate()->SystemShouldUpgrade())
return NULL;
- return new UpdateView;
+ return new UpdateView(severity_);
}
views::View* TrayUpdate::CreateDetailedView(user::LoginStatus status) {
@@ -152,7 +176,9 @@ void TrayUpdate::DestroyDetailedView() {
}
}
-void TrayUpdate::OnUpdateRecommended() {
+void TrayUpdate::OnUpdateRecommended(UpdateObserver::UpdateSeverity severity) {
+ severity_ = severity;
+ SetImageFromResourceId(DecideResource(severity_, false));
tray_view()->SetVisible(true);
if (!Shell::GetInstance()->shelf()->IsVisible() && !nagger_.get()) {
// The shelf is not visible, and there is no nagger scheduled.
« no previous file with comments | « ash/system/tray_update.h ('k') | ash/system/user/update_observer.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698