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

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

Issue 1998933002: Update shelf spacing in Chrome OS according to the MD specs (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: address comments & Refactor border around item implementation Created 4 years, 7 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 4b152b3be601271554d1897d874d83b6f65d3768..043ea9c81a8254e394bfc01b42a4c5317c212a73 100644
--- a/ash/system/overview/overview_button_tray.cc
+++ b/ash/system/overview/overview_button_tray.cc
@@ -4,11 +4,14 @@
#include "ash/system/overview/overview_button_tray.h"
+#include "ash/material_design/material_design_controller.h"
#include "ash/session/session_state_delegate.h"
+#include "ash/shelf/shelf_constants.h"
#include "ash/shelf/shelf_types.h"
#include "ash/shelf/shelf_util.h"
#include "ash/shell.h"
#include "ash/system/tray/system_tray_delegate.h"
+#include "ash/system/tray/tray_constants.h"
#include "ash/system/tray/tray_utils.h"
#include "ash/wm/common/shelf/wm_shelf_util.h"
#include "ash/wm/maximize_mode/maximize_mode_controller.h"
@@ -104,6 +107,27 @@ void OverviewButtonTray::SetShelfAlignment(wm::ShelfAlignment alignment) {
SetIconBorderForShelfAlignment();
}
+void OverviewButtonTray::GetHitRegionInsets(gfx::Insets& insets) {
+ if (ash::MaterialDesignController::IsShelfMaterial()) {
+ int top_edge, left_edge, bottom_edge, right_edge;
+ if (wm::IsHorizontalAlignment(shelf_alignment())) {
+ top_edge = (GetShelfLayoutConstant(SHELF_SIZE) - kShelfItemHeight) / 2;
+ left_edge = 0;
+ bottom_edge = (GetShelfLayoutConstant(SHELF_SIZE) - kShelfItemHeight) / 2;
+ right_edge = GetTrayConstant(PADDING_FROM_EDGE_OF_SHELF);
+ } else { // SHELF_ALIGNMENT_LEFT || SHELF_ALIGNMENT_RIGHT
+ top_edge = 0;
+ left_edge = (GetShelfLayoutConstant(SHELF_SIZE) - kShelfItemHeight) / 2;
+ bottom_edge = GetTrayConstant(PADDING_FROM_EDGE_OF_SHELF);
+ right_edge = (GetShelfLayoutConstant(SHELF_SIZE) - kShelfItemHeight) / 2;
+ }
+ insets.Set(top_edge, left_edge, bottom_edge, right_edge);
+ } else {
+ TrayBackgroundView::GetHitRegionInsets(insets);
+ }
+}
+
+// TODO(yiyix): Remove the 3dp border around the button.
tdanderson 2016/06/03 19:25:23 Move to TrayContainer, reword to be something like
yiyix 2016/06/10 19:26:04 Done.
void OverviewButtonTray::SetIconBorderForShelfAlignment() {
if (wm::IsHorizontalAlignment(shelf_alignment())) {
icon_->SetBorder(views::Border::CreateEmptyBorder(

Powered by Google App Engine
This is Rietveld 408576698