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

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

Issue 2700653002: [Ash MD] Remove pre-MD code from TrayImageItem and subclasses (Closed)
Patch Set: comments Created 3 years, 10 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/common/system/tray_accessibility.cc ('k') | ash/resources/ash_resources.grd » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: ash/common/system/update/tray_update.cc
diff --git a/ash/common/system/update/tray_update.cc b/ash/common/system/update/tray_update.cc
index 75be8f5dc4ccd2d27ce338796e7f06bc8cff260a..f7b4f76df8aa3945d412a742ce58c4e6f5e9f1ed 100644
--- a/ash/common/system/update/tray_update.cc
+++ b/ash/common/system/update/tray_update.cc
@@ -4,7 +4,6 @@
#include "ash/common/system/update/tray_update.h"
-#include "ash/common/material_design/material_design_controller.h"
#include "ash/common/metrics/user_metrics_action.h"
#include "ash/common/system/tray/fixed_sized_image_view.h"
#include "ash/common/system/tray/system_tray.h"
@@ -16,7 +15,6 @@
#include "ash/common/wm_shell.h"
#include "ash/public/interfaces/update.mojom.h"
#include "ash/resources/vector_icons/vector_icons.h"
-#include "grit/ash_resources.h"
#include "grit/ash_strings.h"
#include "ui/base/resource/resource_bundle.h"
#include "ui/gfx/color_palette.h"
@@ -29,37 +27,9 @@
namespace ash {
namespace {
-// Decides the non-material design image resource to use for a given update
-// severity.
-// TODO(tdanderson): This is only used for non-material design, so remove it
-// when material design is the default. See crbug.com/625692.
-int DecideResource(mojom::UpdateSeverity severity, bool dark) {
- switch (severity) {
- case mojom::UpdateSeverity::NONE:
- case mojom::UpdateSeverity::LOW:
- return dark ? IDR_AURA_UBER_TRAY_UPDATE_DARK : IDR_AURA_UBER_TRAY_UPDATE;
-
- case mojom::UpdateSeverity::ELEVATED:
- return dark ? IDR_AURA_UBER_TRAY_UPDATE_DARK_GREEN
- : IDR_AURA_UBER_TRAY_UPDATE_GREEN;
-
- case mojom::UpdateSeverity::HIGH:
- return dark ? IDR_AURA_UBER_TRAY_UPDATE_DARK_ORANGE
- : IDR_AURA_UBER_TRAY_UPDATE_ORANGE;
-
- case mojom::UpdateSeverity::SEVERE:
- case mojom::UpdateSeverity::CRITICAL:
- return dark ? IDR_AURA_UBER_TRAY_UPDATE_DARK_RED
- : IDR_AURA_UBER_TRAY_UPDATE_RED;
- }
-
- NOTREACHED() << "Unknown update severity level.";
- return 0;
-}
-
-// Returns the color to use for the material design update icon when the update
-// severity is |severity|. If |for_menu| is true, the icon color for the system
-// menu is given, otherwise the icon color for the system tray is given.
+// Returns the color to use for the update icon when the update severity is
+// |severity|. If |for_menu| is true, the icon color for the system menu is
+// given, otherwise the icon color for the system tray is given.
SkColor IconColorForUpdateSeverity(mojom::UpdateSeverity severity,
bool for_menu) {
const SkColor default_color = for_menu ? kMenuIconColor : kTrayIconColor;
@@ -101,15 +71,9 @@ class TrayUpdate::UpdateView : public ActionableView {
TriView* tri_view = TrayPopupUtils::CreateDefaultRowView();
AddChildView(tri_view);
views::ImageView* image = TrayPopupUtils::CreateMainImageView();
- if (MaterialDesignController::IsSystemTrayMenuMaterial()) {
- image->SetImage(gfx::CreateVectorIcon(
- kSystemMenuUpdateIcon,
- IconColorForUpdateSeverity(owner->severity_, true)));
- } else {
- image->SetImage(
- bundle.GetImageNamed(DecideResource(owner->severity_, true))
- .ToImageSkia());
- }
+ image->SetImage(gfx::CreateVectorIcon(
+ kSystemMenuUpdateIcon,
+ IconColorForUpdateSeverity(owner->severity_, true)));
tri_view->AddView(TriView::Container::START, image);
base::string16 label_text =
@@ -124,9 +88,7 @@ class TrayUpdate::UpdateView : public ActionableView {
style.SetupLabel(label);
tri_view->AddView(TriView::Container::CENTER, label);
- if (MaterialDesignController::IsSystemTrayMenuMaterial()) {
- SetInkDropMode(InkDropHostView::InkDropMode::ON);
- }
+ SetInkDropMode(InkDropHostView::InkDropMode::ON);
}
~UpdateView() override {}
@@ -145,7 +107,7 @@ class TrayUpdate::UpdateView : public ActionableView {
};
TrayUpdate::TrayUpdate(SystemTray* system_tray)
- : TrayImageItem(system_tray, IDR_AURA_UBER_TRAY_UPDATE, UMA_UPDATE) {}
+ : TrayImageItem(system_tray, kSystemTrayUpdateIcon, UMA_UPDATE) {}
TrayUpdate::~TrayUpdate() {}
@@ -167,10 +129,7 @@ void TrayUpdate::ShowUpdateIcon(mojom::UpdateSeverity severity,
factory_reset_required_ = factory_reset_required;
// Show the icon in the tray.
- if (MaterialDesignController::UseMaterialDesignSystemIcons())
- SetIconColor(IconColorForUpdateSeverity(severity_, false));
- else
- SetImageFromResourceId(DecideResource(severity_, false));
+ SetIconColor(IconColorForUpdateSeverity(severity_, false));
tray_view()->SetVisible(true);
}
« no previous file with comments | « ash/common/system/tray_accessibility.cc ('k') | ash/resources/ash_resources.grd » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698