Chromium Code Reviews| Index: ash/shelf/app_list_button.cc |
| diff --git a/ash/shelf/app_list_button.cc b/ash/shelf/app_list_button.cc |
| index 76b0177bd07a5d2b346eee8026437a8967510587..220877126a9298ae01847622b554c43c871cbd3d 100644 |
| --- a/ash/shelf/app_list_button.cc |
| +++ b/ash/shelf/app_list_button.cc |
| @@ -5,6 +5,7 @@ |
| #include "ash/shelf/app_list_button.h" |
| #include "ash/ash_constants.h" |
| +#include "ash/material_design/material_design_controller.h" |
| #include "ash/shelf/shelf_item_types.h" |
| #include "ash/shelf/shelf_layout_manager.h" |
| #include "ash/shelf/shelf_view.h" |
| @@ -19,6 +20,8 @@ |
| #include "ui/base/resource/resource_bundle.h" |
| #include "ui/base/ui_base_switches_util.h" |
| #include "ui/gfx/canvas.h" |
| +#include "ui/gfx/paint_vector_icon.h" |
| +#include "ui/gfx/vector_icons_public.h" |
| #include "ui/views/painter.h" |
| namespace ash { |
| @@ -109,16 +112,14 @@ void AppListButton::OnPaint(gfx::Canvas* canvas) { |
| else |
| background_image_id = IDR_AURA_NOTIFICATION_BACKGROUND_NORMAL; |
| } |
| + |
| ResourceBundle& rb = ResourceBundle::GetSharedInstance(); |
| const gfx::ImageSkia* background_image = |
| rb.GetImageNamed(background_image_id).ToImageSkia(); |
| - // TODO(mgiuca): When the "classic" app list is removed, also remove this |
| - // resource and its icon file. |
| - int foreground_image_id = app_list::switches::IsExperimentalAppListEnabled() |
| - ? IDR_ASH_SHELF_ICON_APPLIST |
| - : IDR_ASH_SHELF_ICON_APPLIST_CLASSIC; |
| - const gfx::ImageSkia* forground_image = |
| - rb.GetImageNamed(foreground_image_id).ToImageSkia(); |
| + const gfx::ImageSkia& forground_image = |
|
James Cook
2016/06/07 15:51:52
nit: for_e_ground
Can you also fix forground_boun
tdanderson
2016/06/08 17:29:27
Done.
|
| + MaterialDesignController::IsShelfMaterial() |
| + ? CreateVectorIcon(gfx::VectorIconId::SHELF_LAUNCHER, kShelfIconColor) |
|
James Cook
2016/06/07 15:51:52
Given that the class is called AppList, and the le
tdanderson
2016/06/08 17:29:27
No, I guess I don't. Changed.
|
| + : *rb.GetImageNamed(IDR_ASH_SHELF_ICON_APPLIST).ToImageSkia(); |
| gfx::Rect contents_bounds = GetContentsBounds(); |
| gfx::Rect background_bounds, forground_bounds; |
| @@ -140,7 +141,8 @@ void AppListButton::OnPaint(gfx::Canvas* canvas) { |
| (contents_bounds.width() - background_image->width()) / 2); |
| } |
| - forground_bounds.set_size(forground_image->size()); |
| + forground_bounds.set_size(forground_image.size()); |
| + |
| forground_bounds.set_x(background_bounds.x() + |
| std::max(0, |
| (background_bounds.width() - forground_bounds.width()) / 2)); |
| @@ -151,7 +153,7 @@ void AppListButton::OnPaint(gfx::Canvas* canvas) { |
| canvas->DrawImageInt(*background_image, |
| background_bounds.x(), |
| background_bounds.y()); |
| - canvas->DrawImageInt(*forground_image, |
| + canvas->DrawImageInt(forground_image, |
| forground_bounds.x(), |
| forground_bounds.y()); |