Index: ash/system/tray/system_tray.cc |
diff --git a/ash/system/tray/system_tray.cc b/ash/system/tray/system_tray.cc |
index b2b9eca423e25ef2be4ce0c3f57870460b1d6dee..4b4eae351af7fa96d825926a644de03c7b4f80e9 100644 |
--- a/ash/system/tray/system_tray.cc |
+++ b/ash/system/tray/system_tray.cc |
@@ -139,8 +139,8 @@ SystemTray::SystemTray() |
update_observer_(NULL), |
user_observer_(NULL), |
should_show_launcher_(false), |
- shelf_alignment_(SHELF_ALIGNMENT_BOTTOM), |
- default_bubble_height_(0) { |
+ default_bubble_height_(0), |
+ hide_notifications_(false) { |
tray_container_ = new internal::SystemTrayContainer; |
tray_container_->SetLayoutManager(new views::BoxLayout( |
views::BoxLayout::kHorizontal, 0, 0, 0)); |
@@ -298,6 +298,16 @@ void SystemTray::UpdateAfterShelfAlignmentChange(ShelfAlignment alignment) { |
} |
} |
+void SystemTray::SetHideNotifications(bool hide_notifications) { |
+ if (notification_bubble_.get()) |
+ notification_bubble_->SetVisible(!hide_notifications); |
+ hide_notifications_ = hide_notifications; |
+} |
+ |
+bool SystemTray::IsBubbleVisible() const { |
+ return bubble_.get() && bubble_->IsVisible(); |
+} |
+ |
bool SystemTray::CloseBubbleForTest() const { |
if (!bubble_.get()) |
return false; |
@@ -462,6 +472,8 @@ void SystemTray::UpdateNotificationBubble() { |
if (arrow_offset >= 0) |
init_params.arrow_offset = arrow_offset; |
notification_bubble_->InitView(init_params); |
+ if (hide_notifications_) |
+ notification_bubble_->SetVisible(false); |
} |
void SystemTray::UpdateNotificationAnchor() { |
@@ -474,11 +486,11 @@ void SystemTray::UpdateNotificationAnchor() { |
void SystemTray::SetBorder() { |
// Change the border padding for different shelf alignment. |
- if (shelf_alignment_ == SHELF_ALIGNMENT_BOTTOM) { |
+ if (shelf_alignment() == SHELF_ALIGNMENT_BOTTOM) { |
set_border(views::Border::CreateEmptyBorder(0, 0, |
kPaddingFromBottomOfScreenBottomAlignment, |
kPaddingFromRightEdgeOfScreenBottomAlignment)); |
- } else if (shelf_alignment_ == SHELF_ALIGNMENT_LEFT) { |
+ } else if (shelf_alignment() == SHELF_ALIGNMENT_LEFT) { |
set_border(views::Border::CreateEmptyBorder(0, |
kPaddingFromEdgeOfScreenVerticalAlignment, |
kPaddingFromBottomOfScreenVerticalAlignment, |
@@ -492,9 +504,9 @@ void SystemTray::SetBorder() { |
} |
void SystemTray::SetShelfAlignment(ShelfAlignment alignment) { |
- if (alignment == shelf_alignment_) |
+ if (alignment == shelf_alignment()) |
return; |
- shelf_alignment_ = alignment; |
+ internal::TrayBackgroundView::SetShelfAlignment(alignment); |
UpdateAfterShelfAlignmentChange(alignment); |
SetBorder(); |
tray_container_->SetLayoutManager(new views::BoxLayout( |