Index: ash/common/system/tray/tray_image_item.cc |
diff --git a/ash/common/system/tray/tray_image_item.cc b/ash/common/system/tray/tray_image_item.cc |
index 04c5ae49c8b0afe8c3118c1ba139e5013ab6026b..ea34b4e6560f904f0f6bfd723b80b60d6d611559 100644 |
--- a/ash/common/system/tray/tray_image_item.cc |
+++ b/ash/common/system/tray/tray_image_item.cc |
@@ -4,15 +4,12 @@ |
#include "ash/common/system/tray/tray_image_item.h" |
-#include "ash/common/material_design/material_design_controller.h" |
#include "ash/common/shelf/wm_shelf_util.h" |
#include "ash/common/system/tray/system_tray.h" |
#include "ash/common/system/tray/tray_constants.h" |
#include "ash/common/system/tray/tray_item_view.h" |
#include "ash/common/system/tray/tray_utils.h" |
#include "ash/resources/vector_icons/vector_icons.h" |
-#include "grit/ash_resources.h" |
-#include "ui/base/resource/resource_bundle.h" |
#include "ui/gfx/image/image.h" |
#include "ui/gfx/paint_vector_icon.h" |
#include "ui/views/controls/image_view.h" |
@@ -20,40 +17,11 @@ |
namespace ash { |
-namespace { |
- |
-// Maps a non-MD PNG resource id to its corresponding MD vector icon. |
-// TODO(tdanderson): Remove this once material design is enabled by |
-// default. See crbug.com/614453. |
-const gfx::VectorIcon& ResourceIdToVectorIcon(int resource_id) { |
- switch (resource_id) { |
- case IDR_AURA_UBER_TRAY_ACCESSIBILITY: |
- return kSystemTrayAccessibilityIcon; |
- case IDR_AURA_UBER_TRAY_AUTO_ROTATION_LOCKED: |
- return kSystemTrayRotationLockLockedIcon; |
- case IDR_AURA_UBER_TRAY_CAPS_LOCK: |
- return kSystemTrayCapsLockIcon; |
- case IDR_AURA_UBER_TRAY_TRACING: |
- return kSystemTrayTracingIcon; |
- case IDR_AURA_UBER_TRAY_UPDATE: |
- return kSystemTrayUpdateIcon; |
- case IDR_AURA_UBER_TRAY_VOLUME_MUTE: |
- return kSystemTrayVolumeMuteIcon; |
- default: |
- NOTREACHED(); |
- break; |
- } |
- |
- return gfx::kNoneIcon; |
-} |
- |
-} // namespace |
- |
TrayImageItem::TrayImageItem(SystemTray* system_tray, |
- int resource_id, |
+ const gfx::VectorIcon& icon, |
UmaType uma_type) |
: SystemTrayItem(system_tray, uma_type), |
- resource_id_(resource_id), |
+ icon_(&icon), |
icon_color_(kTrayIconColor), |
tray_view_(nullptr) {} |
@@ -99,23 +67,12 @@ void TrayImageItem::SetIconColor(SkColor color) { |
UpdateImageOnImageView(); |
} |
-void TrayImageItem::SetImageFromResourceId(int resource_id) { |
- resource_id_ = resource_id; |
- UpdateImageOnImageView(); |
-} |
- |
void TrayImageItem::UpdateImageOnImageView() { |
if (!tray_view_) |
return; |
- if (MaterialDesignController::UseMaterialDesignSystemIcons()) { |
- tray_view_->image_view()->SetImage(gfx::CreateVectorIcon( |
- ResourceIdToVectorIcon(resource_id_), kTrayIconSize, icon_color_)); |
- } else { |
- tray_view_->image_view()->SetImage(ui::ResourceBundle::GetSharedInstance() |
- .GetImageNamed(resource_id_) |
- .ToImageSkia()); |
- } |
+ tray_view_->image_view()->SetImage( |
+ gfx::CreateVectorIcon(*icon_, kTrayIconSize, icon_color_)); |
} |
} // namespace ash |