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

Unified Diff: ash/system/web_notification/web_notification_tray.cc

Issue 2092473002: Convert TrayBubbleView to wm common types (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@traybubblewrapper
Patch Set: review feedback Created 4 years, 6 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/web_notification/web_notification_tray.h ('k') | ui/views/bubble/bubble_dialog_delegate.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: ash/system/web_notification/web_notification_tray.cc
diff --git a/ash/system/web_notification/web_notification_tray.cc b/ash/system/web_notification/web_notification_tray.cc
index 9f300f4eef8c1706da7edb325602ef50d2762a59..208187b9972a67c591f93046e8c98e7aa87d3065 100644
--- a/ash/system/web_notification/web_notification_tray.cc
+++ b/ash/system/web_notification/web_notification_tray.cc
@@ -10,6 +10,7 @@
#include "ash/common/shelf/shelf_constants.h"
#include "ash/common/shelf/wm_shelf.h"
#include "ash/common/shelf/wm_shelf_util.h"
+#include "ash/common/shell_window_ids.h"
#include "ash/common/system/tray/tray_constants.h"
#include "ash/common/system/tray/tray_utils.h"
#include "ash/common/wm_lookup.h"
@@ -94,8 +95,11 @@ class WebNotificationBubbleWrapper {
views::View::ConvertPointToWidget(anchor, &bounds);
init_params.arrow_offset = bounds.x();
}
- views::TrayBubbleView* bubble_view = views::TrayBubbleView::Create(
- tray->GetBubbleWindowContainer(), anchor, tray, &init_params);
+ DCHECK(anchor);
+ // TrayBubbleView uses |anchor| and |tray| to determine the parent
+ // container. See WebNotificationTray::OnBeforeBubbleWidgetInit().
+ views::TrayBubbleView* bubble_view =
+ views::TrayBubbleView::Create(anchor, tray, &init_params);
bubble_wrapper_.reset(new TrayBubbleWrapper(tray, bubble_view));
bubble_view->SetArrowPaintType(views::BubbleBorder::PAINT_NONE);
bubble->InitializeContents(bubble_view);
@@ -407,6 +411,18 @@ gfx::Rect WebNotificationTray::GetAnchorRect(
return GetBubbleAnchorRect(anchor_widget, anchor_type, anchor_alignment);
}
+void WebNotificationTray::OnBeforeBubbleWidgetInit(
+ views::Widget* anchor_widget,
+ views::Widget* bubble_widget,
+ views::Widget::InitParams* params) const {
+ // Place the bubble in the same root window as |anchor_widget|.
+ WmLookup::Get()
+ ->GetWindowForWidget(anchor_widget)
+ ->GetRootWindowController()
+ ->ConfigureWidgetInitParamsForContainer(
+ bubble_widget, kShellWindowId_SettingBubbleContainer, params);
+}
+
void WebNotificationTray::HideBubble(const views::TrayBubbleView* bubble_view) {
HideBubbleWithView(bubble_view);
}
« no previous file with comments | « ash/system/web_notification/web_notification_tray.h ('k') | ui/views/bubble/bubble_dialog_delegate.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698