| 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..e6c06c4e8354cc3030149f53d194aaea136c29d8 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"
|
| @@ -31,7 +32,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 +127,48 @@ 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 Material Design for Chrome OS shelf is enabled.
|
| + if (MaterialDesignController::IsShelfMaterial()) {
|
| + if (alignment == wm::SHELF_ALIGNMENT_LEFT ||
|
| + alignment == wm::SHELF_ALIGNMENT_RIGHT) {
|
| + background_bounds.set_x(
|
| + (contents_bounds.width() - background_image->width()) / 2);
|
| + background_bounds.set_y(
|
| + contents_bounds.y() + ShelfLayoutManager::GetShelfItemInset(
|
| + ShelfLayoutManager::SHELF_ITEM_INSET) +
|
| + (contents_bounds.height() - background_image->height()) / 2);
|
| + } else { // SHELF_ALIGNMENT_BOTTOM
|
| + 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 +
|
| + ShelfLayoutManager::GetShelfItemInset(
|
| + ShelfLayoutManager::SHELF_ITEM_INSET));
|
| + }
|
| } 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() -
|
| + ShelfLayoutManager::GetShelfItemInset(
|
| + ShelfLayoutManager::SHELF_ITEM_INSET) -
|
| + 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::GetShelfItemInset(
|
| + ShelfLayoutManager::SHELF_ITEM_INSET));
|
| + background_bounds.set_y(
|
| + contents_bounds.y() +
|
| + (contents_bounds.height() - background_image->height()) / 2);
|
| + } else { // SHELF_ALIGNMENT_BOTTOM
|
| + background_bounds.set_y(ShelfLayoutManager::GetShelfItemInset(
|
| + ShelfLayoutManager::SHELF_ITEM_INSET));
|
| + background_bounds.set_x(
|
| + contents_bounds.x() +
|
| + (contents_bounds.width() - background_image->width()) / 2);
|
| + }
|
| }
|
|
|
| forground_bounds.set_size(forground_image->size());
|
|
|