From 596c61c153d7b113fee76160c20f4865b834b0ac Mon Sep 17 00:00:00 2001 From: "oshima@chromium.org" Date: Mon, 29 Oct 2012 17:29:43 +0000 Subject: Make sure tray widget doesn't move to other root windows. There were two reasons why this was failing - Test was using too small display (width=100), which makes the tray widget's origin outside of the root. - GetDisplayNearestWindow was modified to use GetDisplayAt when we disabled extended desktop for 23. This fixes to use GetPrimaryDisplay() I also added kStayInSameRootWindowKey to make sure it will never leave the same root window. BUG=none TEST=ExtendedDesktopTest.OpenSystemTray pass without null check. Review URL: https://chromiumcodereview.appspot.com/11338002 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@164669 0039d316-1c4b-4281-b951-d872f2087c98 --- ash/system/tray/tray_bubble_view.cc | 6 +----- ash/system/tray/tray_bubble_wrapper.cc | 3 +++ 2 files changed, 4 insertions(+), 5 deletions(-) (limited to 'ash/system/tray') diff --git a/ash/system/tray/tray_bubble_view.cc b/ash/system/tray/tray_bubble_view.cc index 2d56dba..0578935 100644 --- a/ash/system/tray/tray_bubble_view.cc +++ b/ash/system/tray/tray_bubble_view.cc @@ -308,13 +308,9 @@ void TrayBubbleView::UpdateBubble() { SizeToContents(); GetWidget()->GetRootView()->SchedulePaint(); aura::RootWindow* root_window = GetWidget()->GetNativeView()->GetRootWindow(); - // TODO(oshima): this NULL check shouldn't be needed. - // ExtendedDesktopTest.OpenSystemTray currently triggers it. It indicates the - // bubble is ending up on a display that doesn't have a shelf. ash::internal::ShelfLayoutManager* shelf = ash::GetRootWindowController(root_window)->shelf(); - const bool is_launcher_visible = shelf && shelf->IsVisible(); - bubble_border_->set_paint_arrow(is_launcher_visible); + bubble_border_->set_paint_arrow(shelf->IsVisible()); } void TrayBubbleView::SetMaxHeight(int height) { diff --git a/ash/system/tray/tray_bubble_wrapper.cc b/ash/system/tray/tray_bubble_wrapper.cc index d591f25..5e92a84 100644 --- a/ash/system/tray/tray_bubble_wrapper.cc +++ b/ash/system/tray/tray_bubble_wrapper.cc @@ -7,6 +7,7 @@ #include "ash/system/tray/tray_background_view.h" #include "ash/system/tray/tray_bubble_view.h" #include "ash/system/tray/tray_event_filter.h" +#include "ash/wm/window_properties.h" #include "ui/views/widget/widget.h" using message_center::TrayBubbleView; @@ -20,6 +21,8 @@ TrayBubbleWrapper::TrayBubbleWrapper(TrayBackgroundView* tray, bubble_view_(bubble_view) { bubble_widget_ = views::BubbleDelegateView::CreateBubble(bubble_view_); bubble_widget_->AddObserver(this); + bubble_widget_->GetNativeView()-> + SetProperty(internal::kStayInSameRootWindowKey, true); bubble_view_->InitializeAndShowBubble(); tray_->InitializeBubbleAnimations(bubble_widget_); -- cgit v1.1