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

Unified Diff: ash/system/overview/overview_button_tray.cc

Issue 2099103002: Give Ash material design tray items the correct size and layout (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: split shelf and tray constants Created 4 years, 6 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
Index: ash/system/overview/overview_button_tray.cc
diff --git a/ash/system/overview/overview_button_tray.cc b/ash/system/overview/overview_button_tray.cc
index f7cb2e120d3b601fb0149612e9d79818371d2e12..499ae5684481fc61c33b5d17165405e0d09b6cf8 100644
--- a/ash/system/overview/overview_button_tray.cc
+++ b/ash/system/overview/overview_button_tray.cc
@@ -10,6 +10,7 @@
#include "ash/common/shelf/shelf_types.h"
#include "ash/common/shelf/wm_shelf_util.h"
#include "ash/common/system/tray/system_tray_delegate.h"
+#include "ash/common/system/tray/tray_constants.h"
#include "ash/common/system/tray/tray_utils.h"
#include "ash/common/wm/overview/window_selector_controller.h"
#include "ash/common/wm_shell.h"
@@ -114,14 +115,23 @@ void OverviewButtonTray::SetShelfAlignment(ShelfAlignment alignment) {
}
void OverviewButtonTray::SetIconBorderForShelfAlignment() {
- if (IsHorizontalAlignment(shelf_alignment())) {
+ if (ash::MaterialDesignController::IsShelfMaterial()) {
+ // Pad button size to align with other controls in the system tray.
+ const gfx::ImageSkia image = icon_->GetImage();
+ const int vertical_padding = (kTrayItemSize - image.height()) / 2;
+ const int horizontal_padding = (kTrayItemSize - image.width()) / 2;
icon_->SetBorder(views::Border::CreateEmptyBorder(
- kHorizontalShelfVerticalPadding, kHorizontalShelfHorizontalPadding,
- kHorizontalShelfVerticalPadding, kHorizontalShelfHorizontalPadding));
+ gfx::Insets(vertical_padding, horizontal_padding)));
} else {
- icon_->SetBorder(views::Border::CreateEmptyBorder(
- kVerticalShelfVerticalPadding, kVerticalShelfHorizontalPadding,
- kVerticalShelfVerticalPadding, kVerticalShelfHorizontalPadding));
+ if (IsHorizontalAlignment(shelf_alignment())) {
+ icon_->SetBorder(views::Border::CreateEmptyBorder(
+ kHorizontalShelfVerticalPadding, kHorizontalShelfHorizontalPadding,
+ kHorizontalShelfVerticalPadding, kHorizontalShelfHorizontalPadding));
+ } else {
+ icon_->SetBorder(views::Border::CreateEmptyBorder(
+ kVerticalShelfVerticalPadding, kVerticalShelfHorizontalPadding,
+ kVerticalShelfVerticalPadding, kVerticalShelfHorizontalPadding));
+ }
}
}
« no previous file with comments | « ash/system/chromeos/virtual_keyboard/virtual_keyboard_tray.cc ('k') | ash/system/status_area_widget_delegate.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698