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

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

Issue 20598004: Do not hide the web notification popups by the system tray, rather let them avoid (2nd) (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: fix Created 7 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
« no previous file with comments | « ash/system/tray/system_tray.h ('k') | ash/system/web_notification/web_notification_tray.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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) {
« no previous file with comments | « ash/system/tray/system_tray.h ('k') | ash/system/web_notification/web_notification_tray.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698