Index: ash/system/tray/system_tray.cc |
diff --git a/ash/system/tray/system_tray.cc b/ash/system/tray/system_tray.cc |
index dcb034659217e46d01995d606fe166a7599445cf..c93efc96d284f200e22844f9ec87530c72889810 100644 |
--- a/ash/system/tray/system_tray.cc |
+++ b/ash/system/tray/system_tray.cc |
@@ -27,6 +27,7 @@ |
#include "ash/system/tray_update.h" |
#include "ash/system/user/login_status.h" |
#include "ash/system/user/tray_user.h" |
+#include "ash/system/web_notification/web_notification_tray.h" |
#include "base/command_line.h" |
#include "base/logging.h" |
#include "base/strings/utf_string_conversions.h" |
@@ -373,12 +374,13 @@ bool SystemTray::HasSystemBubbleType(SystemTrayBubble::BubbleType type) { |
void SystemTray::DestroySystemBubble() { |
system_bubble_.reset(); |
detailed_item_ = NULL; |
+ UpdateWebNotifications(); |
} |
void SystemTray::DestroyNotificationBubble() { |
if (notification_bubble_) { |
notification_bubble_.reset(); |
- status_area_widget()->SetHideWebNotifications(false); |
+ UpdateWebNotifications(); |
} |
} |
@@ -477,7 +479,8 @@ void SystemTray::ShowItems(const std::vector<SystemTrayItem*>& items, |
detailed_item_ = NULL; |
UpdateNotificationBubble(); // State changed, re-create notifications. |
- status_area_widget()->SetHideWebNotifications(true); |
+ if (!notification_bubble_) |
+ UpdateWebNotifications(); |
GetShelfLayoutManager()->UpdateAutoHideState(); |
} |
@@ -527,7 +530,29 @@ void SystemTray::UpdateNotificationBubble() { |
if (hide_notifications_) |
notification_bubble->SetVisible(false); |
else |
- status_area_widget()->SetHideWebNotifications(true); |
+ UpdateWebNotifications(); |
+} |
+ |
+void SystemTray::UpdateWebNotifications() { |
+ TrayBubbleView* bubble_view = NULL; |
+ if (notification_bubble_) |
+ bubble_view = notification_bubble_->bubble_view(); |
+ else if (system_bubble_) |
+ bubble_view = system_bubble_->bubble_view(); |
+ |
+ int height = 0; |
+ if (bubble_view) { |
+ gfx::Rect work_area = Shell::GetScreen()->GetDisplayNearestWindow( |
+ bubble_view->GetWidget()->GetNativeView()).work_area(); |
+ if (GetShelfLayoutManager()->GetAlignment() != SHELF_ALIGNMENT_TOP) { |
+ height = std::max( |
+ 0, work_area.height() - bubble_view->GetBoundsInScreen().y()); |
+ } else { |
+ height = std::max( |
+ 0, bubble_view->GetBoundsInScreen().bottom() - work_area.y()); |
+ } |
+ } |
+ status_area_widget()->web_notification_tray()->SetSystemTrayHeight(height); |
} |
void SystemTray::SetShelfAlignment(ShelfAlignment alignment) { |