summaryrefslogtreecommitdiffstats
path: root/ash
diff options
context:
space:
mode:
authoroshima@chromium.org <oshima@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2012-10-29 17:29:43 +0000
committeroshima@chromium.org <oshima@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2012-10-29 17:29:43 +0000
commit596c61c153d7b113fee76160c20f4865b834b0ac (patch)
tree36b0bcbe5e38a922c63ff16d3261a9949b95f19f /ash
parentf3fde867a6ad1210f1ad3ded55d82810b9db065a (diff)
downloadchromium_src-596c61c153d7b113fee76160c20f4865b834b0ac.zip
chromium_src-596c61c153d7b113fee76160c20f4865b834b0ac.tar.gz
chromium_src-596c61c153d7b113fee76160c20f4865b834b0ac.tar.bz2
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
Diffstat (limited to 'ash')
-rw-r--r--ash/display/multi_display_manager.cc2
-rw-r--r--ash/extended_desktop_unittest.cc10
-rw-r--r--ash/system/tray/tray_bubble_view.cc6
-rw-r--r--ash/system/tray/tray_bubble_wrapper.cc3
4 files changed, 10 insertions, 11 deletions
diff --git a/ash/display/multi_display_manager.cc b/ash/display/multi_display_manager.cc
index 3a4d3e8..d93321b 100644
--- a/ash/display/multi_display_manager.cc
+++ b/ash/display/multi_display_manager.cc
@@ -339,7 +339,7 @@ const gfx::Display& MultiDisplayManager::GetDisplayNearestWindow(
MultiDisplayManager* manager = const_cast<MultiDisplayManager*>(this);
return root ?
manager->FindDisplayForRootWindow(root) :
- *manager->GetDisplayAt(0);
+ DisplayController::GetPrimaryDisplay();
}
const gfx::Display& MultiDisplayManager::GetDisplayNearestPoint(
diff --git a/ash/extended_desktop_unittest.cc b/ash/extended_desktop_unittest.cc
index 7c76958..213cb8a5 100644
--- a/ash/extended_desktop_unittest.cc
+++ b/ash/extended_desktop_unittest.cc
@@ -551,7 +551,7 @@ TEST_F(ExtendedDesktopTest, ConvertPoint) {
}
TEST_F(ExtendedDesktopTest, OpenSystemTray) {
- UpdateDisplay("1000x600,600x400");
+ UpdateDisplay("500x600,600x400");
SystemTray* tray = ash::Shell::GetInstance()->system_tray();
ASSERT_FALSE(tray->HasSystemBubble());
@@ -563,9 +563,9 @@ TEST_F(ExtendedDesktopTest, OpenSystemTray) {
event_generator.ClickLeftButton();
EXPECT_TRUE(tray->HasSystemBubble());
- UpdateDisplay("100x600");
+ UpdateDisplay("500x600");
EXPECT_TRUE(tray->HasSystemBubble());
- UpdateDisplay("100x600,600x400");
+ UpdateDisplay("500x600,600x400");
EXPECT_TRUE(tray->HasSystemBubble());
// Closes the tray and again makes sure that adding/removing displays doesn't
@@ -575,9 +575,9 @@ TEST_F(ExtendedDesktopTest, OpenSystemTray) {
EXPECT_FALSE(tray->HasSystemBubble());
- UpdateDisplay("100x600");
+ UpdateDisplay("500x600");
EXPECT_FALSE(tray->HasSystemBubble());
- UpdateDisplay("100x600,600x400");
+ UpdateDisplay("500x600,600x400");
EXPECT_FALSE(tray->HasSystemBubble());
}
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_);