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

Unified Diff: ash/system/tray/system_tray_item.cc

Issue 10809008: Make spacing between uber tray items consistent with UI spec. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 8 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/system/tray/system_tray_item.cc
diff --git a/ash/system/tray/system_tray_item.cc b/ash/system/tray/system_tray_item.cc
index 7c7fec84258f39f7fabd595529be643330d08acb..0543751e04b46c19e5d91161aba09f48033c1bbd 100644
--- a/ash/system/tray/system_tray_item.cc
+++ b/ash/system/tray/system_tray_item.cc
@@ -6,6 +6,9 @@
#include "ash/shell.h"
#include "ash/system/tray/system_tray.h"
+#include "ash/system/tray/tray_constants.h"
+#include "ash/system/tray/tray_item_view.h"
+#include "ui/views/controls/label.h"
#include "ui/views/view.h"
namespace ash {
@@ -60,6 +63,39 @@ void SystemTrayItem::PopupDetailedView(int for_seconds, bool activate) {
this, for_seconds, activate, BUBBLE_CREATE_NEW);
}
+void SystemTrayItem::SetTrayImageItemBorder(views::View* tray_view,
+ ShelfAlignment alignment) {
+ if (alignment == SHELF_ALIGNMENT_BOTTOM) {
+ tray_view->set_border(views::Border::CreateEmptyBorder(
+ 0, kTrayImageItemHorizontalPaddingBottomAlignment,
+ 0, kTrayImageItemHorizontalPaddingBottomAlignment));
+ } else {
+ tray_view->set_border(views::Border::CreateEmptyBorder(
+ kTrayImageItemVerticalPaddingVerticalAlignment,
+ kTrayImageItemHorizontalPaddingVerticalAlignment,
+ kTrayImageItemVerticalPaddingVerticalAlignment,
+ kTrayImageItemHorizontalPaddingVerticalAlignment));
+ }
+}
+
+void SystemTrayItem::SetTrayLabelItemBorder(internal::TrayItemView* tray_view,
+ ShelfAlignment alignment) {
+ if (alignment == SHELF_ALIGNMENT_BOTTOM) {
+ tray_view->set_border(views::Border::CreateEmptyBorder(
+ 0, kTrayLabelItemHorizontalPaddingBottomAlignment,
+ 0, kTrayLabelItemHorizontalPaddingBottomAlignment));
+ } else {
+ // Center the label for vertical launcher alignment.
+ int horizontal_padding = (tray_view->GetPreferredSize().width() -
+ tray_view->label()->GetPreferredSize().width()) / 2;
+ tray_view->set_border(views::Border::CreateEmptyBorder(
+ kTrayLabelItemVerticalPaddingVeriticalAlignment,
+ horizontal_padding,
+ kTrayLabelItemVerticalPaddingVeriticalAlignment,
+ horizontal_padding));
+ }
+}
+
void SystemTrayItem::SetDetailedViewCloseDelay(int for_seconds) {
Shell::GetInstance()->system_tray()->SetDetailedViewCloseDelay(for_seconds);
}

Powered by Google App Engine
This is Rietveld 408576698