Index: ash/system/tray/system_tray.cc |
diff --git a/ash/system/tray/system_tray.cc b/ash/system/tray/system_tray.cc |
index 99113877940e6d3bc69b85922abe487b6f55ce1f..740a10624fb1e1525d7f4bb54af48956e6e015f3 100644 |
--- a/ash/system/tray/system_tray.cc |
+++ b/ash/system/tray/system_tray.cc |
@@ -168,6 +168,7 @@ SystemTray::SystemTray() |
widget_(NULL), |
background_(new internal::SystemTrayBackground), |
should_show_launcher_(false), |
+ shelf_alignment_(SHELF_ALIGNMENT_BOTTOM), |
ALLOW_THIS_IN_INITIALIZER_LIST(hide_background_animator_(this, |
0, kTrayBackgroundAlpha)), |
ALLOW_THIS_IN_INITIALIZER_LIST(hover_background_animator_(this, |
@@ -179,7 +180,8 @@ SystemTray::SystemTray() |
tray_container_->set_border( |
views::Border::CreateEmptyBorder(1, 1, 1, 1)); |
set_border(views::Border::CreateEmptyBorder(0, 0, |
- kPaddingFromBottomOfScreen, kPaddingFromRightEdgeOfScreen)); |
+ kPaddingFromBottomOfScreenBottomAlignment, |
+ kPaddingFromRightEdgeOfScreenBottomAlignment)); |
set_notify_enter_exit_on_child(true); |
SetLayoutManager(new views::BoxLayout(views::BoxLayout::kVertical, 0, 0, 0)); |
AddChildView(tray_container_); |
@@ -478,6 +480,26 @@ void SystemTray::UpdateNotificationAnchor() { |
notification_bubble_->bubble_view()->GetWidget()->StackAtTop(); |
} |
+void SystemTray::SetAlignment(ShelfAlignment alignment) { |
sadrul
2012/05/17 19:57:05
SetShelfAlignment
jennyz
2012/05/17 22:13:30
Done.
|
+ if (alignment == shelf_alignment_) |
+ return; |
+ |
+ if (alignment == SHELF_ALIGNMENT_BOTTOM){ |
+ tray_container_->SetLayoutManager(new views::BoxLayout( |
+ views::BoxLayout::kHorizontal, 0, 0, 0)); |
+ } else if (alignment == SHELF_ALIGNMENT_LEFT || |
+ alignment == SHELF_ALIGNMENT_RIGHT) { |
+ if (shelf_alignment_ == SHELF_ALIGNMENT_BOTTOM) |
+ tray_container_->SetLayoutManager(new views::BoxLayout( |
+ views::BoxLayout::kVertical, 0, 0, 0)); |
+ } |
+ shelf_alignment_ = alignment; |
+} |
+ |
+ShelfAlignment SystemTray::GetAlignment() const { |
+ return shelf_alignment_; |
sadrul
2012/05/17 19:57:05
This should be unix_hacker style and inlined, i.e.
jennyz
2012/05/17 22:13:30
Done.
|
+} |
+ |
bool SystemTray::PerformAction(const views::Event& event) { |
// If we're already showing the default view, hide it; otherwise, show it |
// (and hide any popup that's currently shown). |