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 a57e12378802c6ebd7720ab4f09aae6c80058aa8..e339f2880324f34b945e8acb2da95b0f8dd7a83c 100644 | 
| --- a/ash/shelf/app_list_button.cc | 
| +++ b/ash/shelf/app_list_button.cc | 
| @@ -5,11 +5,13 @@ | 
| #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" | 
| #include "ash/shelf/shelf_widget.h" | 
| #include "ash/shell.h" | 
| +#include "ash/wm/common/shelf/wm_shelf_util.h" | 
| #include "base/command_line.h" | 
| #include "grit/ash_resources.h" | 
| #include "grit/ash_strings.h" | 
| @@ -31,7 +33,8 @@ AppListButton::AppListButton(ShelfView* shelf_view) | 
| app_list::switches::IsExperimentalAppListEnabled() | 
| ? l10n_util::GetStringUTF16(IDS_ASH_SHELF_APP_LIST_LAUNCHER_TITLE) | 
| : l10n_util::GetStringUTF16(IDS_ASH_SHELF_APP_LIST_TITLE)); | 
| - SetSize(gfx::Size(kShelfSize, kShelfSize)); | 
| + SetSize(gfx::Size(GetShelfLayoutConstant(SHELF_SIZE), | 
| + GetShelfLayoutConstant(SHELF_SIZE))); | 
| SetFocusPainter(views::Painter::CreateSolidFocusPainter( | 
| kFocusBorderColor, gfx::Insets(1, 1, 1, 1))); | 
| set_notify_action(CustomButton::NOTIFY_ON_PRESS); | 
| @@ -125,19 +128,40 @@ void AppListButton::OnPaint(gfx::Canvas* canvas) { | 
| wm::ShelfAlignment alignment = shelf_view_->shelf()->alignment(); | 
| background_bounds.set_size(background_image->size()); | 
| - if (alignment == wm::SHELF_ALIGNMENT_LEFT) { | 
| - background_bounds.set_x(contents_bounds.width() - | 
| - ShelfLayoutManager::kShelfItemInset - background_image->width()); | 
| - background_bounds.set_y(contents_bounds.y() + | 
| - (contents_bounds.height() - background_image->height()) / 2); | 
| - } else if (alignment == wm::SHELF_ALIGNMENT_RIGHT) { | 
| - background_bounds.set_x(ShelfLayoutManager::kShelfItemInset); | 
| - background_bounds.set_y(contents_bounds.y() + | 
| - (contents_bounds.height() - background_image->height()) / 2); | 
| + | 
| + if (MaterialDesignController::IsShelfMaterial()) { | 
| + // SHELF_ALIGHTMENT_RIGHT AND SHELF_ALIGHMENT_LEFT | 
| 
 
tdanderson
2016/06/03 19:25:23
nit: comment not needed
 
yiyix
2016/06/10 19:26:04
Done.
 
 | 
| + if (!wm::IsHorizontalAlignment(alignment)) { | 
| 
 
tdanderson
2016/06/03 19:25:23
super nit: swap if/else to structure this as:
if
 
yiyix
2016/06/10 19:26:04
Done.
 
 | 
| + background_bounds.set_x( | 
| + (contents_bounds.width() - background_image->width()) / 2); | 
| + background_bounds.set_y( | 
| + contents_bounds.y() + | 
| + (contents_bounds.height() - background_image->height()) / 2); | 
| + } else { // SHELF_ALIGNMENT_BOTTOM | 
| 
 
tdanderson
2016/06/03 19:25:23
nit: remove comment
 
yiyix
2016/06/10 19:26:04
Done.
 
 | 
| + background_bounds.set_y( | 
| + (contents_bounds.height() - background_image->height()) / 2); | 
| + background_bounds.set_x( | 
| + contents_bounds.x() + | 
| + (contents_bounds.width() - background_image->width()) / 2); | 
| + } | 
| } else { | 
| - background_bounds.set_y(ShelfLayoutManager::kShelfItemInset); | 
| - background_bounds.set_x(contents_bounds.x() + | 
| - (contents_bounds.width() - background_image->width()) / 2); | 
| + if (alignment == wm::SHELF_ALIGNMENT_LEFT) { | 
| + background_bounds.set_x(contents_bounds.width() - kShelfItemInset - | 
| + background_image->width()); | 
| + background_bounds.set_y( | 
| + contents_bounds.y() + | 
| + (contents_bounds.height() - background_image->height()) / 2); | 
| + } else if (alignment == wm::SHELF_ALIGNMENT_RIGHT) { | 
| + background_bounds.set_x(kShelfItemInset); | 
| + background_bounds.set_y( | 
| + contents_bounds.y() + | 
| + (contents_bounds.height() - background_image->height()) / 2); | 
| + } else { // SHELF_ALIGNMENT_BOTTOM | 
| + background_bounds.set_y(kShelfItemInset); | 
| + background_bounds.set_x( | 
| + contents_bounds.x() + | 
| + (contents_bounds.width() - background_image->width()) / 2); | 
| + } | 
| } | 
| forground_bounds.set_size(forground_image->size()); |