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

Unified Diff: ash/system/tray/system_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/tray/system_tray.cc
diff --git a/ash/system/tray/system_tray.cc b/ash/system/tray/system_tray.cc
index 28b3392d221dc39a3a6726d4c79763869c3c715c..52901e687841c93eec14ed9e84f8af80dd2de045 100644
--- a/ash/system/tray/system_tray.cc
+++ b/ash/system/tray/system_tray.cc
@@ -5,6 +5,7 @@
#include "ash/system/tray/system_tray.h"
#include "ash/ash_switches.h"
+#include "ash/material_design/material_design_controller.h"
#include "ash/metrics/user_metrics_recorder.h"
#include "ash/shelf/shelf_layout_manager.h"
#include "ash/shelf/shelf_util.h"
@@ -706,6 +707,26 @@ TrayCast* SystemTray::GetTrayCastForTesting() const { return tray_cast_; }
TrayDate* SystemTray::GetTrayDateForTesting() const { return tray_date_; }
+void SystemTray::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);
+ }
+}
+
bool SystemTray::PerformAction(const ui::Event& event) {
// If we're already showing the default view, hide it; otherwise, show it
// (and hide any popup that's currently shown).

Powered by Google App Engine
This is Rietveld 408576698