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

Unified Diff: ash/common/system/tray/system_tray.cc

Issue 2147143002: [Chrome OS MD] Draw a 1px separator between 2 tray items (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: new approach Created 4 years, 5 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/common/system/tray/system_tray.cc
diff --git a/ash/common/system/tray/system_tray.cc b/ash/common/system/tray/system_tray.cc
index 979e3a197bf51a66dbd25c7795bd57f0adfe2872..12e7a971b621e8ae5d61fd42de65ff3c784c3736 100644
--- a/ash/common/system/tray/system_tray.cc
+++ b/ash/common/system/tray/system_tray.cc
@@ -6,6 +6,7 @@
#include "ash/common/ash_switches.h"
#include "ash/common/login_status.h"
+#include "ash/common/material_design/material_design_controller.h"
#include "ash/common/session/session_state_delegate.h"
#include "ash/common/shelf/wm_shelf.h"
#include "ash/common/shelf/wm_shelf_util.h"
@@ -20,6 +21,7 @@
#include "ash/common/system/update/tray_update.h"
#include "ash/common/system/user/tray_user.h"
#include "ash/common/system/user/tray_user_separator.h"
+#include "ash/common/system/view_observer.h"
#include "ash/common/system/web_notification/web_notification_tray.h"
#include "ash/common/wm_lookup.h"
#include "ash/common/wm_root_window_controller.h"
@@ -72,6 +74,9 @@ namespace ash {
// The minimum width of the system tray menu width.
const int kMinimumSystemTrayMenuWidth = 300;
+// Padding used to adjust the user-visible size of status tray dark background.
+const int kBackgroundTrayPadding = 3;
+
// Class to initialize and manage the SystemTrayBubble and TrayBubbleWrapper
// instances for a bubble.
@@ -121,8 +126,8 @@ class SystemBubbleWrapper {
// SystemTray
-SystemTray::SystemTray(WmShelf* wm_shelf)
- : TrayBackgroundView(wm_shelf),
+SystemTray::SystemTray(WmShelf* wm_shelf, ViewObserver* view_observer)
+ : TrayBackgroundView(wm_shelf, view_observer),
web_notification_tray_(nullptr),
detailed_item_(nullptr),
default_bubble_height_(0),
@@ -153,6 +158,7 @@ void SystemTray::InitializeTrayItems(
DCHECK(web_notification_tray);
web_notification_tray_ = web_notification_tray;
TrayBackgroundView::Initialize();
+ AdjustStatusTrayBackground();
CreateItems(delegate);
}
@@ -608,6 +614,9 @@ void SystemTray::SetShelfAlignment(ShelfAlignment alignment) {
if (alignment == shelf_alignment())
return;
TrayBackgroundView::SetShelfAlignment(alignment);
+ if (!ash::MaterialDesignController::IsShelfMaterial()) {
+ AdjustStatusTrayBackground();
+ }
UpdateAfterShelfAlignmentChange(alignment);
// Destroy any existing bubble so that it is rebuilt correctly.
CloseSystemBubbleAndDeactivateSystemTray();
@@ -775,4 +784,11 @@ void SystemTray::RecordSystemMenuMetrics() {
}
}
+void SystemTray::AdjustStatusTrayBackground() {
+ if (!ash::MaterialDesignController::IsShelfMaterial()) {
+ tray_container()->SetBorder(
+ views::Border::CreateEmptyBorder(gfx::Insets(kBackgroundTrayPadding)));
+ }
+}
+
} // namespace ash

Powered by Google App Engine
This is Rietveld 408576698