diff options
author | ben@chromium.org <ben@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2013-10-25 19:22:45 +0000 |
---|---|---|
committer | ben@chromium.org <ben@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2013-10-25 19:22:45 +0000 |
commit | bf9cdb36cc79becab099c9f37eb80284fb203f45 (patch) | |
tree | 4c9011f0aa08ac613027abd372cec3a3b613032b | |
parent | fef72c1c9890633a237e06ccb0d0f4ce2ca6c9c1 (diff) | |
download | chromium_src-bf9cdb36cc79becab099c9f37eb80284fb203f45.zip chromium_src-bf9cdb36cc79becab099c9f37eb80284fb203f45.tar.gz chromium_src-bf9cdb36cc79becab099c9f37eb80284fb203f45.tar.bz2 |
Make GetRootWindow() return a Window instead of a RootWindow.
Also adds a typedef from RootWindow to WindowEventDispatcher, the eventual name of this type.
Adds a GetDispatcher() method that crawls up to the root Window and returns the WindowEventDispatcher.
R=sky@chromium.org
http://crbug.com/308843
Review URL: https://codereview.chromium.org/37733003
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@231077 0039d316-1c4b-4281-b951-d872f2087c98
222 files changed, 894 insertions, 855 deletions
diff --git a/ash/accelerators/accelerator_controller.cc b/ash/accelerators/accelerator_controller.cc index 4cc30ed..052baaa 100644 --- a/ash/accelerators/accelerator_controller.cc +++ b/ash/accelerators/accelerator_controller.cc @@ -284,7 +284,7 @@ bool HandleRotateScreen() { } bool HandleToggleRootWindowFullScreen() { - Shell::GetPrimaryRootWindow()->ToggleFullScreen(); + Shell::GetPrimaryRootWindow()->GetDispatcher()->ToggleFullScreen(); return true; } diff --git a/ash/accelerators/accelerator_controller_unittest.cc b/ash/accelerators/accelerator_controller_unittest.cc index ce62062..575a5ec 100644 --- a/ash/accelerators/accelerator_controller_unittest.cc +++ b/ash/accelerators/accelerator_controller_unittest.cc @@ -603,21 +603,23 @@ TEST_F(AcceleratorControllerTest, ProcessOnce) { GetController()->Register(accelerator_a, &target); // The accelerator is processed only once. + aura::WindowEventDispatcher* dispatcher = + Shell::GetPrimaryRootWindow()->GetDispatcher(); #if defined(OS_WIN) MSG msg1 = { NULL, WM_KEYDOWN, ui::VKEY_A, 0 }; ui::TranslatedKeyEvent key_event1(msg1, false); - EXPECT_TRUE(Shell::GetPrimaryRootWindow()->AsRootWindowHostDelegate()-> - OnHostKeyEvent(&key_event1)); + EXPECT_TRUE(dispatcher->AsRootWindowHostDelegate()->OnHostKeyEvent( + &key_event1)); MSG msg2 = { NULL, WM_CHAR, L'A', 0 }; ui::TranslatedKeyEvent key_event2(msg2, true); - EXPECT_FALSE(Shell::GetPrimaryRootWindow()->AsRootWindowHostDelegate()-> - OnHostKeyEvent(&key_event2)); + EXPECT_FALSE(dispatcher->AsRootWindowHostDelegate()->OnHostKeyEvent( + &key_event2)); MSG msg3 = { NULL, WM_KEYUP, ui::VKEY_A, 0 }; ui::TranslatedKeyEvent key_event3(msg3, false); - EXPECT_FALSE(Shell::GetPrimaryRootWindow()->AsRootWindowHostDelegate()-> - OnHostKeyEvent(&key_event3)); + EXPECT_FALSE(dispatcher->AsRootWindowHostDelegate()->OnHostKeyEvent( + &key_event3)); #elif defined(USE_X11) XEvent key_event; ui::InitXKeyEventForTesting(ui::ET_KEY_PRESSED, @@ -625,20 +627,20 @@ TEST_F(AcceleratorControllerTest, ProcessOnce) { 0, &key_event); ui::TranslatedKeyEvent key_event1(&key_event, false); - EXPECT_TRUE(Shell::GetPrimaryRootWindow()->AsRootWindowHostDelegate()-> - OnHostKeyEvent(&key_event1)); + EXPECT_TRUE(dispatcher->AsRootWindowHostDelegate()->OnHostKeyEvent( + &key_event1)); ui::TranslatedKeyEvent key_event2(&key_event, true); - EXPECT_FALSE(Shell::GetPrimaryRootWindow()->AsRootWindowHostDelegate()-> - OnHostKeyEvent(&key_event2)); + EXPECT_FALSE(dispatcher->AsRootWindowHostDelegate()->OnHostKeyEvent( + &key_event2)); ui::InitXKeyEventForTesting(ui::ET_KEY_RELEASED, ui::VKEY_A, 0, &key_event); ui::TranslatedKeyEvent key_event3(&key_event, false); - EXPECT_FALSE(Shell::GetPrimaryRootWindow()->AsRootWindowHostDelegate()-> - OnHostKeyEvent(&key_event3)); + EXPECT_FALSE(dispatcher->AsRootWindowHostDelegate()->OnHostKeyEvent( + &key_event3)); #endif EXPECT_EQ(1, target.accelerator_pressed_count()); } diff --git a/ash/accelerators/exit_warning_handler.cc b/ash/accelerators/exit_warning_handler.cc index 6ea635a..1f8b53e 100644 --- a/ash/accelerators/exit_warning_handler.cc +++ b/ash/accelerators/exit_warning_handler.cc @@ -11,7 +11,7 @@ #include "base/time/time.h" #include "base/timer/timer.h" #include "grit/ash_strings.h" -#include "ui/aura/root_window.h" +#include "ui/aura/window.h" #include "ui/base/accessibility/accessible_view_state.h" #include "ui/base/l10n/l10n_util.h" #include "ui/base/resource/resource_bundle.h" @@ -165,7 +165,7 @@ void ExitWarningHandler::CancelTimer() { void ExitWarningHandler::Show() { if (widget_) return; - aura::RootWindow* root_window = Shell::GetTargetRootWindow(); + aura::Window* root_window = Shell::GetTargetRootWindow(); ExitWarningWidgetDelegateView* delegate = new ExitWarningWidgetDelegateView; gfx::Size rs = root_window->bounds().size(); gfx::Size ps = delegate->GetPreferredSize(); diff --git a/ash/accelerators/nested_dispatcher_controller_unittest.cc b/ash/accelerators/nested_dispatcher_controller_unittest.cc index 955630c..232ae9c 100644 --- a/ash/accelerators/nested_dispatcher_controller_unittest.cc +++ b/ash/accelerators/nested_dispatcher_controller_unittest.cc @@ -88,16 +88,18 @@ void DispatchKeyReleaseA() { ui::VKEY_A, 0, &native_event); - ash::Shell::GetPrimaryRootWindow()->PostNativeEvent(&native_event); + aura::WindowEventDispatcher* dispatcher = + ash::Shell::GetPrimaryRootWindow()->GetDispatcher(); + dispatcher->PostNativeEvent(&native_event); ui::InitXKeyEventForTesting(ui::ET_KEY_RELEASED, ui::VKEY_A, 0, &native_event); - ash::Shell::GetPrimaryRootWindow()->PostNativeEvent(&native_event); + dispatcher->PostNativeEvent(&native_event); #endif // Send noop event to signal dispatcher to exit. - ash::Shell::GetPrimaryRootWindow()->PostNativeEvent(ui::CreateNoopEvent()); + dispatcher->PostNativeEvent(ui::CreateNoopEvent()); } } // namespace @@ -111,7 +113,7 @@ TEST_F(NestedDispatcherTest, AssociatedWindowBelowLockScreen) { Shell::GetInstance()->session_state_delegate()->LockScreen(); DispatchKeyReleaseA(); - aura::RootWindow* root_window = ash::Shell::GetPrimaryRootWindow(); + aura::Window* root_window = ash::Shell::GetPrimaryRootWindow(); aura::client::GetDispatcherClient(root_window)->RunWithDispatcher( &inner_dispatcher, associated_window.get(), @@ -132,7 +134,7 @@ TEST_F(NestedDispatcherTest, AssociatedWindowAboveLockScreen) { mock_lock_container.get())); DispatchKeyReleaseA(); - aura::RootWindow* root_window = ash::Shell::GetPrimaryRootWindow(); + aura::Window* root_window = ash::Shell::GetPrimaryRootWindow(); aura::client::GetDispatcherClient(root_window)->RunWithDispatcher( &inner_dispatcher, associated_window.get(), @@ -143,7 +145,7 @@ TEST_F(NestedDispatcherTest, AssociatedWindowAboveLockScreen) { // Test that the nested dispatcher handles accelerators. TEST_F(NestedDispatcherTest, AcceleratorsHandled) { MockDispatcher inner_dispatcher; - aura::RootWindow* root_window = ash::Shell::GetPrimaryRootWindow(); + aura::Window* root_window = ash::Shell::GetPrimaryRootWindow(); ui::Accelerator accelerator(ui::VKEY_A, ui::EF_NONE); accelerator.set_type(ui::ET_KEY_RELEASED); diff --git a/ash/autoclick/autoclick_controller.cc b/ash/autoclick/autoclick_controller.cc index 31dfe3f..17b2558 100644 --- a/ash/autoclick/autoclick_controller.cc +++ b/ash/autoclick/autoclick_controller.cc @@ -154,13 +154,15 @@ void AutoclickControllerImpl::OnTouchEvent(ui::TouchEvent* event) { void AutoclickControllerImpl::DoAutoclick() { gfx::Point screen_location = aura::Env::GetInstance()->last_mouse_location(); - aura::RootWindow* root_window = wm::GetRootWindowAt(screen_location); + aura::Window* root_window = wm::GetRootWindowAt(screen_location); DCHECK(root_window) << "Root window not found while attempting autoclick."; gfx::Point click_location(screen_location); anchor_location_ = click_location; wm::ConvertPointFromScreen(root_window, &click_location); - root_window->ConvertPointToHost(&click_location); + + aura::WindowEventDispatcher* dispatcher = root_window->GetDispatcher(); + dispatcher->ConvertPointToHost(&click_location); ui::MouseEvent press_event(ui::ET_MOUSE_PRESSED, click_location, @@ -171,8 +173,8 @@ void AutoclickControllerImpl::DoAutoclick() { click_location, mouse_event_flags_ | ui::EF_LEFT_MOUSE_BUTTON); - root_window->AsRootWindowHostDelegate()->OnHostMouseEvent(&press_event); - root_window->AsRootWindowHostDelegate()->OnHostMouseEvent(&release_event); + dispatcher->AsRootWindowHostDelegate()->OnHostMouseEvent(&press_event); + dispatcher->AsRootWindowHostDelegate()->OnHostMouseEvent(&release_event); } // static. diff --git a/ash/autoclick/autoclick_unittest.cc b/ash/autoclick/autoclick_unittest.cc index e9fd5cc..7369511 100644 --- a/ash/autoclick/autoclick_unittest.cc +++ b/ash/autoclick/autoclick_unittest.cc @@ -5,6 +5,7 @@ #include "ash/autoclick/autoclick_controller.h" #include "ash/shell.h" #include "ash/test/ash_test_base.h" +#include "ui/aura/root_window.h" #include "ui/aura/test/event_generator.h" #include "ui/aura/window.h" #include "ui/events/event.h" diff --git a/ash/desktop_background/desktop_background_controller_unittest.cc b/ash/desktop_background/desktop_background_controller_unittest.cc index 4d91949..6a7d19c 100644 --- a/ash/desktop_background/desktop_background_controller_unittest.cc +++ b/ash/desktop_background/desktop_background_controller_unittest.cc @@ -45,7 +45,7 @@ const int kLockScreenBackgroundId = // Returns number of child windows in a shell window container. int ChildCountForContainer(int container_id) { - RootWindow* root = ash::Shell::GetPrimaryRootWindow(); + Window* root = ash::Shell::GetPrimaryRootWindow(); Window* container = root->GetChildById(container_id); return static_cast<int>(container->children().size()); } diff --git a/ash/dip_unittest.cc b/ash/dip_unittest.cc index 59020e8..a501ad2 100644 --- a/ash/dip_unittest.cc +++ b/ash/dip_unittest.cc @@ -35,7 +35,7 @@ typedef ash::test::AshTestBase DIPTest; TEST_F(DIPTest, WorkArea) { UpdateDisplay("1000x900*1.0f"); - aura::RootWindow* root = Shell::GetPrimaryRootWindow(); + aura::Window* root = Shell::GetPrimaryRootWindow(); const gfx::Display display = Shell::GetScreen()->GetDisplayNearestWindow(root); @@ -74,7 +74,7 @@ TEST_F(DIPTest, WorkAreaForLegacyShelfLayout) { ash::switches::kAshDisableAlternateShelfLayout); UpdateDisplay("1000x900*1.0f"); - aura::RootWindow* root = Shell::GetPrimaryRootWindow(); + aura::Window* root = Shell::GetPrimaryRootWindow(); const gfx::Display display = Shell::GetScreen()->GetDisplayNearestWindow(root); diff --git a/ash/display/display_controller.cc b/ash/display/display_controller.cc index 7569ac7..68c6f53 100644 --- a/ash/display/display_controller.cc +++ b/ash/display/display_controller.cc @@ -144,7 +144,7 @@ class FocusActivationStore { void Store(bool display_removed) { if (!activation_client_) { - aura::RootWindow* root = Shell::GetPrimaryRootWindow(); + aura::Window* root = Shell::GetPrimaryRootWindow(); activation_client_ = aura::client::GetActivationClient(root); capture_client_ = aura::client::GetCaptureClient(root); focus_client_ = aura::client::GetFocusClient(root); @@ -311,12 +311,12 @@ void DisplayController::RemoveObserver(Observer* observer) { observers_.RemoveObserver(observer); } -aura::RootWindow* DisplayController::GetPrimaryRootWindow() { +aura::Window* DisplayController::GetPrimaryRootWindow() { DCHECK(!root_windows_.empty()); return root_windows_[primary_display_id]; } -aura::RootWindow* DisplayController::GetRootWindowForDisplayId(int64 id) { +aura::Window* DisplayController::GetRootWindowForDisplayId(int64 id) { return root_windows_[id]; } @@ -495,12 +495,12 @@ void DisplayController::EnsurePointerInDisplays() { int64 closest_distance_squared = -1; internal::DisplayManager* display_manager = GetDisplayManager(); - aura::RootWindow* dst_root_window = NULL; + aura::Window* dst_root_window = NULL; for (size_t i = 0; i < display_manager->GetNumDisplays(); ++i) { const gfx::Display& display = display_manager->GetDisplayAt(i); const internal::DisplayInfo display_info = display_manager->GetDisplayInfo(display.id()); - aura::RootWindow* root_window = GetRootWindowForDisplayId(display.id()); + aura::Window* root_window = GetRootWindowForDisplayId(display.id()); if (display_info.bounds_in_native().Contains( cursor_location_in_native_coords_for_restore_)) { dst_root_window = root_window; @@ -517,24 +517,25 @@ void DisplayController::EnsurePointerInDisplays() { int64 distance_squared = (center - point_in_screen).LengthSquared(); if (closest_distance_squared < 0 || closest_distance_squared > distance_squared) { - aura::RootWindow* root_window = GetRootWindowForDisplayId(display.id()); + aura::Window* root_window = GetRootWindowForDisplayId(display.id()); aura::client::ScreenPositionClient* client = aura::client::GetScreenPositionClient(root_window); client->ConvertPointFromScreen(root_window, ¢er); - root_window->ConvertPointToNativeScreen(¢er); + root_window->GetDispatcher()->ConvertPointToNativeScreen(¢er); dst_root_window = root_window; target_location_in_native = center; closest_distance_squared = distance_squared; } } - dst_root_window->ConvertPointFromNativeScreen(&target_location_in_native); + dst_root_window->GetDispatcher()->ConvertPointFromNativeScreen( + &target_location_in_native); dst_root_window->MoveCursorTo(target_location_in_native); } bool DisplayController::UpdateWorkAreaOfDisplayNearestWindow( const aura::Window* window, const gfx::Insets& insets) { - const aura::RootWindow* root_window = window->GetRootWindow(); + const aura::Window* root_window = window->GetRootWindow(); int64 id = internal::GetRootWindowSettings(root_window)->display_id; // if id is |kInvaildDisplayID|, it's being deleted. DCHECK(id != gfx::Display::kInvalidDisplayID); @@ -545,7 +546,7 @@ const gfx::Display& DisplayController::GetDisplayNearestWindow( const aura::Window* window) const { if (!window) return GetPrimaryDisplay(); - const aura::RootWindow* root_window = window->GetRootWindow(); + const aura::Window* root_window = window->GetRootWindow(); if (!root_window) return GetPrimaryDisplay(); int64 id = internal::GetRootWindowSettings(root_window)->display_id; @@ -689,12 +690,12 @@ void DisplayController::PreDisplayConfigurationChange(bool display_removed) { gfx::Point point_in_screen = Shell::GetScreen()->GetCursorScreenPoint(); gfx::Display display = Shell::GetScreen()->GetDisplayNearestPoint(point_in_screen); - aura::RootWindow* root_window = GetRootWindowForDisplayId(display.id()); + aura::Window* root_window = GetRootWindowForDisplayId(display.id()); aura::client::ScreenPositionClient* client = aura::client::GetScreenPositionClient(root_window); client->ConvertPointFromScreen(root_window, &point_in_screen); - root_window->ConvertPointToNativeScreen(&point_in_screen); + root_window->GetDispatcher()->ConvertPointToNativeScreen(&point_in_screen); cursor_location_in_native_coords_for_restore_ = point_in_screen; } @@ -772,12 +773,13 @@ void DisplayController::UpdateHostWindowNames() { // crbug.com/120229 - set the window title for the primary dislpay // to "aura_root_0" so gtalk can find the primary root window to broadcast. // TODO(jhorwich) Remove this once Chrome supports window-based broadcasting. - aura::RootWindow* primary = Shell::GetPrimaryRootWindow(); + aura::Window* primary = Shell::GetPrimaryRootWindow(); Shell::RootWindowList root_windows = Shell::GetAllRootWindows(); for (size_t i = 0; i < root_windows.size(); ++i) { std::string name = root_windows[i] == primary ? "aura_root_0" : "aura_root_x"; - gfx::AcceleratedWidget xwindow = root_windows[i]->GetAcceleratedWidget(); + gfx::AcceleratedWidget xwindow = + root_windows[i]->GetDispatcher()->GetAcceleratedWidget(); XStoreName(gfx::GetXDisplay(), xwindow, name.c_str()); } #endif diff --git a/ash/display/display_controller.h b/ash/display/display_controller.h index d963f13..1070684 100644 --- a/ash/display/display_controller.h +++ b/ash/display/display_controller.h @@ -93,10 +93,10 @@ class ASH_EXPORT DisplayController : public gfx::DisplayObserver, void RemoveObserver(Observer* observer); // Returns the root window for primary display. - aura::RootWindow* GetPrimaryRootWindow(); + aura::Window* GetPrimaryRootWindow(); // Returns the root window for |display_id|. - aura::RootWindow* GetRootWindowForDisplayId(int64 id); + aura::Window* GetRootWindowForDisplayId(int64 id); // Toggle mirror mode. void ToggleMirrorMode(); diff --git a/ash/display/display_controller_unittest.cc b/ash/display/display_controller_unittest.cc index 3d4acf2..a422109 100644 --- a/ash/display/display_controller_unittest.cc +++ b/ash/display/display_controller_unittest.cc @@ -258,7 +258,7 @@ class TestEventHandler : public ui::EventHandler { private: gfx::Point mouse_location_; - aura::RootWindow* target_root_; + aura::Window* target_root_; float touch_radius_x_; float touch_radius_y_; @@ -279,8 +279,8 @@ float GetStoredUIScale(int64 id) { } #if defined(USE_X11) -void GetPrimaryAndSeconary(aura::RootWindow** primary, - aura::RootWindow** secondary) { +void GetPrimaryAndSeconary(aura::Window** primary, + aura::Window** secondary) { *primary = Shell::GetPrimaryRootWindow(); Shell::RootWindowList root_windows = Shell::GetAllRootWindows(); *secondary = root_windows[0] == *primary ? root_windows[1] : root_windows[0]; @@ -547,9 +547,9 @@ TEST_F(DisplayControllerTest, SwapPrimary) { display_manager->SetLayoutForCurrentDisplays(display_layout); EXPECT_NE(primary_display.id(), secondary_display.id()); - aura::RootWindow* primary_root = + aura::Window* primary_root = display_controller->GetRootWindowForDisplayId(primary_display.id()); - aura::RootWindow* secondary_root = + aura::Window* secondary_root = display_controller->GetRootWindowForDisplayId(secondary_display.id()); EXPECT_NE(primary_root, secondary_root); aura::Window* launcher_window = @@ -641,9 +641,9 @@ TEST_F(DisplayControllerTest, SwapPrimaryForLegacyShelfLayout) { display_manager->SetLayoutForCurrentDisplays(display_layout); EXPECT_NE(primary_display.id(), secondary_display.id()); - aura::RootWindow* primary_root = + aura::Window* primary_root = display_controller->GetRootWindowForDisplayId(primary_display.id()); - aura::RootWindow* secondary_root = + aura::Window* secondary_root = display_controller->GetRootWindowForDisplayId(secondary_display.id()); EXPECT_NE(primary_root, secondary_root); aura::Window* launcher_window = @@ -732,9 +732,9 @@ TEST_F(DisplayControllerTest, SwapPrimaryById) { display_manager->SetLayoutForCurrentDisplays(display_layout); EXPECT_NE(primary_display.id(), secondary_display.id()); - aura::RootWindow* primary_root = + aura::Window* primary_root = display_controller->GetRootWindowForDisplayId(primary_display.id()); - aura::RootWindow* secondary_root = + aura::Window* secondary_root = display_controller->GetRootWindowForDisplayId(secondary_display.id()); aura::Window* launcher_window = Launcher::ForPrimaryDisplay()->shelf_widget()->GetNativeView(); @@ -850,20 +850,20 @@ TEST_F(DisplayControllerTest, CursorDeviceScaleFactorSwapPrimary) { gfx::Display primary_display = Shell::GetScreen()->GetPrimaryDisplay(); gfx::Display secondary_display = ScreenAsh::GetSecondaryDisplay(); - aura::RootWindow* primary_root = + aura::Window* primary_root = display_controller->GetRootWindowForDisplayId(primary_display.id()); - aura::RootWindow* secondary_root = + aura::Window* secondary_root = display_controller->GetRootWindowForDisplayId(secondary_display.id()); EXPECT_NE(primary_root, secondary_root); test::CursorManagerTestApi test_api(Shell::GetInstance()->cursor_manager()); - EXPECT_EQ(1.0f, - primary_root->AsRootWindowHostDelegate()->GetDeviceScaleFactor()); + EXPECT_EQ(1.0f, primary_root->GetDispatcher()->AsRootWindowHostDelegate()-> + GetDeviceScaleFactor()); primary_root->MoveCursorTo(gfx::Point(50, 50)); EXPECT_EQ(1.0f, test_api.GetDisplay().device_scale_factor()); - EXPECT_EQ(2.0f, - secondary_root->AsRootWindowHostDelegate()->GetDeviceScaleFactor()); + EXPECT_EQ(2.0f, secondary_root->GetDispatcher()->AsRootWindowHostDelegate()-> + GetDeviceScaleFactor()); secondary_root->MoveCursorTo(gfx::Point(50, 50)); EXPECT_EQ(2.0f, test_api.GetDisplay().device_scale_factor()); @@ -872,13 +872,13 @@ TEST_F(DisplayControllerTest, CursorDeviceScaleFactorSwapPrimary) { // Cursor's device scale factor should be updated accroding to the swap of // primary and secondary. - EXPECT_EQ(1.0f, - secondary_root->AsRootWindowHostDelegate()->GetDeviceScaleFactor()); + EXPECT_EQ(1.0f, secondary_root->GetDispatcher()->AsRootWindowHostDelegate()-> + GetDeviceScaleFactor()); secondary_root->MoveCursorTo(gfx::Point(50, 50)); EXPECT_EQ(1.0f, test_api.GetDisplay().device_scale_factor()); primary_root->MoveCursorTo(gfx::Point(50, 50)); - EXPECT_EQ(2.0f, - primary_root->AsRootWindowHostDelegate()->GetDeviceScaleFactor()); + EXPECT_EQ(2.0f, primary_root->GetDispatcher()->AsRootWindowHostDelegate()-> + GetDeviceScaleFactor()); EXPECT_EQ(2.0f, test_api.GetDisplay().device_scale_factor()); // Deleting 2nd display. @@ -889,8 +889,8 @@ TEST_F(DisplayControllerTest, CursorDeviceScaleFactorSwapPrimary) { EXPECT_EQ(1.0f, test_api.GetDisplay().device_scale_factor()); primary_root->MoveCursorTo(gfx::Point(50, 50)); - EXPECT_EQ(1.0f, - primary_root->AsRootWindowHostDelegate()->GetDeviceScaleFactor()); + EXPECT_EQ(1.0f, primary_root->GetDispatcher()->AsRootWindowHostDelegate()-> + GetDeviceScaleFactor()); EXPECT_EQ(1.0f, test_api.GetDisplay().device_scale_factor()); } @@ -1145,25 +1145,27 @@ TEST_F(DisplayControllerTest, ConvertHostToRootCoords) { #if defined(USE_X11) TEST_F(DisplayControllerTest, XWidowNameForRootWindow) { - EXPECT_EQ("aura_root_0", GetXWindowName(Shell::GetPrimaryRootWindow())); + EXPECT_EQ("aura_root_0", GetXWindowName( + Shell::GetPrimaryRootWindow()->GetDispatcher())); // Multiple display. UpdateDisplay("200x200,300x300"); - aura::RootWindow* primary, *secondary; + aura::Window* primary, *secondary; GetPrimaryAndSeconary(&primary, &secondary); - EXPECT_EQ("aura_root_0", GetXWindowName(primary)); - EXPECT_EQ("aura_root_x", GetXWindowName(secondary)); + EXPECT_EQ("aura_root_0", GetXWindowName(primary->GetDispatcher())); + EXPECT_EQ("aura_root_x", GetXWindowName(secondary->GetDispatcher())); // Swap primary. primary = secondary = NULL; Shell::GetInstance()->display_controller()->SwapPrimaryDisplay(); GetPrimaryAndSeconary(&primary, &secondary); - EXPECT_EQ("aura_root_0", GetXWindowName(primary)); - EXPECT_EQ("aura_root_x", GetXWindowName(secondary)); + EXPECT_EQ("aura_root_0", GetXWindowName(primary->GetDispatcher())); + EXPECT_EQ("aura_root_x", GetXWindowName(secondary->GetDispatcher())); // Switching back to single display. UpdateDisplay("300x400"); - EXPECT_EQ("aura_root_0", GetXWindowName(Shell::GetPrimaryRootWindow())); + EXPECT_EQ("aura_root_0", GetXWindowName( + Shell::GetPrimaryRootWindow()->GetDispatcher())); } #endif diff --git a/ash/display/display_manager_unittest.cc b/ash/display/display_manager_unittest.cc index 3ce03da..2af8d06 100644 --- a/ash/display/display_manager_unittest.cc +++ b/ash/display/display_manager_unittest.cc @@ -382,13 +382,13 @@ TEST_F(DisplayManagerTest, TestDeviceScaleOnlyChange) { return; UpdateDisplay("1000x600"); - EXPECT_EQ(1, - Shell::GetPrimaryRootWindow()->compositor()->device_scale_factor()); + aura::WindowEventDispatcher* dispatcher = + Shell::GetPrimaryRootWindow()->GetDispatcher(); + EXPECT_EQ(1, dispatcher->compositor()->device_scale_factor()); EXPECT_EQ("1000x600", Shell::GetPrimaryRootWindow()->bounds().size().ToString()); UpdateDisplay("1000x600*2"); - EXPECT_EQ(2, - Shell::GetPrimaryRootWindow()->compositor()->device_scale_factor()); + EXPECT_EQ(2, dispatcher->compositor()->device_scale_factor()); EXPECT_EQ("500x300", Shell::GetPrimaryRootWindow()->bounds().size().ToString()); } @@ -590,8 +590,8 @@ TEST_F(DisplayManagerTest, MAYBE_TestNativeDisplaysChangedNoInternal) { EXPECT_EQ(1U, display_manager()->GetNumDisplays()); EXPECT_EQ("1,1 100x100", GetDisplayInfoForId(10).bounds_in_native().ToString()); - EXPECT_EQ("100x100", - ash::Shell::GetPrimaryRootWindow()->GetHostSize().ToString()); + EXPECT_EQ("100x100", ash::Shell::GetPrimaryRootWindow()->GetDispatcher()-> + GetHostSize().ToString()); } #if defined(OS_WIN) diff --git a/ash/display/mirror_window_controller.cc b/ash/display/mirror_window_controller.cc index 5a59487..31cb7f4 100644 --- a/ash/display/mirror_window_controller.cc +++ b/ash/display/mirror_window_controller.cc @@ -187,9 +187,9 @@ void MirrorWindowController::UpdateWindow(const DisplayInfo& display_info) { root_window_->AddChild(mirror_window); mirror_window->SetBounds(root_window_->bounds()); mirror_window->Show(); - reflector_ = ui::ContextFactory::GetInstance()-> - CreateReflector(Shell::GetPrimaryRootWindow()->compositor(), - mirror_window->layer()); + reflector_ = ui::ContextFactory::GetInstance()->CreateReflector( + Shell::GetPrimaryRootWindow()->GetDispatcher()->compositor(), + mirror_window->layer()); cursor_window_ = new aura::Window(cursor_window_delegate_.get()); cursor_window_->SetTransparent(true); @@ -244,7 +244,7 @@ void MirrorWindowController::UpdateCursorLocation() { if (cursor_window_) { // TODO(oshima): Rotate cursor image (including hotpoint). gfx::Point point = aura::Env::GetInstance()->last_mouse_location(); - Shell::GetPrimaryRootWindow()->ConvertPointToHost(&point); + Shell::GetPrimaryRootWindow()->GetDispatcher()->ConvertPointToHost(&point); point.Offset(-hot_point_.x(), -hot_point_.y()); gfx::Rect bounds = cursor_window_->bounds(); bounds.set_origin(point); diff --git a/ash/display/mirror_window_controller_unittest.cc b/ash/display/mirror_window_controller_unittest.cc index bc851ed..dc10b57 100644 --- a/ash/display/mirror_window_controller_unittest.cc +++ b/ash/display/mirror_window_controller_unittest.cc @@ -75,7 +75,7 @@ TEST_F(MirrorWindowControllerTest, MAYBE_MirrorCursorBasic) { DisplayManager* display_manager = Shell::GetInstance()->display_manager(); display_manager->SetSecondDisplayMode(DisplayManager::MIRRORING); UpdateDisplay("400x400,400x400"); - aura::RootWindow* root = Shell::GetInstance()->GetPrimaryRootWindow(); + aura::Window* root = Shell::GetInstance()->GetPrimaryRootWindow(); scoped_ptr<aura::Window> window(aura::test::CreateTestWindowWithDelegate( &test_window_delegate, 0, @@ -132,7 +132,7 @@ TEST_F(MirrorWindowControllerTest, MAYBE_MirrorCursorRotate) { DisplayManager* display_manager = Shell::GetInstance()->display_manager(); display_manager->SetSecondDisplayMode(DisplayManager::MIRRORING); UpdateDisplay("400x400,400x400"); - aura::RootWindow* root = Shell::GetInstance()->GetPrimaryRootWindow(); + aura::Window* root = Shell::GetInstance()->GetPrimaryRootWindow(); scoped_ptr<aura::Window> window(aura::test::CreateTestWindowWithDelegate( &test_window_delegate, 0, @@ -199,7 +199,7 @@ TEST_F(MirrorWindowControllerTest, MAYBE_MirrorCursorLocations) { // Test with device scale factor. UpdateDisplay("400x600*2,400x600"); - aura::RootWindow* root = Shell::GetInstance()->GetPrimaryRootWindow(); + aura::Window* root = Shell::GetInstance()->GetPrimaryRootWindow(); aura::test::EventGenerator generator(root); generator.MoveMouseToInHost(10, 20); diff --git a/ash/display/mouse_cursor_event_filter.cc b/ash/display/mouse_cursor_event_filter.cc index ffbc33d..ebac900 100644 --- a/ash/display/mouse_cursor_event_filter.cc +++ b/ash/display/mouse_cursor_event_filter.cc @@ -49,7 +49,7 @@ MouseCursorEventFilter::~MouseCursorEventFilter() { } void MouseCursorEventFilter::ShowSharedEdgeIndicator( - const aura::RootWindow* from) { + const aura::Window* from) { HideSharedEdgeIndicator(); if (Shell::GetScreen()->GetNumDisplays() <= 1 || from == NULL) { src_indicator_bounds_.SetRect(0, 0, 0, 0); @@ -100,7 +100,7 @@ void MouseCursorEventFilter::OnMouseEvent(ui::MouseEvent* event) { } bool MouseCursorEventFilter::WarpMouseCursorIfNecessary( - aura::RootWindow* target_root, + aura::Window* target_root, const gfx::Point& point_in_screen) { if (Shell::GetScreen()->GetNumDisplays() <= 1 || mouse_warp_mode_ == WARP_NONE) @@ -116,7 +116,7 @@ bool MouseCursorEventFilter::WarpMouseCursorIfNecessary( return false; } - aura::RootWindow* root_at_point = wm::GetRootWindowAt(point_in_screen); + aura::Window* root_at_point = wm::GetRootWindowAt(point_in_screen); gfx::Point point_in_root = point_in_screen; wm::ConvertPointFromScreen(root_at_point, &point_in_root); gfx::Rect root_bounds = root_at_point->bounds(); @@ -149,7 +149,7 @@ bool MouseCursorEventFilter::WarpMouseCursorIfNecessary( gfx::Point point_in_dst_screen(point_in_screen); point_in_dst_screen.Offset(offset_x, offset_y); - aura::RootWindow* dst_root = wm::GetRootWindowAt(point_in_dst_screen); + aura::Window* dst_root = wm::GetRootWindowAt(point_in_dst_screen); // Warp the mouse cursor only if the location is in the indicator bounds // or the mouse pointer is in the destination root. diff --git a/ash/display/mouse_cursor_event_filter.h b/ash/display/mouse_cursor_event_filter.h index c78804c..b05456e 100644 --- a/ash/display/mouse_cursor_event_filter.h +++ b/ash/display/mouse_cursor_event_filter.h @@ -14,6 +14,7 @@ namespace aura { class RootWindow; +class Window; } namespace ash { @@ -43,7 +44,7 @@ class ASH_EXPORT MouseCursorEventFilter : public ui::EventHandler { // Shows/Hide the indicator for window dragging. The |from| // is the window where the dragging started. - void ShowSharedEdgeIndicator(const aura::RootWindow* from); + void ShowSharedEdgeIndicator(const aura::Window* from); void HideSharedEdgeIndicator(); // Overridden from ui::EventHandler: @@ -69,7 +70,7 @@ class ASH_EXPORT MouseCursorEventFilter : public ui::EventHandler { // hits or exceeds the edge of the |target_root| and the mouse cursor // is considered to be in an alternate display. Returns true if // the cursor was moved. - bool WarpMouseCursorIfNecessary(aura::RootWindow* target_root, + bool WarpMouseCursorIfNecessary(aura::Window* target_root, const gfx::Point& point_in_screen); void UpdateHorizontalIndicatorWindowBounds(); @@ -87,7 +88,7 @@ class ASH_EXPORT MouseCursorEventFilter : public ui::EventHandler { gfx::Rect dst_indicator_bounds_; // The root window in which the dragging started. - const aura::RootWindow* drag_source_root_; + const aura::Window* drag_source_root_; float scale_when_drag_started_; diff --git a/ash/display/root_window_transformers.cc b/ash/display/root_window_transformers.cc index efb11f3..0c81684 100644 --- a/ash/display/root_window_transformers.cc +++ b/ash/display/root_window_transformers.cc @@ -50,7 +50,7 @@ void RoundNearZero(gfx::Transform* transform) { // when the device scale factor is changed, instead of // precalculating the transform using fixed value. -gfx::Transform CreateRotationTransform(aura::RootWindow* root_window, +gfx::Transform CreateRotationTransform(aura::Window* root_window, const gfx::Display& display) { DisplayInfo info = Shell::GetInstance()->display_manager()->GetDisplayInfo(display.id()); @@ -92,7 +92,7 @@ gfx::Transform CreateRotationTransform(aura::RootWindow* root_window, return rotate; } -gfx::Transform CreateMagnifierTransform(aura::RootWindow* root_window) { +gfx::Transform CreateMagnifierTransform(aura::Window* root_window) { MagnificationController* magnifier = Shell::GetInstance()->magnification_controller(); float magnifier_scale = 1.f; @@ -123,7 +123,7 @@ gfx::Transform CreateInsetsAndScaleTransform(const gfx::Insets& insets, return transform; } -gfx::Transform CreateOverscanAndUIScaleTransform(aura::RootWindow* root_window, +gfx::Transform CreateOverscanAndUIScaleTransform(aura::Window* root_window, const gfx::Display& display) { DisplayInfo info = Shell::GetInstance()->display_manager()->GetDisplayInfo(display.id()); @@ -136,7 +136,7 @@ gfx::Transform CreateOverscanAndUIScaleTransform(aura::RootWindow* root_window, // RootWindowTransformer for ash environment. class AshRootWindowTransformer : public aura::RootWindowTransformer { public: - AshRootWindowTransformer(aura::RootWindow* root, + AshRootWindowTransformer(aura::Window* root, const gfx::Display& display) : root_window_(root) { root_window_bounds_transform_ = @@ -185,7 +185,7 @@ class AshRootWindowTransformer : public aura::RootWindowTransformer { private: virtual ~AshRootWindowTransformer() {} - aura::RootWindow* root_window_; + aura::Window* root_window_; gfx::Transform transform_; // The accurate representation of the inverse of the |transform_|. @@ -277,7 +277,7 @@ class MirrorRootWindowTransformer : public aura::RootWindowTransformer { } // namespace aura::RootWindowTransformer* CreateRootWindowTransformerForDisplay( - aura::RootWindow* root, + aura::Window* root, const gfx::Display& display) { return new AshRootWindowTransformer(root, display); } diff --git a/ash/display/root_window_transformers.h b/ash/display/root_window_transformers.h index 8af9ee8..e1d4053 100644 --- a/ash/display/root_window_transformers.h +++ b/ash/display/root_window_transformers.h @@ -8,8 +8,8 @@ #include "ash/ash_export.h" namespace aura { -class RootWindow; class RootWindowTransformer; +class Window; } namespace gfx { @@ -22,7 +22,7 @@ namespace internal { class DisplayInfo; ASH_EXPORT aura::RootWindowTransformer* CreateRootWindowTransformerForDisplay( - aura::RootWindow* root, + aura::Window* root, const gfx::Display& display); // Creates a RootWindowTransformers for mirror root window. diff --git a/ash/display/root_window_transformers_unittest.cc b/ash/display/root_window_transformers_unittest.cc index 6e45559..38e2cf3 100644 --- a/ash/display/root_window_transformers_unittest.cc +++ b/ash/display/root_window_transformers_unittest.cc @@ -96,7 +96,7 @@ class TestEventHandler : public ui::EventHandler { private: gfx::Point mouse_location_; - aura::RootWindow* target_root_; + aura::Window* target_root_; float touch_radius_x_; float touch_radius_y_; diff --git a/ash/display/screen_position_controller.cc b/ash/display/screen_position_controller.cc index 3713b78..c8b8c1d 100644 --- a/ash/display/screen_position_controller.cc +++ b/ash/display/screen_position_controller.cc @@ -35,7 +35,7 @@ bool ShouldStayInSameRootWindow(const aura::Window* window) { // the child windows and transient children of the transient children. void MoveAllTransientChildrenToNewRoot(const gfx::Display& display, aura::Window* window) { - aura::RootWindow* dst_root = Shell::GetInstance()->display_controller()-> + aura::Window* dst_root = Shell::GetInstance()->display_controller()-> GetRootWindowForDisplayId(display.id()); aura::Window::Windows transient_children = window->transient_children(); for (aura::Window::Windows::iterator iter = transient_children.begin(); @@ -66,7 +66,7 @@ void MoveAllTransientChildrenToNewRoot(const gfx::Display& display, std::pair<aura::RootWindow*, gfx::Point> GetRootWindowRelativeToWindow( aura::Window* window, const gfx::Point& location) { - aura::RootWindow* root_window = window->GetRootWindow(); + aura::Window* root_window = window->GetRootWindow(); gfx::Point location_in_root(location); aura::Window::ConvertPointToTarget(window, root_window, &location_in_root); @@ -89,7 +89,8 @@ std::pair<aura::RootWindow*, gfx::Point> GetRootWindowRelativeToWindow( // extended root window's coordinates. gfx::Point location_in_native(location_in_root); - root_window->ConvertPointToNativeScreen(&location_in_native); + root_window->GetDispatcher()->ConvertPointToNativeScreen( + &location_in_native); Shell::RootWindowList root_windows = Shell::GetAllRootWindows(); for (size_t i = 0; i < root_windows.size(); ++i) { @@ -99,7 +100,8 @@ std::pair<aura::RootWindow*, gfx::Point> GetRootWindowRelativeToWindow( if (native_bounds.Contains(location_in_native)) { root_window = root_windows[i]; location_in_root = location_in_native; - root_window->ConvertPointFromNativeScreen(&location_in_root); + root_window->GetDispatcher()->ConvertPointFromNativeScreen( + &location_in_root); break; } } @@ -108,7 +110,7 @@ std::pair<aura::RootWindow*, gfx::Point> GetRootWindowRelativeToWindow( // TODO(yusukes): Support non-X11 platforms if necessary. #endif - return std::make_pair(root_window, location_in_root); + return std::make_pair(root_window->GetDispatcher(), location_in_root); } } // namespace @@ -118,19 +120,19 @@ namespace internal { void ScreenPositionController::ConvertPointToScreen( const aura::Window* window, gfx::Point* point) { - const aura::RootWindow* root = window->GetRootWindow(); + const aura::Window* root = window->GetRootWindow(); aura::Window::ConvertPointToTarget(window, root, point); const gfx::Point display_origin = Shell::GetScreen()->GetDisplayNearestWindow( - const_cast<aura::RootWindow*>(root)).bounds().origin(); + const_cast<aura::Window*>(root)).bounds().origin(); point->Offset(display_origin.x(), display_origin.y()); } void ScreenPositionController::ConvertPointFromScreen( const aura::Window* window, gfx::Point* point) { - const aura::RootWindow* root = window->GetRootWindow(); + const aura::Window* root = window->GetRootWindow(); const gfx::Point display_origin = Shell::GetScreen()->GetDisplayNearestWindow( - const_cast<aura::RootWindow*>(root)).bounds().origin(); + const_cast<aura::Window*>(root)).bounds().origin(); point->Offset(-display_origin.x(), -display_origin.y()); aura::Window::ConvertPointToTarget(root, window, point); } @@ -138,8 +140,8 @@ void ScreenPositionController::ConvertPointFromScreen( void ScreenPositionController::ConvertHostPointToScreen( aura::Window* root_window, gfx::Point* point) { - aura::RootWindow* root = root_window->GetRootWindow(); - root->ConvertPointFromHost(point); + aura::Window* root = root_window->GetRootWindow(); + root->GetDispatcher()->ConvertPointFromHost(point); std::pair<aura::RootWindow*, gfx::Point> pair = GetRootWindowRelativeToWindow(root, *point); *point = pair.second; @@ -163,7 +165,7 @@ void ScreenPositionController::SetBounds(aura::Window* window, // outside of the display. if (!window->transient_parent() && !ShouldStayInSameRootWindow(window)) { - aura::RootWindow* dst_root = + aura::Window* dst_root = Shell::GetInstance()->display_controller()->GetRootWindowForDisplayId( display.id()); DCHECK(dst_root); @@ -197,8 +199,9 @@ void ScreenPositionController::SetBounds(aura::Window* window, // Restore focused/active window. if (tracker.Contains(focused)) { aura::client::GetFocusClient(window)->FocusWindow(focused); + // TODO(beng): replace with GetRootWindow(). ash::Shell::GetInstance()->set_target_root_window( - focused->GetRootWindow()); + focused->GetDispatcher()); } else if (tracker.Contains(active)) { activation_client->ActivateWindow(active); } diff --git a/ash/drag_drop/drag_drop_controller_unittest.cc b/ash/drag_drop/drag_drop_controller_unittest.cc index fd26f37..fa4f2bc 100644 --- a/ash/drag_drop/drag_drop_controller_unittest.cc +++ b/ash/drag_drop/drag_drop_controller_unittest.cc @@ -283,7 +283,8 @@ void DispatchGesture(ui::EventType gesture_type, gfx::Point location) { ui::EventTimeForNow(), ui::GestureEventDetails(gesture_type, 0, 0), 1); - Shell::GetPrimaryRootWindow()->DispatchGestureEvent(&gesture_event); + Shell::GetPrimaryRootWindow()->GetDispatcher()->DispatchGestureEvent( + &gesture_event); } bool IsGestureEventType(ui::EventType type) { @@ -762,8 +763,8 @@ TEST_F(DragDropControllerTest, SyntheticEventsDuringDragDrop) { gfx::Point mouse_move_location = drag_view->bounds().CenterPoint(); ui::MouseEvent mouse_move(ui::ET_MOUSE_MOVED, mouse_move_location, mouse_move_location, 0); - Shell::GetPrimaryRootWindow()->AsRootWindowHostDelegate()->OnHostMouseEvent( - &mouse_move); + Shell::GetPrimaryRootWindow()->GetDispatcher()->AsRootWindowHostDelegate()-> + OnHostMouseEvent(&mouse_move); } generator.ReleaseLeftButton(); diff --git a/ash/drag_drop/drag_drop_tracker.cc b/ash/drag_drop/drag_drop_tracker.cc index 72f0389..03ecf79 100644 --- a/ash/drag_drop/drag_drop_tracker.cc +++ b/ash/drag_drop/drag_drop_tracker.cc @@ -50,7 +50,7 @@ aura::Window* DragDropTracker::GetTarget(const ui::LocatedEvent& event) { gfx::Point location_in_screen = event.location(); wm::ConvertPointToScreen(capture_window_.get(), &location_in_screen); - aura::RootWindow* root_window_at_point = + aura::Window* root_window_at_point = wm::GetRootWindowAt(location_in_screen); gfx::Point location_in_root = location_in_screen; wm::ConvertPointFromScreen(root_window_at_point, &location_in_root); diff --git a/ash/focus_cycler_unittest.cc b/ash/focus_cycler_unittest.cc index aebede4..f7629dc 100644 --- a/ash/focus_cycler_unittest.cc +++ b/ash/focus_cycler_unittest.cc @@ -383,7 +383,7 @@ TEST_F(FocusCyclerTest, CycleFocusThroughWindowWithPanes) { // Pressing "Escape" while on the status area should // deactivate it, and activate the browser window. - aura::RootWindow* root = Shell::GetPrimaryRootWindow(); + aura::Window* root = Shell::GetPrimaryRootWindow(); aura::test::EventGenerator event_generator(root, root); event_generator.PressKey(ui::VKEY_ESCAPE, 0); EXPECT_TRUE(wm::IsActiveWindow(browser_window)); diff --git a/ash/launcher/launcher_item_delegate.h b/ash/launcher/launcher_item_delegate.h index a72b6e6..dbc1e65 100644 --- a/ash/launcher/launcher_item_delegate.h +++ b/ash/launcher/launcher_item_delegate.h @@ -53,7 +53,7 @@ class ASH_EXPORT LauncherItemDelegate { // Returns the context menumodel for the specified item on // |root_window|. Return NULL if there should be no context // menu. The caller takes ownership of the returned model. - virtual ui::MenuModel* CreateContextMenu(aura::RootWindow* root_window) = 0; + virtual ui::MenuModel* CreateContextMenu(aura::Window* root_window) = 0; // Returns the application menu model for the specified item. There are three // possible return values: diff --git a/ash/magnifier/magnification_controller.cc b/ash/magnifier/magnification_controller.cc index c6a6a52..0df6e12 100644 --- a/ash/magnifier/magnification_controller.cc +++ b/ash/magnifier/magnification_controller.cc @@ -127,7 +127,7 @@ class MagnificationControllerImpl : virtual public MagnificationController, // - Unzoom the current root_window. // - Zoom the given new root_window |new_root_window|. // - Switch the target window from current window to |new_root_window|. - void SwitchTargetRootWindow(aura::RootWindow* new_root_window, + void SwitchTargetRootWindow(aura::Window* new_root_window, bool redraw_original_root_window); // Returns if the magnification scale is 1.0 or not (larger then 1.0). @@ -147,7 +147,7 @@ class MagnificationControllerImpl : virtual public MagnificationController, virtual void OnTouchEvent(ui::TouchEvent* event) OVERRIDE; // Target root window. This must not be NULL. - aura::RootWindow* root_window_; + aura::Window* root_window_; // True if the magnified window is currently animating a change. Otherwise, // false. @@ -273,7 +273,7 @@ bool MagnificationControllerImpl::RedrawDIP(const gfx::PointF& position_in_dip, Shell::GetScreen()->GetDisplayNearestWindow(root_window_); scoped_ptr<aura::RootWindowTransformer> transformer( internal::CreateRootWindowTransformerForDisplay(root_window_, display)); - root_window_->SetRootWindowTransformer(transformer.Pass()); + root_window_->GetDispatcher()->SetRootWindowTransformer(transformer.Pass()); if (animate) is_on_animation_ = true; @@ -380,7 +380,7 @@ void MagnificationControllerImpl::OnMouseMove(const gfx::Point& location) { if (ret) { // If the magnified region is moved, hides the mouse cursor and moves it. if (x_diff != 0 || y_diff != 0) - MoveCursorTo(root_window_, mouse); + MoveCursorTo(root_window_->GetDispatcher(), mouse); } } } @@ -437,7 +437,7 @@ void MagnificationControllerImpl::OnImplicitAnimationsCompleted() { return; if (move_cursor_after_animation_) { - MoveCursorTo(root_window_, position_after_animation_); + MoveCursorTo(root_window_->GetDispatcher(), position_after_animation_); move_cursor_after_animation_ = false; aura::client::CursorClient* cursor_client = @@ -456,7 +456,7 @@ void MagnificationControllerImpl::OnWindowDestroying( // destroyed before the root windows get destroyed. DCHECK(root_window); - aura::RootWindow* target_root_window = Shell::GetTargetRootWindow(); + aura::Window* target_root_window = Shell::GetTargetRootWindow(); CHECK(target_root_window); // The destroyed root window must not be target. @@ -475,7 +475,7 @@ void MagnificationControllerImpl::OnWindowBoundsChanged( } void MagnificationControllerImpl::SwitchTargetRootWindow( - aura::RootWindow* new_root_window, + aura::Window* new_root_window, bool redraw_original_root_window) { DCHECK(new_root_window); @@ -577,7 +577,7 @@ bool MagnificationControllerImpl::IsEnabled() const { void MagnificationControllerImpl::OnMouseEvent(ui::MouseEvent* event) { aura::Window* target = static_cast<aura::Window*>(event->target()); - aura::RootWindow* current_root = target->GetRootWindow(); + aura::Window* current_root = target->GetRootWindow(); gfx::Rect root_bounds = current_root->bounds(); if (root_bounds.Contains(event->root_location())) { @@ -615,7 +615,7 @@ void MagnificationControllerImpl::OnScrollEvent(ui::ScrollEvent* event) { void MagnificationControllerImpl::OnTouchEvent(ui::TouchEvent* event) { aura::Window* target = static_cast<aura::Window*>(event->target()); - aura::RootWindow* current_root = target->GetRootWindow(); + aura::Window* current_root = target->GetRootWindow(); if (current_root == root_window_) { gfx::Rect root_bounds = current_root->bounds(); if (root_bounds.Contains(event->root_location())) diff --git a/ash/magnifier/magnification_controller_unittest.cc b/ash/magnifier/magnification_controller_unittest.cc index 63608fc..2f87ee1 100644 --- a/ash/magnifier/magnification_controller_unittest.cc +++ b/ash/magnifier/magnification_controller_unittest.cc @@ -32,7 +32,7 @@ class MagnificationControllerTest: public test::AshTestBase { AshTestBase::SetUp(); UpdateDisplay(base::StringPrintf("%dx%d", kRootWidth, kRootHeight)); - aura::RootWindow* root = GetRootWindow(); + aura::Window* root = GetRootWindow(); gfx::Rect root_bounds(root->bounds()); #if defined(OS_WIN) @@ -48,13 +48,13 @@ class MagnificationControllerTest: public test::AshTestBase { } protected: - aura::RootWindow* GetRootWindow() const { + aura::Window* GetRootWindow() const { return Shell::GetPrimaryRootWindow(); } std::string GetHostMouseLocation() { gfx::Point point; - GetRootWindow()->QueryMouseLocationForTest(&point); + GetRootWindow()->GetDispatcher()->QueryMouseLocationForTest(&point); return point.ToString(); } diff --git a/ash/magnifier/partial_magnification_controller.cc b/ash/magnifier/partial_magnification_controller.cc index d913856..3e762b7 100644 --- a/ash/magnifier/partial_magnification_controller.cc +++ b/ash/magnifier/partial_magnification_controller.cc @@ -79,7 +79,7 @@ void PartialMagnificationController::SetEnabled(bool enabled) { void PartialMagnificationController::OnMouseEvent(ui::MouseEvent* event) { if (IsPartialMagnified() && event->type() == ui::ET_MOUSE_MOVED) { aura::Window* target = static_cast<aura::Window*>(event->target()); - aura::RootWindow* current_root = target->GetRootWindow(); + aura::Window* current_root = target->GetRootWindow(); // TODO(zork): Handle the case where the event is captured on a different // display, such as when a menu is opened. gfx::Rect root_bounds = current_root->bounds(); @@ -178,14 +178,14 @@ void PartialMagnificationController::CloseMagnifierWindow() { void PartialMagnificationController::RemoveZoomWidgetObservers() { DCHECK(zoom_widget_); zoom_widget_->RemoveObserver(this); - aura::RootWindow* root_window = + aura::Window* root_window = zoom_widget_->GetNativeView()->GetRootWindow(); DCHECK(root_window); root_window->RemoveObserver(this); } void PartialMagnificationController::SwitchTargetRootWindow( - aura::RootWindow* new_root_window) { + aura::Window* new_root_window) { if (zoom_widget_ && new_root_window == zoom_widget_->GetNativeView()->GetRootWindow()) return; diff --git a/ash/magnifier/partial_magnification_controller.h b/ash/magnifier/partial_magnification_controller.h index 54c15f3..01c3a2b 100644 --- a/ash/magnifier/partial_magnification_controller.h +++ b/ash/magnifier/partial_magnification_controller.h @@ -49,7 +49,7 @@ class PartialMagnificationController // - Remove the magnifier from the current root window. // - Create a magnifier in the new root_window |new_root_window|. // - Switch the target window from current window to |new_root_window|. - void SwitchTargetRootWindow(aura::RootWindow* new_root_window); + void SwitchTargetRootWindow(aura::Window* new_root_window); // Returns the root window that contains the mouse cursor. aura::RootWindow* GetCurrentRootWindow(); diff --git a/ash/root_window_controller.cc b/ash/root_window_controller.cc index a7e70cd..8afa501 100644 --- a/ash/root_window_controller.cc +++ b/ash/root_window_controller.cc @@ -110,7 +110,7 @@ void ReparentWindow(aura::Window* window, aura::Window* new_parent) { } // Reparents the appropriate set of windows from |src| to |dst|. -void ReparentAllWindows(aura::RootWindow* src, aura::RootWindow* dst) { +void ReparentAllWindows(aura::Window* src, aura::Window* dst) { // Set of windows to move. const int kContainerIdsToMove[] = { internal::kShellWindowId_DefaultContainer, @@ -217,7 +217,7 @@ class EmptyWindowDelegate : public aura::WindowDelegate { namespace internal { void RootWindowController::CreateForPrimaryDisplay( - aura::RootWindow * root) { + aura::RootWindow* root) { RootWindowController* controller = new RootWindowController(root); controller->Init(true /* primary */, Shell::GetInstance()->delegate()->IsFirstRunAfterBoot()); @@ -276,7 +276,7 @@ void RootWindowController::Shutdown() { // being removed triggers a relayout of the shelf it will try to build a // window list adding windows from the target root window's containers which // may have already gone away. - if (Shell::GetTargetRootWindow() == root_window_) { + if (Shell::GetTargetRootWindow()->GetDispatcher() == root_window_) { Shell::GetInstance()->set_target_root_window( Shell::GetPrimaryRootWindow() == root_window_.get() ? NULL : Shell::GetPrimaryRootWindow()); @@ -456,7 +456,7 @@ void RootWindowController::CloseChildWindows() { shelf_.reset(NULL); } -void RootWindowController::MoveWindowsTo(aura::RootWindow* dst) { +void RootWindowController::MoveWindowsTo(aura::Window* dst) { // Forget the shelf early so that shelf don't update itself using wrong // display info. workspace_controller_->SetShelf(NULL); @@ -896,7 +896,7 @@ void RootWindowController::OnTouchHudProjectionToggled(bool enabled) { } RootWindowController* GetRootWindowController( - const aura::RootWindow* root_window) { + const aura::Window* root_window) { return root_window ? GetRootWindowSettings(root_window)->controller : NULL; } diff --git a/ash/root_window_controller.h b/ash/root_window_controller.h index 4e6b8d1..3bbc469 100644 --- a/ash/root_window_controller.h +++ b/ash/root_window_controller.h @@ -202,7 +202,7 @@ class ASH_EXPORT RootWindowController : public ShellObserver { void CloseChildWindows(); // Moves child windows to |dest|. - void MoveWindowsTo(aura::RootWindow* dest); + void MoveWindowsTo(aura::Window* dest); // Force the shelf to query for it's current visibility state. void UpdateShelfVisibility(); @@ -301,7 +301,7 @@ class ASH_EXPORT RootWindowController : public ShellObserver { // Gets the RootWindowController for |root_window|. ASH_EXPORT RootWindowController* GetRootWindowController( - const aura::RootWindow* root_window); + const aura::Window* root_window); } // namespace internal } // ash diff --git a/ash/root_window_controller_unittest.cc b/ash/root_window_controller_unittest.cc index c296609..b8c480c 100644 --- a/ash/root_window_controller_unittest.cc +++ b/ash/root_window_controller_unittest.cc @@ -597,7 +597,7 @@ typedef test::NoSessionAshTestBase NoSessionRootWindowControllerTest; // Make sure that an event handler exists for entire display area. TEST_F(NoSessionRootWindowControllerTest, Event) { - aura::RootWindow* root = Shell::GetPrimaryRootWindow(); + aura::Window* root = Shell::GetPrimaryRootWindow(); const gfx::Size size = root->bounds().size(); aura::Window* event_target = root->GetEventHandlerForPoint(gfx::Point(0, 0)); EXPECT_TRUE(event_target); @@ -639,8 +639,8 @@ TEST_F(VirtualKeyboardRootWindowControllerTest, UpdateDisplay("500x500,500x500"); Shell::RootWindowList root_windows = Shell::GetAllRootWindows(); - aura::RootWindow* primary_root_window = Shell::GetPrimaryRootWindow(); - aura::RootWindow* secondary_root_window = + aura::Window* primary_root_window = Shell::GetPrimaryRootWindow(); + aura::Window* secondary_root_window = root_windows[0] == primary_root_window ? root_windows[1] : root_windows[0]; @@ -656,7 +656,7 @@ TEST_F(VirtualKeyboardRootWindowControllerTest, // events at blocked user session. TEST_F(VirtualKeyboardRootWindowControllerTest, ClickVirtualKeyboardInBlockedWindow) { - aura::RootWindow* root_window = Shell::GetPrimaryRootWindow(); + aura::Window* root_window = Shell::GetPrimaryRootWindow(); aura::Window* keyboard_container = Shell::GetContainer(root_window, internal::kShellWindowId_VirtualKeyboardContainer); ASSERT_TRUE(keyboard_container); @@ -689,7 +689,7 @@ TEST_F(VirtualKeyboardRootWindowControllerTest, // GetWindowContainer(). TEST_F(VirtualKeyboardRootWindowControllerTest, DeleteOldContainerOnVirtualKeyboardInit) { - aura::RootWindow* root_window = ash::Shell::GetPrimaryRootWindow(); + aura::Window* root_window = ash::Shell::GetPrimaryRootWindow(); aura::Window* keyboard_container = Shell::GetContainer(root_window, internal::kShellWindowId_VirtualKeyboardContainer); ASSERT_TRUE(keyboard_container); diff --git a/ash/root_window_settings.cc b/ash/root_window_settings.cc index 06198ca..33880ed 100644 --- a/ash/root_window_settings.cc +++ b/ash/root_window_settings.cc @@ -22,17 +22,17 @@ RootWindowSettings::RootWindowSettings() controller(NULL) { } -RootWindowSettings* InitRootWindowSettings(aura::RootWindow* root) { +RootWindowSettings* InitRootWindowSettings(aura::Window* root) { RootWindowSettings* settings = new RootWindowSettings(); root->SetProperty(kRootWindowSettingsKey, settings); return settings; } -RootWindowSettings* GetRootWindowSettings(aura::RootWindow* root) { +RootWindowSettings* GetRootWindowSettings(aura::Window* root) { return root->GetProperty(kRootWindowSettingsKey); } -const RootWindowSettings* GetRootWindowSettings(const aura::RootWindow* root) { +const RootWindowSettings* GetRootWindowSettings(const aura::Window* root) { return root->GetProperty(kRootWindowSettingsKey); } diff --git a/ash/root_window_settings.h b/ash/root_window_settings.h index 784cce6..e49b0f2 100644 --- a/ash/root_window_settings.h +++ b/ash/root_window_settings.h @@ -9,7 +9,7 @@ #include "base/basictypes.h" namespace aura { -class RootWindow; +class Window; } namespace ash { @@ -37,14 +37,14 @@ struct RootWindowSettings { // Initializes and returns RootWindowSettings for |root|. // It is owned by the |root|. -RootWindowSettings* InitRootWindowSettings(aura::RootWindow* root); +RootWindowSettings* InitRootWindowSettings(aura::Window* root); // Returns the RootWindowSettings for |root|. -ASH_EXPORT RootWindowSettings* GetRootWindowSettings(aura::RootWindow* root); +ASH_EXPORT RootWindowSettings* GetRootWindowSettings(aura::Window* root); // const version of GetRootWindowSettings. ASH_EXPORT const RootWindowSettings* -GetRootWindowSettings(const aura::RootWindow* root); +GetRootWindowSettings(const aura::Window* root); } // namespace internal } // namespace ash diff --git a/ash/scoped_target_root_window.cc b/ash/scoped_target_root_window.cc index b488a6f..c34f4c3 100644 --- a/ash/scoped_target_root_window.cc +++ b/ash/scoped_target_root_window.cc @@ -9,7 +9,7 @@ namespace ash { namespace internal { ScopedTargetRootWindow::ScopedTargetRootWindow( - aura::RootWindow* root_window) { + aura::Window* root_window) { Shell::GetInstance()->scoped_target_root_window_ = root_window; } diff --git a/ash/scoped_target_root_window.h b/ash/scoped_target_root_window.h index ab695be..0e7a8b1 100644 --- a/ash/scoped_target_root_window.h +++ b/ash/scoped_target_root_window.h @@ -7,7 +7,7 @@ #include "base/basictypes.h" namespace aura { -class RootWindow; +class Window; } namespace ash { @@ -20,7 +20,7 @@ namespace internal { // a new window using launcher's icon. class ScopedTargetRootWindow { public: - explicit ScopedTargetRootWindow(aura::RootWindow* root_window); + explicit ScopedTargetRootWindow(aura::Window* root_window); ~ScopedTargetRootWindow(); private: diff --git a/ash/screensaver/screensaver_view.cc b/ash/screensaver/screensaver_view.cc index 6c2c1e0..b16d812a 100644 --- a/ash/screensaver/screensaver_view.cc +++ b/ash/screensaver/screensaver_view.cc @@ -143,7 +143,7 @@ void ScreensaverView::LoadScreensaver() { } void ScreensaverView::ShowWindow() { - aura::RootWindow* root_window = ash::Shell::GetPrimaryRootWindow(); + aura::Window* root_window = ash::Shell::GetPrimaryRootWindow(); gfx::Rect screen_rect = Shell::GetScreen()->GetDisplayNearestWindow(root_window).bounds(); diff --git a/ash/shelf/app_list_shelf_item_delegate.cc b/ash/shelf/app_list_shelf_item_delegate.cc index 231f68d..f032d69 100644 --- a/ash/shelf/app_list_shelf_item_delegate.cc +++ b/ash/shelf/app_list_shelf_item_delegate.cc @@ -36,7 +36,7 @@ base::string16 AppListShelfItemDelegate::GetTitle() { } ui::MenuModel* AppListShelfItemDelegate::CreateContextMenu( - aura::RootWindow* root_window) { + aura::Window* root_window) { return NULL; } diff --git a/ash/shelf/app_list_shelf_item_delegate.h b/ash/shelf/app_list_shelf_item_delegate.h index 2827599..6a14f14 100644 --- a/ash/shelf/app_list_shelf_item_delegate.h +++ b/ash/shelf/app_list_shelf_item_delegate.h @@ -23,7 +23,7 @@ class AppListShelfItemDelegate : public LauncherItemDelegate { virtual void ItemSelected(const ui::Event& event) OVERRIDE; virtual base::string16 GetTitle() OVERRIDE; virtual ui::MenuModel* CreateContextMenu( - aura::RootWindow* root_window) OVERRIDE; + aura::Window* root_window) OVERRIDE; virtual LauncherMenuModel* CreateApplicationMenu(int event_flags) OVERRIDE; virtual bool IsDraggable() OVERRIDE; virtual bool ShouldShowTooltip() OVERRIDE; diff --git a/ash/shelf/shelf_alignment_menu.cc b/ash/shelf/shelf_alignment_menu.cc index d0d381f..722b053 100644 --- a/ash/shelf/shelf_alignment_menu.cc +++ b/ash/shelf/shelf_alignment_menu.cc @@ -8,12 +8,12 @@ #include "ash/shelf/shelf_types.h" #include "ash/shell.h" #include "grit/ash_strings.h" -#include "ui/aura/root_window.h" +#include "ui/aura/window.h" #include "ui/base/l10n/l10n_util.h" namespace ash { -ShelfAlignmentMenu::ShelfAlignmentMenu(aura::RootWindow* root) +ShelfAlignmentMenu::ShelfAlignmentMenu(aura::Window* root) : ui::SimpleMenuModel(NULL), root_window_(root) { DCHECK(root_window_); diff --git a/ash/shelf/shelf_alignment_menu.h b/ash/shelf/shelf_alignment_menu.h index 288de9a..e7acce28 100644 --- a/ash/shelf/shelf_alignment_menu.h +++ b/ash/shelf/shelf_alignment_menu.h @@ -19,7 +19,7 @@ namespace ash { class ASH_EXPORT ShelfAlignmentMenu : public ui::SimpleMenuModel, public ui::SimpleMenuModel::Delegate { public: - explicit ShelfAlignmentMenu(aura::RootWindow* root); + explicit ShelfAlignmentMenu(aura::Window* root); virtual ~ShelfAlignmentMenu(); // ui::SimpleMenuModel::Delegate overrides: @@ -38,7 +38,7 @@ class ASH_EXPORT ShelfAlignmentMenu : public ui::SimpleMenuModel, MENU_ALIGN_BOTTOM, }; - aura::RootWindow* root_window_; + aura::Window* root_window_; DISALLOW_COPY_AND_ASSIGN(ShelfAlignmentMenu); }; diff --git a/ash/shelf/shelf_layout_manager.h b/ash/shelf/shelf_layout_manager.h index d8b6e8f..7c4e26e 100644 --- a/ash/shelf/shelf_layout_manager.h +++ b/ash/shelf/shelf_layout_manager.h @@ -342,7 +342,7 @@ class ASH_EXPORT ShelfLayoutManager : // The RootWindow is cached so that we don't invoke Shell::GetInstance() from // our destructor. We avoid that as at the time we're deleted Shell is being // deleted too. - aura::RootWindow* root_window_; + aura::Window* root_window_; // True when inside UpdateBoundsAndOpacity() method. Used to prevent calling // UpdateBoundsAndOpacity() again from SetChildBounds(). diff --git a/ash/shelf/shelf_layout_manager_observer.h b/ash/shelf/shelf_layout_manager_observer.h index 328e209..6209980 100644 --- a/ash/shelf/shelf_layout_manager_observer.h +++ b/ash/shelf/shelf_layout_manager_observer.h @@ -9,7 +9,7 @@ #include "ash/shelf/shelf_types.h" namespace aura { -class RootWindow; +class Window; } namespace ash { @@ -28,7 +28,7 @@ class ASH_EXPORT ShelfLayoutManagerObserver { virtual void OnAutoHideStateChanged(ShelfAutoHideState new_state) {} // Called when the auto hide behavior is changed. - virtual void OnAutoHideBehaviorChanged(aura::RootWindow* root_window, + virtual void OnAutoHideBehaviorChanged(aura::Window* root_window, ShelfAutoHideBehavior new_behavior) {} }; diff --git a/ash/shelf/shelf_layout_manager_unittest.cc b/ash/shelf/shelf_layout_manager_unittest.cc index 9795e0e..ed9bb34 100644 --- a/ash/shelf/shelf_layout_manager_unittest.cc +++ b/ash/shelf/shelf_layout_manager_unittest.cc @@ -797,7 +797,7 @@ TEST_F(ShelfLayoutManagerTest, LauncherUpdatedWhenStatusAreaChangesSize) { // Various assertions around auto-hide. TEST_F(ShelfLayoutManagerTest, MAYBE_AutoHide) { - aura::RootWindow* root = Shell::GetPrimaryRootWindow(); + aura::Window* root = Shell::GetPrimaryRootWindow(); aura::test::EventGenerator generator(root, root); generator.MoveMouseTo(0, 0); @@ -974,7 +974,7 @@ TEST_F(ShelfLayoutManagerTest, VisibleWhenLockScreenShowing) { EXPECT_EQ(SHELF_AUTO_HIDE, shelf->visibility_state()); EXPECT_EQ(SHELF_AUTO_HIDE_HIDDEN, shelf->auto_hide_state()); - aura::RootWindow* root = Shell::GetPrimaryRootWindow(); + aura::Window* root = Shell::GetPrimaryRootWindow(); // LayoutShelf() forces the animation to completion, at which point the // launcher should go off the screen. shelf->LayoutShelf(); diff --git a/ash/shelf/shelf_tooltip_manager.cc b/ash/shelf/shelf_tooltip_manager.cc index bdf3306..10ea4a6 100644 --- a/ash/shelf/shelf_tooltip_manager.cc +++ b/ash/shelf/shelf_tooltip_manager.cc @@ -96,7 +96,7 @@ ShelfTooltipManager::ShelfTooltipBubble::ShelfTooltipBubble( SetLayoutManager(new views::FillLayout()); // The anchor may not have the widget in tests. if (anchor->GetWidget() && anchor->GetWidget()->GetNativeView()) { - aura::RootWindow* root_window = + aura::Window* root_window = anchor->GetWidget()->GetNativeView()->GetRootWindow(); set_parent_window(ash::Shell::GetInstance()->GetContainer( root_window, ash::internal::kShellWindowId_SettingBubbleContainer)); diff --git a/ash/shelf/shelf_tooltip_manager_unittest.cc b/ash/shelf/shelf_tooltip_manager_unittest.cc index 6f2f0fa..d4b9c07 100644 --- a/ash/shelf/shelf_tooltip_manager_unittest.cc +++ b/ash/shelf/shelf_tooltip_manager_unittest.cc @@ -180,7 +180,7 @@ TEST_F(ShelfTooltipManagerTest, ShouldHideForEvents) { ShowImmediately(); ASSERT_TRUE(TooltipIsVisible()); - aura::RootWindow* root_window = Shell::GetInstance()->GetPrimaryRootWindow(); + aura::Window* root_window = Shell::GetInstance()->GetPrimaryRootWindow(); ui::EventHandler* event_handler = GetEventHandler(); // Should not hide for key events. @@ -222,7 +222,7 @@ TEST_F(ShelfTooltipManagerTest, HideForMouseMoveEvent) { ShowImmediately(); ASSERT_TRUE(TooltipIsVisible()); - aura::RootWindow* root_window = Shell::GetInstance()->GetPrimaryRootWindow(); + aura::Window* root_window = Shell::GetInstance()->GetPrimaryRootWindow(); ui::EventHandler* event_handler = GetEventHandler(); gfx::Rect tooltip_rect = GetTooltipWidget()->GetNativeWindow()->bounds(); @@ -251,7 +251,7 @@ TEST_F(ShelfTooltipManagerTest, HideForMouseClickEvent) { ShowImmediately(); ASSERT_TRUE(TooltipIsVisible()); - aura::RootWindow* root_window = Shell::GetInstance()->GetPrimaryRootWindow(); + aura::Window* root_window = Shell::GetInstance()->GetPrimaryRootWindow(); ui::EventHandler* event_handler = GetEventHandler(); gfx::Rect tooltip_rect = GetTooltipWidget()->GetNativeWindow()->bounds(); diff --git a/ash/shelf/shelf_view.cc b/ash/shelf/shelf_view.cc index aece79f..aebe0b1 100644 --- a/ash/shelf/shelf_view.cc +++ b/ash/shelf/shelf_view.cc @@ -327,7 +327,7 @@ void ReflectItemStatus(const ash::LauncherItem& item, gfx::Point GetPositionInScreen(const gfx::Point& root_location, views::View* view) { gfx::Point root_location_in_screen = root_location; - aura::RootWindow* root_window = + aura::Window* root_window = view->GetWidget()->GetNativeWindow()->GetRootWindow(); aura::client::GetScreenPositionClient(root_window->GetRootWindow())-> ConvertPointToScreen(root_window, &root_location_in_screen); diff --git a/ash/shelf/shelf_widget_unittest.cc b/ash/shelf/shelf_widget_unittest.cc index 6004a6c..010db18 100644 --- a/ash/shelf/shelf_widget_unittest.cc +++ b/ash/shelf/shelf_widget_unittest.cc @@ -54,7 +54,7 @@ TEST_F(ShelfWidgetTest, DISABLED_ActivateAsFallback) { EXPECT_FALSE(shelf_widget->CanActivate()); } -void TestLauncherAlignment(aura::RootWindow* root, +void TestLauncherAlignment(aura::Window* root, ShelfAlignment alignment, const std::string& expected) { Shell::GetInstance()->SetShelfAlignment(alignment, root); diff --git a/ash/shell.cc b/ash/shell.cc index ddb1598..177638f 100644 --- a/ash/shell.cc +++ b/ash/shell.cc @@ -202,12 +202,12 @@ Shell::RootWindowControllerList Shell::GetAllRootWindowControllers() { } // static -aura::RootWindow* Shell::GetPrimaryRootWindow() { +aura::Window* Shell::GetPrimaryRootWindow() { return GetInstance()->display_controller()->GetPrimaryRootWindow(); } // static -aura::RootWindow* Shell::GetTargetRootWindow() { +aura::Window* Shell::GetTargetRootWindow() { Shell* shell = GetInstance(); if (shell->scoped_target_root_window_) return shell->scoped_target_root_window_; @@ -226,13 +226,13 @@ Shell::RootWindowList Shell::GetAllRootWindows() { } // static -aura::Window* Shell::GetContainer(aura::RootWindow* root_window, +aura::Window* Shell::GetContainer(aura::Window* root_window, int container_id) { return root_window->GetChildById(container_id); } // static -const aura::Window* Shell::GetContainer(const aura::RootWindow* root_window, +const aura::Window* Shell::GetContainer(const aura::Window* root_window, int container_id) { return root_window->GetChildById(container_id); } @@ -240,7 +240,7 @@ const aura::Window* Shell::GetContainer(const aura::RootWindow* root_window, // static std::vector<aura::Window*> Shell::GetContainersFromAllRootWindows( int container_id, - aura::RootWindow* priority_root) { + aura::Window* priority_root) { std::vector<aura::Window*> containers; RootWindowList root_windows = GetAllRootWindows(); for (RootWindowList::const_iterator it = root_windows.begin(); @@ -265,7 +265,7 @@ void Shell::ShowContextMenu(const gfx::Point& location_in_screen, if (session_state_delegate_->IsScreenLocked()) return; - aura::RootWindow* root = + aura::Window* root = wm::GetRootWindowMatching(gfx::Rect(location_in_screen, gfx::Size())); internal::GetRootWindowController(root)-> ShowContextMenu(location_in_screen, source_type); @@ -402,19 +402,19 @@ void Shell::UpdateShelfVisibility() { } void Shell::SetShelfAutoHideBehavior(ShelfAutoHideBehavior behavior, - aura::RootWindow* root_window) { + aura::Window* root_window) { ash::internal::ShelfLayoutManager::ForLauncher(root_window)-> SetAutoHideBehavior(behavior); } ShelfAutoHideBehavior Shell::GetShelfAutoHideBehavior( - aura::RootWindow* root_window) const { + aura::Window* root_window) const { return ash::internal::ShelfLayoutManager::ForLauncher(root_window)-> auto_hide_behavior(); } void Shell::SetShelfAlignment(ShelfAlignment alignment, - aura::RootWindow* root_window) { + aura::Window* root_window) { if (ash::internal::ShelfLayoutManager::ForLauncher(root_window)-> SetAlignment(alignment)) { FOR_EACH_OBSERVER( @@ -422,7 +422,7 @@ void Shell::SetShelfAlignment(ShelfAlignment alignment, } } -ShelfAlignment Shell::GetShelfAlignment(aura::RootWindow* root_window) { +ShelfAlignment Shell::GetShelfAlignment(aura::Window* root_window) { return internal::GetRootWindowController(root_window)-> GetShelfLayoutManager()->GetAlignment(); } @@ -435,7 +435,7 @@ void Shell::SetDimming(bool should_dim) { } void Shell::NotifyFullscreenStateChange(bool is_fullscreen, - aura::RootWindow* root_window) { + aura::Window* root_window) { FOR_EACH_OBSERVER(ShellObserver, observers_, OnFullscreenStateChanged( is_fullscreen, root_window)); } @@ -744,7 +744,7 @@ void Shell::Init() { display_controller_->Start(); display_controller_->InitPrimaryDisplay(); - aura::RootWindow* root_window = display_controller_->GetPrimaryRootWindow(); + aura::Window* root_window = display_controller_->GetPrimaryRootWindow(); target_root_window_ = root_window; resolution_notification_controller_.reset( @@ -769,7 +769,7 @@ void Shell::Init() { AddShellObserver(overlay_filter_.get()); input_method_filter_.reset(new views::corewm::InputMethodEventFilter( - root_window->GetAcceleratedWidget())); + root_window->GetDispatcher()->GetAcceleratedWidget())); AddPreTargetHandler(input_method_filter_.get()); accelerator_filter_.reset(new internal::AcceleratorFilter); @@ -859,7 +859,8 @@ void Shell::Init() { // TODO(oshima): Initialize all RootWindowControllers once, and // initialize controller/delegates above when initializing the // primary root window controller. - internal::RootWindowController::CreateForPrimaryDisplay(root_window); + internal::RootWindowController::CreateForPrimaryDisplay( + root_window->GetDispatcher()); display_controller_->InitSecondaryDisplays(); diff --git a/ash/shell.h b/ash/shell.h index eb20038..5f8b7cf 100644 --- a/ash/shell.h +++ b/ash/shell.h @@ -191,16 +191,16 @@ class ASH_EXPORT Shell // TODO(oshima): move this to |RootWindowController| static RootWindowControllerList GetAllRootWindowControllers(); - // Returns the primary RootWindow. The primary RootWindow is the one - // that has a launcher. - static aura::RootWindow* GetPrimaryRootWindow(); + // Returns the primary root Window. The primary root Window is the one that + // has a launcher. + static aura::Window* GetPrimaryRootWindow(); - // Returns a RootWindow when used as a target when creating a new window. + // Returns a root Window when used as a target when creating a new window. // The root window of the active window is used in most cases, but can // be overridden by using ScopedTargetRootWindow(). - // If you want to get a RootWindow of the active window, just use + // If you want to get the root Window of the active window, just use // |wm::GetActiveWindow()->GetRootWindow()|. - static aura::RootWindow* GetTargetRootWindow(); + static aura::Window* GetTargetRootWindow(); // Returns the global Screen object that's always active in ash. static gfx::Screen* GetScreen(); @@ -208,9 +208,9 @@ class ASH_EXPORT Shell // Returns all root windows. static RootWindowList GetAllRootWindows(); - static aura::Window* GetContainer(aura::RootWindow* root_window, + static aura::Window* GetContainer(aura::Window* root_window, int container_id); - static const aura::Window* GetContainer(const aura::RootWindow* root_window, + static const aura::Window* GetContainer(const aura::Window* root_window, int container_id); // Returns the list of containers that match |container_id| in @@ -218,9 +218,9 @@ class ASH_EXPORT Shell // in the |priority_root| will be inserted at the top of the list. static std::vector<aura::Window*> GetContainersFromAllRootWindows( int container_id, - aura::RootWindow* priority_root); + aura::Window* priority_root); - void set_target_root_window(aura::RootWindow* target_root_window) { + void set_target_root_window(aura::Window* target_root_window) { target_root_window_ = target_root_window; } @@ -410,14 +410,14 @@ class ASH_EXPORT Shell // Sets/gets the shelf auto-hide behavior on |root_window|. void SetShelfAutoHideBehavior(ShelfAutoHideBehavior behavior, - aura::RootWindow* root_window); + aura::Window* root_window); ShelfAutoHideBehavior GetShelfAutoHideBehavior( - aura::RootWindow* root_window) const; + aura::Window* root_window) const; // Sets/gets shelf's alignment on |root_window|. void SetShelfAlignment(ShelfAlignment alignment, - aura::RootWindow* root_window); - ShelfAlignment GetShelfAlignment(aura::RootWindow* root_window); + aura::Window* root_window); + ShelfAlignment GetShelfAlignment(aura::Window* root_window); // Dims or undims the screen. void SetDimming(bool should_dim); @@ -425,7 +425,7 @@ class ASH_EXPORT Shell // Notifies |observers_| when entering or exiting fullscreen mode in // |root_window|. void NotifyFullscreenStateChange(bool is_fullscreen, - aura::RootWindow* root_window); + aura::Window* root_window); // Creates a modal background (a partially-opaque fullscreen window) // on all displays for |window|. @@ -566,8 +566,8 @@ class ASH_EXPORT Shell // created on |scoped_target_root_window_| , unless NULL in // which case they are created on |target_root_window_|. // |target_root_window_| never becomes NULL during the session. - aura::RootWindow* target_root_window_; - aura::RootWindow* scoped_target_root_window_; + aura::Window* target_root_window_; + aura::Window* scoped_target_root_window_; // The CompoundEventFilter owned by aura::Env object. scoped_ptr<views::corewm::CompoundEventFilter> env_filter_; diff --git a/ash/shell/content_client/shell_browser_main_parts.cc b/ash/shell/content_client/shell_browser_main_parts.cc index f8eb434..71e6ca4 100644 --- a/ash/shell/content_client/shell_browser_main_parts.cc +++ b/ash/shell/content_client/shell_browser_main_parts.cc @@ -134,7 +134,7 @@ void ShellBrowserMainParts::PreMainMessageLoopRun() { Shell::GetInstance()->desktop_background_controller()->SetDefaultWallpaper( false /* is_guest */); - ash::Shell::GetPrimaryRootWindow()->ShowRootWindow(); + ash::Shell::GetPrimaryRootWindow()->GetDispatcher()->ShowRootWindow(); } void ShellBrowserMainParts::PostMainMessageLoopRun() { diff --git a/ash/shell/context_menu.cc b/ash/shell/context_menu.cc index e1a62d1..19ad408 100644 --- a/ash/shell/context_menu.cc +++ b/ash/shell/context_menu.cc @@ -14,7 +14,7 @@ namespace ash { namespace shell { -ContextMenu::ContextMenu(aura::RootWindow* root) +ContextMenu::ContextMenu(aura::Window* root) : ui::SimpleMenuModel(NULL), root_window_(root), alignment_menu_(root) { diff --git a/ash/shell/context_menu.h b/ash/shell/context_menu.h index a07310e..32421ca 100644 --- a/ash/shell/context_menu.h +++ b/ash/shell/context_menu.h @@ -21,7 +21,7 @@ namespace shell { class ContextMenu : public ui::SimpleMenuModel, public ui::SimpleMenuModel::Delegate { public: - explicit ContextMenu(aura::RootWindow* root); + explicit ContextMenu(aura::Window* root); virtual ~ContextMenu(); // ui::SimpleMenuModel::Delegate overrides: @@ -38,7 +38,7 @@ class ContextMenu : public ui::SimpleMenuModel, MENU_ALIGNMENT_MENU, }; - aura::RootWindow* root_window_; + aura::Window* root_window_; ShelfAlignmentMenu alignment_menu_; diff --git a/ash/shell/shell_delegate_impl.cc b/ash/shell/shell_delegate_impl.cc index 6280f2b..717d07d 100644 --- a/ash/shell/shell_delegate_impl.cc +++ b/ash/shell/shell_delegate_impl.cc @@ -155,7 +155,7 @@ void ShellDelegateImpl::HandleMediaPlayPause() { void ShellDelegateImpl::HandleMediaPrevTrack() { } -ui::MenuModel* ShellDelegateImpl::CreateContextMenu(aura::RootWindow* root) { +ui::MenuModel* ShellDelegateImpl::CreateContextMenu(aura::Window* root) { return new ContextMenu(root); } diff --git a/ash/shell/shell_delegate_impl.h b/ash/shell/shell_delegate_impl.h index 75c14e4..35f46ff 100644 --- a/ash/shell/shell_delegate_impl.h +++ b/ash/shell/shell_delegate_impl.h @@ -52,7 +52,7 @@ class ShellDelegateImpl : public ash::ShellDelegate { virtual void HandleMediaPlayPause() OVERRIDE; virtual void HandleMediaPrevTrack() OVERRIDE; virtual ui::MenuModel* CreateContextMenu( - aura::RootWindow* root_window) OVERRIDE; + aura::Window* root_window) OVERRIDE; virtual RootWindowHostFactory* CreateRootWindowHostFactory() OVERRIDE; virtual base::string16 GetProductName() const OVERRIDE; diff --git a/ash/shell/window_watcher.cc b/ash/shell/window_watcher.cc index 7c72e27..302a523 100644 --- a/ash/shell/window_watcher.cc +++ b/ash/shell/window_watcher.cc @@ -36,7 +36,7 @@ class WindowWatcher::WorkspaceWindowWatcher : public aura::WindowObserver { window->RemoveObserver(watcher_); } - void RootWindowAdded(aura::RootWindow* root) { + void RootWindowAdded(aura::Window* root) { aura::Window* panel_container = ash::Shell::GetContainer( root, internal::kShellWindowId_PanelContainer); @@ -150,7 +150,7 @@ void WindowWatcher::OnDisplayBoundsChanged(const gfx::Display& display) { } void WindowWatcher::OnDisplayAdded(const gfx::Display& new_display) { - aura::RootWindow* root = Shell::GetInstance()->display_controller()-> + aura::Window* root = Shell::GetInstance()->display_controller()-> GetRootWindowForDisplayId(new_display.id()); workspace_window_watcher_->RootWindowAdded(root); } diff --git a/ash/shell/window_watcher_launcher_item_delegate.cc b/ash/shell/window_watcher_launcher_item_delegate.cc index 553b9fc..e755a6e 100644 --- a/ash/shell/window_watcher_launcher_item_delegate.cc +++ b/ash/shell/window_watcher_launcher_item_delegate.cc @@ -36,7 +36,7 @@ base::string16 WindowWatcherLauncherItemDelegate::GetTitle() { } ui::MenuModel* WindowWatcherLauncherItemDelegate::CreateContextMenu( - aura::RootWindow* root_window) { + aura::Window* root_window) { return NULL; } diff --git a/ash/shell/window_watcher_launcher_item_delegate.h b/ash/shell/window_watcher_launcher_item_delegate.h index e7d0b22..53014b6 100644 --- a/ash/shell/window_watcher_launcher_item_delegate.h +++ b/ash/shell/window_watcher_launcher_item_delegate.h @@ -25,7 +25,7 @@ class WindowWatcherLauncherItemDelegate : public ash::LauncherItemDelegate { virtual void ItemSelected(const ui::Event& event) OVERRIDE; virtual base::string16 GetTitle() OVERRIDE; virtual ui::MenuModel* CreateContextMenu( - aura::RootWindow* root_window) OVERRIDE; + aura::Window* root_window) OVERRIDE; virtual ash::LauncherMenuModel* CreateApplicationMenu( int event_flags) OVERRIDE; virtual bool IsDraggable() OVERRIDE; diff --git a/ash/shell/window_watcher_unittest.cc b/ash/shell/window_watcher_unittest.cc index 71a2f87..4d470ae 100644 --- a/ash/shell/window_watcher_unittest.cc +++ b/ash/shell/window_watcher_unittest.cc @@ -24,7 +24,7 @@ TEST_F(WindowWatcherTest, ShellDeleteInstance) { shell::ShellDelegateImpl* delegate = new ash::shell::ShellDelegateImpl; Shell::CreateInstance(delegate); - Shell::GetPrimaryRootWindow()->ShowRootWindow(); + Shell::GetPrimaryRootWindow()->GetDispatcher()->ShowRootWindow(); Shell::GetInstance()->CreateLauncher(); Shell::GetInstance()->UpdateAfterLoginStatusChange( user::LOGGED_IN_USER); diff --git a/ash/shell_delegate.h b/ash/shell_delegate.h index 42d936a..6cd0baa 100644 --- a/ash/shell_delegate.h +++ b/ash/shell_delegate.h @@ -182,7 +182,7 @@ class ASH_EXPORT ShellDelegate { virtual void HandleMediaPrevTrack() = 0; // Creates a menu model of the context for the |root_window|. - virtual ui::MenuModel* CreateContextMenu(aura::RootWindow* root_window) = 0; + virtual ui::MenuModel* CreateContextMenu(aura::Window* root_window) = 0; // Creates a root window host factory. Shell takes ownership of the returned // value. diff --git a/ash/shell_observer.h b/ash/shell_observer.h index b09229b..9d1db02 100644 --- a/ash/shell_observer.h +++ b/ash/shell_observer.h @@ -9,7 +9,7 @@ #include "ash/system/user/login_status.h" namespace aura { -class RootWindow; +class Window; } namespace ash { @@ -30,14 +30,14 @@ class ASH_EXPORT ShellObserver { virtual void OnLockStateChanged(bool locked) {} // Invoked when the shelf alignment in |root_window| is changed. - virtual void OnShelfAlignmentChanged(aura::RootWindow* root_window) {} + virtual void OnShelfAlignmentChanged(aura::Window* root_window) {} // Invoked when the projection touch HUD is toggled. virtual void OnTouchHudProjectionToggled(bool enabled) {} // Invoked when entering or exiting fullscreen mode in |root_window|. virtual void OnFullscreenStateChanged(bool is_fullscreen, - aura::RootWindow* root_window) {} + aura::Window* root_window) {} protected: virtual ~ShellObserver() {} diff --git a/ash/shell_unittest.cc b/ash/shell_unittest.cc index 994f456..309ebae 100644 --- a/ash/shell_unittest.cc +++ b/ash/shell_unittest.cc @@ -54,7 +54,7 @@ aura::Window* GetAlwaysOnTopContainer() { // Expect ALL the containers! void ExpectAllContainers() { - aura::RootWindow* root_window = Shell::GetPrimaryRootWindow(); + aura::Window* root_window = Shell::GetPrimaryRootWindow(); EXPECT_TRUE(Shell::GetContainer( root_window, internal::kShellWindowId_DesktopBackgroundContainer)); EXPECT_TRUE(Shell::GetContainer( @@ -397,8 +397,9 @@ TEST_F(ShellTest, ManagedWindowModeBasics) { EXPECT_TRUE(launcher_widget->IsVisible()); // Launcher is at bottom-left of screen. EXPECT_EQ(0, launcher_widget->GetWindowBoundsInScreen().x()); - EXPECT_EQ(Shell::GetPrimaryRootWindow()->GetHostSize().height(), - launcher_widget->GetWindowBoundsInScreen().bottom()); + EXPECT_EQ( + Shell::GetPrimaryRootWindow()->GetDispatcher()->GetHostSize().height(), + launcher_widget->GetWindowBoundsInScreen().bottom()); // We have a desktop background but not a bare layer. // TODO (antrim): enable once we find out why it fails component build. // internal::DesktopBackgroundWidgetController* background = @@ -482,7 +483,7 @@ TEST_F(ShellTest, ToggleAutoHide) { wm::ActivateWindow(window.get()); Shell* shell = Shell::GetInstance(); - aura::RootWindow* root_window = Shell::GetPrimaryRootWindow(); + aura::Window* root_window = Shell::GetPrimaryRootWindow(); shell->SetShelfAutoHideBehavior(ash::SHELF_AUTO_HIDE_BEHAVIOR_ALWAYS, root_window); EXPECT_EQ(ash::SHELF_AUTO_HIDE_BEHAVIOR_ALWAYS, diff --git a/ash/system/tray/tray_background_view.cc b/ash/system/tray/tray_background_view.cc index b106122..f357706 100644 --- a/ash/system/tray/tray_background_view.cc +++ b/ash/system/tray/tray_background_view.cc @@ -573,7 +573,7 @@ gfx::Rect TrayBackgroundView::GetBubbleAnchorRect( // TODO(jennyz): May need to add left/right alignment in the following code. if (rect.IsEmpty()) { - aura::RootWindow* target_root = anchor_widget ? + aura::Window* target_root = anchor_widget ? anchor_widget->GetNativeView()->GetRootWindow() : Shell::GetPrimaryRootWindow(); rect = target_root->bounds(); @@ -622,7 +622,7 @@ void TrayBackgroundView::UpdateBubbleViewArrow( if (switches::UseAlternateShelfLayout()) return; - aura::RootWindow* root_window = + aura::Window* root_window = bubble_view->GetWidget()->GetNativeView()->GetRootWindow(); ash::internal::ShelfLayoutManager* shelf = ShelfLayoutManager::ForLauncher(root_window); diff --git a/ash/system/tray/tray_event_filter.cc b/ash/system/tray/tray_event_filter.cc index a5ea3a2..676c8b6 100644 --- a/ash/system/tray/tray_event_filter.cc +++ b/ash/system/tray/tray_event_filter.cc @@ -75,7 +75,7 @@ bool TrayEventFilter::ProcessLocatedEvent(ui::LocatedEvent* event) { gfx::Rect bounds = bubble_widget->GetWindowBoundsInScreen(); bounds.Inset(wrapper->bubble_view()->GetBorderInsets()); - aura::RootWindow* root = bubble_widget->GetNativeView()->GetRootWindow(); + aura::Window* root = bubble_widget->GetNativeView()->GetRootWindow(); aura::client::ScreenPositionClient* screen_position_client = aura::client::GetScreenPositionClient(root); gfx::Point screen_point(event->root_location()); diff --git a/ash/system/web_notification/web_notification_tray.cc b/ash/system/web_notification/web_notification_tray.cc index 70e2b5b..53a381b 100644 --- a/ash/system/web_notification/web_notification_tray.cc +++ b/ash/system/web_notification/web_notification_tray.cc @@ -83,7 +83,7 @@ class WorkAreaObserver : public ShelfLayoutManagerObserver, // Starts observing |shelf| and shell and sends the change to |collection|. void StartObserving(message_center::MessagePopupCollection* collection, - aura::RootWindow* root_window); + aura::Window* root_window); // Stops the observing session. void StopObserving(); @@ -99,7 +99,7 @@ class WorkAreaObserver : public ShelfLayoutManagerObserver, void UpdateShelf(); message_center::MessagePopupCollection* collection_; - aura::RootWindow* root_window_; + aura::Window* root_window_; ShelfLayoutManager* shelf_; int system_tray_height_; @@ -139,7 +139,7 @@ void WorkAreaObserver::SetSystemTrayHeight(int height) { void WorkAreaObserver::StartObserving( message_center::MessagePopupCollection* collection, - aura::RootWindow* root_window) { + aura::Window* root_window) { DCHECK(collection); collection_ = collection; root_window_ = root_window; @@ -349,7 +349,7 @@ bool WebNotificationTray::ShowMessageCenterInternal(bool show_settings) { break; } case SHELF_ALIGNMENT_TOP: { - aura::RootWindow* root = status_area_window->GetRootWindow(); + aura::Window* root = status_area_window->GetRootWindow(); max_height = root->bounds().height() - status_area_window->bounds().height(); break; diff --git a/ash/test/ash_test_base.cc b/ash/test/ash_test_base.cc index b6c10a4..c82ae75 100644 --- a/ash/test/ash_test_base.cc +++ b/ash/test/ash_test_base.cc @@ -60,7 +60,7 @@ class AshEventGeneratorDelegate : public aura::test::EventGeneratorDelegate { gfx::Screen* screen = Shell::GetScreen(); gfx::Display display = screen->GetDisplayNearestPoint(point_in_screen); return Shell::GetInstance()->display_controller()-> - GetRootWindowForDisplayId(display.id()); + GetRootWindowForDisplayId(display.id())->GetDispatcher(); } virtual aura::client::ScreenPositionClient* GetScreenPositionClient( @@ -115,7 +115,7 @@ void AshTestBase::SetUp() { ash_test_helper_->SetUp(start_session_); Shell::GetPrimaryRootWindow()->Show(); - Shell::GetPrimaryRootWindow()->ShowRootWindow(); + Shell::GetPrimaryRootWindow()->GetDispatcher()->ShowRootWindow(); // Move the mouse cursor to far away so that native events doesn't // interfere test expectations. Shell::GetPrimaryRootWindow()->MoveCursorTo(gfx::Point(-1000, -1000)); @@ -207,7 +207,7 @@ void AshTestBase::UpdateDisplay(const std::string& display_specs) { display_manager_test_api.UpdateDisplay(display_specs); } -aura::RootWindow* AshTestBase::CurrentContext() { +aura::Window* AshTestBase::CurrentContext() { return ash_test_helper_->CurrentContext(); } @@ -254,7 +254,7 @@ aura::Window* AshTestBase::CreateTestWindowInShellWithDelegateAndType( } else { gfx::Display display = Shell::GetScreen()->GetDisplayMatching(bounds); - aura::RootWindow* root = ash::Shell::GetInstance()->display_controller()-> + aura::Window* root = ash::Shell::GetInstance()->display_controller()-> GetRootWindowForDisplayId(display.id()); gfx::Point origin = bounds.origin(); wm::ConvertPointFromScreen(root, &origin); diff --git a/ash/test/ash_test_base.h b/ash/test/ash_test_base.h index dc2bfe4..b88f26cc 100644 --- a/ash/test/ash_test_base.h +++ b/ash/test/ash_test_base.h @@ -64,10 +64,10 @@ class AshTestBase : public testing::Test { // See ash::test::DisplayManagerTestApi::UpdateDisplay for more details. void UpdateDisplay(const std::string& display_specs); - // Returns a RootWindow. Usually this is the active RootWindow, but that + // Returns a root Window. Usually this is the active root Window, but that // method can return NULL sometimes, and in those cases, we fall back on the - // primary RootWindow. - aura::RootWindow* CurrentContext(); + // primary root Window. + aura::Window* CurrentContext(); // Versions of the functions in aura::test:: that go through our shell // StackingController instead of taking a parent. diff --git a/ash/test/ash_test_helper.cc b/ash/test/ash_test_helper.cc index 49bb4d1..8981507 100644 --- a/ash/test/ash_test_helper.cc +++ b/ash/test/ash_test_helper.cc @@ -128,8 +128,8 @@ void AshTestHelper::RunAllPendingInMessageLoop() { run_loop.RunUntilIdle(); } -aura::RootWindow* AshTestHelper::CurrentContext() { - aura::RootWindow* root_window = Shell::GetTargetRootWindow(); +aura::Window* AshTestHelper::CurrentContext() { + aura::Window* root_window = Shell::GetTargetRootWindow(); if (!root_window) root_window = Shell::GetPrimaryRootWindow(); DCHECK(root_window); diff --git a/ash/test/ash_test_helper.h b/ash/test/ash_test_helper.h index 030f7f8..9e78fea 100644 --- a/ash/test/ash_test_helper.h +++ b/ash/test/ash_test_helper.h @@ -9,7 +9,7 @@ #include "base/memory/scoped_ptr.h" namespace aura { -class RootWindow; +class Window; } // namespace aura namespace base { @@ -41,10 +41,10 @@ class AshTestHelper { // Destroys the ash::Shell and performs associated cleanup. void TearDown(); - // Returns a RootWindow. Usually this is the active RootWindow, but that + // Returns a root Window. Usually this is the active root Window, but that // method can return NULL sometimes, and in those cases, we fall back on the - // primary RootWindow. - aura::RootWindow* CurrentContext(); + // primary root Window. + aura::Window* CurrentContext(); void RunAllPendingInMessageLoop(); diff --git a/ash/test/test_launcher_item_delegate.cc b/ash/test/test_launcher_item_delegate.cc index 9cb56bb..7ac8b72 100644 --- a/ash/test/test_launcher_item_delegate.cc +++ b/ash/test/test_launcher_item_delegate.cc @@ -31,7 +31,7 @@ base::string16 TestLauncherItemDelegate::GetTitle() { } ui::MenuModel* TestLauncherItemDelegate::CreateContextMenu( - aura::RootWindow* root_window) { + aura::Window* root_window) { return NULL; } diff --git a/ash/test/test_launcher_item_delegate.h b/ash/test/test_launcher_item_delegate.h index 138a772..fd4c394 100644 --- a/ash/test/test_launcher_item_delegate.h +++ b/ash/test/test_launcher_item_delegate.h @@ -26,7 +26,7 @@ class TestLauncherItemDelegate : public ash::LauncherItemDelegate { virtual void ItemSelected(const ui::Event& event) OVERRIDE; virtual base::string16 GetTitle() OVERRIDE; virtual ui::MenuModel* CreateContextMenu( - aura::RootWindow* root_window) OVERRIDE; + aura::Window* root_window) OVERRIDE; virtual ash::LauncherMenuModel* CreateApplicationMenu( int event_flags) OVERRIDE; virtual bool IsDraggable() OVERRIDE; diff --git a/ash/test/test_shell_delegate.cc b/ash/test/test_shell_delegate.cc index f2b3722..b7a4823 100644 --- a/ash/test/test_shell_delegate.cc +++ b/ash/test/test_shell_delegate.cc @@ -137,7 +137,7 @@ void TestShellDelegate::HandleMediaPlayPause() { void TestShellDelegate::HandleMediaPrevTrack() { } -ui::MenuModel* TestShellDelegate::CreateContextMenu(aura::RootWindow* root) { +ui::MenuModel* TestShellDelegate::CreateContextMenu(aura::Window* root) { return NULL; } diff --git a/ash/test/test_shell_delegate.h b/ash/test/test_shell_delegate.h index 5e854ee..98ffca41 100644 --- a/ash/test/test_shell_delegate.h +++ b/ash/test/test_shell_delegate.h @@ -54,7 +54,7 @@ class TestShellDelegate : public ShellDelegate { virtual void HandleMediaNextTrack() OVERRIDE; virtual void HandleMediaPlayPause() OVERRIDE; virtual void HandleMediaPrevTrack() OVERRIDE; - virtual ui::MenuModel* CreateContextMenu(aura::RootWindow* root) OVERRIDE; + virtual ui::MenuModel* CreateContextMenu(aura::Window* root) OVERRIDE; virtual RootWindowHostFactory* CreateRootWindowHostFactory() OVERRIDE; virtual base::string16 GetProductName() const OVERRIDE; diff --git a/ash/test/ui_controls_factory_ash.cc b/ash/test/ui_controls_factory_ash.cc index 458a4cb..b8393e5 100644 --- a/ash/test/ui_controls_factory_ash.cc +++ b/ash/test/ui_controls_factory_ash.cc @@ -30,11 +30,12 @@ DEFINE_OWNED_WINDOW_PROPERTY_KEY(UIControlsAura, kUIControlsKey, NULL); // Returns the UIControls object for RootWindow. // kUIControlsKey is owned property and UIControls object // will be deleted when the root window is deleted. -UIControlsAura* GetUIControlsForRootWindow(aura::RootWindow* root_window) { +UIControlsAura* GetUIControlsForRootWindow(aura::Window* root_window) { UIControlsAura* native_ui_control = root_window->GetProperty(kUIControlsKey); if (!native_ui_control) { - native_ui_control = aura::test::CreateUIControlsAura(root_window); + native_ui_control = + aura::test::CreateUIControlsAura(root_window->GetDispatcher()); // Pass the ownership to the |root_window|. root_window->SetProperty(kUIControlsKey, native_ui_control); } @@ -47,7 +48,7 @@ UIControlsAura* GetUIControlsForRootWindow(aura::RootWindow* root_window) { // the |point_in_screen|. UIControlsAura* GetUIControlsAt(gfx::Point* point_in_screen) { // TODO(mazda): Support the case passive grab is taken. - aura::RootWindow* root = ash::wm::GetRootWindowAt(*point_in_screen); + aura::Window* root = ash::wm::GetRootWindowAt(*point_in_screen); aura::client::ScreenPositionClient* screen_position_client = aura::client::GetScreenPositionClient(root); @@ -85,7 +86,7 @@ class UIControlsAsh : public UIControlsAura { bool alt, bool command, const base::Closure& closure) OVERRIDE { - aura::RootWindow* root = + aura::Window* root = window ? window->GetRootWindow() : ash::Shell::GetTargetRootWindow(); UIControlsAura* ui_controls = GetUIControlsForRootWindow(root); return ui_controls && ui_controls->SendKeyPressNotifyWhenDone( diff --git a/ash/touch/touch_observer_hud.h b/ash/touch/touch_observer_hud.h index b94cc17..2303fa8 100644 --- a/ash/touch/touch_observer_hud.h +++ b/ash/touch/touch_observer_hud.h @@ -80,7 +80,7 @@ class ASH_EXPORT TouchObserverHUD friend class TouchHudTest; const int64 display_id_; - aura::RootWindow* root_window_; + aura::Window* root_window_; views::Widget* widget_; diff --git a/ash/touch/touch_observer_hud_unittest.cc b/ash/touch/touch_observer_hud_unittest.cc index df992ba..0a4f89df 100644 --- a/ash/touch/touch_observer_hud_unittest.cc +++ b/ash/touch/touch_observer_hud_unittest.cc @@ -170,43 +170,43 @@ class TouchHudTest : public test::AshTestBase { return GetDisplayManager()->GetDisplayForId(external_display_id_); } - aura::RootWindow* GetInternalRootWindow() { + aura::Window* GetInternalRootWindow() { return GetDisplayController()->GetRootWindowForDisplayId( internal_display_id_); } - aura::RootWindow* GetExternalRootWindow() { + aura::Window* GetExternalRootWindow() { return GetDisplayController()->GetRootWindowForDisplayId( external_display_id_); } - aura::RootWindow* GetPrimaryRootWindow() { + aura::Window* GetPrimaryRootWindow() { const gfx::Display& display = GetPrimaryDisplay(); return GetDisplayController()->GetRootWindowForDisplayId(display.id()); } - aura::RootWindow* GetSecondaryRootWindow() { + aura::Window* GetSecondaryRootWindow() { const gfx::Display& display = GetSecondaryDisplay(); return GetDisplayController()->GetRootWindowForDisplayId(display.id()); } internal::RootWindowController* GetInternalRootController() { - aura::RootWindow* root = GetInternalRootWindow(); + aura::Window* root = GetInternalRootWindow(); return GetRootWindowController(root); } internal::RootWindowController* GetExternalRootController() { - aura::RootWindow* root = GetExternalRootWindow(); + aura::Window* root = GetExternalRootWindow(); return GetRootWindowController(root); } internal::RootWindowController* GetPrimaryRootController() { - aura::RootWindow* root = GetPrimaryRootWindow(); + aura::Window* root = GetPrimaryRootWindow(); return GetRootWindowController(root); } internal::RootWindowController* GetSecondaryRootController() { - aura::RootWindow* root = GetSecondaryRootWindow(); + aura::Window* root = GetSecondaryRootWindow(); return GetRootWindowController(root); } diff --git a/ash/wm/app_list_controller.cc b/ash/wm/app_list_controller.cc index a6549c2..68af351 100644 --- a/ash/wm/app_list_controller.cc +++ b/ash/wm/app_list_controller.cc @@ -163,7 +163,7 @@ void AppListController::SetVisible(bool visible, aura::Window* window) { // will be released with AppListView on close. app_list::AppListView* view = new app_list::AppListView( Shell::GetInstance()->delegate()->CreateAppListViewDelegate()); - aura::RootWindow* root_window = window->GetRootWindow(); + aura::Window* root_window = window->GetRootWindow(); aura::Window* container = GetRootWindowController(root_window)-> GetContainer(kShellWindowId_AppListContainer); if (ash::switches::UseAlternateShelfLayout()) { @@ -369,7 +369,7 @@ void AppListController::OnWidgetDestroying(views::Widget* widget) { //////////////////////////////////////////////////////////////////////////////// // AppListController, ShellObserver implementation: -void AppListController::OnShelfAlignmentChanged(aura::RootWindow* root_window) { +void AppListController::OnShelfAlignmentChanged(aura::Window* root_window) { if (view_) view_->SetBubbleArrow(GetBubbleArrow(view_->GetWidget()->GetNativeView())); } diff --git a/ash/wm/app_list_controller.h b/ash/wm/app_list_controller.h index f47c7a4..0fc20b5 100644 --- a/ash/wm/app_list_controller.h +++ b/ash/wm/app_list_controller.h @@ -111,7 +111,7 @@ class AppListController : public ui::EventHandler, virtual void OnWidgetDestroying(views::Widget* widget) OVERRIDE; // ShellObserver overrides: - virtual void OnShelfAlignmentChanged(aura::RootWindow* root_window) OVERRIDE; + virtual void OnShelfAlignmentChanged(aura::Window* root_window) OVERRIDE; // LauncherIconObserver overrides: virtual void OnLauncherIconPositionsChanged() OVERRIDE; diff --git a/ash/wm/ash_focus_rules.cc b/ash/wm/ash_focus_rules.cc index e6688d7..02b2d02 100644 --- a/ash/wm/ash_focus_rules.cc +++ b/ash/wm/ash_focus_rules.cc @@ -105,7 +105,7 @@ aura::Window* AshFocusRules::GetNextActivatableWindow( int starting_container_index = 0; // If the container of the window losing focus is in the list, start from that // container. - aura::RootWindow* root = ignore->GetRootWindow(); + aura::Window* root = ignore->GetRootWindow(); if (!root) root = Shell::GetTargetRootWindow(); int container_count = static_cast<int>(arraysize(kWindowContainerIds)); @@ -137,7 +137,7 @@ aura::Window* AshFocusRules::GetTopmostWindowToActivateForContainerIndex( int index, aura::Window* ignore) const { aura::Window* window = NULL; - aura::RootWindow* root = ignore ? ignore->GetRootWindow() : NULL; + aura::Window* root = ignore ? ignore->GetRootWindow() : NULL; aura::Window::Windows containers = Shell::GetContainersFromAllRootWindows( kWindowContainerIds[index], root); for (aura::Window::Windows::const_iterator iter = containers.begin(); diff --git a/ash/wm/ash_native_cursor_manager_unittest.cc b/ash/wm/ash_native_cursor_manager_unittest.cc index 113e624..76da49d 100644 --- a/ash/wm/ash_native_cursor_manager_unittest.cc +++ b/ash/wm/ash_native_cursor_manager_unittest.cc @@ -173,7 +173,7 @@ TEST_F(AshNativeCursorManagerTest, SetDeviceScaleFactorAndRotation) { } TEST_F(AshNativeCursorManagerTest, DisabledQueryMouseLocation) { - aura::RootWindow* root_window = Shell::GetInstance()->GetPrimaryRootWindow(); + aura::Window* root_window = Shell::GetInstance()->GetPrimaryRootWindow(); #if defined(OS_WIN) if (base::win::GetVersion() < base::win::VERSION_WIN8) return; @@ -193,11 +193,12 @@ TEST_F(AshNativeCursorManagerTest, DisabledQueryMouseLocation) { Sleep(100); RunAllPendingInMessageLoop(); #endif + aura::WindowEventDispatcher* dispatcher = root_window->GetDispatcher(); gfx::Point mouse_location; - EXPECT_TRUE(root_window->QueryMouseLocationForTest(&mouse_location)); + EXPECT_TRUE(dispatcher->QueryMouseLocationForTest(&mouse_location)); EXPECT_EQ("10,10", mouse_location.ToString()); Shell::GetInstance()->cursor_manager()->DisableMouseEvents(); - EXPECT_FALSE(root_window->QueryMouseLocationForTest(&mouse_location)); + EXPECT_FALSE(dispatcher->QueryMouseLocationForTest(&mouse_location)); EXPECT_EQ("0,0", mouse_location.ToString()); } diff --git a/ash/wm/base_layout_manager.cc b/ash/wm/base_layout_manager.cc index 90c0d97..65fb820 100644 --- a/ash/wm/base_layout_manager.cc +++ b/ash/wm/base_layout_manager.cc @@ -15,7 +15,6 @@ #include "ash/wm/workspace/workspace_window_resizer.h" #include "ui/aura/client/activation_client.h" #include "ui/aura/client/aura_constants.h" -#include "ui/aura/root_window.h" #include "ui/aura/window.h" #include "ui/base/ui_base_types.h" #include "ui/compositor/layer.h" @@ -29,7 +28,7 @@ namespace internal { ///////////////////////////////////////////////////////////////////////////// // BaseLayoutManager, public: -BaseLayoutManager::BaseLayoutManager(aura::RootWindow* root_window) +BaseLayoutManager::BaseLayoutManager(aura::Window* root_window) : root_window_(root_window) { Shell::GetInstance()->activation_client()->AddObserver(this); Shell::GetInstance()->AddShellObserver(this); diff --git a/ash/wm/base_layout_manager.h b/ash/wm/base_layout_manager.h index 7a94bf38..6f74e4c 100644 --- a/ash/wm/base_layout_manager.h +++ b/ash/wm/base_layout_manager.h @@ -19,7 +19,6 @@ #include "ui/events/event_handler.h" namespace aura { -class RootWindow; class Window; } @@ -44,7 +43,7 @@ class ASH_EXPORT BaseLayoutManager public: typedef std::set<aura::Window*> WindowSet; - explicit BaseLayoutManager(aura::RootWindow* root_window); + explicit BaseLayoutManager(aura::Window* root_window); virtual ~BaseLayoutManager(); const WindowSet& windows() const { return windows_; } @@ -109,7 +108,7 @@ class ASH_EXPORT BaseLayoutManager wm::WindowState* window_state, AdjustWindowReason reason); - aura::RootWindow* root_window() { return root_window_; } + aura::Window* root_window() { return root_window_; } private: // Update window bounds based on a change in show state. @@ -118,7 +117,7 @@ class ASH_EXPORT BaseLayoutManager // Set of windows we're listening to. WindowSet windows_; - aura::RootWindow* root_window_; + aura::Window* root_window_; DISALLOW_COPY_AND_ASSIGN(BaseLayoutManager); }; diff --git a/ash/wm/caption_buttons/frame_maximize_button_unittest.cc b/ash/wm/caption_buttons/frame_maximize_button_unittest.cc index 2eaa333..c2ea2e8 100644 --- a/ash/wm/caption_buttons/frame_maximize_button_unittest.cc +++ b/ash/wm/caption_buttons/frame_maximize_button_unittest.cc @@ -535,7 +535,7 @@ TEST_F(FrameMaximizeButtonTest, MaximizeKeepFocus) { TEST_F(FrameMaximizeButtonTest, MaximizeTap) { aura::Window* window = widget()->GetNativeWindow(); - aura::RootWindow* root_window = window->GetRootWindow(); + aura::Window* root_window = window->GetRootWindow(); ash::FrameMaximizeButton* maximize_button = FrameMaximizeButtonTest::maximize_button(); gfx::Point button_pos = maximize_button->GetBoundsInScreen().CenterPoint(); @@ -544,12 +544,13 @@ TEST_F(FrameMaximizeButtonTest, MaximizeTap) { ui::GestureConfiguration::default_radius(); ui::GestureConfiguration::set_default_radius(0); + aura::WindowEventDispatcher* dispatcher = root_window->GetDispatcher(); const int kTouchId = 2; ui::TouchEvent press(ui::ET_TOUCH_PRESSED, button_pos, kTouchId, ui::EventTimeForNow()); - root_window->AsRootWindowHostDelegate()->OnHostTouchEvent(&press); + dispatcher->AsRootWindowHostDelegate()->OnHostTouchEvent(&press); button_pos.Offset(9, 8); ui::TouchEvent release( @@ -557,7 +558,7 @@ TEST_F(FrameMaximizeButtonTest, MaximizeTap) { button_pos, kTouchId, press.time_stamp() + base::TimeDelta::FromMilliseconds(50)); - root_window->AsRootWindowHostDelegate()->OnHostTouchEvent(&release); + dispatcher->AsRootWindowHostDelegate()->OnHostTouchEvent(&release); ui::GestureConfiguration::set_default_radius(touch_default_radius); } diff --git a/ash/wm/coordinate_conversion.cc b/ash/wm/coordinate_conversion.cc index 467a1fc..448bd0f 100644 --- a/ash/wm/coordinate_conversion.cc +++ b/ash/wm/coordinate_conversion.cc @@ -7,7 +7,6 @@ #include "ash/display/display_controller.h" #include "ash/shell.h" #include "ui/aura/client/screen_position_client.h" -#include "ui/aura/root_window.h" #include "ui/gfx/display.h" #include "ui/gfx/point.h" #include "ui/gfx/rect.h" @@ -16,7 +15,7 @@ namespace ash { namespace wm { -aura::RootWindow* GetRootWindowAt(const gfx::Point& point) { +aura::Window* GetRootWindowAt(const gfx::Point& point) { const gfx::Display& display = Shell::GetScreen()->GetDisplayNearestPoint(point); DCHECK(display.is_valid()); @@ -26,7 +25,7 @@ aura::RootWindow* GetRootWindowAt(const gfx::Point& point) { GetRootWindowForDisplayId(display.id()); } -aura::RootWindow* GetRootWindowMatching(const gfx::Rect& rect) { +aura::Window* GetRootWindowMatching(const gfx::Rect& rect) { const gfx::Display& display = Shell::GetScreen()->GetDisplayMatching(rect); return Shell::GetInstance()->display_controller()-> GetRootWindowForDisplayId(display.id()); diff --git a/ash/wm/coordinate_conversion.h b/ash/wm/coordinate_conversion.h index b1ee83c..f5c1af8 100644 --- a/ash/wm/coordinate_conversion.h +++ b/ash/wm/coordinate_conversion.h @@ -8,7 +8,6 @@ #include "ash/ash_export.h" namespace aura { -class RootWindow; class Window; } // namespace gfx @@ -23,11 +22,11 @@ namespace wm { // Returns the RootWindow at |point| in the virtual screen coordinates. // Returns NULL if the root window does not exist at the given // point. -ASH_EXPORT aura::RootWindow* GetRootWindowAt(const gfx::Point& point); +ASH_EXPORT aura::Window* GetRootWindowAt(const gfx::Point& point); // Returns the RootWindow that shares the most area with |rect| in // the virtual scren coordinates. -ASH_EXPORT aura::RootWindow* GetRootWindowMatching(const gfx::Rect& rect); +ASH_EXPORT aura::Window* GetRootWindowMatching(const gfx::Rect& rect); // Converts the |point| from a given |window|'s coordinates into the screen // coordinates. diff --git a/ash/wm/dock/docked_window_layout_manager.cc b/ash/wm/dock/docked_window_layout_manager.cc index a81ed97..8b64ffb 100644 --- a/ash/wm/dock/docked_window_layout_manager.cc +++ b/ash/wm/dock/docked_window_layout_manager.cc @@ -502,7 +502,7 @@ void DockedWindowLayoutManager::OnDisplayWorkAreaInsetsChanged() { } void DockedWindowLayoutManager::OnFullscreenStateChanged( - bool is_fullscreen, aura::RootWindow* root_window) { + bool is_fullscreen, aura::Window* root_window) { if (dock_container_->GetRootWindow() != root_window) return; // Entering fullscreen mode (including immersive) hides docked windows. @@ -534,7 +534,7 @@ void DockedWindowLayoutManager::OnFullscreenStateChanged( } void DockedWindowLayoutManager::OnShelfAlignmentChanged( - aura::RootWindow* root_window) { + aura::Window* root_window) { if (dock_container_->GetRootWindow() != root_window) return; diff --git a/ash/wm/dock/docked_window_layout_manager.h b/ash/wm/dock/docked_window_layout_manager.h index 29979d7..f380f77 100644 --- a/ash/wm/dock/docked_window_layout_manager.h +++ b/ash/wm/dock/docked_window_layout_manager.h @@ -143,8 +143,8 @@ class ASH_EXPORT DockedWindowLayoutManager // ash::ShellObserver: virtual void OnDisplayWorkAreaInsetsChanged() OVERRIDE; virtual void OnFullscreenStateChanged(bool is_fullscreen, - aura::RootWindow* root_window) OVERRIDE; - virtual void OnShelfAlignmentChanged(aura::RootWindow* root_window) OVERRIDE; + aura::Window* root_window) OVERRIDE; + virtual void OnShelfAlignmentChanged(aura::Window* root_window) OVERRIDE; // wm::WindowStateObserver: virtual void OnWindowShowTypeChanged(wm::WindowState* window_state, diff --git a/ash/wm/dock/docked_window_resizer.cc b/ash/wm/dock/docked_window_resizer.cc index f900818..28d0438 100644 --- a/ash/wm/dock/docked_window_resizer.cc +++ b/ash/wm/dock/docked_window_resizer.cc @@ -42,7 +42,7 @@ DockedWindowLayoutManager* GetDockedLayoutManagerAtPoint( gfx::Display display = ScreenAsh::FindDisplayContainingPoint(point); if (!display.is_valid()) return NULL; - aura::RootWindow* root = Shell::GetInstance()->display_controller()-> + aura::Window* root = Shell::GetInstance()->display_controller()-> GetRootWindowForDisplayId(display.id()); aura::Window* dock_container = Shell::GetContainer( root, kShellWindowId_DockedContainer); diff --git a/ash/wm/drag_window_resizer.cc b/ash/wm/drag_window_resizer.cc index 002853a..4c07b65 100644 --- a/ash/wm/drag_window_resizer.cc +++ b/ash/wm/drag_window_resizer.cc @@ -38,7 +38,7 @@ bool HasSecondaryRootWindow() { // When there are two root windows, returns one of the root windows which is not // |root_window|. Returns NULL if only one root window exists. -aura::RootWindow* GetAnotherRootWindow(aura::RootWindow* root_window) { +aura::RootWindow* GetAnotherRootWindow(aura::Window* root_window) { Shell::RootWindowList root_windows = Shell::GetAllRootWindows(); if (root_windows.size() < 2) return NULL; @@ -171,7 +171,7 @@ void DragWindowResizer::UpdateDragWindow(const gfx::Rect& bounds, return; // It's available. Show a phantom window on the display if needed. - aura::RootWindow* another_root = + aura::Window* another_root = GetAnotherRootWindow(GetTarget()->GetRootWindow()); const gfx::Rect root_bounds_in_screen(another_root->GetBoundsInScreen()); const gfx::Rect bounds_in_screen = diff --git a/ash/wm/drag_window_resizer_unittest.cc b/ash/wm/drag_window_resizer_unittest.cc index 5be8a78..6bf3d6a 100644 --- a/ash/wm/drag_window_resizer_unittest.cc +++ b/ash/wm/drag_window_resizer_unittest.cc @@ -40,7 +40,7 @@ class DragWindowResizerTest : public test::AshTestBase { AshTestBase::SetUp(); UpdateDisplay(base::StringPrintf("800x%d", kRootHeight)); - aura::RootWindow* root = Shell::GetPrimaryRootWindow(); + aura::Window* root = Shell::GetPrimaryRootWindow(); gfx::Rect root_bounds(root->bounds()); EXPECT_EQ(kRootHeight, root_bounds.height()); EXPECT_EQ(800, root_bounds.width()); diff --git a/ash/wm/event_client_impl.cc b/ash/wm/event_client_impl.cc index 03d4dea..fbf5f86 100644 --- a/ash/wm/event_client_impl.cc +++ b/ash/wm/event_client_impl.cc @@ -21,7 +21,7 @@ EventClientImpl::~EventClientImpl() { bool EventClientImpl::CanProcessEventsWithinSubtree( const aura::Window* window) const { - const aura::RootWindow* root_window = window ? window->GetRootWindow() : NULL; + const aura::Window* root_window = window ? window->GetRootWindow() : NULL; if (!root_window || !Shell::GetInstance()->session_state_delegate()->IsUserSessionBlocked()) { return true; diff --git a/ash/wm/gestures/long_press_affordance_handler.cc b/ash/wm/gestures/long_press_affordance_handler.cc index 9747706..8faa78f 100644 --- a/ash/wm/gestures/long_press_affordance_handler.cc +++ b/ash/wm/gestures/long_press_affordance_handler.cc @@ -59,7 +59,7 @@ const SkColor kAffordanceGlowEndColor = SkColorSetARGB(0, 255, 255, 255); const SkColor kAffordanceArcColor = SkColorSetARGB(80, 0, 0, 0); const int kAffordanceFrameRateHz = 60; -views::Widget* CreateAffordanceWidget(aura::RootWindow* root_window) { +views::Widget* CreateAffordanceWidget(aura::Window* root_window) { views::Widget* widget = new views::Widget; views::Widget::InitParams params; params.type = views::Widget::InitParams::TYPE_WINDOW_FRAMELESS; @@ -140,7 +140,7 @@ class LongPressAffordanceHandler::LongPressAffordanceView : public views::View { public: LongPressAffordanceView(const gfx::Point& event_location, - aura::RootWindow* root_window) + aura::Window* root_window) : views::View(), widget_(CreateAffordanceWidget(root_window)), current_angle_(kAffordanceAngleStartValue), @@ -292,7 +292,7 @@ void LongPressAffordanceHandler::ProcessEvent(aura::Window* target, // LongPressAffordanceHandler, private void LongPressAffordanceHandler::StartAnimation() { - aura::RootWindow* root_window = NULL; + aura::Window* root_window = NULL; switch (current_animation_type_) { case GROW_ANIMATION: root_window = Shell::GetInstance()->display_controller()-> diff --git a/ash/wm/header_painter.cc b/ash/wm/header_painter.cc index 99f8515..3f8f2fe 100644 --- a/ash/wm/header_painter.cc +++ b/ash/wm/header_painter.cc @@ -22,7 +22,6 @@ #include "third_party/skia/include/core/SkPath.h" #include "ui/aura/client/aura_constants.h" #include "ui/aura/env.h" -#include "ui/aura/root_window.h" #include "ui/aura/window.h" #include "ui/base/hit_test.h" #include "ui/base/layout.h" @@ -172,7 +171,7 @@ bool IsSoloWindowHeaderCandidate(aura::Window* window) { // Returns a list of windows in |root_window|| that potentially could have // a transparent solo-window header. -std::vector<Window*> GetWindowsForSoloHeaderUpdate(RootWindow* root_window) { +std::vector<Window*> GetWindowsForSoloHeaderUpdate(Window* root_window) { std::vector<Window*> windows; // Avoid memory allocations for typical window counts. windows.reserve(16); @@ -274,7 +273,7 @@ void HeaderPainter::SetSoloWindowHeadersEnabled(bool enabled) { } // static -void HeaderPainter::UpdateSoloWindowHeader(RootWindow* root_window) { +void HeaderPainter::UpdateSoloWindowHeader(Window* root_window) { // Use a separate function here so callers outside of HeaderPainter don't need // to know about "ignorable_window". UpdateSoloWindowInRoot(root_window, NULL /* ignorable_window */); @@ -690,15 +689,15 @@ bool HeaderPainter::UseSoloWindowHeader() const { // Don't use transparent headers for panels, pop-ups, etc. if (!IsSoloWindowHeaderCandidate(window_)) return false; - aura::RootWindow* root = window_->GetRootWindow(); + aura::Window* root = window_->GetRootWindow(); // Don't recompute every time, as it would require many window property // lookups. return internal::GetRootWindowSettings(root)->solo_window_header; } // static -bool HeaderPainter::UseSoloWindowHeaderInRoot(RootWindow* root_window, - Window* ignore_window) { +bool HeaderPainter::UseSoloWindowHeaderInRoot(Window* root_window, + Window* ignore_window) { int visible_window_count = 0; std::vector<Window*> windows = GetWindowsForSoloHeaderUpdate(root_window); for (std::vector<Window*>::const_iterator it = windows.begin(); @@ -722,8 +721,8 @@ bool HeaderPainter::UseSoloWindowHeaderInRoot(RootWindow* root_window, } // static -void HeaderPainter::UpdateSoloWindowInRoot(RootWindow* root, - Window* ignore_window) { +void HeaderPainter::UpdateSoloWindowInRoot(Window* root, + Window* ignore_window) { #if defined(OS_WIN) // Non-Ash Windows doesn't do solo-window counting for transparency effects, // as the desktop background and window frames are managed by the OS. diff --git a/ash/wm/header_painter.h b/ash/wm/header_painter.h index 0d6c3d8..bdc5dbf7 100644 --- a/ash/wm/header_painter.h +++ b/ash/wm/header_painter.h @@ -16,7 +16,6 @@ #include "ui/gfx/rect.h" namespace aura { -class RootWindow; class Window; } namespace gfx { @@ -69,7 +68,7 @@ class ASH_EXPORT HeaderPainter : public aura::WindowObserver, // Updates the solo-window transparent header appearance for all windows // using frame painters in |root_window|. - static void UpdateSoloWindowHeader(aura::RootWindow* root_window); + static void UpdateSoloWindowHeader(aura::Window* root_window); // Returns the bounds of the client view for a window with |header_height| // and |window_bounds|. The return value and |window_bounds| are in the @@ -198,7 +197,7 @@ class ASH_EXPORT HeaderPainter : public aura::WindowObserver, // Returns true if |root_window| has exactly one visible, normal-type window. // It ignores |ignore_window| while calculating the number of windows. // Pass NULL for |ignore_window| to consider all windows. - static bool UseSoloWindowHeaderInRoot(aura::RootWindow* root_window, + static bool UseSoloWindowHeaderInRoot(aura::Window* root_window, aura::Window* ignore_window); // Updates the solo-window transparent header appearance for all windows in @@ -206,7 +205,7 @@ class ASH_EXPORT HeaderPainter : public aura::WindowObserver, // counting visible windows. This is useful for updates when a window is about // to be closed or is moving to another root. If the solo window status // changes it schedules paints as necessary. - static void UpdateSoloWindowInRoot(aura::RootWindow* root_window, + static void UpdateSoloWindowInRoot(aura::Window* root_window, aura::Window* ignore_window); // Schedules a paint for the header. Used when transitioning from no header to diff --git a/ash/wm/header_painter_unittest.cc b/ash/wm/header_painter_unittest.cc index a6e8515..55f0ff7 100644 --- a/ash/wm/header_painter_unittest.cc +++ b/ash/wm/header_painter_unittest.cc @@ -208,7 +208,7 @@ class HeaderPainterTest : public ash::test::AshTestBase { TEST_F(HeaderPainterTest, CreateAndDeleteSingleWindow) { // Ensure that creating/deleting a window works well and doesn't cause // crashes. See crbug.com/155634 - aura::RootWindow* root = Shell::GetTargetRootWindow(); + aura::Window* root = Shell::GetTargetRootWindow(); scoped_ptr<Widget> widget(CreateTestWidget()); scoped_ptr<HeaderPainter> painter(CreateTestPainter(widget.get())); diff --git a/ash/wm/lock_state_controller.cc b/ash/wm/lock_state_controller.cc index 6117224..11b840b 100644 --- a/ash/wm/lock_state_controller.cc +++ b/ash/wm/lock_state_controller.cc @@ -27,7 +27,7 @@ namespace ash { namespace { aura::Window* GetBackground() { - aura::RootWindow* root_window = Shell::GetPrimaryRootWindow(); + aura::Window* root_window = Shell::GetPrimaryRootWindow(); return Shell::GetContainer(root_window, internal::kShellWindowId_DesktopBackgroundContainer); } @@ -156,11 +156,12 @@ LockStateController::LockStateController() shutdown_after_lock_(false), animating_lock_(false), can_cancel_lock_animation_(false) { - Shell::GetPrimaryRootWindow()->AddRootWindowObserver(this); + Shell::GetPrimaryRootWindow()->GetDispatcher()->AddRootWindowObserver(this); } LockStateController::~LockStateController() { - Shell::GetPrimaryRootWindow()->RemoveRootWindowObserver(this); + Shell::GetPrimaryRootWindow()->GetDispatcher()->RemoveRootWindowObserver( + this); } void LockStateController::SetDelegate(LockStateControllerDelegate* delegate) { diff --git a/ash/wm/lock_state_controller_unittest.cc b/ash/wm/lock_state_controller_unittest.cc index 001a5f72..425f439 100644 --- a/ash/wm/lock_state_controller_unittest.cc +++ b/ash/wm/lock_state_controller_unittest.cc @@ -46,7 +46,7 @@ void CheckCalledCallback(bool* flag) { } aura::Window* GetContainer(int container ) { - aura::RootWindow* root_window = Shell::GetPrimaryRootWindow(); + aura::Window* root_window = Shell::GetPrimaryRootWindow(); return Shell::GetContainer(root_window, container); } diff --git a/ash/wm/mru_window_tracker.cc b/ash/wm/mru_window_tracker.cc index 8ff631b..5974aad 100644 --- a/ash/wm/mru_window_tracker.cc +++ b/ash/wm/mru_window_tracker.cc @@ -23,9 +23,9 @@ namespace { // Adds the windows that can be cycled through for the specified window id to // |windows|. -void AddTrackedWindows(aura::RootWindow* root, - int container_id, - MruWindowTracker::WindowList* windows) { +void AddTrackedWindows(aura::Window* root, + int container_id, + MruWindowTracker::WindowList* windows) { aura::Window* container = Shell::GetContainer(root, container_id); const MruWindowTracker::WindowList& children(container->children()); windows->insert(windows->end(), children.begin(), children.end()); @@ -59,7 +59,7 @@ MruWindowTracker::WindowList BuildWindowListInternal( MruWindowTracker::WindowList windows; Shell::RootWindowList root_windows = Shell::GetAllRootWindows(); - aura::RootWindow* active_root = Shell::GetTargetRootWindow(); + aura::Window* active_root = Shell::GetTargetRootWindow(); for (Shell::RootWindowList::const_iterator iter = root_windows.begin(); iter != root_windows.end(); ++iter) { if (*iter == active_root) diff --git a/ash/wm/overview/scoped_transform_overview_window.cc b/ash/wm/overview/scoped_transform_overview_window.cc index 9c6eefd..a9322c0 100644 --- a/ash/wm/overview/scoped_transform_overview_window.cc +++ b/ash/wm/overview/scoped_transform_overview_window.cc @@ -9,7 +9,7 @@ #include "ash/wm/overview/scoped_window_copy.h" #include "ash/wm/window_state.h" #include "ui/aura/client/aura_constants.h" -#include "ui/aura/root_window.h" +#include "ui/aura/client/screen_position_client.h" #include "ui/aura/window.h" #include "ui/compositor/scoped_layer_animation_settings.h" #include "ui/views/corewm/window_animations.h" @@ -187,7 +187,7 @@ gfx::Transform ScopedTransformOverviewWindow::GetTransformForRect( } void ScopedTransformOverviewWindow::SetTransform( - aura::RootWindow* root_window, + aura::Window* root_window, const gfx::Transform& transform, bool animate) { DCHECK(overview_started_); diff --git a/ash/wm/overview/scoped_transform_overview_window.h b/ash/wm/overview/scoped_transform_overview_window.h index c41a225..0ff00de 100644 --- a/ash/wm/overview/scoped_transform_overview_window.h +++ b/ash/wm/overview/scoped_transform_overview_window.h @@ -11,7 +11,6 @@ #include "ui/gfx/transform.h" namespace aura { -class RootWindow; class Window; } @@ -74,7 +73,7 @@ class ScopedTransformOverviewWindow { // Sets |transform| on the window and a copy of the window if the target // |root_window| is not the window's root window. If |animate| the transform // is animated in, otherwise it is immediately applied. - void SetTransform(aura::RootWindow* root_window, + void SetTransform(aura::Window* root_window, const gfx::Transform& transform, bool animate); diff --git a/ash/wm/overview/scoped_window_copy.cc b/ash/wm/overview/scoped_window_copy.cc index 149a82b..660b284 100644 --- a/ash/wm/overview/scoped_window_copy.cc +++ b/ash/wm/overview/scoped_window_copy.cc @@ -21,7 +21,7 @@ namespace ash { namespace { // Creates a copy of |window| with |recreated_layer| in the |target_root|. -views::Widget* CreateCopyOfWindow(aura::RootWindow* target_root, +views::Widget* CreateCopyOfWindow(aura::Window* target_root, aura::Window* src_window, ui::Layer* recreated_layer) { // Save and remove the transform from the layer to later reapply to both the @@ -158,7 +158,7 @@ void CleanupWidgetAfterAnimationObserver::MaybeDestruct() { delete this; } -ScopedWindowCopy::ScopedWindowCopy(aura::RootWindow* target_root, +ScopedWindowCopy::ScopedWindowCopy(aura::Window* target_root, aura::Window* src_window) { layer_ = views::corewm::RecreateWindowLayers(src_window, true); widget_ = CreateCopyOfWindow(target_root, src_window, layer_); diff --git a/ash/wm/overview/scoped_window_copy.h b/ash/wm/overview/scoped_window_copy.h index bd7fc45..d5da445 100644 --- a/ash/wm/overview/scoped_window_copy.h +++ b/ash/wm/overview/scoped_window_copy.h @@ -28,7 +28,7 @@ class CleanupWidgetAfterAnimationObserver; // the class goes out of scope and the last animation has finished. class ScopedWindowCopy { public: - ScopedWindowCopy(aura::RootWindow* target_root, aura::Window* src_window); + ScopedWindowCopy(aura::Window* target_root, aura::Window* src_window); ~ScopedWindowCopy(); aura::Window* GetWindow(); diff --git a/ash/wm/overview/window_overview.cc b/ash/wm/overview/window_overview.cc index 90a3639..a7de2f8 100644 --- a/ash/wm/overview/window_overview.cc +++ b/ash/wm/overview/window_overview.cc @@ -117,7 +117,7 @@ void CleanupWidgetAfterAnimationObserver::OnLayerAnimationScheduled( WindowOverview::WindowOverview(WindowSelector* window_selector, WindowSelectorItemList* windows, - aura::RootWindow* single_root_window) + aura::Window* single_root_window) : window_selector_(window_selector), windows_(windows), selection_index_(0), @@ -239,7 +239,7 @@ void WindowOverview::OnWindowsChanged() { PositionWindows(); } -void WindowOverview::MoveToSingleRootWindow(aura::RootWindow* root_window) { +void WindowOverview::MoveToSingleRootWindow(aura::Window* root_window) { single_root_window_ = root_window; PositionWindows(); } @@ -348,7 +348,7 @@ void WindowOverview::PositionWindows() { } } -void WindowOverview::PositionWindowsFromRoot(aura::RootWindow* root_window) { +void WindowOverview::PositionWindowsFromRoot(aura::Window* root_window) { std::vector<WindowSelectorItem*> windows; for (WindowSelectorItemList::iterator iter = windows_->begin(); iter != windows_->end(); ++iter) { @@ -359,7 +359,7 @@ void WindowOverview::PositionWindowsFromRoot(aura::RootWindow* root_window) { } void WindowOverview::PositionWindowsOnRoot( - aura::RootWindow* root_window, + aura::Window* root_window, const std::vector<WindowSelectorItem*>& windows) { if (windows.empty()) return; diff --git a/ash/wm/overview/window_overview.h b/ash/wm/overview/window_overview.h index fed1bc9..3f21dac 100644 --- a/ash/wm/overview/window_overview.h +++ b/ash/wm/overview/window_overview.h @@ -14,14 +14,10 @@ #include "ui/gfx/rect.h" namespace aura { - class Window; -class RootWindow; - namespace client { class CursorClient; } - } // namespace aura namespace ui { @@ -50,7 +46,7 @@ class WindowOverview : public ui::EventHandler { // given root window. WindowOverview(WindowSelector* window_selector, WindowSelectorItemList* windows, - aura::RootWindow* single_root_window); + aura::Window* single_root_window); virtual ~WindowOverview(); // Sets the selected window to be the window in position |index|. @@ -60,7 +56,7 @@ class WindowOverview : public ui::EventHandler { void OnWindowsChanged(); // Moves the overview to only |root_window|. - void MoveToSingleRootWindow(aura::RootWindow* root_window); + void MoveToSingleRootWindow(aura::Window* root_window); // ui::EventHandler: virtual void OnKeyEvent(ui::KeyEvent* event) OVERRIDE; @@ -82,9 +78,9 @@ class WindowOverview : public ui::EventHandler { // Position all of the windows based on the current selection mode. void PositionWindows(); // Position all of the windows from |root_window| on |root_window|. - void PositionWindowsFromRoot(aura::RootWindow* root_window); + void PositionWindowsFromRoot(aura::Window* root_window); // Position all of the |windows| to fit on the |root_window|. - void PositionWindowsOnRoot(aura::RootWindow* root_window, + void PositionWindowsOnRoot(aura::Window* root_window, const std::vector<WindowSelectorItem*>& windows); // Creates the selection widget. @@ -111,7 +107,7 @@ class WindowOverview : public ui::EventHandler { // If NULL, each root window displays an overview of the windows in that // display. Otherwise, all windows are in a single overview on // |single_root_window_|. - aura::RootWindow* single_root_window_; + aura::Window* single_root_window_; // The time when overview was started. base::Time overview_start_time_; diff --git a/ash/wm/overview/window_selector.cc b/ash/wm/overview/window_selector.cc index e23f5b3..a7c4ce7 100644 --- a/ash/wm/overview/window_selector.cc +++ b/ash/wm/overview/window_selector.cc @@ -73,7 +73,7 @@ struct WindowSelectorItemComparator // A comparator for locating a selector item for a given root. struct WindowSelectorItemForRoot : public std::unary_function<WindowSelectorItem*, bool> { - explicit WindowSelectorItemForRoot(const aura::RootWindow* root) + explicit WindowSelectorItemForRoot(const aura::Window* root) : root_window(root) { } @@ -81,7 +81,7 @@ struct WindowSelectorItemForRoot return item->GetRootWindow() == root_window; } - const aura::RootWindow* root_window; + const aura::Window* root_window; }; // Filter to watch for the termination of a keyboard gesture to cycle through diff --git a/ash/wm/overview/window_selector_item.cc b/ash/wm/overview/window_selector_item.cc index 6dacf76..a2c25b6 100644 --- a/ash/wm/overview/window_selector_item.cc +++ b/ash/wm/overview/window_selector_item.cc @@ -16,7 +16,7 @@ WindowSelectorItem::WindowSelectorItem() WindowSelectorItem::~WindowSelectorItem() { } -void WindowSelectorItem::SetBounds(aura::RootWindow* root_window, +void WindowSelectorItem::SetBounds(aura::Window* root_window, const gfx::Rect& target_bounds) { if (in_bounds_update_) return; diff --git a/ash/wm/overview/window_selector_item.h b/ash/wm/overview/window_selector_item.h index 36cebc2d..4b0ef01 100644 --- a/ash/wm/overview/window_selector_item.h +++ b/ash/wm/overview/window_selector_item.h @@ -9,7 +9,6 @@ #include "ui/gfx/rect.h" namespace aura { -class RootWindow; class Window; } @@ -24,7 +23,7 @@ class WindowSelectorItem { virtual ~WindowSelectorItem(); // Returns the root window on which this item is shown. - virtual aura::RootWindow* GetRootWindow() = 0; + virtual aura::Window* GetRootWindow() = 0; // Returns the targeted window given the event |target| window. // Returns NULL if no Window in this item was selected. @@ -51,7 +50,7 @@ class WindowSelectorItem { // Sets the bounds of this window selector item to |target_bounds| in the // |root_window| root window. - void SetBounds(aura::RootWindow* root_window, + void SetBounds(aura::Window* root_window, const gfx::Rect& target_bounds); // Recomputes the positions for the windows in this selection item. This is @@ -64,7 +63,7 @@ class WindowSelectorItem { protected: // Sets the bounds of this selector item to |target_bounds| in |root_window|. // If |animate| the windows are animated from their current location. - virtual void SetItemBounds(aura::RootWindow* root_window, + virtual void SetItemBounds(aura::Window* root_window, const gfx::Rect& target_bounds, bool animate) = 0; @@ -73,7 +72,7 @@ class WindowSelectorItem { private: // The root window this item is being displayed on. - aura::RootWindow* root_window_; + aura::Window* root_window_; // The target bounds this selector item is fit within. gfx::Rect target_bounds_; diff --git a/ash/wm/overview/window_selector_panels.cc b/ash/wm/overview/window_selector_panels.cc index ad2735d..70f9028 100644 --- a/ash/wm/overview/window_selector_panels.cc +++ b/ash/wm/overview/window_selector_panels.cc @@ -97,7 +97,7 @@ void WindowSelectorPanels::AddWindow(aura::Window* window) { transform_windows_.push_back(new ScopedTransformPanelWindow(window)); } -aura::RootWindow* WindowSelectorPanels::GetRootWindow() { +aura::Window* WindowSelectorPanels::GetRootWindow() { return transform_windows_.front()->window()->GetRootWindow(); } @@ -146,7 +146,7 @@ void WindowSelectorPanels::PrepareForOverview() { } } -void WindowSelectorPanels::SetItemBounds(aura::RootWindow* root_window, +void WindowSelectorPanels::SetItemBounds(aura::Window* root_window, const gfx::Rect& target_bounds, bool animate) { gfx::Rect bounding_rect; diff --git a/ash/wm/overview/window_selector_panels.h b/ash/wm/overview/window_selector_panels.h index 785c6dc..bcc9137 100644 --- a/ash/wm/overview/window_selector_panels.h +++ b/ash/wm/overview/window_selector_panels.h @@ -10,11 +10,6 @@ #include "base/memory/scoped_vector.h" #include "ui/gfx/rect.h" -namespace aura { -class RootWindow; -class Window; -} - namespace ash { class ScopedTransformOverviewWindow; @@ -32,14 +27,14 @@ class WindowSelectorPanels : public WindowSelectorItem { void AddWindow(aura::Window* window); // WindowSelectorItem: - virtual aura::RootWindow* GetRootWindow() OVERRIDE; + virtual aura::Window* GetRootWindow() OVERRIDE; virtual aura::Window* TargetedWindow(const aura::Window* target) OVERRIDE; virtual void RestoreWindowOnExit(aura::Window* window) OVERRIDE; virtual aura::Window* SelectionWindow() OVERRIDE; virtual void RemoveWindow(const aura::Window* window) OVERRIDE; virtual bool empty() const OVERRIDE; virtual void PrepareForOverview() OVERRIDE; - virtual void SetItemBounds(aura::RootWindow* root_window, + virtual void SetItemBounds(aura::Window* root_window, const gfx::Rect& target_bounds, bool animate) OVERRIDE; diff --git a/ash/wm/overview/window_selector_unittest.cc b/ash/wm/overview/window_selector_unittest.cc index ec7e9e2..eff4ace 100644 --- a/ash/wm/overview/window_selector_unittest.cc +++ b/ash/wm/overview/window_selector_unittest.cc @@ -184,7 +184,7 @@ class WindowSelectorTest : public test::AshTestBase { // Tests entering overview mode with two windows and selecting one. TEST_F(WindowSelectorTest, Basic) { gfx::Rect bounds(0, 0, 400, 400); - aura::RootWindow* root_window = Shell::GetPrimaryRootWindow(); + aura::Window* root_window = Shell::GetPrimaryRootWindow(); scoped_ptr<aura::Window> window1(CreateWindow(bounds)); scoped_ptr<aura::Window> window2(CreateWindow(bounds)); scoped_ptr<aura::Window> panel1(CreatePanelWindow(bounds)); @@ -196,7 +196,7 @@ TEST_F(WindowSelectorTest, Basic) { EXPECT_TRUE(wm::IsActiveWindow(window2.get())); EXPECT_EQ(window2.get(), GetFocusedWindow()); // Hide the cursor before entering overview to test that it will be shown. - GetCursorClient(root_window)->HideCursor(); + aura::client::GetCursorClient(root_window)->HideCursor(); // In overview mode the windows should no longer overlap and focus should // be removed from the window. @@ -209,9 +209,10 @@ TEST_F(WindowSelectorTest, Basic) { EXPECT_TRUE(WindowsOverlapping(panel1.get(), panel2.get())); // The cursor should be visible and locked as a pointer - EXPECT_EQ(ui::kCursorPointer, root_window->last_cursor().native_type()); - EXPECT_TRUE(GetCursorClient(root_window)->IsCursorLocked()); - EXPECT_TRUE(GetCursorClient(root_window)->IsCursorVisible()); + EXPECT_EQ(ui::kCursorPointer, + root_window->GetDispatcher()->last_cursor().native_type()); + EXPECT_TRUE(aura::client::GetCursorClient(root_window)->IsCursorLocked()); + EXPECT_TRUE(aura::client::GetCursorClient(root_window)->IsCursorVisible()); // Clicking window 1 should activate it. ClickWindow(window1.get()); @@ -220,7 +221,7 @@ TEST_F(WindowSelectorTest, Basic) { EXPECT_EQ(window1.get(), GetFocusedWindow()); // Cursor should have been unlocked. - EXPECT_FALSE(GetCursorClient(root_window)->IsCursorLocked()); + EXPECT_FALSE(aura::client::GetCursorClient(root_window)->IsCursorLocked()); } // Tests that the shelf dimming state is removed while in overview and restored diff --git a/ash/wm/overview/window_selector_window.cc b/ash/wm/overview/window_selector_window.cc index 3f090b3..7c3e36c 100644 --- a/ash/wm/overview/window_selector_window.cc +++ b/ash/wm/overview/window_selector_window.cc @@ -15,7 +15,7 @@ WindowSelectorWindow::WindowSelectorWindow(aura::Window* window) WindowSelectorWindow::~WindowSelectorWindow() { } -aura::RootWindow* WindowSelectorWindow::GetRootWindow() { +aura::Window* WindowSelectorWindow::GetRootWindow() { return transform_window_.window()->GetRootWindow(); } @@ -46,7 +46,7 @@ void WindowSelectorWindow::PrepareForOverview() { transform_window_.PrepareForOverview(); } -void WindowSelectorWindow::SetItemBounds(aura::RootWindow* root_window, +void WindowSelectorWindow::SetItemBounds(aura::Window* root_window, const gfx::Rect& target_bounds, bool animate) { gfx::Rect src_rect = transform_window_.GetBoundsInScreen(); diff --git a/ash/wm/overview/window_selector_window.h b/ash/wm/overview/window_selector_window.h index ef912eb..fb49a58 100644 --- a/ash/wm/overview/window_selector_window.h +++ b/ash/wm/overview/window_selector_window.h @@ -11,7 +11,6 @@ #include "ui/gfx/rect.h" namespace aura { -class RootWindow; class Window; } @@ -25,14 +24,14 @@ class WindowSelectorWindow : public WindowSelectorItem { virtual ~WindowSelectorWindow(); // WindowSelectorItem: - virtual aura::RootWindow* GetRootWindow() OVERRIDE; + virtual aura::Window* GetRootWindow() OVERRIDE; virtual aura::Window* TargetedWindow(const aura::Window* target) OVERRIDE; virtual void RestoreWindowOnExit(aura::Window* window) OVERRIDE; virtual aura::Window* SelectionWindow() OVERRIDE; virtual void RemoveWindow(const aura::Window* window) OVERRIDE; virtual bool empty() const OVERRIDE; virtual void PrepareForOverview() OVERRIDE; - virtual void SetItemBounds(aura::RootWindow* root_window, + virtual void SetItemBounds(aura::Window* root_window, const gfx::Rect& target_bounds, bool animate) OVERRIDE; diff --git a/ash/wm/panels/panel_layout_manager.cc b/ash/wm/panels/panel_layout_manager.cc index 56d8e5a..fc2f4bb9 100644 --- a/ash/wm/panels/panel_layout_manager.cc +++ b/ash/wm/panels/panel_layout_manager.cc @@ -450,8 +450,7 @@ void PanelLayoutManager::OnLauncherIconPositionsChanged() { //////////////////////////////////////////////////////////////////////////////// // PanelLayoutManager, ash::ShellObserver implementation: -void PanelLayoutManager::OnShelfAlignmentChanged( - aura::RootWindow* root_window) { +void PanelLayoutManager::OnShelfAlignmentChanged(aura::Window* root_window) { if (panel_container_->GetRootWindow() == root_window) Relayout(); } diff --git a/ash/wm/panels/panel_layout_manager.h b/ash/wm/panels/panel_layout_manager.h index 27ec0cd..5b247eb 100644 --- a/ash/wm/panels/panel_layout_manager.h +++ b/ash/wm/panels/panel_layout_manager.h @@ -93,7 +93,7 @@ class ASH_EXPORT PanelLayoutManager virtual void OnLauncherIconPositionsChanged() OVERRIDE; // Overridden from ash::ShellObserver - virtual void OnShelfAlignmentChanged(aura::RootWindow* root_window) OVERRIDE; + virtual void OnShelfAlignmentChanged(aura::Window* root_window) OVERRIDE; // Overridden from ash::wm::WindowStateObserver virtual void OnWindowShowTypeChanged(wm::WindowState* window_state, diff --git a/ash/wm/panels/panel_layout_manager_unittest.cc b/ash/wm/panels/panel_layout_manager_unittest.cc index 7c61f73..e387138 100644 --- a/ash/wm/panels/panel_layout_manager_unittest.cc +++ b/ash/wm/panels/panel_layout_manager_unittest.cc @@ -236,12 +236,12 @@ class PanelLayoutManagerTest : public test::AshTestBase { test_api.RunMessageLoopUntilAnimationsDone(); } - void SetAlignment(aura::RootWindow* root_window, ShelfAlignment alignment) { + void SetAlignment(aura::Window* root_window, ShelfAlignment alignment) { ash::Shell* shell = ash::Shell::GetInstance(); shell->SetShelfAlignment(alignment, root_window); } - ShelfAlignment GetAlignment(aura::RootWindow* root_window) { + ShelfAlignment GetAlignment(aura::Window* root_window) { ash::Shell* shell = ash::Shell::GetInstance(); return shell->GetShelfAlignment(root_window); } diff --git a/ash/wm/panels/panel_window_resizer.cc b/ash/wm/panels/panel_window_resizer.cc index 49b356c..d8b4b26 100644 --- a/ash/wm/panels/panel_window_resizer.cc +++ b/ash/wm/panels/panel_window_resizer.cc @@ -77,7 +77,7 @@ void PanelWindowResizer::Drag(const gfx::Point& location, int event_flags) { // complete it would begin positioning the panel. if (GetTarget()->parent() != panel_container_) GetPanelLayoutManager(panel_container_)->FinishDragging(); - aura::RootWindow* dst_root = Shell::GetInstance()->display_controller()-> + aura::Window* dst_root = Shell::GetInstance()->display_controller()-> GetRootWindowForDisplayId(dst_display.id()); panel_container_ = Shell::GetContainer( dst_root, internal::kShellWindowId_PanelContainer); @@ -197,7 +197,7 @@ void PanelWindowResizer::StartedDragging() { // We use root window coordinates to ensure that during the drag the panel // is reparented to a container in the root window that has that window. aura::Window* target = GetTarget(); - aura::RootWindow* target_root = target->GetRootWindow(); + aura::Window* target_root = target->GetRootWindow(); aura::client::ParentWindowWithContext( target, target_root, target_root->GetBoundsInScreen()); wm::ReparentTransientChildrenOfChild(target->parent(), target); @@ -212,7 +212,7 @@ void PanelWindowResizer::FinishDragging() { // We use last known location to ensure that after the drag the panel // is reparented to a container in the root window that has that location. aura::Window* target = GetTarget(); - aura::RootWindow* target_root = target->GetRootWindow(); + aura::Window* target_root = target->GetRootWindow(); aura::client::ParentWindowWithContext( target, target_root, gfx::Rect(last_location_, gfx::Size())); wm::ReparentTransientChildrenOfChild(target->parent(), GetTarget()); diff --git a/ash/wm/panels/panel_window_resizer_unittest.cc b/ash/wm/panels/panel_window_resizer_unittest.cc index 8cdec83..e5c4157 100644 --- a/ash/wm/panels/panel_window_resizer_unittest.cc +++ b/ash/wm/panels/panel_window_resizer_unittest.cc @@ -102,7 +102,7 @@ class PanelWindowResizerTest : public test::AshTestBase { void DetachReattachTest(aura::Window* window, int dx, int dy) { wm::WindowState* window_state = wm::GetWindowState(window); EXPECT_TRUE(window_state->panel_attached()); - aura::RootWindow* root_window = window->GetRootWindow(); + aura::Window* root_window = window->GetRootWindow(); EXPECT_EQ(internal::kShellWindowId_PanelContainer, window->parent()->id()); DragStart(window); gfx::Rect initial_bounds = window->GetBoundsInScreen(); diff --git a/ash/wm/partial_screenshot_view.cc b/ash/wm/partial_screenshot_view.cc index e3f5528..66a4259 100644 --- a/ash/wm/partial_screenshot_view.cc +++ b/ash/wm/partial_screenshot_view.cc @@ -163,7 +163,7 @@ void PartialScreenshotView::OnSelectionFinished() { is_dragging_ = false; if (screenshot_delegate_) { - aura::RootWindow *root_window = + aura::Window*root_window = GetWidget()->GetNativeWindow()->GetRootWindow(); screenshot_delegate_->HandleTakePartialScreenshot( root_window, diff --git a/ash/wm/screen_dimmer_unittest.cc b/ash/wm/screen_dimmer_unittest.cc index 5b74e0f..a87c71b 100644 --- a/ash/wm/screen_dimmer_unittest.cc +++ b/ash/wm/screen_dimmer_unittest.cc @@ -71,7 +71,7 @@ TEST_F(ScreenDimmerTest, ResizeLayer) { // When we resize the root window, the dimming layer should be resized to // match. gfx::Size kNewSize(400, 300); - Shell::GetPrimaryRootWindow()->SetHostSize(kNewSize); + Shell::GetPrimaryRootWindow()->GetDispatcher()->SetHostSize(kNewSize); EXPECT_EQ(kNewSize.ToString(), dimming_layer->bounds().size().ToString()); } diff --git a/ash/wm/session_state_animator.cc b/ash/wm/session_state_animator.cc index 81e3fcc..38091bf 100644 --- a/ash/wm/session_state_animator.cc +++ b/ash/wm/session_state_animator.cc @@ -403,7 +403,7 @@ bool SessionStateAnimator::TestApi::ContainersAreAnimated( bool SessionStateAnimator::TestApi::RootWindowIsAnimated(AnimationType type) const { - aura::RootWindow* root_window = Shell::GetPrimaryRootWindow(); + aura::Window* root_window = Shell::GetPrimaryRootWindow(); ui::Layer* layer = root_window->layer(); return IsLayerAnimated(layer, type); } @@ -455,7 +455,7 @@ base::TimeDelta SessionStateAnimator::GetDuration(AnimationSpeed speed) { // Fills |containers| with the containers described by |container_mask|. void SessionStateAnimator::GetContainers(int container_mask, aura::Window::Windows* containers) { - aura::RootWindow* root_window = Shell::GetPrimaryRootWindow(); + aura::Window* root_window = Shell::GetPrimaryRootWindow(); containers->clear(); if (container_mask & DESKTOP_BACKGROUND) { @@ -542,7 +542,7 @@ void SessionStateAnimator::StartAnimationWithObserver( void SessionStateAnimator::StartGlobalAnimation(AnimationType type, AnimationSpeed speed) { - aura::RootWindow* root_window = Shell::GetPrimaryRootWindow(); + aura::Window* root_window = Shell::GetPrimaryRootWindow(); RunAnimationForWindow(root_window, type, speed, NULL); } diff --git a/ash/wm/stacking_controller.cc b/ash/wm/stacking_controller.cc index 7b211a3..bd4a654 100644 --- a/ash/wm/stacking_controller.cc +++ b/ash/wm/stacking_controller.cc @@ -23,13 +23,13 @@ namespace { // coordinates is enabled and the bounds is specified, the root window // that matches the window's bound will be used. Otherwise, it'll // return the active root window. -aura::RootWindow* FindContainerRoot(const gfx::Rect& bounds) { +aura::Window* FindContainerRoot(const gfx::Rect& bounds) { if (bounds.x() == 0 && bounds.y() == 0 && bounds.IsEmpty()) return Shell::GetTargetRootWindow(); return wm::GetRootWindowMatching(bounds); } -aura::Window* GetContainerById(aura::RootWindow* root, int id) { +aura::Window* GetContainerById(aura::Window* root, int id) { return Shell::GetContainer(root, id); } @@ -50,7 +50,7 @@ bool HasTransientParentWindow(aura::Window* window) { } internal::AlwaysOnTopController* -GetAlwaysOnTopController(aura::RootWindow* root_window) { +GetAlwaysOnTopController(aura::Window* root_window) { return internal::GetRootWindowController(root_window)-> always_on_top_controller(); } @@ -72,7 +72,7 @@ StackingController::~StackingController() { aura::Window* StackingController::GetDefaultParent(aura::Window* context, aura::Window* window, const gfx::Rect& bounds) { - aura::RootWindow* target_root = NULL; + aura::Window* target_root = NULL; if (window->transient_parent()) { // Transient window should use the same root as its transient parent. target_root = window->transient_parent()->GetRootWindow(); @@ -115,7 +115,7 @@ aura::Window* StackingController::GetDefaultParent(aura::Window* context, // StackingController, private: aura::Window* StackingController::GetSystemModalContainer( - aura::RootWindow* root, + aura::Window* root, aura::Window* window) const { DCHECK(IsSystemModal(window)); diff --git a/ash/wm/stacking_controller.h b/ash/wm/stacking_controller.h index 0aa690e..bbe715e 100644 --- a/ash/wm/stacking_controller.h +++ b/ash/wm/stacking_controller.h @@ -11,12 +11,7 @@ #include "base/memory/scoped_ptr.h" #include "ui/aura/client/window_tree_client.h" -namespace aura{ -class RootWindow; -} - namespace ash { - namespace internal { class AlwaysOnTopController; } @@ -37,7 +32,7 @@ class ASH_EXPORT StackingController : public aura::client::WindowTreeClient { // normal modal container. // Otherwise those that originate from LockScreen container and above are // placed in the screen lock modal container. - aura::Window* GetSystemModalContainer(aura::RootWindow* root, + aura::Window* GetSystemModalContainer(aura::Window* root, aura::Window* window) const; DISALLOW_COPY_AND_ASSIGN(StackingController); diff --git a/ash/wm/sticky_keys.cc b/ash/wm/sticky_keys.cc index dce3a4e..b4e1cfd 100644 --- a/ash/wm/sticky_keys.cc +++ b/ash/wm/sticky_keys.cc @@ -40,7 +40,7 @@ StickyKeysHandlerDelegateImpl::~StickyKeysHandlerDelegateImpl() { void StickyKeysHandlerDelegateImpl::DispatchKeyEvent(ui::KeyEvent* event, aura::Window* target) { DCHECK(target); - target->GetRootWindow()->AsRootWindowHostDelegate()->OnHostKeyEvent(event); + target->GetDispatcher()->AsRootWindowHostDelegate()->OnHostKeyEvent(event); } } // namespace diff --git a/ash/wm/system_gesture_event_filter_unittest.cc b/ash/wm/system_gesture_event_filter_unittest.cc index 3712c0a..d4edc82 100644 --- a/ash/wm/system_gesture_event_filter_unittest.cc +++ b/ash/wm/system_gesture_event_filter_unittest.cc @@ -243,7 +243,8 @@ void MoveToDeviceControlBezelStartPosition( gfx::Point(-10, ypos + ypos_half), touch_id, ui::EventTimeForNow()); - root_window->AsRootWindowHostDelegate()->OnHostTouchEvent(&press1); + root_window->GetDispatcher()->AsRootWindowHostDelegate()->OnHostTouchEvent( + &press1); // There is a noise filter which will require several calls before it // allows the touch event through. @@ -285,7 +286,7 @@ void MoveToDeviceControlBezelStartPosition( } TEST_P(SystemGestureEventFilterTest, LongPressAffordanceStateOnCaptureLoss) { - aura::RootWindow* root_window = Shell::GetPrimaryRootWindow(); + aura::Window* root_window = Shell::GetPrimaryRootWindow(); aura::test::TestWindowDelegate delegate; scoped_ptr<aura::Window> window0( @@ -309,7 +310,8 @@ TEST_P(SystemGestureEventFilterTest, LongPressAffordanceStateOnCaptureLoss) { gfx::Point(10, 10), kTouchId, ui::EventTimeForNow()); - root_window->AsRootWindowHostDelegate()->OnHostTouchEvent(&press); + root_window->GetDispatcher()->AsRootWindowHostDelegate()->OnHostTouchEvent( + &press); EXPECT_TRUE(window1->HasCapture()); base::OneShotTimer<internal::LongPressAffordanceHandler>* timer = @@ -344,7 +346,7 @@ TEST_P(SystemGestureEventFilterTest, LongPressAffordanceStateOnCaptureLoss) { } TEST_P(SystemGestureEventFilterTest, MultiFingerSwipeGestures) { - aura::RootWindow* root_window = Shell::GetPrimaryRootWindow(); + aura::Window* root_window = Shell::GetPrimaryRootWindow(); views::Widget* toplevel = views::Widget::CreateWindowWithContextAndBounds( new ResizableWidgetDelegate, root_window, gfx::Rect(0, 0, 600, 600)); toplevel->Show(); @@ -403,7 +405,7 @@ TEST_P(SystemGestureEventFilterTest, MultiFingerSwipeGestures) { TEST_P(SystemGestureEventFilterTest, TwoFingerDrag) { gfx::Rect bounds(0, 0, 600, 600); - aura::RootWindow* root_window = Shell::GetPrimaryRootWindow(); + aura::Window* root_window = Shell::GetPrimaryRootWindow(); views::Widget* toplevel = views::Widget::CreateWindowWithContextAndBounds( new ResizableWidgetDelegate, root_window, bounds); toplevel->Show(); @@ -460,7 +462,7 @@ TEST_P(SystemGestureEventFilterTest, TwoFingerDrag) { } TEST_P(SystemGestureEventFilterTest, TwoFingerDragTwoWindows) { - aura::RootWindow* root_window = Shell::GetPrimaryRootWindow(); + aura::Window* root_window = Shell::GetPrimaryRootWindow(); ui::GestureConfiguration::set_max_separation_for_gesture_touches_in_pixels(0); views::Widget* first = views::Widget::CreateWindowWithContextAndBounds( new ResizableWidgetDelegate, root_window, gfx::Rect(0, 0, 50, 100)); @@ -495,7 +497,7 @@ TEST_P(SystemGestureEventFilterTest, TwoFingerDragTwoWindows) { TEST_P(SystemGestureEventFilterTest, WindowsWithMaxSizeDontSnap) { gfx::Rect bounds(150, 150, 100, 100); - aura::RootWindow* root_window = Shell::GetPrimaryRootWindow(); + aura::Window* root_window = Shell::GetPrimaryRootWindow(); views::Widget* toplevel = views::Widget::CreateWindowWithContextAndBounds( new MaxSizeWidgetDelegate, root_window, bounds); toplevel->Show(); @@ -554,7 +556,7 @@ TEST_P(SystemGestureEventFilterTest, WindowsWithMaxSizeDontSnap) { TEST_P(SystemGestureEventFilterTest, TwoFingerDragEdge) { gfx::Rect bounds(0, 0, 100, 100); - aura::RootWindow* root_window = Shell::GetPrimaryRootWindow(); + aura::Window* root_window = Shell::GetPrimaryRootWindow(); views::Widget* toplevel = views::Widget::CreateWindowWithContextAndBounds( new ResizableWidgetDelegate, root_window, bounds); toplevel->Show(); @@ -581,7 +583,7 @@ TEST_P(SystemGestureEventFilterTest, TwoFingerDragEdge) { TEST_P(SystemGestureEventFilterTest, TwoFingerDragDelayed) { gfx::Rect bounds(0, 0, 100, 100); - aura::RootWindow* root_window = Shell::GetPrimaryRootWindow(); + aura::Window* root_window = Shell::GetPrimaryRootWindow(); views::Widget* toplevel = views::Widget::CreateWindowWithContextAndBounds( new ResizableWidgetDelegate, root_window, bounds); toplevel->Show(); @@ -616,7 +618,7 @@ TEST_P(SystemGestureEventFilterTest, TwoFingerDragDelayed) { TEST_P(SystemGestureEventFilterTest, ThreeFingerGestureStopsDrag) { gfx::Rect bounds(0, 0, 100, 100); - aura::RootWindow* root_window = Shell::GetPrimaryRootWindow(); + aura::Window* root_window = Shell::GetPrimaryRootWindow(); views::Widget* toplevel = views::Widget::CreateWindowWithContextAndBounds( new ResizableWidgetDelegate, root_window, bounds); toplevel->Show(); diff --git a/ash/wm/system_modal_container_layout_manager_unittest.cc b/ash/wm/system_modal_container_layout_manager_unittest.cc index 0a11329..551382b 100644 --- a/ash/wm/system_modal_container_layout_manager_unittest.cc +++ b/ash/wm/system_modal_container_layout_manager_unittest.cc @@ -90,7 +90,7 @@ class EventTestWindow : public TestWindow { mouse_presses_(0) {} virtual ~EventTestWindow() {} - aura::Window* OpenTestWindowWithContext(aura::RootWindow* context) { + aura::Window* OpenTestWindowWithContext(aura::Window* context) { views::Widget* widget = views::Widget::CreateWindowWithContext(this, context); widget->Show(); diff --git a/ash/wm/toplevel_window_event_handler.cc b/ash/wm/toplevel_window_event_handler.cc index f6d5902..ef8051d 100644 --- a/ash/wm/toplevel_window_event_handler.cc +++ b/ash/wm/toplevel_window_event_handler.cc @@ -335,7 +335,7 @@ aura::client::WindowMoveResult ToplevelWindowEventHandler::RunMoveLoop( DCHECK(!in_move_loop_); // Can only handle one nested loop at a time. in_move_loop_ = true; move_cancelled_ = false; - aura::RootWindow* root_window = source->GetRootWindow(); + aura::Window* root_window = source->GetRootWindow(); DCHECK(root_window); gfx::Point drag_location; if (move_source == aura::client::WINDOW_MOVE_SOURCE_TOUCH && @@ -345,7 +345,7 @@ aura::client::WindowMoveResult ToplevelWindowEventHandler::RunMoveLoop( GetLastTouchPointForTarget(source, &drag_location); DCHECK(has_point); } else { - drag_location = root_window->GetLastMouseLocationInRoot(); + drag_location = root_window->GetDispatcher()->GetLastMouseLocationInRoot(); aura::Window::ConvertPointToTarget( root_window, source->parent(), &drag_location); } diff --git a/ash/wm/window_cycle_controller_unittest.cc b/ash/wm/window_cycle_controller_unittest.cc index ef1f1e5..7bb9d27 100644 --- a/ash/wm/window_cycle_controller_unittest.cc +++ b/ash/wm/window_cycle_controller_unittest.cc @@ -18,6 +18,7 @@ #include "ui/aura/client/aura_constants.h" #include "ui/aura/client/screen_position_client.h" #include "ui/aura/env.h" +#include "ui/aura/root_window.h" #include "ui/aura/test/test_windows.h" #include "ui/aura/window.h" #include "ui/gfx/rect.h" diff --git a/ash/wm/window_manager_unittest.cc b/ash/wm/window_manager_unittest.cc index 2968f73..6f24d6d 100644 --- a/ash/wm/window_manager_unittest.cc +++ b/ash/wm/window_manager_unittest.cc @@ -143,7 +143,7 @@ TEST_F(WindowManagerTest, Focus) { Shell::GetInstance()->RemovePreTargetHandler( shell_test.input_method_event_filter()); - aura::RootWindow* root_window = Shell::GetPrimaryRootWindow(); + aura::Window* root_window = Shell::GetPrimaryRootWindow(); root_window->SetBounds(gfx::Rect(0, 0, 510, 510)); // Supplied ids are negative so as not to collide with shell ids. @@ -183,21 +183,23 @@ TEST_F(WindowManagerTest, Focus) { aura::client::GetFocusClient(w121.get()); EXPECT_EQ(w121.get(), focus_client->GetFocusedWindow()); + aura::WindowEventDispatcher* dispatcher = root_window->GetDispatcher(); + // The key press should be sent to the focused sub-window. ui::KeyEvent keyev(ui::ET_KEY_PRESSED, ui::VKEY_E, 0, false); - root_window->AsRootWindowHostDelegate()->OnHostKeyEvent(&keyev); + dispatcher->AsRootWindowHostDelegate()->OnHostKeyEvent(&keyev); EXPECT_EQ(ui::VKEY_E, w121delegate->last_key_code()); // Touch on a sub-window (w122) to focus it. gfx::Point click_point = w122->bounds().CenterPoint(); aura::Window::ConvertPointToTarget(w122->parent(), root_window, &click_point); ui::TouchEvent touchev(ui::ET_TOUCH_PRESSED, click_point, 0, getTime()); - root_window->AsRootWindowHostDelegate()->OnHostTouchEvent(&touchev); + dispatcher->AsRootWindowHostDelegate()->OnHostTouchEvent(&touchev); focus_client = aura::client::GetFocusClient(w122.get()); EXPECT_EQ(w122.get(), focus_client->GetFocusedWindow()); // The key press should be sent to the focused sub-window. - root_window->AsRootWindowHostDelegate()->OnHostKeyEvent(&keyev); + dispatcher->AsRootWindowHostDelegate()->OnHostKeyEvent(&keyev); EXPECT_EQ(ui::VKEY_E, w122delegate->last_key_code()); // Hiding the focused window will set the focus to its parent if @@ -234,7 +236,7 @@ TEST_F(WindowManagerTest, Focus) { EXPECT_EQ(aura::client::GetFocusClient(w12.get()), aura::client::GetFocusClient(w123.get())); EXPECT_EQ(NULL, aura::client::GetFocusClient(w12.get())->GetFocusedWindow()); - EXPECT_FALSE(root_window->AsRootWindowHostDelegate()->OnHostKeyEvent(&keyev)); + EXPECT_FALSE(dispatcher->AsRootWindowHostDelegate()->OnHostKeyEvent(&keyev)); // Set the focus back to w123 aura::client::SetActivationDelegate(w1.get(), NULL); @@ -248,12 +250,12 @@ TEST_F(WindowManagerTest, Focus) { // parent window is not focusable. w12->RemoveChild(w123.get()); EXPECT_EQ(NULL, aura::client::GetFocusClient(w123.get())); - EXPECT_FALSE(root_window->AsRootWindowHostDelegate()->OnHostKeyEvent(&keyev)); + EXPECT_FALSE(dispatcher->AsRootWindowHostDelegate()->OnHostKeyEvent(&keyev)); } // Various assertion testing for activating windows. TEST_F(WindowManagerTest, ActivateOnMouse) { - aura::RootWindow* root_window = Shell::GetPrimaryRootWindow(); + aura::Window* root_window = Shell::GetPrimaryRootWindow(); test::TestActivationDelegate d1; aura::test::TestWindowDelegate wd; @@ -408,7 +410,7 @@ TEST_F(WindowManagerTest, PanelActivation) { // Essentially the same as ActivateOnMouse, but for touch events. TEST_F(WindowManagerTest, ActivateOnTouch) { - aura::RootWindow* root_window = Shell::GetPrimaryRootWindow(); + aura::Window* root_window = Shell::GetPrimaryRootWindow(); test::TestActivationDelegate d1; aura::test::TestWindowDelegate wd; @@ -438,7 +440,9 @@ TEST_F(WindowManagerTest, ActivateOnTouch) { gfx::Point press_point = w2->bounds().CenterPoint(); aura::Window::ConvertPointToTarget(w2->parent(), root_window, &press_point); ui::TouchEvent touchev1(ui::ET_TOUCH_PRESSED, press_point, 0, getTime()); - root_window->AsRootWindowHostDelegate()->OnHostTouchEvent(&touchev1); + + aura::WindowEventDispatcher* dispatcher = root_window->GetDispatcher(); + dispatcher->AsRootWindowHostDelegate()->OnHostTouchEvent(&touchev1); // Window2 should have become active. EXPECT_TRUE(wm::IsActiveWindow(w2.get())); @@ -455,7 +459,7 @@ TEST_F(WindowManagerTest, ActivateOnTouch) { aura::Window::ConvertPointToTarget(w1->parent(), root_window, &press_point); d1.set_activate(false); ui::TouchEvent touchev2(ui::ET_TOUCH_PRESSED, press_point, 1, getTime()); - root_window->AsRootWindowHostDelegate()->OnHostTouchEvent(&touchev2); + dispatcher->AsRootWindowHostDelegate()->OnHostTouchEvent(&touchev2); // Window2 should still be active and focused. EXPECT_TRUE(wm::IsActiveWindow(w2.get())); @@ -479,7 +483,7 @@ TEST_F(WindowManagerTest, ActivateOnTouch) { } TEST_F(WindowManagerTest, MouseEventCursors) { - aura::RootWindow* root_window = Shell::GetPrimaryRootWindow(); + aura::Window* root_window = Shell::GetPrimaryRootWindow(); // Create a window. const int kWindowLeft = 123; @@ -497,76 +501,78 @@ TEST_F(WindowManagerTest, MouseEventCursors) { gfx::Point point2(kWindowLeft + 1, kWindowTop + 1); aura::Window::ConvertPointToTarget(window->parent(), root_window, &point2); + aura::WindowEventDispatcher* dispatcher = root_window->GetDispatcher(); + // Cursor starts as a pointer (set during Shell::Init()). - EXPECT_EQ(ui::kCursorPointer, root_window->last_cursor().native_type()); + EXPECT_EQ(ui::kCursorPointer, dispatcher->last_cursor().native_type()); { // Resize edges and corners show proper cursors. window_delegate.set_hittest_code(HTBOTTOM); ui::MouseEvent move1(ui::ET_MOUSE_MOVED, point1, point1, 0x0); - root_window->AsRootWindowHostDelegate()->OnHostMouseEvent(&move1); - EXPECT_EQ(ui::kCursorSouthResize, root_window->last_cursor().native_type()); + dispatcher->AsRootWindowHostDelegate()->OnHostMouseEvent(&move1); + EXPECT_EQ(ui::kCursorSouthResize, dispatcher->last_cursor().native_type()); } { window_delegate.set_hittest_code(HTBOTTOMLEFT); ui::MouseEvent move2(ui::ET_MOUSE_MOVED, point2, point2, 0x0); - root_window->AsRootWindowHostDelegate()->OnHostMouseEvent(&move2); + dispatcher->AsRootWindowHostDelegate()->OnHostMouseEvent(&move2); EXPECT_EQ(ui::kCursorSouthWestResize, - root_window->last_cursor().native_type()); + dispatcher->last_cursor().native_type()); } { window_delegate.set_hittest_code(HTBOTTOMRIGHT); ui::MouseEvent move1(ui::ET_MOUSE_MOVED, point1, point1, 0x0); - root_window->AsRootWindowHostDelegate()->OnHostMouseEvent(&move1); + dispatcher->AsRootWindowHostDelegate()->OnHostMouseEvent(&move1); EXPECT_EQ(ui::kCursorSouthEastResize, - root_window->last_cursor().native_type()); + dispatcher->last_cursor().native_type()); } { window_delegate.set_hittest_code(HTLEFT); ui::MouseEvent move2(ui::ET_MOUSE_MOVED, point2, point2, 0x0); - root_window->AsRootWindowHostDelegate()->OnHostMouseEvent(&move2); - EXPECT_EQ(ui::kCursorWestResize, root_window->last_cursor().native_type()); + dispatcher->AsRootWindowHostDelegate()->OnHostMouseEvent(&move2); + EXPECT_EQ(ui::kCursorWestResize, dispatcher->last_cursor().native_type()); } { window_delegate.set_hittest_code(HTRIGHT); ui::MouseEvent move1(ui::ET_MOUSE_MOVED, point1, point1, 0x0); - root_window->AsRootWindowHostDelegate()->OnHostMouseEvent(&move1); - EXPECT_EQ(ui::kCursorEastResize, root_window->last_cursor().native_type()); + dispatcher->AsRootWindowHostDelegate()->OnHostMouseEvent(&move1); + EXPECT_EQ(ui::kCursorEastResize, dispatcher->last_cursor().native_type()); } { window_delegate.set_hittest_code(HTTOP); ui::MouseEvent move2(ui::ET_MOUSE_MOVED, point2, point2, 0x0); - root_window->AsRootWindowHostDelegate()->OnHostMouseEvent(&move2); - EXPECT_EQ(ui::kCursorNorthResize, root_window->last_cursor().native_type()); + dispatcher->AsRootWindowHostDelegate()->OnHostMouseEvent(&move2); + EXPECT_EQ(ui::kCursorNorthResize, dispatcher->last_cursor().native_type()); } { window_delegate.set_hittest_code(HTTOPLEFT); ui::MouseEvent move1(ui::ET_MOUSE_MOVED, point1, point1, 0x0); - root_window->AsRootWindowHostDelegate()->OnHostMouseEvent(&move1); + dispatcher->AsRootWindowHostDelegate()->OnHostMouseEvent(&move1); EXPECT_EQ(ui::kCursorNorthWestResize, - root_window->last_cursor().native_type()); + dispatcher->last_cursor().native_type()); } { window_delegate.set_hittest_code(HTTOPRIGHT); ui::MouseEvent move2(ui::ET_MOUSE_MOVED, point2, point2, 0x0); - root_window->AsRootWindowHostDelegate()->OnHostMouseEvent(&move2); + dispatcher->AsRootWindowHostDelegate()->OnHostMouseEvent(&move2); EXPECT_EQ(ui::kCursorNorthEastResize, - root_window->last_cursor().native_type()); + dispatcher->last_cursor().native_type()); } { // Client area uses null cursor. window_delegate.set_hittest_code(HTCLIENT); ui::MouseEvent move1(ui::ET_MOUSE_MOVED, point1, point1, 0x0); - root_window->AsRootWindowHostDelegate()->OnHostMouseEvent(&move1); - EXPECT_EQ(ui::kCursorNull, root_window->last_cursor().native_type()); + dispatcher->AsRootWindowHostDelegate()->OnHostMouseEvent(&move1); + EXPECT_EQ(ui::kCursorNull, dispatcher->last_cursor().native_type()); } } @@ -576,7 +582,7 @@ TEST_F(WindowManagerTest, MouseEventCursors) { #define MAYBE_TransformActivate TransformActivate #endif TEST_F(WindowManagerTest, MAYBE_TransformActivate) { - aura::RootWindow* root_window = Shell::GetPrimaryRootWindow(); + aura::Window* root_window = Shell::GetPrimaryRootWindow(); gfx::Size size = root_window->bounds().size(); EXPECT_EQ(gfx::Rect(size).ToString(), Shell::GetScreen()->GetDisplayNearestPoint( @@ -601,13 +607,14 @@ TEST_F(WindowManagerTest, MAYBE_TransformActivate) { miss_point, miss_point, ui::EF_LEFT_MOUSE_BUTTON); - root_window->AsRootWindowHostDelegate()->OnHostMouseEvent(&mouseev1); + aura::WindowEventDispatcher* dispatcher = root_window->GetDispatcher(); + dispatcher->AsRootWindowHostDelegate()->OnHostMouseEvent(&mouseev1); EXPECT_EQ(NULL, aura::client::GetFocusClient(w1.get())->GetFocusedWindow()); ui::MouseEvent mouseup(ui::ET_MOUSE_RELEASED, miss_point, miss_point, ui::EF_LEFT_MOUSE_BUTTON); - root_window->AsRootWindowHostDelegate()->OnHostMouseEvent(&mouseup); + dispatcher->AsRootWindowHostDelegate()->OnHostMouseEvent(&mouseup); gfx::Point hit_point(5, 15); transform.TransformPoint(&hit_point); @@ -615,7 +622,7 @@ TEST_F(WindowManagerTest, MAYBE_TransformActivate) { hit_point, hit_point, ui::EF_LEFT_MOUSE_BUTTON); - root_window->AsRootWindowHostDelegate()->OnHostMouseEvent(&mouseev2); + dispatcher->AsRootWindowHostDelegate()->OnHostMouseEvent(&mouseev2); EXPECT_TRUE(wm::IsActiveWindow(w1.get())); EXPECT_EQ(w1.get(), aura::client::GetFocusClient(w1.get())->GetFocusedWindow()); @@ -628,7 +635,7 @@ TEST_F(WindowManagerTest, AdditionalFilters) { Shell::GetInstance()->RemovePreTargetHandler( shell_test.input_method_event_filter()); - aura::RootWindow* root_window = Shell::GetPrimaryRootWindow(); + aura::Window* root_window = Shell::GetPrimaryRootWindow(); // Creates a window and make it active scoped_ptr<aura::Window> w1(CreateTestWindowInShell( @@ -647,10 +654,11 @@ TEST_F(WindowManagerTest, AdditionalFilters) { // Dispatches mouse and keyboard events. ui::KeyEvent key_event(ui::ET_KEY_PRESSED, ui::VKEY_A, 0, false); - root_window->AsRootWindowHostDelegate()->OnHostKeyEvent(&key_event); + aura::WindowEventDispatcher* dispatcher = root_window->GetDispatcher(); + dispatcher->AsRootWindowHostDelegate()->OnHostKeyEvent(&key_event); ui::MouseEvent mouse_pressed( ui::ET_MOUSE_PRESSED, gfx::Point(0, 0), gfx::Point(0, 0), 0x0); - root_window->AsRootWindowHostDelegate()->OnHostMouseEvent(&mouse_pressed); + dispatcher->AsRootWindowHostDelegate()->OnHostMouseEvent(&mouse_pressed); // Both filters should get the events. EXPECT_EQ(1, f1->num_key_events()); @@ -666,10 +674,10 @@ TEST_F(WindowManagerTest, AdditionalFilters) { f1->set_mouse_event_handling_result(ui::ER_CONSUMED); // Dispatches events. - root_window->AsRootWindowHostDelegate()->OnHostKeyEvent(&key_event); + dispatcher->AsRootWindowHostDelegate()->OnHostKeyEvent(&key_event); ui::MouseEvent mouse_released( ui::ET_MOUSE_RELEASED, gfx::Point(0, 0), gfx::Point(0, 0), 0x0); - root_window->AsRootWindowHostDelegate()->OnHostMouseEvent(&mouse_released); + dispatcher->AsRootWindowHostDelegate()->OnHostMouseEvent(&mouse_released); // f1 should still get the events but f2 no longer gets them. EXPECT_EQ(1, f1->num_key_events()); @@ -684,8 +692,8 @@ TEST_F(WindowManagerTest, AdditionalFilters) { env_filter->RemoveHandler(f1.get()); // Dispatches events. - root_window->AsRootWindowHostDelegate()->OnHostKeyEvent(&key_event); - root_window->AsRootWindowHostDelegate()->OnHostMouseEvent(&mouse_pressed); + dispatcher->AsRootWindowHostDelegate()->OnHostKeyEvent(&key_event); + dispatcher->AsRootWindowHostDelegate()->OnHostMouseEvent(&mouse_pressed); // f1 should get no events since it's out and f2 should get them. EXPECT_EQ(0, f1->num_key_events()); diff --git a/ash/wm/window_positioner.cc b/ash/wm/window_positioner.cc index f4bea7c..ceef02f 100644 --- a/ash/wm/window_positioner.cc +++ b/ash/wm/window_positioner.cc @@ -146,7 +146,7 @@ void AutoPlaceSingleWindow(aura::Window* window, bool animated) { } // Get the first open (non minimized) window which is on the screen defined. -aura::Window* GetReferenceWindow(const aura::RootWindow* root_window, +aura::Window* GetReferenceWindow(const aura::Window* root_window, const aura::Window* exclude, bool *single_window) { if (single_window) @@ -220,7 +220,7 @@ void WindowPositioner::GetBoundsAndShowStateForNewWindow( ui::WindowShowState* show_state_out) { // Always open new window in the target display. - aura::RootWindow* target = Shell::GetTargetRootWindow(); + aura::Window* target = Shell::GetTargetRootWindow(); aura::Window* top_window = GetReferenceWindow(target, NULL, NULL); // Our window should not have any impact if we are already on top. diff --git a/ash/wm/window_util.cc b/ash/wm/window_util.cc index 66a6243..7f35840 100644 --- a/ash/wm/window_util.cc +++ b/ash/wm/window_util.cc @@ -100,7 +100,7 @@ bool MoveWindowToEventRoot(aura::Window* window, const ui::Event& event) { views::View* target = static_cast<views::View*>(event.target()); if (!target) return false; - aura::RootWindow* target_root = + aura::Window* target_root = target->GetWidget()->GetNativeView()->GetRootWindow(); if (!target_root || target_root == window->GetRootWindow()) return false; diff --git a/ash/wm/workspace/phantom_window_controller.cc b/ash/wm/workspace/phantom_window_controller.cc index cd2865e..0eb934d 100644 --- a/ash/wm/workspace/phantom_window_controller.cc +++ b/ash/wm/workspace/phantom_window_controller.cc @@ -104,7 +104,7 @@ void PhantomWindowController::Show(const gfx::Rect& bounds_in_screen) { if (bounds_in_screen == bounds_in_screen_) return; bounds_in_screen_ = bounds_in_screen; - aura::RootWindow* target_root = wm::GetRootWindowMatching(bounds_in_screen); + aura::Window* target_root = wm::GetRootWindowMatching(bounds_in_screen); // Show the phantom at the current bounds of the window. We'll animate to the // target bounds. If phantom exists, update the start bounds. if (!phantom_widget_) @@ -122,7 +122,7 @@ void PhantomWindowController::Show(const gfx::Rect& bounds_in_screen) { // Create a secondary widget in a second screen if start_bounds_ lie at least // partially in that other screen. This allows animations to start or restart // in one root window and progress into another root. - aura::RootWindow* start_root = wm::GetRootWindowMatching(start_bounds_); + aura::Window* start_root = wm::GetRootWindowMatching(start_bounds_); if (start_root == target_root) { Shell::RootWindowList root_windows = Shell::GetAllRootWindows(); for (size_t i = 0; i < root_windows.size(); ++i) { @@ -172,7 +172,7 @@ void PhantomWindowController::AnimationProgressed( } views::Widget* PhantomWindowController::CreatePhantomWidget( - aura::RootWindow* root_window, + aura::Window* root_window, const gfx::Rect& bounds_in_screen) { views::Widget* phantom_widget = new views::Widget; views::Widget::InitParams params(views::Widget::InitParams::TYPE_POPUP); diff --git a/ash/wm/workspace/phantom_window_controller.h b/ash/wm/workspace/phantom_window_controller.h index 4a92792..77d4a28 100644 --- a/ash/wm/workspace/phantom_window_controller.h +++ b/ash/wm/workspace/phantom_window_controller.h @@ -13,7 +13,6 @@ #include "ui/gfx/rect.h" namespace aura { -class RootWindow; class Window; } @@ -65,7 +64,7 @@ class ASH_EXPORT PhantomWindowController : public gfx::AnimationDelegate { // Creates, shows and returns a phantom widget at |bounds| // with kShellWindowId_ShelfContainer in |root_window| as a parent. - views::Widget* CreatePhantomWidget(aura::RootWindow* root_window, + views::Widget* CreatePhantomWidget(aura::Window* root_window, const gfx::Rect& bounds_in_screen); // Window the phantom is placed beneath. diff --git a/ash/wm/workspace/workspace_event_handler_unittest.cc b/ash/wm/workspace/workspace_event_handler_unittest.cc index 61d55bd..d0dcdb6 100644 --- a/ash/wm/workspace/workspace_event_handler_unittest.cc +++ b/ash/wm/workspace/workspace_event_handler_unittest.cc @@ -256,7 +256,7 @@ TEST_F(WorkspaceEventHandlerTest, DoubleClickCaptionTogglesMaximize) { wm::WindowState* window_state = wm::GetWindowState(window.get()); EXPECT_FALSE(window_state->IsMaximized()); - aura::RootWindow* root = Shell::GetPrimaryRootWindow(); + aura::Window* root = Shell::GetPrimaryRootWindow(); aura::test::EventGenerator generator(root, window.get()); generator.DoubleClickLeftButton(); EXPECT_NE("1,2 30x40", window->bounds().ToString()); @@ -272,11 +272,12 @@ TEST_F(WorkspaceEventHandlerTest, DoubleClickCaptionTogglesMaximize) { ui::MouseEvent press(ui::ET_MOUSE_PRESSED, generator.current_location(), generator.current_location(), ui::EF_MIDDLE_MOUSE_BUTTON | ui::EF_IS_DOUBLE_CLICK); - root->AsRootWindowHostDelegate()->OnHostMouseEvent(&press); + aura::WindowEventDispatcher* dispatcher = root->GetDispatcher(); + dispatcher->AsRootWindowHostDelegate()->OnHostMouseEvent(&press); ui::MouseEvent release(ui::ET_MOUSE_RELEASED, generator.current_location(), generator.current_location(), ui::EF_IS_DOUBLE_CLICK); - root->AsRootWindowHostDelegate()->OnHostMouseEvent(&release); + dispatcher->AsRootWindowHostDelegate()->OnHostMouseEvent(&release); EXPECT_FALSE(window_state->IsMaximized()); EXPECT_EQ("1,2 30x40", window->bounds().ToString()); diff --git a/ash/wm/workspace/workspace_layout_manager.cc b/ash/wm/workspace/workspace_layout_manager.cc index 3a313b2..cfe77ff 100644 --- a/ash/wm/workspace/workspace_layout_manager.cc +++ b/ash/wm/workspace/workspace_layout_manager.cc @@ -55,7 +55,7 @@ void MoveToDisplayForRestore(wm::WindowState* window_state) { Shell::GetInstance()->display_controller(); const gfx::Display& display = display_controller->GetDisplayMatching(restore_bounds); - aura::RootWindow* new_root = + aura::Window* new_root = display_controller->GetRootWindowForDisplayId(display.id()); if (new_root != window_state->window()->GetRootWindow()) { aura::Window* new_container = diff --git a/ash/wm/workspace/workspace_window_resizer.cc b/ash/wm/workspace/workspace_window_resizer.cc index 61a58a1..a443332 100644 --- a/ash/wm/workspace/workspace_window_resizer.cc +++ b/ash/wm/workspace/workspace_window_resizer.cc @@ -394,7 +394,7 @@ void WorkspaceWindowResizer::Drag(const gfx::Point& location_in_parent, gfx::Point location_in_screen = location_in_parent; wm::ConvertPointToScreen(window()->parent(), &location_in_screen); - aura::RootWindow* root = NULL; + aura::Window* root = NULL; gfx::Display display = ScreenAsh::FindDisplayContainingPoint(location_in_screen); // Track the last screen that the pointer was on to keep the snap phantom diff --git a/ash/wm/workspace/workspace_window_resizer_unittest.cc b/ash/wm/workspace/workspace_window_resizer_unittest.cc index f3efaa52..1d5f0d2 100644 --- a/ash/wm/workspace/workspace_window_resizer_unittest.cc +++ b/ash/wm/workspace/workspace_window_resizer_unittest.cc @@ -107,7 +107,7 @@ class WorkspaceWindowResizerTest : public test::AshTestBase { AshTestBase::SetUp(); UpdateDisplay(base::StringPrintf("800x%d", kRootHeight)); - aura::RootWindow* root = Shell::GetPrimaryRootWindow(); + aura::Window* root = Shell::GetPrimaryRootWindow(); gfx::Rect root_bounds(root->bounds()); #if defined(OS_WIN) // RootWindow and Display can't resize on Windows Ash. @@ -462,7 +462,7 @@ TEST_F(WorkspaceWindowResizerTest, AttachedResize_BOTTOM_2) { // windows. TEST_F(WorkspaceWindowResizerTest, MAYBE_AttachedResize_BOTTOM_3) { UpdateDisplay("600x800"); - aura::RootWindow* root = Shell::GetPrimaryRootWindow(); + aura::Window* root = Shell::GetPrimaryRootWindow(); Shell::GetInstance()->SetDisplayWorkAreaInsets(root, gfx::Insets()); window_->SetBounds(gfx::Rect( 300, 100, 300, 200)); @@ -1478,7 +1478,7 @@ TEST_F(WorkspaceWindowResizerTest, PhantomSnapMaxSize) { TEST_F(WorkspaceWindowResizerTest, DontRewardRightmostWindowForOverflows) { UpdateDisplay("600x800"); - aura::RootWindow* root = Shell::GetPrimaryRootWindow(); + aura::Window* root = Shell::GetPrimaryRootWindow(); Shell::GetInstance()->SetDisplayWorkAreaInsets(root, gfx::Insets()); // Four 100x100 windows flush against eachother, starting at 100,100. @@ -1509,7 +1509,7 @@ TEST_F(WorkspaceWindowResizerTest, DontRewardRightmostWindowForOverflows) { TEST_F(WorkspaceWindowResizerTest, DontExceedMaxWidth) { UpdateDisplay("600x800"); - aura::RootWindow* root = Shell::GetPrimaryRootWindow(); + aura::Window* root = Shell::GetPrimaryRootWindow(); Shell::GetInstance()->SetDisplayWorkAreaInsets(root, gfx::Insets()); // Four 100x100 windows flush against eachother, starting at 100,100. @@ -1538,7 +1538,7 @@ TEST_F(WorkspaceWindowResizerTest, DontExceedMaxWidth) { TEST_F(WorkspaceWindowResizerTest, DontExceedMaxHeight) { UpdateDisplay("600x800"); - aura::RootWindow* root = Shell::GetPrimaryRootWindow(); + aura::Window* root = Shell::GetPrimaryRootWindow(); Shell::GetInstance()->SetDisplayWorkAreaInsets(root, gfx::Insets()); // Four 100x100 windows flush against eachother, starting at 100,100. @@ -1574,7 +1574,7 @@ TEST_F(WorkspaceWindowResizerTest, DontExceedMaxHeight) { TEST_F(WorkspaceWindowResizerTest, MAYBE_DontExceedMinHeight) { UpdateDisplay("600x500"); - aura::RootWindow* root = Shell::GetPrimaryRootWindow(); + aura::Window* root = Shell::GetPrimaryRootWindow(); Shell::GetInstance()->SetDisplayWorkAreaInsets(root, gfx::Insets()); // Four 100x100 windows flush against eachother, starting at 100,100. @@ -1603,7 +1603,7 @@ TEST_F(WorkspaceWindowResizerTest, MAYBE_DontExceedMinHeight) { TEST_F(WorkspaceWindowResizerTest, DontExpandRightmostPastMaxWidth) { UpdateDisplay("600x800"); - aura::RootWindow* root = Shell::GetPrimaryRootWindow(); + aura::Window* root = Shell::GetPrimaryRootWindow(); Shell::GetInstance()->SetDisplayWorkAreaInsets(root, gfx::Insets()); // Three 100x100 windows flush against eachother, starting at 100,100. @@ -1629,7 +1629,7 @@ TEST_F(WorkspaceWindowResizerTest, DontExpandRightmostPastMaxWidth) { TEST_F(WorkspaceWindowResizerTest, MoveAttachedWhenGrownToMaxSize) { UpdateDisplay("600x800"); - aura::RootWindow* root = Shell::GetPrimaryRootWindow(); + aura::Window* root = Shell::GetPrimaryRootWindow(); Shell::GetInstance()->SetDisplayWorkAreaInsets(root, gfx::Insets()); // Three 100x100 windows flush against eachother, starting at 100,100. @@ -1663,7 +1663,7 @@ TEST_F(WorkspaceWindowResizerTest, MoveAttachedWhenGrownToMaxSize) { TEST_F(WorkspaceWindowResizerTest, MAYBE_MainWindowHonoursMaxWidth) { UpdateDisplay("400x800"); - aura::RootWindow* root = Shell::GetPrimaryRootWindow(); + aura::Window* root = Shell::GetPrimaryRootWindow(); Shell::GetInstance()->SetDisplayWorkAreaInsets(root, gfx::Insets()); // Three 100x100 windows flush against eachother, starting at 100,100. @@ -1690,7 +1690,7 @@ TEST_F(WorkspaceWindowResizerTest, MAYBE_MainWindowHonoursMaxWidth) { TEST_F(WorkspaceWindowResizerTest, MainWindowHonoursMinWidth) { UpdateDisplay("400x800"); - aura::RootWindow* root = Shell::GetPrimaryRootWindow(); + aura::Window* root = Shell::GetPrimaryRootWindow(); Shell::GetInstance()->SetDisplayWorkAreaInsets(root, gfx::Insets()); // Three 100x100 windows flush against eachother, starting at 100,100. diff --git a/chrome/browser/chromeos/display/overscan_calibrator.cc b/chrome/browser/chromeos/display/overscan_calibrator.cc index ed4adae..de8f190 100644 --- a/chrome/browser/chromeos/display/overscan_calibrator.cc +++ b/chrome/browser/chromeos/display/overscan_calibrator.cc @@ -73,7 +73,7 @@ OverscanCalibrator::OverscanCalibrator( ash::internal::DisplayInfo info = ash::Shell::GetInstance()-> display_manager()->GetDisplayInfo(display_.id()); - aura::RootWindow* root = ash::Shell::GetInstance()->display_controller()-> + aura::Window* root = ash::Shell::GetInstance()->display_controller()-> GetRootWindowForDisplayId(display_.id()); ui::Layer* parent_layer = ash::Shell::GetContainer( root, ash::internal::kShellWindowId_OverlayContainer)->layer(); diff --git a/chrome/browser/download/drag_download_item_views.cc b/chrome/browser/download/drag_download_item_views.cc index 872e1d5..7b94718 100644 --- a/chrome/browser/download/drag_download_item_views.cc +++ b/chrome/browser/download/drag_download_item_views.cc @@ -58,7 +58,7 @@ void DragDownloadItem(const content::DownloadItem* download, #if !defined(TOOLKIT_GTK) #if defined(USE_AURA) - aura::RootWindow* root_window = view->GetRootWindow(); + aura::Window* root_window = view->GetRootWindow(); if (!root_window || !aura::client::GetDragDropClient(root_window)) return; diff --git a/chrome/browser/extensions/api/input/input.cc b/chrome/browser/extensions/api/input/input.cc index 974b45e..8a3d7f4 100644 --- a/chrome/browser/extensions/api/input/input.cc +++ b/chrome/browser/extensions/api/input/input.cc @@ -56,8 +56,10 @@ bool VirtualKeyboardPrivateMoveCursorFunction::RunImpl() { EXTENSION_FUNCTION_VALIDATE(args_->GetInteger(0, &swipe_direction)); EXTENSION_FUNCTION_VALIDATE(args_->GetInteger(1, &modifier_flags)); - return keyboard::MoveCursor(swipe_direction, modifier_flags, - ash::Shell::GetPrimaryRootWindow()); + return keyboard::MoveCursor( + swipe_direction, + modifier_flags, + ash::Shell::GetPrimaryRootWindow()->GetDispatcher()); #endif error_ = kNotYetImplementedError; return false; @@ -81,11 +83,12 @@ bool VirtualKeyboardPrivateSendKeyEventFunction::RunImpl() { EXTENSION_FUNCTION_VALIDATE(params->GetInteger("keyCode", &key_code)); EXTENSION_FUNCTION_VALIDATE(params->GetInteger("modifiers", &modifiers)); - return keyboard::SendKeyEvent(type, - char_value, - key_code, - modifiers, - ash::Shell::GetPrimaryRootWindow()); + return keyboard::SendKeyEvent( + type, + char_value, + key_code, + modifiers, + ash::Shell::GetPrimaryRootWindow()->GetDispatcher()); #endif error_ = kNotYetImplementedError; return false; diff --git a/chrome/browser/first_run/try_chrome_dialog_view.cc b/chrome/browser/first_run/try_chrome_dialog_view.cc index c8ef28c7..430ce5b 100644 --- a/chrome/browser/first_run/try_chrome_dialog_view.cc +++ b/chrome/browser/first_run/try_chrome_dialog_view.cc @@ -283,7 +283,7 @@ TryChromeDialogView::Result TryChromeDialogView::ShowModal( HWND toast_window; #if defined(USE_AURA) toast_window = - popup_->GetNativeView()->GetRootWindow()->GetAcceleratedWidget(); + popup_->GetNativeView()->GetDispatcher()->GetAcceleratedWidget(); #else toast_window = popup_->GetNativeView(); #endif diff --git a/chrome/browser/printing/print_dialog_cloud.cc b/chrome/browser/printing/print_dialog_cloud.cc index 187dac6..4f9c5f9 100644 --- a/chrome/browser/printing/print_dialog_cloud.cc +++ b/chrome/browser/printing/print_dialog_cloud.cc @@ -636,7 +636,7 @@ void CreateDialogImpl(content::BrowserContext* browser_context, if (window) { HWND dialog_handle; #if defined(USE_AURA) - dialog_handle = window->GetRootWindow()->GetAcceleratedWidget(); + dialog_handle = window->GetDispatcher()->GetAcceleratedWidget(); #else dialog_handle = window; #endif diff --git a/chrome/browser/renderer_host/pepper/pepper_flash_drm_host.cc b/chrome/browser/renderer_host/pepper/pepper_flash_drm_host.cc index 7f0f4bb..c7f47e5 100644 --- a/chrome/browser/renderer_host/pepper/pepper_flash_drm_host.cc +++ b/chrome/browser/renderer_host/pepper/pepper_flash_drm_host.cc @@ -80,10 +80,10 @@ class MonitorFinder : public base::RefCountedThreadSafe<MonitorFinder> { return; gfx::NativeView native_view = view->GetNativeView(); #if defined(USE_AURA) - aura::RootWindow* root = native_view->GetRootWindow(); - if (!root) + aura::WindowEventDispatcher* dispatcher = native_view->GetDispatcher(); + if (!dispatcher) return; - HWND window = root->GetAcceleratedWidget(); + HWND window = dispatcher->GetAcceleratedWidget(); #else HWND window = native_view; #endif diff --git a/chrome/browser/ui/ash/ash_init.cc b/chrome/browser/ui/ash/ash_init.cc index 8fbecad..8fa62e8 100644 --- a/chrome/browser/ui/ash/ash_init.cc +++ b/chrome/browser/ui/ash/ash_init.cc @@ -83,7 +83,7 @@ void OpenAsh() { chrome::StartKeepAlive(); } #endif - ash::Shell::GetPrimaryRootWindow()->ShowRootWindow(); + ash::Shell::GetPrimaryRootWindow()->GetDispatcher()->ShowRootWindow(); } void CloseAsh() { diff --git a/chrome/browser/ui/ash/chrome_shell_delegate.cc b/chrome/browser/ui/ash/chrome_shell_delegate.cc index 420839c..35facf0 100644 --- a/chrome/browser/ui/ash/chrome_shell_delegate.cc +++ b/chrome/browser/ui/ash/chrome_shell_delegate.cc @@ -306,7 +306,7 @@ void ChromeShellDelegate::RecordUserMetricsAction( } } -ui::MenuModel* ChromeShellDelegate::CreateContextMenu(aura::RootWindow* root) { +ui::MenuModel* ChromeShellDelegate::CreateContextMenu(aura::Window* root) { DCHECK(launcher_delegate_); // Don't show context menu for exclusive app runtime mode. if (chrome::IsRunningInAppMode()) diff --git a/chrome/browser/ui/ash/chrome_shell_delegate.h b/chrome/browser/ui/ash/chrome_shell_delegate.h index ce48df5..28b298d 100644 --- a/chrome/browser/ui/ash/chrome_shell_delegate.h +++ b/chrome/browser/ui/ash/chrome_shell_delegate.h @@ -61,7 +61,7 @@ class ChromeShellDelegate : public ash::ShellDelegate, virtual void HandleMediaNextTrack() OVERRIDE; virtual void HandleMediaPlayPause() OVERRIDE; virtual void HandleMediaPrevTrack() OVERRIDE; - virtual ui::MenuModel* CreateContextMenu(aura::RootWindow* root) OVERRIDE; + virtual ui::MenuModel* CreateContextMenu(aura::Window* root) OVERRIDE; virtual ash::RootWindowHostFactory* CreateRootWindowHostFactory() OVERRIDE; virtual string16 GetProductName() const OVERRIDE; diff --git a/chrome/browser/ui/ash/event_rewriter.cc b/chrome/browser/ui/ash/event_rewriter.cc index 54e808c..c28df4f4 100644 --- a/chrome/browser/ui/ash/event_rewriter.cc +++ b/chrome/browser/ui/ash/event_rewriter.cc @@ -170,8 +170,10 @@ EventRewriter::EventRewriter() #endif pref_service_(NULL) { // The ash shell isn't instantiated for our unit tests. - if (ash::Shell::HasInstance()) - ash::Shell::GetPrimaryRootWindow()->AddRootWindowObserver(this); + if (ash::Shell::HasInstance()) { + ash::Shell::GetPrimaryRootWindow()->GetDispatcher()-> + AddRootWindowObserver(this); + } #if defined(OS_CHROMEOS) if (base::SysInfo::IsRunningOnChromeOS()) { chromeos::XInputHierarchyChangedEventListener::GetInstance() @@ -182,8 +184,10 @@ EventRewriter::EventRewriter() } EventRewriter::~EventRewriter() { - if (ash::Shell::HasInstance()) - ash::Shell::GetPrimaryRootWindow()->RemoveRootWindowObserver(this); + if (ash::Shell::HasInstance()) { + ash::Shell::GetPrimaryRootWindow()->GetDispatcher()-> + RemoveRootWindowObserver(this); + } #if defined(OS_CHROMEOS) if (base::SysInfo::IsRunningOnChromeOS()) { chromeos::XInputHierarchyChangedEventListener::GetInstance() diff --git a/chrome/browser/ui/ash/launcher/app_shortcut_launcher_item_controller.cc b/chrome/browser/ui/ash/launcher/app_shortcut_launcher_item_controller.cc index e14aa33..cbb15ec 100644 --- a/chrome/browser/ui/ash/launcher/app_shortcut_launcher_item_controller.cc +++ b/chrome/browser/ui/ash/launcher/app_shortcut_launcher_item_controller.cc @@ -209,7 +209,7 @@ base::string16 AppShortcutLauncherItemController::GetTitle() { } ui::MenuModel* AppShortcutLauncherItemController::CreateContextMenu( - aura::RootWindow* root_window) { + aura::Window* root_window) { ash::LauncherItem item = *(launcher_controller()->model()->ItemByID(launcher_id())); return new LauncherContextMenu(launcher_controller(), &item, root_window); diff --git a/chrome/browser/ui/ash/launcher/app_shortcut_launcher_item_controller.h b/chrome/browser/ui/ash/launcher/app_shortcut_launcher_item_controller.h index 3dc6726..f74725f 100644 --- a/chrome/browser/ui/ash/launcher/app_shortcut_launcher_item_controller.h +++ b/chrome/browser/ui/ash/launcher/app_shortcut_launcher_item_controller.h @@ -47,7 +47,7 @@ class AppShortcutLauncherItemController : public LauncherItemController { virtual void ItemSelected(const ui::Event& event) OVERRIDE; virtual base::string16 GetTitle() OVERRIDE; virtual ui::MenuModel* CreateContextMenu( - aura::RootWindow* root_window) OVERRIDE; + aura::Window* root_window) OVERRIDE; virtual ash::LauncherMenuModel* CreateApplicationMenu( int event_flags) OVERRIDE; virtual bool IsDraggable() OVERRIDE; diff --git a/chrome/browser/ui/ash/launcher/browser_shortcut_launcher_item_controller.cc b/chrome/browser/ui/ash/launcher/browser_shortcut_launcher_item_controller.cc index e0f0936b..fb0ab5b0 100644 --- a/chrome/browser/ui/ash/launcher/browser_shortcut_launcher_item_controller.cc +++ b/chrome/browser/ui/ash/launcher/browser_shortcut_launcher_item_controller.cc @@ -242,7 +242,7 @@ string16 BrowserShortcutLauncherItemController::GetTitle() { } ui::MenuModel* BrowserShortcutLauncherItemController::CreateContextMenu( - aura::RootWindow* root_window) { + aura::Window* root_window) { ash::LauncherItem item = *(launcher_controller()->model()->ItemByID(launcher_id())); return new LauncherContextMenu(launcher_controller(), &item, root_window); diff --git a/chrome/browser/ui/ash/launcher/browser_shortcut_launcher_item_controller.h b/chrome/browser/ui/ash/launcher/browser_shortcut_launcher_item_controller.h index fbdfd97..d4e64e5 100644 --- a/chrome/browser/ui/ash/launcher/browser_shortcut_launcher_item_controller.h +++ b/chrome/browser/ui/ash/launcher/browser_shortcut_launcher_item_controller.h @@ -41,7 +41,7 @@ class BrowserShortcutLauncherItemController : public LauncherItemController { virtual void ItemSelected(const ui::Event& event) OVERRIDE; virtual base::string16 GetTitle() OVERRIDE; virtual ui::MenuModel* CreateContextMenu( - aura::RootWindow* root_window) OVERRIDE; + aura::Window* root_window) OVERRIDE; virtual ash::LauncherMenuModel* CreateApplicationMenu( int event_flags) OVERRIDE; virtual bool IsDraggable() OVERRIDE; diff --git a/chrome/browser/ui/ash/launcher/browser_status_monitor.cc b/chrome/browser/ui/ash/launcher/browser_status_monitor.cc index a3a95e8..43845fa 100644 --- a/chrome/browser/ui/ash/launcher/browser_status_monitor.cc +++ b/chrome/browser/ui/ash/launcher/browser_status_monitor.cc @@ -183,7 +183,7 @@ void BrowserStatusMonitor::OnDisplayBoundsChanged( void BrowserStatusMonitor::OnDisplayAdded(const gfx::Display& new_display) { // Add a new RootWindow and its ActivationClient to observed list. - aura::RootWindow* root_window = ash::Shell::GetInstance()-> + aura::Window* root_window = ash::Shell::GetInstance()-> display_controller()->GetRootWindowForDisplayId(new_display.id()); // When the primary root window's display get removed, the existing root // window is taken over by the new display and the observer is already set. diff --git a/chrome/browser/ui/ash/launcher/chrome_launcher_controller.cc b/chrome/browser/ui/ash/launcher/chrome_launcher_controller.cc index bad877b..22b7f71 100644 --- a/chrome/browser/ui/ash/launcher/chrome_launcher_controller.cc +++ b/chrome/browser/ui/ash/launcher/chrome_launcher_controller.cc @@ -102,7 +102,7 @@ namespace { // will ignore it. const char kAppLauncherIdPlaceholder[] = "AppLauncherIDPlaceholder--------"; -std::string GetPrefKeyForRootWindow(aura::RootWindow* root_window) { +std::string GetPrefKeyForRootWindow(aura::Window* root_window) { gfx::Display display = gfx::Screen::GetScreenFor( root_window)->GetDisplayNearestWindow(root_window); DCHECK(display.is_valid()); @@ -111,7 +111,7 @@ std::string GetPrefKeyForRootWindow(aura::RootWindow* root_window) { } void UpdatePerDisplayPref(PrefService* pref_service, - aura::RootWindow* root_window, + aura::Window* root_window, const char* pref_key, const std::string& value) { std::string key = GetPrefKeyForRootWindow(root_window); @@ -144,7 +144,7 @@ void UpdatePerDisplayPref(PrefService* pref_service, // * The default value for |local_path| if the value is not recommended by // policy. std::string GetPrefForRootWindow(PrefService* pref_service, - aura::RootWindow* root_window, + aura::Window* root_window, const char* local_path, const char* path) { const PrefService::Preference* local_pref = @@ -671,7 +671,7 @@ void ChromeLauncherController::SetAppImage(const std::string& id, } void ChromeLauncherController::OnAutoHideBehaviorChanged( - aura::RootWindow* root_window, + aura::Window* root_window, ash::ShelfAutoHideBehavior new_behavior) { SetShelfAutoHideBehaviorPrefs(new_behavior, root_window); } @@ -802,7 +802,7 @@ Profile* ChromeLauncherController::profile() { } ash::ShelfAutoHideBehavior ChromeLauncherController::GetShelfAutoHideBehavior( - aura::RootWindow* root_window) const { + aura::Window* root_window) const { // Don't show the shelf in app mode. if (chrome::IsRunningInAppMode()) return ash::SHELF_AUTO_HIDE_ALWAYS_HIDDEN; @@ -824,13 +824,13 @@ ash::ShelfAutoHideBehavior ChromeLauncherController::GetShelfAutoHideBehavior( } bool ChromeLauncherController::CanUserModifyShelfAutoHideBehavior( - aura::RootWindow* root_window) const { + aura::Window* root_window) const { return profile_->GetPrefs()-> FindPreference(prefs::kShelfAutoHideBehaviorLocal)->IsUserModifiable(); } void ChromeLauncherController::ToggleShelfAutoHideBehavior( - aura::RootWindow* root_window) { + aura::Window* root_window) { ash::ShelfAutoHideBehavior behavior = GetShelfAutoHideBehavior(root_window) == ash::SHELF_AUTO_HIDE_BEHAVIOR_ALWAYS ? ash::SHELF_AUTO_HIDE_BEHAVIOR_NEVER : @@ -1084,7 +1084,7 @@ void ChromeLauncherController::Observe( } void ChromeLauncherController::OnShelfAlignmentChanged( - aura::RootWindow* root_window) { + aura::Window* root_window) { const char* pref_value = NULL; switch (ash::Shell::GetInstance()->GetShelfAlignment(root_window)) { case ash::SHELF_ALIGNMENT_BOTTOM: @@ -1519,7 +1519,7 @@ void ChromeLauncherController::UpdateAppLaunchersFromPref() { void ChromeLauncherController::SetShelfAutoHideBehaviorPrefs( ash::ShelfAutoHideBehavior behavior, - aura::RootWindow* root_window) { + aura::Window* root_window) { const char* value = NULL; switch (behavior) { case ash::SHELF_AUTO_HIDE_BEHAVIOR_ALWAYS: diff --git a/chrome/browser/ui/ash/launcher/chrome_launcher_controller.h b/chrome/browser/ui/ash/launcher/chrome_launcher_controller.h index 1ddaaa7..e566a9b 100644 --- a/chrome/browser/ui/ash/launcher/chrome_launcher_controller.h +++ b/chrome/browser/ui/ash/launcher/chrome_launcher_controller.h @@ -252,15 +252,15 @@ class ChromeLauncherController : public ash::LauncherDelegate, // Gets the shelf auto-hide behavior on |root_window|. ash::ShelfAutoHideBehavior GetShelfAutoHideBehavior( - aura::RootWindow* root_window) const; + aura::Window* root_window) const; // Returns |true| if the user is allowed to modify the shelf auto-hide // behavior on |root_window|. - bool CanUserModifyShelfAutoHideBehavior(aura::RootWindow* root_window) const; + bool CanUserModifyShelfAutoHideBehavior(aura::Window* root_window) const; // Toggles the shelf auto-hide behavior on |root_window|. Does nothing if the // user is not allowed to modify the auto-hide behavior. - void ToggleShelfAutoHideBehavior(aura::RootWindow* root_window); + void ToggleShelfAutoHideBehavior(aura::Window* root_window); // The tab no longer represents its previously identified application. void RemoveTabFromRunningApp(content::WebContents* tab, @@ -308,7 +308,7 @@ class ChromeLauncherController : public ash::LauncherDelegate, const content::NotificationDetails& details) OVERRIDE; // ash::ShellObserver overrides: - virtual void OnShelfAlignmentChanged(aura::RootWindow* root_window) OVERRIDE; + virtual void OnShelfAlignmentChanged(aura::Window* root_window) OVERRIDE; // ash::DisplayController::Observer overrides: virtual void OnDisplayConfigurationChanging() OVERRIDE; @@ -330,7 +330,7 @@ class ChromeLauncherController : public ash::LauncherDelegate, // ash::ShelfLayoutManagerObserver overrides: virtual void OnAutoHideBehaviorChanged( - aura::RootWindow* root_window, + aura::Window* root_window, ash::ShelfAutoHideBehavior new_behavior) OVERRIDE; // Called when the active user has changed. @@ -436,7 +436,7 @@ class ChromeLauncherController : public ash::LauncherDelegate, // Persists the shelf auto-hide behavior to prefs. void SetShelfAutoHideBehaviorPrefs(ash::ShelfAutoHideBehavior behavior, - aura::RootWindow* root_window); + aura::Window* root_window); // Sets the shelf auto-hide behavior from prefs. void SetShelfAutoHideBehaviorFromPrefs(); diff --git a/chrome/browser/ui/ash/launcher/chrome_launcher_controller_unittest.cc b/chrome/browser/ui/ash/launcher/chrome_launcher_controller_unittest.cc index 3c5ac47..840129f 100644 --- a/chrome/browser/ui/ash/launcher/chrome_launcher_controller_unittest.cc +++ b/chrome/browser/ui/ash/launcher/chrome_launcher_controller_unittest.cc @@ -233,7 +233,7 @@ class TestV2AppLauncherItemController : public LauncherItemController { return items.Pass(); } virtual ui::MenuModel* CreateContextMenu( - aura::RootWindow* root_window) OVERRIDE { return NULL; } + aura::Window* root_window) OVERRIDE { return NULL; } virtual ash::LauncherMenuModel* CreateApplicationMenu( int event_flags) OVERRIDE { return NULL; } virtual bool IsDraggable() OVERRIDE { return false; } diff --git a/chrome/browser/ui/ash/launcher/launcher_context_menu.cc b/chrome/browser/ui/ash/launcher/launcher_context_menu.cc index 15e1ba0..bc2c6d62 100644 --- a/chrome/browser/ui/ash/launcher/launcher_context_menu.cc +++ b/chrome/browser/ui/ash/launcher/launcher_context_menu.cc @@ -37,7 +37,7 @@ bool MenuItemHasLauncherContext(const extensions::MenuItem* item) { LauncherContextMenu::LauncherContextMenu(ChromeLauncherController* controller, const ash::LauncherItem* item, - aura::RootWindow* root) + aura::Window* root) : ui::SimpleMenuModel(NULL), controller_(controller), item_(*item), @@ -49,7 +49,7 @@ LauncherContextMenu::LauncherContextMenu(ChromeLauncherController* controller, } LauncherContextMenu::LauncherContextMenu(ChromeLauncherController* controller, - aura::RootWindow* root) + aura::Window* root) : ui::SimpleMenuModel(NULL), controller_(controller), item_(ash::LauncherItem()), diff --git a/chrome/browser/ui/ash/launcher/launcher_context_menu.h b/chrome/browser/ui/ash/launcher/launcher_context_menu.h index 3fc1dd9..5b89dfb 100644 --- a/chrome/browser/ui/ash/launcher/launcher_context_menu.h +++ b/chrome/browser/ui/ash/launcher/launcher_context_menu.h @@ -15,7 +15,7 @@ class ChromeLauncherController; namespace aura { -class RootWindow; +class Window; } namespace extensions { @@ -30,10 +30,10 @@ class LauncherContextMenu : public ui::SimpleMenuModel, // |clicked on an area with no icons). LauncherContextMenu(ChromeLauncherController* controller, const ash::LauncherItem* item, - aura::RootWindow* root_window); + aura::Window* root_window); // Creates a menu used as a desktop context menu on |root_window|. LauncherContextMenu(ChromeLauncherController* controller, - aura::RootWindow* root_window); + aura::Window* root_window); virtual ~LauncherContextMenu(); void Init(); @@ -88,7 +88,7 @@ class LauncherContextMenu : public ui::SimpleMenuModel, scoped_ptr<extensions::ContextMenuMatcher> extension_items_; - aura::RootWindow* root_window_; + aura::Window* root_window_; DISALLOW_COPY_AND_ASSIGN(LauncherContextMenu); }; diff --git a/chrome/browser/ui/ash/launcher/shell_window_launcher_item_controller.cc b/chrome/browser/ui/ash/launcher/shell_window_launcher_item_controller.cc index d20bddc..d86b10a 100644 --- a/chrome/browser/ui/ash/launcher/shell_window_launcher_item_controller.cc +++ b/chrome/browser/ui/ash/launcher/shell_window_launcher_item_controller.cc @@ -229,7 +229,7 @@ base::string16 ShellWindowLauncherItemController::GetTitle() { } ui::MenuModel* ShellWindowLauncherItemController::CreateContextMenu( - aura::RootWindow* root_window) { + aura::Window* root_window) { ash::LauncherItem item = *(launcher_controller()->model()->ItemByID(launcher_id())); return new LauncherContextMenu(launcher_controller(), &item, root_window); diff --git a/chrome/browser/ui/ash/launcher/shell_window_launcher_item_controller.h b/chrome/browser/ui/ash/launcher/shell_window_launcher_item_controller.h index ea2226c..2ffc77d 100644 --- a/chrome/browser/ui/ash/launcher/shell_window_launcher_item_controller.h +++ b/chrome/browser/ui/ash/launcher/shell_window_launcher_item_controller.h @@ -66,7 +66,7 @@ class ShellWindowLauncherItemController : public LauncherItemController, virtual void ItemSelected(const ui::Event& eent) OVERRIDE; virtual base::string16 GetTitle() OVERRIDE; virtual ui::MenuModel* CreateContextMenu( - aura::RootWindow* root_window) OVERRIDE; + aura::Window* root_window) OVERRIDE; virtual ash::LauncherMenuModel* CreateApplicationMenu( int event_flags) OVERRIDE; virtual bool IsDraggable() OVERRIDE; diff --git a/chrome/browser/ui/ash/screenshot_taker.cc b/chrome/browser/ui/ash/screenshot_taker.cc index b7517f2..adaee4e 100644 --- a/chrome/browser/ui/ash/screenshot_taker.cc +++ b/chrome/browser/ui/ash/screenshot_taker.cc @@ -343,11 +343,11 @@ void ScreenshotTaker::HandleTakeScreenshotForAllRootWindows() { ash::Shell::RootWindowList root_windows = ash::Shell::GetAllRootWindows(); // Reorder root_windows to take the primary root window's snapshot at first. - aura::RootWindow* primary_root = ash::Shell::GetPrimaryRootWindow(); + aura::Window* primary_root = ash::Shell::GetPrimaryRootWindow(); if (*(root_windows.begin()) != primary_root) { root_windows.erase(std::find( root_windows.begin(), root_windows.end(), primary_root)); - root_windows.insert(root_windows.begin(), primary_root); + root_windows.insert(root_windows.begin(), primary_root->GetDispatcher()); } for (size_t i = 0; i < root_windows.size(); ++i) { aura::RootWindow* root_window = root_windows[i]; diff --git a/chrome/browser/ui/aura/tabs/dock_info_aurax11.cc b/chrome/browser/ui/aura/tabs/dock_info_aurax11.cc index 274f5c2..2a089b8 100644 --- a/chrome/browser/ui/aura/tabs/dock_info_aurax11.cc +++ b/chrome/browser/ui/aura/tabs/dock_info_aurax11.cc @@ -27,7 +27,7 @@ class BaseWindowFinder : public ui::EnumerateWindowsDelegate { explicit BaseWindowFinder(const std::set<aura::Window*>& ignore) { std::set<aura::Window*>::iterator iter; for (iter = ignore.begin(); iter != ignore.end(); iter++) { - XID xid = (*iter)->GetRootWindow()->GetAcceleratedWidget(); + XID xid = (*iter)->GetDispatcher()->GetAcceleratedWidget(); ignore_.insert(xid); } } diff --git a/chrome/browser/ui/libgtk2ui/select_file_dialog_impl_gtk2.cc b/chrome/browser/ui/libgtk2ui/select_file_dialog_impl_gtk2.cc index 3626255..77863f1 100644 --- a/chrome/browser/ui/libgtk2ui/select_file_dialog_impl_gtk2.cc +++ b/chrome/browser/ui/libgtk2ui/select_file_dialog_impl_gtk2.cc @@ -42,7 +42,7 @@ void SetGtkTransientForAura(GtkWidget* dialog, aura::Window* parent) { // display server ever happens. Otherwise, this will crash. XSetTransientForHint(GDK_WINDOW_XDISPLAY(gdk_window), GDK_WINDOW_XID(gdk_window), - parent->GetRootWindow()->GetAcceleratedWidget()); + parent->GetDispatcher()->GetAcceleratedWidget()); // We also set the |parent| as a property of |dialog|, so that we can unlink // the two later. diff --git a/chrome/browser/ui/views/apps/native_app_window_views.cc b/chrome/browser/ui/views/apps/native_app_window_views.cc index 215eae9..d5d39fd 100644 --- a/chrome/browser/ui/views/apps/native_app_window_views.cc +++ b/chrome/browser/ui/views/apps/native_app_window_views.cc @@ -49,7 +49,6 @@ #include "chrome/browser/ui/ash/ash_util.h" #include "ui/aura/client/aura_constants.h" #include "ui/aura/client/window_tree_client.h" -#include "ui/aura/root_window.h" #include "ui/aura/window.h" #endif @@ -268,7 +267,7 @@ void NativeAppWindowViews::InitializePanelWindow( #if defined(USE_ASH) if (ash::Shell::HasInstance()) { // Open a new panel on the target root. - aura::RootWindow* target = ash::Shell::GetTargetRootWindow(); + aura::Window* target = ash::Shell::GetTargetRootWindow(); params.bounds = ash::ScreenAsh::ConvertRectToScreen( target, gfx::Rect(preferred_size_)); } else { diff --git a/chrome/browser/ui/views/ash/tab_scrubber_browsertest.cc b/chrome/browser/ui/views/ash/tab_scrubber_browsertest.cc index 32fabba..46862e6 100644 --- a/chrome/browser/ui/views/ash/tab_scrubber_browsertest.cc +++ b/chrome/browser/ui/views/ash/tab_scrubber_browsertest.cc @@ -80,7 +80,7 @@ class TabScrubberTest : public InProcessBrowserTest, // fling events. void SendScrubEvent(Browser* browser, int index) { aura::Window* window = browser->window()->GetNativeWindow(); - aura::RootWindow* root = window->GetRootWindow(); + aura::Window* root = window->GetRootWindow(); aura::test::EventGenerator event_generator(root, window); int active_index = browser->tab_strip_model()->active_index(); TabScrubber::Direction direction = index < active_index ? @@ -107,7 +107,7 @@ class TabScrubberTest : public InProcessBrowserTest, // active. void Scrub(Browser* browser, int index, ScrubType scrub_type) { aura::Window* window = browser->window()->GetNativeWindow(); - aura::RootWindow* root = window->GetRootWindow(); + aura::Window* root = window->GetRootWindow(); aura::test::EventGenerator event_generator(root, window); event_generator.set_async(true); activation_order_.clear(); @@ -150,7 +150,7 @@ class TabScrubberTest : public InProcessBrowserTest, // synchronously (as we don't have anything to wait for). void SendScrubSequence(Browser* browser, int x_offset, int index) { aura::Window* window = browser->window()->GetNativeWindow(); - aura::RootWindow* root = window->GetRootWindow(); + aura::Window* root = window->GetRootWindow(); aura::test::EventGenerator event_generator(root, window); bool wait_for_active = false; if (index != browser->tab_strip_model()->active_index()) { diff --git a/chrome/browser/ui/views/certificate_viewer_win.cc b/chrome/browser/ui/views/certificate_viewer_win.cc index 21948ae..fa34539 100644 --- a/chrome/browser/ui/views/certificate_viewer_win.cc +++ b/chrome/browser/ui/views/certificate_viewer_win.cc @@ -56,7 +56,7 @@ void ShowCertificateViewer(content::WebContents* web_contents, if (chrome::GetHostDesktopTypeForNativeWindow(parent) != chrome::HOST_DESKTOP_TYPE_ASH) { ShowCertificateViewerImpl( - web_contents, parent->GetRootWindow()->GetAcceleratedWidget(), cert); + web_contents, parent->GetDispatcher()->GetAcceleratedWidget(), cert); } else { NOTIMPLEMENTED(); } diff --git a/chrome/browser/ui/views/desktop_media_picker_views.cc b/chrome/browser/ui/views/desktop_media_picker_views.cc index 4155e5b..1ed67e3 100644 --- a/chrome/browser/ui/views/desktop_media_picker_views.cc +++ b/chrome/browser/ui/views/desktop_media_picker_views.cc @@ -489,7 +489,7 @@ DesktopMediaPickerDialogView::DesktopMediaPickerDialogView( views::HWNDForWidget(GetWidget())); #elif defined(USE_AURA) dialog_window_id = static_cast<content::DesktopMediaID::Id>( - GetWidget()->GetNativeWindow()->GetRootWindow()->GetAcceleratedWidget()); + GetWidget()->GetNativeWindow()->GetDispatcher()->GetAcceleratedWidget()); #else dialog_window_id = 0; NOTIMPLEMENTED(); diff --git a/chrome/browser/ui/views/frame/app_non_client_frame_view_ash_browsertest.cc b/chrome/browser/ui/views/frame/app_non_client_frame_view_ash_browsertest.cc index dcf54e8..d9aab04 100644 --- a/chrome/browser/ui/views/frame/app_non_client_frame_view_ash_browsertest.cc +++ b/chrome/browser/ui/views/frame/app_non_client_frame_view_ash_browsertest.cc @@ -78,7 +78,7 @@ class AppNonClientFrameViewAshTest : public InProcessBrowserTest { return browser_frame->GetFrameView()->GetClassName(); } - aura::RootWindow* GetRootWindow() const { + aura::Window* GetRootWindow() const { BrowserView* browser_view = static_cast<BrowserView*>(app_browser_->window()); views::Widget* widget = browser_view->GetWidget(); @@ -137,7 +137,7 @@ IN_PROC_BROWSER_TEST_F(AppNonClientFrameViewAshTest, SwitchFrames) { // Ensure that we can click the close button when the controls are shown. // In particular make sure that we can click it on the top pixel of the button. IN_PROC_BROWSER_TEST_F(AppNonClientFrameViewAshTest, ClickClose) { - aura::RootWindow* root_window = GetRootWindow(); + aura::Window* root_window = GetRootWindow(); aura::test::EventGenerator eg(root_window, gfx::Point(0, 1)); // Click close button. @@ -154,7 +154,7 @@ IN_PROC_BROWSER_TEST_F(AppNonClientFrameViewAshTest, ClickClose) { // Ensure that closing a maximized app with Ctrl-W does not crash the // application. crbug.com/147635 IN_PROC_BROWSER_TEST_F(AppNonClientFrameViewAshTest, KeyboardClose) { - aura::RootWindow* root_window = GetRootWindow(); + aura::Window* root_window = GetRootWindow(); aura::test::EventGenerator eg(root_window); // Base browser and app browser. @@ -176,7 +176,7 @@ IN_PROC_BROWSER_TEST_F(AppNonClientFrameViewAshTest, KeyboardClose) { // Ensure that snapping left with Alt-[ closes the control window. IN_PROC_BROWSER_TEST_F(AppNonClientFrameViewAshTest, SnapLeftClosesControls) { - aura::RootWindow* root_window = GetRootWindow(); + aura::Window* root_window = GetRootWindow(); aura::test::EventGenerator eg(root_window); aura::Window* native_window = app_browser()->window()->GetNativeWindow(); @@ -196,7 +196,7 @@ IN_PROC_BROWSER_TEST_F(AppNonClientFrameViewAshTest, SnapLeftClosesControls) { // Ensure that the controls are at the proper locations. IN_PROC_BROWSER_TEST_F(AppNonClientFrameViewAshTest, ControlsAtRightSide) { - aura::RootWindow* root_window = GetRootWindow(); + aura::Window* root_window = GetRootWindow(); aura::test::EventGenerator eg(root_window); aura::Window* native_window = app_browser()->window()->GetNativeWindow(); const gfx::Rect work_area = diff --git a/chrome/browser/ui/views/tab_contents/chrome_web_contents_view_delegate_views.cc b/chrome/browser/ui/views/tab_contents/chrome_web_contents_view_delegate_views.cc index 04dc7b8..47a0ebd 100644 --- a/chrome/browser/ui/views/tab_contents/chrome_web_contents_view_delegate_views.cc +++ b/chrome/browser/ui/views/tab_contents/chrome_web_contents_view_delegate_views.cc @@ -24,7 +24,6 @@ #if defined(USE_AURA) #include "chrome/browser/ui/aura/tab_contents/web_drag_bookmark_handler_aura.h" #include "ui/aura/client/screen_position_client.h" -#include "ui/aura/root_window.h" #include "ui/aura/window.h" #else #include "chrome/browser/ui/views/tab_contents/web_drag_bookmark_handler_win.h" @@ -150,7 +149,7 @@ void ChromeWebContentsViewDelegateViews::ShowContextMenu( // Convert from content coordinates to window coordinates. aura::Window* web_contents_window = web_contents_->GetView()->GetNativeView(); - aura::RootWindow* root_window = web_contents_window->GetRootWindow(); + aura::Window* root_window = web_contents_window->GetRootWindow(); aura::client::ScreenPositionClient* screen_position_client = aura::client::GetScreenPositionClient(root_window); if (screen_position_client) { diff --git a/chrome/browser/ui/views/tabs/dock_info_win.cc b/chrome/browser/ui/views/tabs/dock_info_win.cc index 07325b7..ad8abc8 100644 --- a/chrome/browser/ui/views/tabs/dock_info_win.cc +++ b/chrome/browser/ui/views/tabs/dock_info_win.cc @@ -304,7 +304,7 @@ std::set<HWND> RemapIgnoreSet(const std::set<gfx::NativeView>& ignore) { std::set<HWND> hwnd_set; std::set<gfx::NativeView>::const_iterator it = ignore.begin(); for (; it != ignore.end(); ++it) { - HWND w = (*it)->GetRootWindow()->GetAcceleratedWidget(); + HWND w = (*it)->GetDispatcher()->GetAcceleratedWidget(); if (w) hwnd_set.insert(w); } diff --git a/chrome/browser/ui/views/tabs/tab_drag_controller_interactive_uitest.cc b/chrome/browser/ui/views/tabs/tab_drag_controller_interactive_uitest.cc index 2be43e7..f8b89b0 100644 --- a/chrome/browser/ui/views/tabs/tab_drag_controller_interactive_uitest.cc +++ b/chrome/browser/ui/views/tabs/tab_drag_controller_interactive_uitest.cc @@ -223,14 +223,14 @@ bool GetTrackedByWorkspace(Browser* browser) { #if defined(USE_ASH) && !defined(OS_WIN) // TODO(win_ash) class ScreenEventGeneratorDelegate : public aura::test::EventGeneratorDelegate { public: - explicit ScreenEventGeneratorDelegate(aura::RootWindow* root_window) + explicit ScreenEventGeneratorDelegate(aura::Window* root_window) : root_window_(root_window) {} virtual ~ScreenEventGeneratorDelegate() {} // EventGeneratorDelegate overrides: virtual aura::RootWindow* GetRootWindowAt( const gfx::Point& point) const OVERRIDE { - return root_window_; + return root_window_->GetDispatcher(); } virtual aura::client::ScreenPositionClient* GetScreenPositionClient( @@ -239,7 +239,7 @@ class ScreenEventGeneratorDelegate : public aura::test::EventGeneratorDelegate { } private: - aura::RootWindow* root_window_; + aura::Window* root_window_; DISALLOW_COPY_AND_ASSIGN(ScreenEventGeneratorDelegate); }; diff --git a/chrome/browser/ui/window_sizer/window_sizer_ash_unittest.cc b/chrome/browser/ui/window_sizer/window_sizer_ash_unittest.cc index 7a37701..ebad0cb 100644 --- a/chrome/browser/ui/window_sizer/window_sizer_ash_unittest.cc +++ b/chrome/browser/ui/window_sizer/window_sizer_ash_unittest.cc @@ -46,7 +46,7 @@ class TestBrowserWindowAura : public TestBrowserWindow { native_window_->Hide(); } virtual void Activate() OVERRIDE { - GetActivationClient( + aura::client::GetActivationClient( native_window_->GetRootWindow())->ActivateWindow(native_window_.get()); } virtual gfx::NativeWindow GetNativeWindow() OVERRIDE { diff --git a/chrome/test/base/interactive_test_utils_win.cc b/chrome/test/base/interactive_test_utils_win.cc index 345d48b..7a4f747 100644 --- a/chrome/test/base/interactive_test_utils_win.cc +++ b/chrome/test/base/interactive_test_utils_win.cc @@ -29,7 +29,7 @@ void HideNativeWindow(gfx::NativeWindow window) { HideNativeWindowAura(window); return; } - HWND hwnd = window->GetRootWindow()->GetAcceleratedWidget(); + HWND hwnd = window->GetDispatcher()->GetAcceleratedWidget(); #else HWND hwnd = window; #endif @@ -43,7 +43,7 @@ bool ShowAndFocusNativeWindow(gfx::NativeWindow window) { ShowAndFocusNativeWindowAura(window); window->Show(); // Always make sure the window hosting ash is visible and focused. - HWND hwnd = window->GetRootWindow()->GetAcceleratedWidget(); + HWND hwnd = window->GetDispatcher()->GetAcceleratedWidget(); #else HWND hwnd = window; #endif diff --git a/content/browser/renderer_host/render_widget_host_view_aura.cc b/content/browser/renderer_host/render_widget_host_view_aura.cc index fab01ac..3ad459b 100644 --- a/content/browser/renderer_host/render_widget_host_view_aura.cc +++ b/content/browser/renderer_host/render_widget_host_view_aura.cc @@ -144,7 +144,7 @@ BOOL CALLBACK ShowWindowsCallback(HWND window, LPARAM param) { if (GetProp(window, kWidgetOwnerProperty) == widget) { HWND parent = - widget->GetNativeView()->GetRootWindow()->GetAcceleratedWidget(); + widget->GetNativeView()->GetDispatcher()->GetAcceleratedWidget(); SetParent(window, parent); } return TRUE; @@ -166,7 +166,7 @@ BOOL CALLBACK SetCutoutRectsCallback(HWND window, LPARAM param) { if (GetProp(window, kWidgetOwnerProperty) == params->widget) { // First calculate the offset of this plugin from the root window, since // the cutouts are relative to the root window. - HWND parent = params->widget->GetNativeView()->GetRootWindow()-> + HWND parent = params->widget->GetNativeView()->GetDispatcher()-> GetAcceleratedWidget(); POINT offset; offset.x = offset.y = 0; @@ -369,13 +369,13 @@ class RenderWidgetHostViewAura::EventFilterForPopupExit : explicit EventFilterForPopupExit(RenderWidgetHostViewAura* rwhva) : rwhva_(rwhva) { DCHECK(rwhva_); - aura::RootWindow* root_window = rwhva_->window_->GetRootWindow(); + aura::Window* root_window = rwhva_->window_->GetRootWindow(); DCHECK(root_window); root_window->AddPreTargetHandler(this); } virtual ~EventFilterForPopupExit() { - aura::RootWindow* root_window = rwhva_->window_->GetRootWindow(); + aura::Window* root_window = rwhva_->window_->GetRootWindow(); DCHECK(root_window); root_window->RemovePreTargetHandler(this); } @@ -504,7 +504,7 @@ class RenderWidgetHostViewAura::TransientWindowObserver } aura::Window* GetToplevelWindow() { - aura::RootWindow* root = view_->window_->GetRootWindow(); + aura::Window* root = view_->window_->GetRootWindow(); if (!root) return NULL; aura::client::ActivationClient* activation_client = @@ -619,7 +619,7 @@ void RenderWidgetHostViewAura::InitAsPopup( window_->Init(ui::LAYER_TEXTURED); window_->SetName("RenderWidgetHostViewAura"); - aura::RootWindow* root = popup_parent_host_view_->window_->GetRootWindow(); + aura::Window* root = popup_parent_host_view_->window_->GetRootWindow(); aura::client::ParentWindowWithContext(window_, root, bounds_in_screen); // TODO(erg): While I could make sure details of the WindowTreeClient are @@ -644,7 +644,7 @@ void RenderWidgetHostViewAura::InitAsFullscreen( window_->SetName("RenderWidgetHostViewAura"); window_->SetProperty(aura::client::kShowStateKey, ui::SHOW_STATE_FULLSCREEN); - aura::RootWindow* parent = NULL; + aura::Window* parent = NULL; gfx::Rect bounds; if (reference_host_view) { aura::Window* reference_window = @@ -674,7 +674,7 @@ void RenderWidgetHostViewAura::WasShown() { host_->WasShown(); software_frame_manager_->SetVisibility(true); - aura::RootWindow* root = window_->GetRootWindow(); + aura::Window* root = window_->GetRootWindow(); if (root) { aura::client::CursorClient* cursor_client = aura::client::GetCursorClient(root); @@ -704,9 +704,9 @@ void RenderWidgetHostViewAura::WasHidden() { released_front_lock_ = NULL; #if defined(OS_WIN) - aura::RootWindow* root_window = window_->GetRootWindow(); - if (root_window) { - HWND parent = root_window->GetAcceleratedWidget(); + aura::WindowEventDispatcher* dispatcher = window_->GetDispatcher(); + if (dispatcher) { + HWND parent = dispatcher->GetAcceleratedWidget(); LPARAM lparam = reinterpret_cast<LPARAM>(this); EnumChildWindows(parent, HideWindowsCallback, lparam); @@ -734,11 +734,11 @@ void RenderWidgetHostViewAura::SetBounds(const gfx::Rect& rect) { void RenderWidgetHostViewAura::MaybeCreateResizeLock() { if (!ShouldCreateResizeLock()) return; - DCHECK(window_->GetRootWindow()); - DCHECK(window_->GetRootWindow()->compositor()); + DCHECK(window_->GetDispatcher()); + DCHECK(window_->GetDispatcher()->compositor()); // Listen to changes in the compositor lock state. - ui::Compositor* compositor = window_->GetRootWindow()->compositor(); + ui::Compositor* compositor = window_->GetDispatcher()->compositor(); if (!compositor->HasObserver(this)) compositor->AddObserver(this); @@ -776,11 +776,11 @@ bool RenderWidgetHostViewAura::ShouldCreateResizeLock() { if (desired_size == current_frame_size_) return false; - aura::RootWindow* root_window = window_->GetRootWindow(); - if (!root_window) + aura::WindowEventDispatcher* dispatcher = window_->GetDispatcher(); + if (!dispatcher) return false; - ui::Compositor* compositor = root_window->compositor(); + ui::Compositor* compositor = dispatcher->compositor(); if (!compositor) return false; @@ -791,7 +791,7 @@ scoped_ptr<ResizeLock> RenderWidgetHostViewAura::CreateResizeLock( bool defer_compositor_lock) { gfx::Size desired_size = window_->bounds().size(); return scoped_ptr<ResizeLock>(new CompositorResizeLock( - window_->GetRootWindow(), + window_->GetDispatcher(), desired_size, defer_compositor_lock, base::TimeDelta::FromMilliseconds(kResizeLockTimeoutMs))); @@ -803,9 +803,9 @@ gfx::NativeView RenderWidgetHostViewAura::GetNativeView() const { gfx::NativeViewId RenderWidgetHostViewAura::GetNativeViewId() const { #if defined(OS_WIN) - aura::RootWindow* root_window = window_->GetRootWindow(); - if (root_window) { - HWND window = root_window->GetAcceleratedWidget(); + aura::WindowEventDispatcher* dispatcher = window_->GetDispatcher(); + if (dispatcher) { + HWND window = dispatcher->GetAcceleratedWidget(); return reinterpret_cast<gfx::NativeViewId>(window); } #endif @@ -814,10 +814,10 @@ gfx::NativeViewId RenderWidgetHostViewAura::GetNativeViewId() const { gfx::NativeViewAccessible RenderWidgetHostViewAura::GetNativeViewAccessible() { #if defined(OS_WIN) - aura::RootWindow* root_window = window_->GetRootWindow(); - if (!root_window) + aura::WindowEventDispatcher* dispatcher = window_->GetDispatcher(); + if (!dispatcher) return static_cast<gfx::NativeViewAccessible>(NULL); - HWND hwnd = root_window->GetAcceleratedWidget(); + HWND hwnd = dispatcher->GetAcceleratedWidget(); BrowserAccessibilityManager* manager = GetOrCreateBrowserAccessibilityManager(); @@ -836,10 +836,10 @@ RenderWidgetHostViewAura::GetOrCreateBrowserAccessibilityManager() { return manager; #if defined(OS_WIN) - aura::RootWindow* root_window = window_->GetRootWindow(); - if (!root_window) + aura::WindowEventDispatcher* dispatcher = window_->GetDispatcher(); + if (!dispatcher) return NULL; - HWND hwnd = root_window->GetAcceleratedWidget(); + HWND hwnd = dispatcher->GetAcceleratedWidget(); // The accessible_parent may be NULL at this point. The WebContents will pass // it down to this instance (by way of the RenderViewHost and @@ -870,7 +870,7 @@ void RenderWidgetHostViewAura::MovePluginWindows( DCHECK(plugin_window_moves.empty()); return; } - HWND parent = window_->GetRootWindow()->GetAcceleratedWidget(); + HWND parent = window_->GetDispatcher()->GetAcceleratedWidget(); gfx::Rect view_bounds = window_->GetBoundsInRootWindow(); std::vector<WebPluginGeometry> moves = plugin_window_moves; @@ -1045,7 +1045,7 @@ void RenderWidgetHostViewAura::DidUpdateBackingStore( SchedulePaintIfNotInClip(scroll_rect, clip_rect); #if defined(OS_WIN) - aura::RootWindow* root_window = window_->GetRootWindow(); + aura::WindowEventDispatcher* dispatcher = window_->GetDispatcher(); #endif for (size_t i = 0; i < copy_rects.size(); ++i) { gfx::Rect rect = gfx::SubtractRects(copy_rects[i], scroll_rect); @@ -1055,12 +1055,12 @@ void RenderWidgetHostViewAura::DidUpdateBackingStore( SchedulePaintIfNotInClip(rect, clip_rect); #if defined(OS_WIN) - if (root_window) { + if (dispatcher) { // Send the invalid rect in screen coordinates. gfx::Rect screen_rect = GetViewBounds(); gfx::Rect invalid_screen_rect(rect); invalid_screen_rect.Offset(screen_rect.x(), screen_rect.y()); - HWND hwnd = root_window->GetAcceleratedWidget(); + HWND hwnd = dispatcher->GetAcceleratedWidget(); PaintPluginWindowsHelper(hwnd, invalid_screen_rect); } #endif // defined(OS_WIN) @@ -1083,7 +1083,7 @@ void RenderWidgetHostViewAura::Destroy() { void RenderWidgetHostViewAura::SetTooltipText(const string16& tooltip_text) { tooltip_ = tooltip_text; - aura::RootWindow* root_window = window_->GetRootWindow(); + aura::Window* root_window = window_->GetRootWindow(); aura::client::TooltipClient* tooltip_client = aura::client::GetTooltipClient(root_window); if (tooltip_client) { @@ -1129,7 +1129,7 @@ void RenderWidgetHostViewAura::SelectionBoundsChanged( } void RenderWidgetHostViewAura::ScrollOffsetChanged() { - aura::RootWindow* root = window_->GetRootWindow(); + aura::Window* root = window_->GetRootWindow(); if (!root) return; aura::client::CursorClient* cursor_client = @@ -1363,7 +1363,7 @@ void RenderWidgetHostViewAura::UpdateConstrainedWindowRects( void RenderWidgetHostViewAura::UpdateCutoutRects() { if (!window_->GetRootWindow()) return; - HWND parent = window_->GetRootWindow()->GetAcceleratedWidget(); + HWND parent = window_->GetDispatcher()->GetAcceleratedWidget(); CutoutRectsParams params; params.widget = this; params.cutout_rects.assign(transient_rects_.begin(), transient_rects_.end()); @@ -2060,10 +2060,10 @@ gfx::Rect RenderWidgetHostViewAura::GetBoundsInRootWindow() { RECT window_rect = {0}; aura::Window* top_level = window_->GetToplevelWindow(); - aura::RootWindow* root_window = top_level->GetRootWindow(); - if (!root_window) + aura::WindowEventDispatcher* dispatcher = top_level->GetDispatcher(); + if (!dispatcher) return top_level->GetBoundsInScreen(); - HWND hwnd = root_window->GetAcceleratedWidget(); + HWND hwnd = dispatcher->GetAcceleratedWidget(); ::GetWindowRect(hwnd, &window_rect); gfx::Rect rect(window_rect); @@ -2095,16 +2095,16 @@ void RenderWidgetHostViewAura::ProcessAckedTouchEvent( SCREEN_COORDINATES)) return; - aura::RootWindow* root = window_->GetRootWindow(); - // |root| is NULL during tests. - if (!root) + aura::WindowEventDispatcher* dispatcher = window_->GetDispatcher(); + // |dispatcher| is NULL during tests. + if (!dispatcher) return; ui::EventResult result = (ack_result == INPUT_EVENT_ACK_STATE_CONSUMED) ? ui::ER_HANDLED : ui::ER_UNHANDLED; for (ScopedVector<ui::TouchEvent>::iterator iter = events.begin(), end = events.end(); iter != end; ++iter) { - root->ProcessedTouchEvent((*iter), window_, result); + dispatcher->ProcessedTouchEvent((*iter), window_, result); } } @@ -2149,7 +2149,7 @@ gfx::GLSurfaceHandle RenderWidgetHostViewAura::GetCompositingSurface() { } bool RenderWidgetHostViewAura::LockMouse() { - aura::RootWindow* root_window = window_->GetRootWindow(); + aura::Window* root_window = window_->GetRootWindow(); if (!root_window) return false; @@ -2177,7 +2177,7 @@ bool RenderWidgetHostViewAura::LockMouse() { } void RenderWidgetHostViewAura::UnlockMouse() { - aura::RootWindow* root_window = window_->GetRootWindow(); + aura::Window* root_window = window_->GetRootWindow(); if (!mouse_locked_ || !root_window) return; @@ -2286,7 +2286,7 @@ gfx::Rect RenderWidgetHostViewAura::ConvertRectToScreen( gfx::Point origin = rect.origin(); gfx::Point end = gfx::Point(rect.right(), rect.bottom()); - aura::RootWindow* root_window = window_->GetRootWindow(); + aura::Window* root_window = window_->GetRootWindow(); if (!root_window) return rect; aura::client::ScreenPositionClient* screen_position_client = @@ -2306,7 +2306,7 @@ gfx::Rect RenderWidgetHostViewAura::ConvertRectFromScreen( gfx::Point origin = rect.origin(); gfx::Point end = gfx::Point(rect.right(), rect.bottom()); - aura::RootWindow* root_window = window_->GetRootWindow(); + aura::Window* root_window = window_->GetRootWindow(); if (root_window) { aura::client::ScreenPositionClient* screen_position_client = aura::client::GetScreenPositionClient(root_window); @@ -2552,7 +2552,7 @@ void RenderWidgetHostViewAura::OnWindowDestroying() { if (!window_->GetRootWindow() || host_->is_hidden()) { parent = ui::GetHiddenWindow(); } else { - parent = window_->GetRootWindow()->GetAcceleratedWidget(); + parent = window_->GetDispatcher()->GetAcceleratedWidget(); } LPARAM lparam = reinterpret_cast<LPARAM>(this); EnumChildWindows(parent, WindowDestroyingCallback, lparam); @@ -2756,9 +2756,9 @@ void RenderWidgetHostViewAura::OnMouseEvent(ui::MouseEvent* event) { // We get mouse wheel/scroll messages even if we are not in the foreground. // So here we check if we have any owned popup windows in the foreground and // dismiss them. - aura::RootWindow* root_window = window_->GetRootWindow(); - if (root_window) { - HWND parent = root_window->GetAcceleratedWidget(); + aura::WindowEventDispatcher* dispatcher = window_->GetDispatcher(); + if (dispatcher) { + HWND parent = dispatcher->GetAcceleratedWidget(); HWND toplevel_hwnd = ::GetAncestor(parent, GA_ROOT); EnumThreadWindows(GetCurrentThreadId(), DismissOwnedPopups, @@ -2913,10 +2913,10 @@ void RenderWidgetHostViewAura::OnGestureEvent(ui::GestureEvent* event) { // RenderWidgetHostViewAura, aura::client::ActivationDelegate implementation: bool RenderWidgetHostViewAura::ShouldActivate() const { - aura::RootWindow* root_window = window_->GetRootWindow(); - if (!root_window) + aura::WindowEventDispatcher* dispatcher = window_->GetDispatcher(); + if (!dispatcher) return true; - const ui::Event* event = root_window->current_event(); + const ui::Event* event = dispatcher->current_event(); if (!event) return true; return is_fullscreen_; @@ -2930,7 +2930,7 @@ void RenderWidgetHostViewAura::OnWindowActivated(aura::Window* gained_active, aura::Window* lost_active) { DCHECK(window_ == gained_active || window_ == lost_active); if (window_ == gained_active) { - const ui::Event* event = window_->GetRootWindow()->current_event(); + const ui::Event* event = window_->GetDispatcher()->current_event(); if (event && PointerEventActivates(*event)) host_->OnPointerEventActivate(); } @@ -3175,8 +3175,8 @@ RenderWidgetHostViewAura::~RenderWidgetHostViewAura() { #if defined(OS_WIN) transient_observer_.reset(); #endif - if (window_->GetRootWindow()) - window_->GetRootWindow()->RemoveRootWindowObserver(this); + if (window_->GetDispatcher()) + window_->GetDispatcher()->RemoveRootWindowObserver(this); UnlockMouse(); if (popup_type_ != WebKit::WebPopupTypeNone && popup_parent_host_view_) { DCHECK(popup_parent_host_view_->popup_child_host_view_ == NULL || @@ -3203,7 +3203,7 @@ RenderWidgetHostViewAura::~RenderWidgetHostViewAura() { void RenderWidgetHostViewAura::UpdateCursorIfOverSelf() { const gfx::Point screen_point = gfx::Screen::GetScreenFor(GetNativeView())->GetCursorScreenPoint(); - aura::RootWindow* root_window = window_->GetRootWindow(); + aura::Window* root_window = window_->GetRootWindow(); if (!root_window) return; @@ -3215,7 +3215,8 @@ void RenderWidgetHostViewAura::UpdateCursorIfOverSelf() { // If there's another toplevel window above us at this point (for example a // menu), we don't want to update the cursor. POINT windows_point = { screen_point.x(), screen_point.y() }; - if (root_window->GetAcceleratedWidget() != ::WindowFromPoint(windows_point)) + aura::WindowEventDispatcher* dispatcher = root_window->GetDispatcher(); + if (dispatcher->GetAcceleratedWidget() != ::WindowFromPoint(windows_point)) return; #endif if (root_window->GetEventHandlerForPoint(local_point) != window_) @@ -3234,7 +3235,7 @@ void RenderWidgetHostViewAura::UpdateCursorIfOverSelf() { } ui::InputMethod* RenderWidgetHostViewAura::GetInputMethod() const { - aura::RootWindow* root_window = window_->GetRootWindow(); + aura::Window* root_window = window_->GetRootWindow(); if (!root_window) return NULL; return root_window->GetProperty(aura::client::kRootWindowInputMethodKey); @@ -3343,7 +3344,7 @@ void RenderWidgetHostViewAura::AddOnCommitCallbackAndDisableLocks( } void RenderWidgetHostViewAura::AddedToRootWindow() { - window_->GetRootWindow()->AddRootWindowObserver(this); + window_->GetDispatcher()->AddRootWindowObserver(this); host_->ParentChanged(GetNativeViewId()); UpdateScreenInfo(window_); if (popup_type_ != WebKit::WebPopupTypeNone) @@ -3366,7 +3367,7 @@ void RenderWidgetHostViewAura::RemovingFromRootWindow() { cursor_client->RemoveObserver(this); event_filter_for_popup_exit_.reset(); - window_->GetRootWindow()->RemoveRootWindowObserver(this); + window_->GetDispatcher()->RemoveRootWindowObserver(this); host_->ParentChanged(0); ui::Compositor* compositor = GetCompositor(); if (current_surface_.get()) { @@ -3385,8 +3386,8 @@ void RenderWidgetHostViewAura::RemovingFromRootWindow() { } ui::Compositor* RenderWidgetHostViewAura::GetCompositor() const { - aura::RootWindow* root_window = window_->GetRootWindow(); - return root_window ? root_window->compositor() : NULL; + aura::WindowEventDispatcher* dispatcher = window_->GetDispatcher(); + return dispatcher ? dispatcher->compositor() : NULL; } void RenderWidgetHostViewAura::DetachFromInputMethod() { diff --git a/content/browser/renderer_host/render_widget_host_view_aura_unittest.cc b/content/browser/renderer_host/render_widget_host_view_aura_unittest.cc index df3bd29..d96f25f 100644 --- a/content/browser/renderer_host/render_widget_host_view_aura_unittest.cc +++ b/content/browser/renderer_host/render_widget_host_view_aura_unittest.cc @@ -44,6 +44,7 @@ using testing::_; namespace content { namespace { + class MockRenderWidgetHostDelegate : public RenderWidgetHostDelegate { public: MockRenderWidgetHostDelegate() {} @@ -101,7 +102,7 @@ class FakeRenderWidgetHostViewAura : public RenderWidgetHostViewAura { } void RunOnCompositingDidCommit() { - OnCompositingDidCommit(window()->GetRootWindow()->compositor()); + OnCompositingDidCommit(window()->GetDispatcher()->compositor()); } // A lock that doesn't actually do anything to the compositor, and does not diff --git a/content/browser/renderer_host/touch_smooth_scroll_gesture_aura.cc b/content/browser/renderer_host/touch_smooth_scroll_gesture_aura.cc index 5df932d..659cd99 100644 --- a/content/browser/renderer_host/touch_smooth_scroll_gesture_aura.cc +++ b/content/browser/renderer_host/touch_smooth_scroll_gesture_aura.cc @@ -16,16 +16,15 @@ void InjectTouchEvent(const gfx::Point& location, ui::EventType type, aura::Window* window) { gfx::Point screen_location = location; + aura::Window* root_window = window->GetRootWindow(); // First convert the location from Window to RootWindow. - aura::RootWindow* root_window = window->GetRootWindow(); aura::Window::ConvertPointToTarget(window, root_window, &screen_location); // Then convert the location from RootWindow to screen. - root_window->ConvertPointToHost(&screen_location); + aura::WindowEventDispatcher* dispatcher = root_window->GetDispatcher(); + dispatcher->ConvertPointToHost(&screen_location); ui::TouchEvent touch(type, screen_location, 0, 0, ui::EventTimeForNow(), 1.0f, 1.0f, 1.0f, 1.0f); - aura::RootWindowHostDelegate* root_window_host_delegate = - root_window->AsRootWindowHostDelegate(); - root_window_host_delegate->OnHostTouchEvent(&touch); + dispatcher->AsRootWindowHostDelegate()->OnHostTouchEvent(&touch); } } // namespace diff --git a/content/browser/web_contents/touch_editable_impl_aura_browsertest.cc b/content/browser/web_contents/touch_editable_impl_aura_browsertest.cc index 47531e5..4290e57 100644 --- a/content/browser/web_contents/touch_editable_impl_aura_browsertest.cc +++ b/content/browser/web_contents/touch_editable_impl_aura_browsertest.cc @@ -189,7 +189,7 @@ class TouchEditableImplAuraTest : public ContentBrowserTest { NavigateToURL(shell(), test_url); aura::Window* content = shell()->web_contents()->GetView()->GetContentNativeView(); - content->GetRootWindow()->SetHostSize(gfx::Size(800, 600)); + content->GetDispatcher()->SetHostSize(gfx::Size(800, 600)); } // TODO(mohsen): Remove logs if the test showed no flakiness anymore. diff --git a/content/browser/web_contents/web_contents_view_aura.cc b/content/browser/web_contents/web_contents_view_aura.cc index db33992..bc7ee3a 100644 --- a/content/browser/web_contents/web_contents_view_aura.cc +++ b/content/browser/web_contents/web_contents_view_aura.cc @@ -659,8 +659,8 @@ class WebContentsViewAura::WindowObserver virtual ~WindowObserver() { view_->window_->RemoveObserver(this); - if (view_->window_->GetRootWindow()) - view_->window_->GetRootWindow()->RemoveRootWindowObserver(this); + if (view_->window_->GetDispatcher()) + view_->window_->GetDispatcher()->RemoveRootWindowObserver(this); if (parent_) parent_->RemoveObserver(this); } @@ -687,12 +687,12 @@ class WebContentsViewAura::WindowObserver virtual void OnWindowAddedToRootWindow(aura::Window* window) OVERRIDE { if (window != parent_) - window->GetRootWindow()->AddRootWindowObserver(this); + window->GetDispatcher()->AddRootWindowObserver(this); } virtual void OnWindowRemovingFromRootWindow(aura::Window* window) OVERRIDE { if (window != parent_) - window->GetRootWindow()->RemoveRootWindowObserver(this); + window->GetDispatcher()->RemoveRootWindowObserver(this); } // Overridden RootWindowObserver: @@ -861,7 +861,7 @@ void WebContentsViewAura::SizeChangedCommon(const gfx::Size& size) { } void WebContentsViewAura::EndDrag(WebKit::WebDragOperationsMask ops) { - aura::RootWindow* root_window = GetNativeView()->GetRootWindow(); + aura::Window* root_window = GetNativeView()->GetRootWindow(); gfx::Point screen_loc = gfx::Screen::GetScreenFor(GetNativeView())->GetCursorScreenPoint(); gfx::Point client_loc = screen_loc; @@ -1146,7 +1146,7 @@ void WebContentsViewAura::CreateView( window_->SetType(aura::client::WINDOW_TYPE_CONTROL); window_->SetTransparent(false); window_->Init(ui::LAYER_NOT_DRAWN); - aura::RootWindow* root_window = context ? context->GetRootWindow() : NULL; + aura::Window* root_window = context ? context->GetRootWindow() : NULL; if (root_window) { // There are places where there is no context currently because object // hierarchies are built before they're attached to a Widget. (See @@ -1282,7 +1282,7 @@ void WebContentsViewAura::StartDragging( const gfx::ImageSkia& image, const gfx::Vector2d& image_offset, const DragEventSourceInfo& event_info) { - aura::RootWindow* root_window = GetNativeView()->GetRootWindow(); + aura::Window* root_window = GetNativeView()->GetRootWindow(); if (!aura::client::GetDragDropClient(root_window)) { web_contents_->SystemDragEnded(); return; diff --git a/content/browser/web_contents/web_contents_view_aura_browsertest.cc b/content/browser/web_contents/web_contents_view_aura_browsertest.cc index 0ccea28..2759244 100644 --- a/content/browser/web_contents/web_contents_view_aura_browsertest.cc +++ b/content/browser/web_contents/web_contents_view_aura_browsertest.cc @@ -150,7 +150,7 @@ class WebContentsViewAuraTest : public ContentBrowserTest { NavigateToURL(shell(), test_url); aura::Window* content = shell()->web_contents()->GetView()->GetContentNativeView(); - content->GetRootWindow()->SetHostSize(gfx::Size(800, 600)); + content->GetDispatcher()->SetHostSize(gfx::Size(800, 600)); WebContentsImpl* web_contents = static_cast<WebContentsImpl*>(shell()->web_contents()); @@ -331,21 +331,21 @@ IN_PROC_BROWSER_TEST_F(WebContentsViewAuraTest, EXPECT_EQ(1, GetCurrentIndex()); aura::Window* content = web_contents->GetView()->GetContentNativeView(); - aura::RootWindow* root_window = content->GetRootWindow(); + aura::WindowEventDispatcher* dispatcher = content->GetDispatcher(); gfx::Rect bounds = content->GetBoundsInRootWindow(); base::TimeDelta timestamp; ui::TouchEvent press(ui::ET_TOUCH_PRESSED, gfx::Point(bounds.x() + bounds.width() / 2, bounds.y() + 5), 0, timestamp); - root_window->AsRootWindowHostDelegate()->OnHostTouchEvent(&press); + dispatcher->AsRootWindowHostDelegate()->OnHostTouchEvent(&press); EXPECT_EQ(1, GetCurrentIndex()); timestamp += base::TimeDelta::FromMilliseconds(10); ui::TouchEvent move1(ui::ET_TOUCH_MOVED, gfx::Point(bounds.right() - 10, bounds.y() + 5), 0, timestamp); - root_window->AsRootWindowHostDelegate()->OnHostTouchEvent(&move1); + dispatcher->AsRootWindowHostDelegate()->OnHostTouchEvent(&move1); EXPECT_EQ(1, GetCurrentIndex()); // Swipe back from the right edge, back to the left edge, back to the right @@ -356,7 +356,7 @@ IN_PROC_BROWSER_TEST_F(WebContentsViewAuraTest, ui::TouchEvent inc(ui::ET_TOUCH_MOVED, gfx::Point(x, bounds.y() + 5), 0, timestamp); - root_window->AsRootWindowHostDelegate()->OnHostTouchEvent(&inc); + dispatcher->AsRootWindowHostDelegate()->OnHostTouchEvent(&inc); EXPECT_EQ(1, GetCurrentIndex()); } @@ -365,7 +365,7 @@ IN_PROC_BROWSER_TEST_F(WebContentsViewAuraTest, ui::TouchEvent inc(ui::ET_TOUCH_MOVED, gfx::Point(x, bounds.y() + 5), 0, timestamp); - root_window->AsRootWindowHostDelegate()->OnHostTouchEvent(&inc); + dispatcher->AsRootWindowHostDelegate()->OnHostTouchEvent(&inc); EXPECT_EQ(1, GetCurrentIndex()); } @@ -374,7 +374,7 @@ IN_PROC_BROWSER_TEST_F(WebContentsViewAuraTest, ui::TouchEvent inc(ui::ET_TOUCH_MOVED, gfx::Point(x, bounds.y() + 5), 0, timestamp); - root_window->AsRootWindowHostDelegate()->OnHostTouchEvent(&inc); + dispatcher->AsRootWindowHostDelegate()->OnHostTouchEvent(&inc); EXPECT_EQ(1, GetCurrentIndex()); } diff --git a/content/shell/browser/shell_views.cc b/content/shell/browser/shell_views.cc index 7d8309a..a0f633af 100644 --- a/content/shell/browser/shell_views.cc +++ b/content/shell/browser/shell_views.cc @@ -361,7 +361,7 @@ void Shell::PlatformCreateWindow(int width, int height) { window_ = window_widget_->GetNativeWindow(); // Call ShowRootWindow on RootWindow created by MinimalShell without // which XWindow owned by RootWindow doesn't get mapped. - window_->GetRootWindow()->ShowRootWindow(); + window_->GetDispatcher()->ShowRootWindow(); window_widget_->Show(); } diff --git a/printing/printing_context_win.cc b/printing/printing_context_win.cc index 29b2604..e967b4b 100644 --- a/printing/printing_context_win.cc +++ b/printing/printing_context_win.cc @@ -55,7 +55,7 @@ HWND GetRootWindow(gfx::NativeView view) { HWND window = NULL; #if defined(USE_AURA) if (view) - window = view->GetRootWindow()->GetAcceleratedWidget(); + window = view->GetDispatcher()->GetAcceleratedWidget(); #else if (view && IsWindow(view)) { window = GetAncestor(view, GA_ROOTOWNER); diff --git a/ui/app_list/views/app_list_view.cc b/ui/app_list/views/app_list_view.cc index 5a9d79c..0f6d2df 100644 --- a/ui/app_list/views/app_list_view.cc +++ b/ui/app_list/views/app_list_view.cc @@ -168,7 +168,7 @@ HWND AppListView::GetHWND() const { #if defined(USE_AURA) gfx::NativeWindow window = GetWidget()->GetTopLevelWidget()->GetNativeWindow(); - return window->GetRootWindow()->GetAcceleratedWidget(); + return window->GetDispatcher()->GetAcceleratedWidget(); #else return GetWidget()->GetTopLevelWidget()->GetNativeWindow(); #endif diff --git a/ui/aura/client/default_capture_client.cc b/ui/aura/client/default_capture_client.cc index 648f964..6008a89 100644 --- a/ui/aura/client/default_capture_client.cc +++ b/ui/aura/client/default_capture_client.cc @@ -30,7 +30,7 @@ void DefaultCaptureClient::SetCapture(Window* window) { Window* old_capture_window = capture_window_; capture_window_ = window; - CaptureDelegate* capture_delegate = root_window_->GetRootWindow(); + CaptureDelegate* capture_delegate = root_window_->GetDispatcher(); if (capture_window_) capture_delegate->SetNativeCapture(); else diff --git a/ui/aura/client/focus_client.cc b/ui/aura/client/focus_client.cc index a9be6aa..0769b0d 100644 --- a/ui/aura/client/focus_client.cc +++ b/ui/aura/client/focus_client.cc @@ -25,7 +25,7 @@ FocusClient* GetFocusClient(Window* window) { } FocusClient* GetFocusClient(const Window* window) { - const RootWindow* root_window = window->GetRootWindow(); + const Window* root_window = window->GetRootWindow(); return root_window ? root_window->GetProperty(kRootWindowFocusClientKey) : NULL; } diff --git a/ui/aura/client/window_tree_client.cc b/ui/aura/client/window_tree_client.cc index b2ea10f..de1ece5 100644 --- a/ui/aura/client/window_tree_client.cc +++ b/ui/aura/client/window_tree_client.cc @@ -19,14 +19,14 @@ DEFINE_WINDOW_PROPERTY_KEY( void SetWindowTreeClient(Window* window, WindowTreeClient* window_tree_client) { DCHECK(window); - RootWindow* root_window = window->GetRootWindow(); + Window* root_window = window->GetRootWindow(); DCHECK(root_window); root_window->SetProperty(kRootWindowWindowTreeClientKey, window_tree_client); } WindowTreeClient* GetWindowTreeClient(Window* window) { DCHECK(window); - RootWindow* root_window = window->GetRootWindow(); + Window* root_window = window->GetRootWindow(); DCHECK(root_window); WindowTreeClient* client = root_window->GetProperty(kRootWindowWindowTreeClientKey); diff --git a/ui/aura/root_window.cc b/ui/aura/root_window.cc index 7195c2b..9c6d5ce 100644 --- a/ui/aura/root_window.cc +++ b/ui/aura/root_window.cc @@ -151,6 +151,7 @@ RootWindow::RootWindow(const CreateParams& params) event_factory_(this), held_event_factory_(this), repostable_event_factory_(this) { + set_dispatcher(this); SetName("RootWindow"); compositor_.reset(new ui::Compositor(params.use_software_renderer, @@ -184,6 +185,8 @@ RootWindow::~RootWindow() { // Destroying/removing child windows may try to access |host_| (eg. // GetAcceleratedWidget()) host_.reset(NULL); + + set_dispatcher(NULL); } // static @@ -523,11 +526,11 @@ gfx::Transform RootWindow::GetRootTransform() const { //////////////////////////////////////////////////////////////////////////////// // RootWindow, Window overrides: -RootWindow* RootWindow::GetRootWindow() { +Window* RootWindow::GetRootWindow() { return this; } -const RootWindow* RootWindow::GetRootWindow() const { +const Window* RootWindow::GetRootWindow() const { return this; } @@ -616,7 +619,7 @@ void RootWindow::OnWindowAddedToRootWindow(Window* attached) { } void RootWindow::OnWindowRemovedFromRootWindow(Window* detached, - RootWindow* new_root) { + Window* new_root) { DCHECK(aura::client::GetCaptureWindow(this) != this); DispatchMouseExitToHidingWindow(detached); @@ -940,15 +943,15 @@ void RootWindow::DispatchMouseEventRepost(ui::MouseEvent* event) { if (event->type() != ui::ET_MOUSE_PRESSED) return; Window* target = client::GetCaptureWindow(this); - RootWindow* root = this; + WindowEventDispatcher* dispatcher = this; if (!target) { target = GetEventHandlerForPoint(event->location()); } else { - root = target->GetRootWindow(); - CHECK(root); // Capture window better be in valid root. + dispatcher = target->GetDispatcher(); + CHECK(dispatcher); // Capture window better be in valid root. } - root->mouse_pressed_handler_ = NULL; - root->DispatchMouseEventToTarget(event, target); + dispatcher->mouse_pressed_handler_ = NULL; + dispatcher->DispatchMouseEventToTarget(event, target); } bool RootWindow::DispatchMouseEventToTarget(ui::MouseEvent* event, diff --git a/ui/aura/root_window.h b/ui/aura/root_window.h index 503ff9a..e716dcb 100644 --- a/ui/aura/root_window.h +++ b/ui/aura/root_window.h @@ -241,8 +241,8 @@ class AURA_EXPORT RootWindow : public Window, gfx::Transform GetRootTransform() const; // Overridden from Window: - virtual RootWindow* GetRootWindow() OVERRIDE; - virtual const RootWindow* GetRootWindow() const OVERRIDE; + virtual Window* GetRootWindow() OVERRIDE; + virtual const Window* GetRootWindow() const OVERRIDE; virtual void SetTransform(const gfx::Transform& transform) OVERRIDE; virtual bool CanFocus() const OVERRIDE; virtual bool CanReceiveEvents() const OVERRIDE; @@ -284,7 +284,7 @@ class AURA_EXPORT RootWindow : public Window, // Called when a Window is attached or detached from the RootWindow. void OnWindowAddedToRootWindow(Window* window); - void OnWindowRemovedFromRootWindow(Window* window, RootWindow* new_root); + void OnWindowRemovedFromRootWindow(Window* window, Window* new_root); // Called when a window becomes invisible, either by being removed // from root window hierarchy, via SetVisible(false) or being destroyed. diff --git a/ui/aura/root_window_unittest.cc b/ui/aura/root_window_unittest.cc index 02966e8..5819305 100644 --- a/ui/aura/root_window_unittest.cc +++ b/ui/aura/root_window_unittest.cc @@ -992,7 +992,7 @@ class RepostGestureEventRecorder : public EventFilterRecorder { EXPECT_NE(repost_target_, event->target()); reposted_ = true; events().clear(); - repost_target_->GetRootWindow()->RepostEvent(*event); + repost_target_->GetDispatcher()->RepostEvent(*event); // Ensure that the reposted gesture event above goes to the // repost_target_; repost_source_->GetRootWindow()->RemoveChild(repost_source_); diff --git a/ui/aura/test/event_generator.cc b/ui/aura/test/event_generator.cc index a5aad78..dea96a5e 100644 --- a/ui/aura/test/event_generator.cc +++ b/ui/aura/test/event_generator.cc @@ -31,13 +31,13 @@ void DummyCallback(ui::EventType, const gfx::Vector2dF&) { class DefaultEventGeneratorDelegate : public EventGeneratorDelegate { public: - explicit DefaultEventGeneratorDelegate(RootWindow* root_window) + explicit DefaultEventGeneratorDelegate(Window* root_window) : root_window_(root_window) {} virtual ~DefaultEventGeneratorDelegate() {} // EventGeneratorDelegate overrides: virtual RootWindow* GetRootWindowAt(const gfx::Point& point) const OVERRIDE { - return root_window_; + return root_window_->GetDispatcher(); } virtual client::ScreenPositionClient* GetScreenPositionClient( @@ -46,7 +46,7 @@ class DefaultEventGeneratorDelegate : public EventGeneratorDelegate { } private: - RootWindow* root_window_; + Window* root_window_; DISALLOW_COPY_AND_ASSIGN(DefaultEventGeneratorDelegate); }; @@ -77,7 +77,7 @@ const int kAllButtonMask = ui::EF_LEFT_MOUSE_BUTTON | ui::EF_RIGHT_MOUSE_BUTTON; } // namespace -EventGenerator::EventGenerator(RootWindow* root_window) +EventGenerator::EventGenerator(Window* root_window) : delegate_(new DefaultEventGeneratorDelegate(root_window)), current_root_window_(delegate_->GetRootWindowAt(current_location_)), flags_(0), @@ -85,7 +85,7 @@ EventGenerator::EventGenerator(RootWindow* root_window) async_(false) { } -EventGenerator::EventGenerator(RootWindow* root_window, const gfx::Point& point) +EventGenerator::EventGenerator(Window* root_window, const gfx::Point& point) : delegate_(new DefaultEventGeneratorDelegate(root_window)), current_location_(point), current_root_window_(delegate_->GetRootWindowAt(current_location_)), @@ -94,7 +94,7 @@ EventGenerator::EventGenerator(RootWindow* root_window, const gfx::Point& point) async_(false) { } -EventGenerator::EventGenerator(RootWindow* root_window, Window* window) +EventGenerator::EventGenerator(Window* root_window, Window* window) : delegate_(new DefaultEventGeneratorDelegate(root_window)), current_location_(CenterOfWindow(window)), current_root_window_(delegate_->GetRootWindowAt(current_location_)), diff --git a/ui/aura/test/event_generator.h b/ui/aura/test/event_generator.h index 2a4649b..ee9ebda 100644 --- a/ui/aura/test/event_generator.h +++ b/ui/aura/test/event_generator.h @@ -87,7 +87,7 @@ class EventGenerator { public: // Creates an EventGenerator with the mouse/touch location (0,0), // which uses the |root_window|'s coordinates. - explicit EventGenerator(RootWindow* root_window); + explicit EventGenerator(Window* root_window); // Create an EventGenerator with EventGeneratorDelegate, // which uses the coordinates used by |delegate|. @@ -95,11 +95,11 @@ class EventGenerator { // Creates an EventGenerator with the mouse/touch location // at |initial_location|, which uses the |root_window|'s coordinates. - EventGenerator(RootWindow* root_window, const gfx::Point& initial_location); + EventGenerator(Window* root_window, const gfx::Point& initial_location); // Creates an EventGenerator with the mouse/touch location // centered over |window|, which uses the |root_window|'s coordinates. - EventGenerator(RootWindow* root_window, Window* window); + EventGenerator(Window* root_window, Window* window); virtual ~EventGenerator(); diff --git a/ui/aura/test/ui_controls_factory_aurawin.cc b/ui/aura/test/ui_controls_factory_aurawin.cc index 48997fe..60a15c9 100644 --- a/ui/aura/test/ui_controls_factory_aurawin.cc +++ b/ui/aura/test/ui_controls_factory_aurawin.cc @@ -36,7 +36,7 @@ class UIControlsWin : public UIControlsAura { bool alt, bool command) { DCHECK(!command); // No command key on Aura - HWND window = native_window->GetRootWindow()->GetAcceleratedWidget(); + HWND window = native_window->GetDispatcher()->GetAcceleratedWidget(); return SendKeyPressImpl( window, key, control, shift, alt, base::Closure()); } @@ -48,7 +48,7 @@ class UIControlsWin : public UIControlsAura { bool command, const base::Closure& task) { DCHECK(!command); // No command key on Aura - HWND window = native_window->GetRootWindow()->GetAcceleratedWidget(); + HWND window = native_window->GetDispatcher()->GetAcceleratedWidget(); return SendKeyPressImpl(window, key, control, shift, alt, task); } virtual bool SendMouseMove(long x, long y) { diff --git a/ui/aura/window.cc b/ui/aura/window.cc index f32f1e7..1436ff9 100644 --- a/ui/aura/window.cc +++ b/ui/aura/window.cc @@ -34,7 +34,8 @@ namespace aura { Window::Window(WindowDelegate* delegate) - : type_(client::WINDOW_TYPE_UNKNOWN), + : dispatcher_(NULL), + type_(client::WINDOW_TYPE_UNKNOWN), owned_by_parent_(true), delegate_(delegate), parent_(NULL), @@ -63,9 +64,9 @@ Window::~Window() { FOR_EACH_OBSERVER(WindowObserver, observers_, OnWindowDestroying(this)); // Let the root know so that it can remove any references to us. - RootWindow* root_window = GetRootWindow(); - if (root_window) - root_window->OnWindowDestroying(this); + WindowEventDispatcher* dispatcher = GetDispatcher(); + if (dispatcher) + dispatcher->OnWindowDestroying(this); // Then destroy the children. RemoveOrDestroyChildren(); @@ -174,15 +175,25 @@ void Window::SetTransparent(bool transparent) { transparent_ = transparent; } -RootWindow* Window::GetRootWindow() { - return const_cast<RootWindow*>( +Window* Window::GetRootWindow() { + return const_cast<Window*>( static_cast<const Window*>(this)->GetRootWindow()); } -const RootWindow* Window::GetRootWindow() const { +const Window* Window::GetRootWindow() const { return parent_ ? parent_->GetRootWindow() : NULL; } +WindowEventDispatcher* Window::GetDispatcher() { + return const_cast<WindowEventDispatcher*>(const_cast<const Window*>(this)-> + GetDispatcher()); +} + +const WindowEventDispatcher* Window::GetDispatcher() const { + const Window* root_window = GetRootWindow(); + return root_window ? root_window->dispatcher_ : NULL; +} + void Window::Show() { SetVisible(true); } @@ -217,7 +228,7 @@ gfx::Rect Window::GetBoundsInRootWindow() const { gfx::Rect Window::GetBoundsInScreen() const { gfx::Rect bounds(GetBoundsInRootWindow()); - const RootWindow* root = GetRootWindow(); + const Window* root = GetRootWindow(); if (root) { aura::client::ScreenPositionClient* screen_position_client = aura::client::GetScreenPositionClient(root); @@ -231,12 +242,12 @@ gfx::Rect Window::GetBoundsInScreen() const { } void Window::SetTransform(const gfx::Transform& transform) { - RootWindow* root_window = GetRootWindow(); - bool contained_mouse = IsVisible() && root_window && - ContainsPointInRoot(root_window->GetLastMouseLocationInRoot()); + WindowEventDispatcher* dispatcher = GetDispatcher(); + bool contained_mouse = IsVisible() && dispatcher && + ContainsPointInRoot(dispatcher->GetLastMouseLocationInRoot()); layer()->SetTransform(transform); - if (root_window) - root_window->OnWindowTransformed(this, contained_mouse); + if (dispatcher) + dispatcher->OnWindowTransformed(this, contained_mouse); } void Window::SetLayoutManager(LayoutManager* layout_manager) { @@ -262,7 +273,7 @@ void Window::SetBounds(const gfx::Rect& new_bounds) { void Window::SetBoundsInScreen(const gfx::Rect& new_bounds_in_screen, const gfx::Display& dst_display) { - RootWindow* root = GetRootWindow(); + Window* root = GetRootWindow(); if (root) { gfx::Point origin = new_bounds_in_screen.origin(); aura::client::ScreenPositionClient* screen_position_client = @@ -316,7 +327,7 @@ void Window::AddChild(Window* child) { params.phase = WindowObserver::HierarchyChangeParams::HIERARCHY_CHANGING; NotifyWindowHierarchyChange(params); - RootWindow* old_root = child->GetRootWindow(); + Window* old_root = child->GetRootWindow(); DCHECK(std::find(children_.begin(), children_.end(), child) == children_.end()); @@ -332,9 +343,9 @@ void Window::AddChild(Window* child) { FOR_EACH_OBSERVER(WindowObserver, observers_, OnWindowAdded(child)); child->OnParentChanged(); - RootWindow* root_window = GetRootWindow(); + Window* root_window = GetRootWindow(); if (root_window && old_root != root_window) { - root_window->OnWindowAddedToRootWindow(child); + root_window->GetDispatcher()->OnWindowAddedToRootWindow(child); child->NotifyAddedToRootWindow(); } @@ -410,11 +421,11 @@ void Window::ConvertPointToTarget(const Window* source, return; if (source->GetRootWindow() != target->GetRootWindow()) { client::ScreenPositionClient* source_client = - GetScreenPositionClient(source->GetRootWindow()); + client::GetScreenPositionClient(source->GetRootWindow()); source_client->ConvertPointToScreen(source, point); client::ScreenPositionClient* target_client = - GetScreenPositionClient(target->GetRootWindow()); + client::GetScreenPositionClient(target->GetRootWindow()); target_client->ConvertPointFromScreen(target, point); } else { ui::Layer::ConvertPointToLayer(source->layer(), target->layer(), point); @@ -422,11 +433,11 @@ void Window::ConvertPointToTarget(const Window* source, } void Window::MoveCursorTo(const gfx::Point& point_in_window) { - RootWindow* root_window = GetRootWindow(); + Window* root_window = GetRootWindow(); DCHECK(root_window); gfx::Point point_in_root(point_in_window); ConvertPointToTarget(this, root_window, &point_in_root); - root_window->MoveCursorTo(point_in_root); + root_window->GetDispatcher()->MoveCursorTo(point_in_root); } gfx::NativeCursor Window::GetCursor(const gfx::Point& point) const { @@ -552,21 +563,21 @@ void Window::SetCapture() { if (!IsVisible()) return; - RootWindow* root_window = GetRootWindow(); + Window* root_window = GetRootWindow(); if (!root_window) return; client::GetCaptureClient(root_window)->SetCapture(this); } void Window::ReleaseCapture() { - RootWindow* root_window = GetRootWindow(); + Window* root_window = GetRootWindow(); if (!root_window) return; client::GetCaptureClient(root_window)->ReleaseCapture(this); } bool Window::HasCapture() { - RootWindow* root_window = GetRootWindow(); + Window* root_window = GetRootWindow(); return root_window && client::GetCaptureClient(root_window)->GetCaptureWindow() == this; } @@ -692,9 +703,9 @@ void Window::SetVisible(bool visible) { FOR_EACH_OBSERVER(WindowObserver, observers_, OnWindowVisibilityChanging(this, visible)); - RootWindow* root_window = GetRootWindow(); - if (root_window) - root_window->DispatchMouseExitToHidingWindow(this); + WindowEventDispatcher* dispatcher = GetDispatcher(); + if (dispatcher) + dispatcher->DispatchMouseExitToHidingWindow(this); client::VisibilityClient* visibility_client = client::GetVisibilityClient(this); @@ -712,8 +723,8 @@ void Window::SetVisible(bool visible) { NotifyWindowVisibilityChanged(this, visible); - if (root_window) - root_window->OnWindowVisibilityChanged(this, visible); + if (dispatcher) + dispatcher->OnWindowVisibilityChanged(this, visible); } void Window::SchedulePaint() { @@ -780,10 +791,11 @@ void Window::RemoveChildImpl(Window* child, Window* new_parent) { if (layout_manager_) layout_manager_->OnWillRemoveWindowFromLayout(child); FOR_EACH_OBSERVER(WindowObserver, observers_, OnWillRemoveWindow(child)); - RootWindow* root_window = child->GetRootWindow(); - RootWindow* new_root_window = new_parent ? new_parent->GetRootWindow() : NULL; + Window* root_window = child->GetRootWindow(); + Window* new_root_window = new_parent ? new_parent->GetRootWindow() : NULL; if (root_window && root_window != new_root_window) { - root_window->OnWindowRemovedFromRootWindow(child, new_root_window); + root_window->GetDispatcher()->OnWindowRemovedFromRootWindow( + child, new_root_window); child->NotifyRemovingFromRootWindow(); } child->parent_ = NULL; @@ -1082,9 +1094,9 @@ void Window::OnLayerBoundsChanged(const gfx::Rect& old_bounds, FOR_EACH_OBSERVER(WindowObserver, observers_, OnWindowBoundsChanged(this, old_bounds, bounds())); - RootWindow* root_window = GetRootWindow(); - if (root_window) - root_window->OnWindowBoundsChanged(this, contained_mouse); + WindowEventDispatcher* dispatcher = GetDispatcher(); + if (dispatcher) + dispatcher->OnWindowBoundsChanged(this, contained_mouse); } void Window::OnPaintLayer(gfx::Canvas* canvas) { @@ -1132,9 +1144,9 @@ void Window::UpdateLayerName(const std::string& name) { bool Window::ContainsMouse() { bool contains_mouse = false; if (IsVisible()) { - RootWindow* root_window = GetRootWindow(); - contains_mouse = root_window && - ContainsPointInRoot(root_window->GetLastMouseLocationInRoot()); + WindowEventDispatcher* dispatcher = GetDispatcher(); + contains_mouse = dispatcher && + ContainsPointInRoot(dispatcher->GetLastMouseLocationInRoot()); } return contains_mouse; } diff --git a/ui/aura/window.h b/ui/aura/window.h index e908de4..e11f83a 100644 --- a/ui/aura/window.h +++ b/ui/aura/window.h @@ -46,6 +46,9 @@ class RootWindow; class WindowDelegate; class WindowObserver; +// TODO(beng): remove once RootWindow is renamed. +typedef RootWindow WindowEventDispatcher; + // Defined in window_property.h (which we do not include) template<typename T> struct WindowProperty; @@ -108,10 +111,19 @@ class AURA_EXPORT Window : public ui::LayerDelegate, Window* parent() { return parent_; } const Window* parent() const { return parent_; } - // Returns the RootWindow that contains this Window or NULL if the Window is - // not contained by a RootWindow. - virtual RootWindow* GetRootWindow(); - virtual const RootWindow* GetRootWindow() const; + // Returns the root Window that contains this Window. The root Window is + // defined as the Window that has a dispatcher. These functions return NULL if + // the Window is contained in a hierarchy that does not have a dispatcher at + // its root. + virtual Window* GetRootWindow(); + virtual const Window* GetRootWindow() const; + + WindowEventDispatcher* GetDispatcher(); + const WindowEventDispatcher* GetDispatcher() const; + void set_dispatcher(WindowEventDispatcher* dispatcher) { + dispatcher_ = dispatcher; + } + bool HasDispatcher() const { return !!dispatcher_; } // The Window does not own this object. void set_user_data(void* user_data) { user_data_ = user_data; } @@ -475,6 +487,8 @@ class AURA_EXPORT Window : public ui::LayerDelegate, // Returns true if the mouse is currently within our bounds. bool ContainsMouse(); + WindowEventDispatcher* dispatcher_; + client::WindowType type_; // True if the Window is owned by its parent - i.e. it will be deleted by its diff --git a/ui/keyboard/keyboard_ui_handler.cc b/ui/keyboard/keyboard_ui_handler.cc index c4b29ac..610d0e2 100644 --- a/ui/keyboard/keyboard_ui_handler.cc +++ b/ui/keyboard/keyboard_ui_handler.cc @@ -54,7 +54,7 @@ void KeyboardUIHandler::HandleInsertTextMessage(const base::ListValue* args) { return; } - aura::RootWindow* root_window = + aura::Window* root_window = web_ui()->GetWebContents()->GetView()->GetNativeView()->GetRootWindow(); if (!root_window) { LOG(ERROR) << "insertText failed: no root window"; @@ -75,7 +75,7 @@ void KeyboardUIHandler::HandleGetInputContextMessage( base::DictionaryValue results; results.SetInteger("requestId", request_id); - aura::RootWindow* root_window = + aura::Window* root_window = web_ui()->GetWebContents()->GetView()->GetNativeView()->GetRootWindow(); if (!root_window) { LOG(ERROR) << "getInputContext failed: no root window"; @@ -113,10 +113,10 @@ void KeyboardUIHandler::HandleSendKeyEventMessage( return; } - aura::RootWindow* root_window = - web_ui()->GetWebContents()->GetView()->GetNativeView()->GetRootWindow(); - if (!root_window) { - LOG(ERROR) << "sendKeyEvent failed: no root window"; + aura::WindowEventDispatcher* dispatcher = + web_ui()->GetWebContents()->GetView()->GetNativeView()->GetDispatcher(); + if (!dispatcher) { + LOG(ERROR) << "sendKeyEvent failed: no dispatcher"; return; } @@ -124,7 +124,7 @@ void KeyboardUIHandler::HandleSendKeyEventMessage( char_value, key_code, modifiers, - root_window)) { + dispatcher)) { LOG(ERROR) << "sendKeyEvent failed"; } } diff --git a/ui/keyboard/keyboard_util.cc b/ui/keyboard/keyboard_util.cc index 32cf8c4..ac2d723 100644 --- a/ui/keyboard/keyboard_util.cc +++ b/ui/keyboard/keyboard_util.cc @@ -23,11 +23,12 @@ namespace { const char kKeyDown[] ="keydown"; const char kKeyUp[] = "keyup"; -void SendProcessKeyEvent(ui::EventType type, aura::RootWindow* root_window) { +void SendProcessKeyEvent(ui::EventType type, + aura::WindowEventDispatcher* dispatcher) { ui::TranslatedKeyEvent event(type == ui::ET_KEY_PRESSED, ui::VKEY_PROCESSKEY, ui::EF_NONE); - root_window->AsRootWindowHostDelegate()->OnHostKeyEvent(&event); + dispatcher->AsRootWindowHostDelegate()->OnHostKeyEvent(&event); } } // namespace @@ -42,7 +43,7 @@ bool IsKeyboardEnabled() { } -bool InsertText(const base::string16& text, aura::RootWindow* root_window) { +bool InsertText(const base::string16& text, aura::Window* root_window) { if (!root_window) return false; @@ -66,8 +67,8 @@ bool InsertText(const base::string16& text, aura::RootWindow* root_window) { // ui::TextInputClient from that (see above in InsertText()). bool MoveCursor(int swipe_direction, int modifier_flags, - aura::RootWindow* root_window) { - if (!root_window) + aura::WindowEventDispatcher* dispatcher) { + if (!dispatcher) return false; ui::KeyboardCode codex = ui::VKEY_UNKNOWN; ui::KeyboardCode codey = ui::VKEY_UNKNOWN; @@ -84,17 +85,17 @@ bool MoveCursor(int swipe_direction, // First deal with the x movement. if (codex != ui::VKEY_UNKNOWN) { ui::KeyEvent press_event(ui::ET_KEY_PRESSED, codex, modifier_flags, 0); - root_window->AsRootWindowHostDelegate()->OnHostKeyEvent(&press_event); + dispatcher->AsRootWindowHostDelegate()->OnHostKeyEvent(&press_event); ui::KeyEvent release_event(ui::ET_KEY_RELEASED, codex, modifier_flags, 0); - root_window->AsRootWindowHostDelegate()->OnHostKeyEvent(&release_event); + dispatcher->AsRootWindowHostDelegate()->OnHostKeyEvent(&release_event); } // Then deal with the y movement. if (codey != ui::VKEY_UNKNOWN) { ui::KeyEvent press_event(ui::ET_KEY_PRESSED, codey, modifier_flags, 0); - root_window->AsRootWindowHostDelegate()->OnHostKeyEvent(&press_event); + dispatcher->AsRootWindowHostDelegate()->OnHostKeyEvent(&press_event); ui::KeyEvent release_event(ui::ET_KEY_RELEASED, codey, modifier_flags, 0); - root_window->AsRootWindowHostDelegate()->OnHostKeyEvent(&release_event); + dispatcher->AsRootWindowHostDelegate()->OnHostKeyEvent(&release_event); } return true; } @@ -103,7 +104,7 @@ bool SendKeyEvent(const std::string type, int key_value, int key_code, int modifiers, - aura::RootWindow* root_window) { + aura::WindowEventDispatcher* dispatcher) { ui::EventType event_type = ui::ET_UNKNOWN; if (type == kKeyDown) event_type = ui::ET_KEY_PRESSED; @@ -118,16 +119,16 @@ bool SendKeyEvent(const std::string type, // Handling of special printable characters (e.g. accented characters) for // which there is no key code. if (event_type == ui::ET_KEY_RELEASED) { - ui::InputMethod* input_method = root_window->GetProperty( + ui::InputMethod* input_method = dispatcher->GetProperty( aura::client::kRootWindowInputMethodKey); if (!input_method) return false; ui::TextInputClient* tic = input_method->GetTextInputClient(); - SendProcessKeyEvent(ui::ET_KEY_PRESSED, root_window); + SendProcessKeyEvent(ui::ET_KEY_PRESSED, dispatcher); tic->InsertChar(static_cast<uint16>(key_value), ui::EF_NONE); - SendProcessKeyEvent(ui::ET_KEY_RELEASED, root_window); + SendProcessKeyEvent(ui::ET_KEY_RELEASED, dispatcher); } } else { if (event_type == ui::ET_KEY_RELEASED) { @@ -146,7 +147,7 @@ bool SendKeyEvent(const std::string type, } ui::KeyEvent event(event_type, code, modifiers, false); - root_window->AsRootWindowHostDelegate()->OnHostKeyEvent(&event); + dispatcher->AsRootWindowHostDelegate()->OnHostKeyEvent(&event); } return true; } diff --git a/ui/keyboard/keyboard_util.h b/ui/keyboard/keyboard_util.h index f35f7d7a..653e32b 100644 --- a/ui/keyboard/keyboard_util.h +++ b/ui/keyboard/keyboard_util.h @@ -8,11 +8,10 @@ #include <string> #include "base/strings/string16.h" +// TODO(beng): replace with forward decl once RootWindow is renamed. +#include "ui/aura/window.h" #include "ui/keyboard/keyboard_export.h" -namespace aura { -class RootWindow; -} struct GritResourceMap; namespace keyboard { @@ -41,13 +40,13 @@ KEYBOARD_EXPORT bool IsKeyboardEnabled(); // that this may convert |text| into ui::KeyEvents for injection in some // special circumstances (i.e. VKEY_RETURN, VKEY_BACK). KEYBOARD_EXPORT bool InsertText(const base::string16& text, - aura::RootWindow* root_window); + aura::Window* root_window); // Move cursor when swipe on the virtualkeyboard. Returns true if cursor was // successfully moved according to |swipe_direction|. KEYBOARD_EXPORT bool MoveCursor(int swipe_direction, int modifier_flags, - aura::RootWindow* root_window); + aura::WindowEventDispatcher* dispatcher); // Sends a fabricated key event, where |type| is the event type, |key_value| // is the unicode value of the character, |key_code| is the legacy key code @@ -58,7 +57,7 @@ KEYBOARD_EXPORT bool SendKeyEvent(std::string type, int key_value, int key_code, int modifiers, - aura::RootWindow* root_window); + aura::WindowEventDispatcher* dispatcher); // Get the list of keyboard resources. |size| is populated with the number of // resources in the returned array. diff --git a/ui/shell_dialogs/select_file_dialog_win.cc b/ui/shell_dialogs/select_file_dialog_win.cc index c028d22..7cec71d 100644 --- a/ui/shell_dialogs/select_file_dialog_win.cc +++ b/ui/shell_dialogs/select_file_dialog_win.cc @@ -599,7 +599,7 @@ void SelectFileDialogImpl::SelectFileImpl( } } HWND owner = owning_window && owning_window->GetRootWindow() - ? owning_window->GetRootWindow()->GetAcceleratedWidget() : NULL; + ? owning_window->GetDispatcher()->GetAcceleratedWidget() : NULL; #else HWND owner = owning_window; #endif @@ -621,7 +621,7 @@ bool SelectFileDialogImpl::IsRunning(gfx::NativeWindow owning_window) const { #if defined(USE_AURA) if (!owning_window->GetRootWindow()) return false; - HWND owner = owning_window->GetRootWindow()->GetAcceleratedWidget(); + HWND owner = owning_window->GetDispatcher()->GetAcceleratedWidget(); #else HWND owner = owning_window; #endif diff --git a/ui/snapshot/snapshot_aura.cc b/ui/snapshot/snapshot_aura.cc index 29daf9f..ea4cb1b 100644 --- a/ui/snapshot/snapshot_aura.cc +++ b/ui/snapshot/snapshot_aura.cc @@ -40,9 +40,9 @@ bool GrabWindowSnapshot(gfx::NativeWindow window, // We must take into account the window's position on the desktop. read_pixels_bounds.Offset( window->GetBoundsInRootWindow().origin().OffsetFromOrigin()); - aura::RootWindow* root_window = window->GetRootWindow(); - if (root_window) - root_window->GetRootTransform().TransformRect(&read_pixels_bounds); + aura::WindowEventDispatcher* dispatcher = window->GetDispatcher(); + if (dispatcher) + dispatcher->GetRootTransform().TransformRect(&read_pixels_bounds); gfx::Rect read_pixels_bounds_in_pixel = gfx::ToEnclosingRect(read_pixels_bounds); diff --git a/ui/views/controls/menu/display_change_listener_aura.cc b/ui/views/controls/menu/display_change_listener_aura.cc index 1cec651..e6df560 100644 --- a/ui/views/controls/menu/display_change_listener_aura.cc +++ b/ui/views/controls/menu/display_change_listener_aura.cc @@ -2,10 +2,9 @@ // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. -#include "ui/views/controls/menu/menu_runner.h" - -#include "ui/aura/root_window.h" +#include "ui/aura/window.h" #include "ui/aura/window_observer.h" +#include "ui/views/controls/menu/menu_runner.h" #include "ui/views/widget/widget.h" namespace views { @@ -28,7 +27,7 @@ class AuraDisplayChangeListener private: MenuRunner* menu_runner_; - aura::RootWindow* root_window_; + aura::Window* root_window_; DISALLOW_COPY_AND_ASSIGN(AuraDisplayChangeListener); }; diff --git a/ui/views/controls/menu/menu_controller_aura.cc b/ui/views/controls/menu/menu_controller_aura.cc index c65c97f..48bf311 100644 --- a/ui/views/controls/menu/menu_controller_aura.cc +++ b/ui/views/controls/menu/menu_controller_aura.cc @@ -9,7 +9,7 @@ #include "ui/aura/client/activation_client.h" #include "ui/aura/client/dispatcher_client.h" #include "ui/aura/client/drag_drop_client.h" -#include "ui/aura/root_window.h" +#include "ui/aura/window.h" #include "ui/aura/window_observer.h" #include "ui/gfx/screen.h" #include "ui/views/widget/widget.h" @@ -27,7 +27,7 @@ class ActivationChangeObserverImpl public ui::EventHandler { public: ActivationChangeObserverImpl(MenuController* controller, - aura::RootWindow* root) + aura::Window* root) : controller_(controller), root_(root) { aura::client::GetActivationClient(root_)->AddObserver(this); @@ -71,12 +71,12 @@ class ActivationChangeObserverImpl } MenuController* controller_; - aura::RootWindow* root_; + aura::Window* root_; DISALLOW_COPY_AND_ASSIGN(ActivationChangeObserverImpl); }; -aura::RootWindow* GetOwnerRootWindow(views::Widget* owner) { +aura::Window* GetOwnerRootWindow(views::Widget* owner) { return owner ? owner->GetNativeWindow()->GetRootWindow() : NULL; } @@ -84,7 +84,7 @@ aura::RootWindow* GetOwnerRootWindow(views::Widget* owner) { void MenuController::RunMessageLoop(bool nested_menu) { // |owner_| may be NULL. - aura::RootWindow* root = GetOwnerRootWindow(owner_); + aura::Window* root = GetOwnerRootWindow(owner_); if (root) { scoped_ptr<ActivationChangeObserverImpl> observer; if (!nested_menu) @@ -100,13 +100,13 @@ void MenuController::RunMessageLoop(bool nested_menu) { } bool MenuController::ShouldQuitNow() const { - aura::RootWindow* root = GetOwnerRootWindow(owner_); + aura::Window* root = GetOwnerRootWindow(owner_); return !aura::client::GetDragDropClient(root) || !aura::client::GetDragDropClient(root)->IsDragDropInProgress(); } gfx::Screen* MenuController::GetScreen() { - aura::RootWindow* root = GetOwnerRootWindow(owner_); + aura::Window* root = GetOwnerRootWindow(owner_); return root ? gfx::Screen::GetScreenFor(root) : gfx::Screen::GetNativeScreen(); } diff --git a/ui/views/corewm/capture_controller.cc b/ui/views/corewm/capture_controller.cc index 1276c82b..59ff199 100644 --- a/ui/views/corewm/capture_controller.cc +++ b/ui/views/corewm/capture_controller.cc @@ -13,13 +13,13 @@ namespace corewm { //////////////////////////////////////////////////////////////////////////////// // CaptureController, public: -void CaptureController::Attach(aura::RootWindow* root) { +void CaptureController::Attach(aura::Window* root) { DCHECK_EQ(0u, root_windows_.count(root)); root_windows_.insert(root); aura::client::SetCaptureClient(root, this); } -void CaptureController::Detach(aura::RootWindow* root) { +void CaptureController::Detach(aura::Window* root) { root_windows_.erase(root); aura::client::SetCaptureClient(root, NULL); } @@ -36,7 +36,7 @@ void CaptureController::SetCapture(aura::Window* new_capture_window) { DCHECK(!capture_window_ || capture_window_->GetRootWindow()); aura::Window* old_capture_window = capture_window_; - aura::RootWindow* old_capture_root = old_capture_window ? + aura::Window* old_capture_root = old_capture_window ? old_capture_window->GetRootWindow() : NULL; // Copy the list in case it's modified out from under us. @@ -57,19 +57,20 @@ void CaptureController::SetCapture(aura::Window* new_capture_window) { for (RootWindows::const_iterator i = root_windows.begin(); i != root_windows.end(); ++i) { - aura::client::CaptureDelegate* delegate = *i; + aura::client::CaptureDelegate* delegate = (*i)->GetDispatcher(); delegate->UpdateCapture(old_capture_window, new_capture_window); } - aura::RootWindow* capture_root = + aura::Window* capture_root = capture_window_ ? capture_window_->GetRootWindow() : NULL; if (capture_root != old_capture_root) { if (old_capture_root) { - aura::client::CaptureDelegate* delegate = old_capture_root; + aura::client::CaptureDelegate* delegate = + old_capture_root->GetDispatcher(); delegate->ReleaseNativeCapture(); } if (capture_root) { - aura::client::CaptureDelegate* delegate = capture_root; + aura::client::CaptureDelegate* delegate = capture_root->GetDispatcher(); delegate->SetNativeCapture(); } } @@ -101,7 +102,7 @@ CaptureController::~CaptureController() { // static CaptureController* ScopedCaptureClient::capture_controller_ = NULL; -ScopedCaptureClient::ScopedCaptureClient(aura::RootWindow* root) +ScopedCaptureClient::ScopedCaptureClient(aura::Window* root) : root_window_(root) { root->AddObserver(this); if (!capture_controller_) diff --git a/ui/views/corewm/capture_controller.h b/ui/views/corewm/capture_controller.h index f7e8128..3250221 100644 --- a/ui/views/corewm/capture_controller.h +++ b/ui/views/corewm/capture_controller.h @@ -13,10 +13,6 @@ #include "ui/aura/window_observer.h" #include "ui/views/views_export.h" -namespace aura { -class RootWindow; -} - namespace views { namespace corewm { @@ -24,10 +20,10 @@ namespace corewm { class VIEWS_EXPORT CaptureController : public aura::client::CaptureClient { public: // Adds |root| to the list of RootWindows notified when capture changes. - void Attach(aura::RootWindow* root); + void Attach(aura::Window* root); // Removes |root| from the list of RootWindows notified when capture changes. - void Detach(aura::RootWindow* root); + void Detach(aura::Window* root); // Returns true if this CaptureController is installed on at least one // RootWindow. @@ -40,7 +36,7 @@ class VIEWS_EXPORT CaptureController : public aura::client::CaptureClient { private: friend class ScopedCaptureClient; - typedef std::set<aura::RootWindow*> RootWindows; + typedef std::set<aura::Window*> RootWindows; CaptureController(); virtual ~CaptureController(); @@ -59,7 +55,7 @@ class VIEWS_EXPORT CaptureController : public aura::client::CaptureClient { // among all ScopedCaptureClients and adds the RootWindow to it. class VIEWS_EXPORT ScopedCaptureClient : public aura::WindowObserver { public: - explicit ScopedCaptureClient(aura::RootWindow* root); + explicit ScopedCaptureClient(aura::Window* root); virtual ~ScopedCaptureClient(); // Returns true if there is a CaptureController with at least one RootWindow. @@ -80,7 +76,7 @@ class VIEWS_EXPORT ScopedCaptureClient : public aura::WindowObserver { static CaptureController* capture_controller_; // RootWindow this ScopedCaptureClient was create for. - aura::RootWindow* root_window_; + aura::Window* root_window_; DISALLOW_COPY_AND_ASSIGN(ScopedCaptureClient); }; diff --git a/ui/views/corewm/compound_event_filter.cc b/ui/views/corewm/compound_event_filter.cc index 0d021bd..146edb3 100644 --- a/ui/views/corewm/compound_event_filter.cc +++ b/ui/views/corewm/compound_event_filter.cc @@ -123,7 +123,7 @@ void CompoundEventFilter::UpdateCursor(aura::Window* target, ui::MouseEvent* event) { // If drag and drop is in progress, let the drag drop client set the cursor // instead of setting the cursor here. - aura::RootWindow* root_window = target->GetRootWindow(); + aura::Window* root_window = target->GetRootWindow(); aura::client::DragDropClient* drag_drop_client = aura::client::GetDragDropClient(root_window); if (drag_drop_client && drag_drop_client->IsDragDropInProgress()) diff --git a/ui/views/corewm/focus_controller_unittest.cc b/ui/views/corewm/focus_controller_unittest.cc index 964fd58..2177271 100644 --- a/ui/views/corewm/focus_controller_unittest.cc +++ b/ui/views/corewm/focus_controller_unittest.cc @@ -98,7 +98,7 @@ class ScopedFocusNotificationObserver : public FocusNotificationObserver { class ScopedTargetFocusNotificationObserver : public FocusNotificationObserver { public: - ScopedTargetFocusNotificationObserver(aura::RootWindow* root_window, int id) + ScopedTargetFocusNotificationObserver(aura::Window* root_window, int id) : target_(root_window->GetChildById(id)) { aura::client::SetActivationChangeObserver(target_, this); aura::client::SetFocusChangeObserver(target_, this); diff --git a/ui/views/corewm/input_method_event_filter.cc b/ui/views/corewm/input_method_event_filter.cc index cfdab6b..8c99063 100644 --- a/ui/views/corewm/input_method_event_filter.cc +++ b/ui/views/corewm/input_method_event_filter.cc @@ -18,7 +18,7 @@ namespace corewm { InputMethodEventFilter::InputMethodEventFilter(gfx::AcceleratedWidget widget) : input_method_(ui::CreateInputMethod(this, widget)), - target_root_window_(NULL) { + target_dispatcher_(NULL) { // TODO(yusukes): Check if the root window is currently focused and pass the // result to Init(). input_method_->Init(true); @@ -28,7 +28,7 @@ InputMethodEventFilter::~InputMethodEventFilter() { } void InputMethodEventFilter::SetInputMethodPropertyInRootWindow( - aura::RootWindow* root_window) { + aura::Window* root_window) { root_window->SetProperty(aura::client::kRootWindowInputMethodKey, input_method_.get()); } @@ -45,10 +45,10 @@ void InputMethodEventFilter::OnKeyEvent(ui::KeyEvent* event) { static_cast<ui::TranslatedKeyEvent*>(event)->ConvertToKeyEvent(); } else { // If the focused window is changed, all requests to IME will be - // discarded so it's safe to update the target_root_window_ here. + // discarded so it's safe to update the target_dispatcher_ here. aura::Window* target = static_cast<aura::Window*>(event->target()); - target_root_window_ = target->GetRootWindow(); - DCHECK(target_root_window_); + target_dispatcher_ = target->GetRootWindow()->GetDispatcher(); + DCHECK(target_dispatcher_); bool handled = false; if (event->HasNativeEvent()) handled = input_method_->DispatchKeyEvent(event->native_event()); @@ -68,7 +68,7 @@ bool InputMethodEventFilter::DispatchKeyEventPostIME( DCHECK(event.message != WM_CHAR); #endif ui::TranslatedKeyEvent aura_event(event, false /* is_char */); - return target_root_window_->AsRootWindowHostDelegate()->OnHostKeyEvent( + return target_dispatcher_->AsRootWindowHostDelegate()->OnHostKeyEvent( &aura_event); } @@ -78,7 +78,7 @@ bool InputMethodEventFilter::DispatchFabricatedKeyEventPostIME( int flags) { ui::TranslatedKeyEvent aura_event(type == ui::ET_KEY_PRESSED, key_code, flags); - return target_root_window_->AsRootWindowHostDelegate()->OnHostKeyEvent( + return target_dispatcher_->AsRootWindowHostDelegate()->OnHostKeyEvent( &aura_event); } diff --git a/ui/views/corewm/input_method_event_filter.h b/ui/views/corewm/input_method_event_filter.h index cb1fae4..902244c 100644 --- a/ui/views/corewm/input_method_event_filter.h +++ b/ui/views/corewm/input_method_event_filter.h @@ -8,15 +8,12 @@ #include "base/basictypes.h" #include "base/compiler_specific.h" #include "base/memory/scoped_ptr.h" +#include "ui/aura/window.h" #include "ui/base/ime/input_method_delegate.h" #include "ui/events/event_handler.h" #include "ui/gfx/native_widget_types.h" #include "ui/views/views_export.h" -namespace aura { -class RootWindow; -} - namespace ui { class InputMethod; } @@ -33,7 +30,7 @@ class VIEWS_EXPORT InputMethodEventFilter explicit InputMethodEventFilter(gfx::AcceleratedWidget widget); virtual ~InputMethodEventFilter(); - void SetInputMethodPropertyInRootWindow(aura::RootWindow* root_window); + void SetInputMethodPropertyInRootWindow(aura::Window* root_window); ui::InputMethod* input_method() const { return input_method_.get(); } @@ -49,9 +46,8 @@ class VIEWS_EXPORT InputMethodEventFilter scoped_ptr<ui::InputMethod> input_method_; - // The target root window to which the key event translated by IME will - // be dispatched. - aura::RootWindow* target_root_window_; + // The target dispatcher that will receive translated key events from the IME. + aura::WindowEventDispatcher* target_dispatcher_; DISALLOW_COPY_AND_ASSIGN(InputMethodEventFilter); }; diff --git a/ui/views/corewm/tooltip_aura.cc b/ui/views/corewm/tooltip_aura.cc index 70e07e3..1f7029e 100644 --- a/ui/views/corewm/tooltip_aura.cc +++ b/ui/views/corewm/tooltip_aura.cc @@ -172,8 +172,9 @@ gfx::Rect TooltipAura::GetBoundsForTooltip( // (which comes from the RootWindow). if (screen_type_ == gfx::SCREEN_TYPE_NATIVE && gfx::SCREEN_TYPE_NATIVE != gfx::SCREEN_TYPE_ALTERNATE) { - aura::RootWindow* root = tooltip_window_->GetRootWindow(); - widget_bounds = gfx::Rect(root->GetHostOrigin(), root->GetHostSize()); + aura::WindowEventDispatcher* dispatcher = tooltip_window_->GetDispatcher(); + widget_bounds = gfx::Rect(dispatcher->GetHostOrigin(), + dispatcher->GetHostSize()); } gfx::Screen* screen = gfx::Screen::GetScreenByType(screen_type_); gfx::Rect bounds(screen->GetDisplayNearestPoint(origin).bounds()); diff --git a/ui/views/corewm/tooltip_controller.cc b/ui/views/corewm/tooltip_controller.cc index a51d4d4..adfff86 100644 --- a/ui/views/corewm/tooltip_controller.cc +++ b/ui/views/corewm/tooltip_controller.cc @@ -10,7 +10,6 @@ #include "ui/aura/client/cursor_client.h" #include "ui/aura/client/drag_drop_client.h" #include "ui/aura/env.h" -#include "ui/aura/root_window.h" #include "ui/aura/window.h" #include "ui/events/event.h" #include "ui/gfx/font.h" @@ -234,7 +233,7 @@ bool TooltipController::IsDragDropInProgress() { bool TooltipController::IsCursorVisible() { if (!tooltip_window_) return false; - aura::RootWindow* root = tooltip_window_->GetRootWindow(); + aura::Window* root = tooltip_window_->GetRootWindow(); if (!root) return false; aura::client::CursorClient* cursor_client = diff --git a/ui/views/corewm/tooltip_controller_unittest.cc b/ui/views/corewm/tooltip_controller_unittest.cc index ebde564..4898792 100644 --- a/ui/views/corewm/tooltip_controller_unittest.cc +++ b/ui/views/corewm/tooltip_controller_unittest.cc @@ -101,7 +101,7 @@ class TooltipControllerTest : public aura::test::AuraTestBase { return widget_->GetNativeWindow(); } - aura::RootWindow* GetRootWindow() { + aura::Window* GetRootWindow() { return GetWindow()->GetRootWindow(); } @@ -159,7 +159,7 @@ TEST_F(TooltipControllerTest, TooltipsInMultipleViews) { PrepareSecondView(); aura::Window* window = GetWindow(); - aura::RootWindow* root_window = GetRootWindow(); + aura::Window* root_window = GetRootWindow(); // Fire tooltip timer so tooltip becomes visible. generator_->MoveMouseRelativeTo(window, view_->bounds().CenterPoint()); @@ -356,7 +356,7 @@ TEST_F(TooltipControllerTest, TooltipsInMultipleRootWindows) { EXPECT_EQ(NULL, helper_->GetTooltipWindow()); aura::Window* window = GetWindow(); - aura::RootWindow* root_window = GetRootWindow(); + aura::Window* root_window = GetRootWindow(); // Fire tooltip timer so tooltip becomes visible. generator_->MoveMouseRelativeTo(window, view_->bounds().CenterPoint()); @@ -386,7 +386,7 @@ TEST_F(TooltipControllerTest, TooltipsInMultipleRootWindows) { view2->set_tooltip_text(ASCIIToUTF16("Tooltip Text For RootWindow2")); aura::Window* window2 = widget2->GetNativeWindow(); - aura::RootWindow* root_window2 = + aura::Window* root_window2 = widget2->GetNativeWindow()->GetRootWindow(); // Fire tooltip timer so tooltip becomes visible. generator_->MoveMouseRelativeTo(window2, view2->bounds().CenterPoint()); diff --git a/ui/views/drag_utils.cc b/ui/views/drag_utils.cc index b156276..0b9c317 100644 --- a/ui/views/drag_utils.cc +++ b/ui/views/drag_utils.cc @@ -47,7 +47,7 @@ void RunShellDrag(gfx::NativeView view, ui::DragDropTypes::DragEventSource source) { #if defined(USE_AURA) gfx::Point root_location(location); - aura::RootWindow* root_window = view->GetRootWindow(); + aura::Window* root_window = view->GetRootWindow(); aura::Window::ConvertPointToTarget(view, root_window, &root_location); if (aura::client::GetDragDropClient(root_window)) { aura::client::GetDragDropClient(root_window)->StartDragAndDrop( diff --git a/ui/views/event_utils_aura.cc b/ui/views/event_utils_aura.cc index 455ec1a..054b280 100644 --- a/ui/views/event_utils_aura.cc +++ b/ui/views/event_utils_aura.cc @@ -20,10 +20,11 @@ bool RepostLocatedEvent(gfx::NativeWindow window, if (!window) return false; - aura::RootWindow* root_window = window->GetRootWindow(); + aura::Window* root_window = window->GetRootWindow(); gfx::Point root_loc(event.location()); - ScreenPositionClient* spc = GetScreenPositionClient(root_window); + ScreenPositionClient* spc = + aura::client::GetScreenPositionClient(root_window); if (!spc) return false; @@ -43,7 +44,7 @@ bool RepostLocatedEvent(gfx::NativeWindow window, relocated->set_location(root_loc); relocated->set_root_location(root_loc); - root_window->RepostEvent(*relocated); + root_window->GetDispatcher()->RepostEvent(*relocated); return true; } diff --git a/ui/views/test/ui_controls_factory_desktop_aurax11.cc b/ui/views/test/ui_controls_factory_desktop_aurax11.cc index f6f4f7e..bffa77b 100644 --- a/ui/views/test/ui_controls_factory_desktop_aurax11.cc +++ b/ui/views/test/ui_controls_factory_desktop_aurax11.cc @@ -125,32 +125,32 @@ class UIControlsDesktopX11 : public UIControlsAura { const base::Closure& closure) OVERRIDE { DCHECK(!command); // No command key on Aura - aura::RootWindow* root_window = window->GetRootWindow(); + aura::WindowEventDispatcher* dispatcher = window->GetDispatcher(); XEvent xevent = {0}; xevent.xkey.type = KeyPress; if (control) { - SetKeycodeAndSendThenMask(root_window, &xevent, XK_Control_L, + SetKeycodeAndSendThenMask(dispatcher, &xevent, XK_Control_L, ControlMask); } if (shift) - SetKeycodeAndSendThenMask(root_window, &xevent, XK_Shift_L, ShiftMask); + SetKeycodeAndSendThenMask(dispatcher, &xevent, XK_Shift_L, ShiftMask); if (alt) - SetKeycodeAndSendThenMask(root_window, &xevent, XK_Alt_L, Mod1Mask); + SetKeycodeAndSendThenMask(dispatcher, &xevent, XK_Alt_L, Mod1Mask); xevent.xkey.keycode = XKeysymToKeycode(x_display_, ui::XKeysymForWindowsKeyCode(key, shift)); - root_window->PostNativeEvent(&xevent); + dispatcher->PostNativeEvent(&xevent); // Send key release events. xevent.xkey.type = KeyRelease; - root_window->PostNativeEvent(&xevent); + dispatcher->PostNativeEvent(&xevent); if (alt) - UnmaskAndSetKeycodeThenSend(root_window, &xevent, Mod1Mask, XK_Alt_L); + UnmaskAndSetKeycodeThenSend(dispatcher, &xevent, Mod1Mask, XK_Alt_L); if (shift) - UnmaskAndSetKeycodeThenSend(root_window, &xevent, ShiftMask, XK_Shift_L); + UnmaskAndSetKeycodeThenSend(dispatcher, &xevent, ShiftMask, XK_Shift_L); if (control) { - UnmaskAndSetKeycodeThenSend(root_window, &xevent, ControlMask, + UnmaskAndSetKeycodeThenSend(dispatcher, &xevent, ControlMask, XK_Control_L); } DCHECK(!xevent.xkey.state); @@ -168,7 +168,7 @@ class UIControlsDesktopX11 : public UIControlsAura { const base::Closure& closure) OVERRIDE { gfx::Point screen_point(x, y); gfx::Point window_point = screen_point; - aura::RootWindow* root_window = RootWindowForPoint(screen_point); + aura::Window* root_window = RootWindowForPoint(screen_point); aura::client::ScreenPositionClient* screen_position_client = aura::client::GetScreenPositionClient(root_window); @@ -185,7 +185,7 @@ class UIControlsDesktopX11 : public UIControlsAura { xmotion->state = button_down_mask; xmotion->same_screen = True; // RootWindow will take care of other necessary fields. - root_window->PostNativeEvent(&xevent); + root_window->GetDispatcher()->PostNativeEvent(&xevent); RunClosureAfterAllPendingUIEvents(closure); return true; } @@ -199,7 +199,7 @@ class UIControlsDesktopX11 : public UIControlsAura { XEvent xevent = {0}; XButtonEvent* xbutton = &xevent.xbutton; gfx::Point mouse_loc = aura::Env::GetInstance()->last_mouse_location(); - aura::RootWindow* root_window = RootWindowForPoint(mouse_loc); + aura::Window* root_window = RootWindowForPoint(mouse_loc); aura::client::ScreenPositionClient* screen_position_client = aura::client::GetScreenPositionClient(root_window); if (screen_position_client) @@ -224,12 +224,12 @@ class UIControlsDesktopX11 : public UIControlsAura { // RootWindow will take care of other necessary fields. if (state & DOWN) { xevent.xbutton.type = ButtonPress; - root_window->PostNativeEvent(&xevent); + root_window->GetDispatcher()->PostNativeEvent(&xevent); button_down_mask |= xbutton->state; } if (state & UP) { xevent.xbutton.type = ButtonRelease; - root_window->PostNativeEvent(&xevent); + root_window->GetDispatcher()->PostNativeEvent(&xevent); button_down_mask = (button_down_mask | xbutton->state) ^ xbutton->state; } RunClosureAfterAllPendingUIEvents(closure); @@ -255,7 +255,7 @@ class UIControlsDesktopX11 : public UIControlsAura { new EventWaiter(closure, &Matcher); } private: - aura::RootWindow* RootWindowForPoint(const gfx::Point& point) { + aura::Window* RootWindowForPoint(const gfx::Point& point) { // Most interactive_ui_tests run inside of the aura_test_helper // environment. This means that we can't rely on gfx::Screen and several // other things to work properly. Therefore we hack around this by diff --git a/ui/views/widget/desktop_aura/desktop_drag_drop_client_aurax11.cc b/ui/views/widget/desktop_aura/desktop_drag_drop_client_aurax11.cc index 2764da1..3b3ae39 100644 --- a/ui/views/widget/desktop_aura/desktop_drag_drop_client_aurax11.cc +++ b/ui/views/widget/desktop_aura/desktop_drag_drop_client_aurax11.cc @@ -681,7 +681,7 @@ void DesktopDragDropClientAuraX11::DragTranslate( scoped_ptr<ui::DropTargetEvent>* event, aura::client::DragDropDelegate** delegate) { gfx::Point root_location = root_window_location; - root_window_->GetRootWindow()->ConvertPointFromNativeScreen(&root_location); + root_window_->GetDispatcher()->ConvertPointFromNativeScreen(&root_location); aura::Window* target_window = root_window_->GetEventHandlerForPoint(root_location); bool target_window_changed = false; diff --git a/ui/views/widget/desktop_aura/desktop_drop_target_win.cc b/ui/views/widget/desktop_aura/desktop_drop_target_win.cc index 252826a..1a9150f 100644 --- a/ui/views/widget/desktop_aura/desktop_drop_target_win.cc +++ b/ui/views/widget/desktop_aura/desktop_drop_target_win.cc @@ -96,7 +96,7 @@ void DesktopDropTargetWin::Translate( DragDropDelegate** delegate) { gfx::Point location(position.x, position.y); gfx::Point root_location = location; - root_window_->GetRootWindow()->ConvertPointFromNativeScreen(&root_location); + root_window_->GetDispatcher()->ConvertPointFromNativeScreen(&root_location); aura::Window* target_window = root_window_->GetEventHandlerForPoint(root_location); bool target_window_changed = false; diff --git a/ui/views/widget/desktop_aura/desktop_root_window_host_win.cc b/ui/views/widget/desktop_aura/desktop_root_window_host_win.cc index d448d50..2dad0d9 100644 --- a/ui/views/widget/desktop_aura/desktop_root_window_host_win.cc +++ b/ui/views/widget/desktop_aura/desktop_root_window_host_win.cc @@ -79,11 +79,12 @@ aura::Window* DesktopRootWindowHostWin::GetContentWindowForHWND(HWND hwnd) { ui::NativeTheme* DesktopRootWindowHost::GetNativeTheme(aura::Window* window) { // Use NativeThemeWin for windows shown on the desktop, those not on the // desktop come from Ash and get NativeThemeAura. - aura::RootWindow* root = window ? window->GetRootWindow() : NULL; - if (root) { - HWND root_hwnd = root->GetAcceleratedWidget(); - if (root_hwnd && - DesktopRootWindowHostWin::GetContentWindowForHWND(root_hwnd)) { + aura::WindowEventDispatcher* dispatcher = + window ? window->GetDispatcher() : NULL; + if (dispatcher) { + HWND host_hwnd = dispatcher->GetAcceleratedWidget(); + if (host_hwnd && + DesktopRootWindowHostWin::GetContentWindowForHWND(host_hwnd)) { return ui::NativeThemeWin::instance(); } } @@ -107,8 +108,8 @@ void DesktopRootWindowHostWin::Init( native_widget_delegate_); HWND parent_hwnd = NULL; - if (params.parent && params.parent->GetRootWindow()) - parent_hwnd = params.parent->GetRootWindow()->GetAcceleratedWidget(); + if (params.parent && params.parent->GetDispatcher()) + parent_hwnd = params.parent->GetDispatcher()->GetAcceleratedWidget(); message_handler_->set_remove_standard_frame(params.remove_standard_frame); diff --git a/ui/views/widget/desktop_aura/desktop_screen_position_client.cc b/ui/views/widget/desktop_aura/desktop_screen_position_client.cc index 08e5d92..1d21740 100644 --- a/ui/views/widget/desktop_aura/desktop_screen_position_client.cc +++ b/ui/views/widget/desktop_aura/desktop_screen_position_client.cc @@ -14,9 +14,9 @@ namespace views { namespace { -gfx::Point GetOrigin(const aura::RootWindow* root_window) { - gfx::Point origin_in_pixels = root_window->GetHostOrigin(); - aura::RootWindow* window = const_cast<aura::RootWindow*>(root_window); +gfx::Point GetOrigin(const aura::Window* root_window) { + gfx::Point origin_in_pixels = root_window->GetDispatcher()->GetHostOrigin(); + aura::Window* window = const_cast<aura::Window*>(root_window); float scale = gfx::Screen::GetScreenFor(window)-> GetDisplayNearestWindow(window).device_scale_factor(); return gfx::ToFlooredPoint( @@ -44,7 +44,7 @@ DesktopScreenPositionClient::~DesktopScreenPositionClient() { void DesktopScreenPositionClient::ConvertPointToScreen( const aura::Window* window, gfx::Point* point) { - const aura::RootWindow* root_window = window->GetRootWindow(); + const aura::Window* root_window = window->GetRootWindow(); aura::Window::ConvertPointToTarget(window, root_window, point); gfx::Point origin = GetOrigin(root_window); point->Offset(origin.x(), origin.y()); @@ -52,7 +52,7 @@ void DesktopScreenPositionClient::ConvertPointToScreen( void DesktopScreenPositionClient::ConvertPointFromScreen( const aura::Window* window, gfx::Point* point) { - const aura::RootWindow* root_window = window->GetRootWindow(); + const aura::Window* root_window = window->GetRootWindow(); gfx::Point origin = GetOrigin(root_window); point->Offset(-origin.x(), -origin.y()); aura::Window::ConvertPointToTarget(root_window, window, point); @@ -60,7 +60,7 @@ void DesktopScreenPositionClient::ConvertPointFromScreen( void DesktopScreenPositionClient::ConvertHostPointToScreen( aura::Window* window, gfx::Point* point) { - aura::RootWindow* root_window = window->GetRootWindow(); + aura::Window* root_window = window->GetRootWindow(); ConvertPointToScreen(root_window, point); } @@ -69,7 +69,7 @@ void DesktopScreenPositionClient::SetBounds( const gfx::Rect& bounds, const gfx::Display& display) { // TODO: Use the 3rd parameter, |display|. - aura::RootWindow* root = window->GetRootWindow(); + aura::Window* root = window->GetRootWindow(); if (PositionWindowInScreenCoordinates(window)) { // The caller expects windows we consider "embedded" to be placed in the @@ -88,7 +88,7 @@ void DesktopScreenPositionClient::SetBounds( DesktopNativeWidgetAura* desktop_native_widget = DesktopNativeWidgetAura::ForWindow(window); if (desktop_native_widget) { - root->SetHostBounds(bounds); + root->GetDispatcher()->SetHostBounds(bounds); // Setting bounds of root resizes |window|. } else { window->SetBounds(bounds); diff --git a/ui/views/widget/desktop_aura/desktop_screen_win.cc b/ui/views/widget/desktop_aura/desktop_screen_win.cc index 93721bce..f1a7767 100644 --- a/ui/views/widget/desktop_aura/desktop_screen_win.cc +++ b/ui/views/widget/desktop_aura/desktop_screen_win.cc @@ -53,8 +53,8 @@ gfx::Display DesktopScreenWin::GetDisplayMatching( } HWND DesktopScreenWin::GetHWNDFromNativeView(gfx::NativeView window) const { - aura::RootWindow* root_window = window->GetRootWindow(); - return root_window ? root_window->GetAcceleratedWidget() : NULL; + aura::WindowEventDispatcher* dispatcher = window->GetDispatcher(); + return dispatcher ? dispatcher->GetAcceleratedWidget() : NULL; } gfx::NativeWindow DesktopScreenWin::GetNativeWindowFromHWND(HWND hwnd) const { diff --git a/ui/views/widget/desktop_aura/desktop_screen_x11.cc b/ui/views/widget/desktop_aura/desktop_screen_x11.cc index 9358875..8d8bd02 100644 --- a/ui/views/widget/desktop_aura/desktop_screen_x11.cc +++ b/ui/views/widget/desktop_aura/desktop_screen_x11.cc @@ -187,10 +187,10 @@ gfx::Display DesktopScreenX11::GetDisplayNearestWindow( // create the aura::RootWindow. So we ask what the DRWHX11 believes the // window bounds are instead of going through the aura::Window's screen // bounds. - aura::RootWindow* root_window = window->GetRootWindow(); - if (root_window) { + aura::WindowEventDispatcher* dispatcher = window->GetDispatcher(); + if (dispatcher) { DesktopRootWindowHostX11* rwh = DesktopRootWindowHostX11::GetHostForXID( - root_window->GetAcceleratedWidget()); + dispatcher->GetAcceleratedWidget()); if (rwh) return GetDisplayMatching(rwh->GetX11RootWindowBounds()); } diff --git a/ui/views/widget/desktop_aura/x11_desktop_window_move_client.cc b/ui/views/widget/desktop_aura/x11_desktop_window_move_client.cc index 273372f..41573fe 100644 --- a/ui/views/widget/desktop_aura/x11_desktop_window_move_client.cc +++ b/ui/views/widget/desktop_aura/x11_desktop_window_move_client.cc @@ -50,7 +50,7 @@ aura::client::WindowMoveResult X11DesktopWindowMoveClient::RunMoveLoop( const gfx::Vector2d& drag_offset, aura::client::WindowMoveSource move_source) { window_offset_ = drag_offset; - root_window_ = source->GetRootWindow(); + root_window_ = source->GetDispatcher(); bool success = move_loop_.RunMoveLoop(source, root_window_->last_cursor()); return success ? aura::client::MOVE_SUCCESSFUL : aura::client::MOVE_CANCELED; diff --git a/ui/views/widget/native_widget_aura.cc b/ui/views/widget/native_widget_aura.cc index 8366092..dd2f7e8 100644 --- a/ui/views/widget/native_widget_aura.cc +++ b/ui/views/widget/native_widget_aura.cc @@ -276,7 +276,7 @@ bool NativeWidgetAura::HasCapture() const { InputMethod* NativeWidgetAura::CreateInputMethod() { if (!window_) return NULL; - aura::RootWindow* root_window = window_->GetRootWindow(); + aura::Window* root_window = window_->GetRootWindow(); ui::InputMethod* host = root_window->GetProperty(aura::client::kRootWindowInputMethodKey); return new InputMethodBridge(this, host, true); @@ -391,7 +391,7 @@ void NativeWidgetAura::SetBounds(const gfx::Rect& bounds) { if (!window_) return; - aura::RootWindow* root = window_->GetRootWindow(); + aura::Window* root = window_->GetRootWindow(); if (root) { aura::client::ScreenPositionClient* screen_position_client = aura::client::GetScreenPositionClient(root); @@ -523,7 +523,7 @@ bool NativeWidgetAura::IsActive() const { // We may up here during destruction of the root, in which case // GetRootWindow() returns NULL (~RootWindow() has run and we're in ~Window). - aura::RootWindow* root = window_->GetRootWindow(); + aura::Window* root = window_->GetRootWindow(); return root && aura::client::GetActivationClient(root)->GetActiveWindow() == window_; } @@ -1118,7 +1118,7 @@ void NativeWidgetPrivate::ReparentNativeView(gfx::NativeView native_view, // in this case is the stacking client of the current RootWindow. This // matches our previous behaviour; the global stacking client would almost // always reattach the window to the same RootWindow. - aura::RootWindow* root_window = native_view->GetRootWindow(); + aura::Window* root_window = native_view->GetRootWindow(); aura::client::ParentWindowWithContext( native_view, root_window, root_window->GetBoundsInScreen()); } diff --git a/ui/views/widget/tooltip_manager_aura.cc b/ui/views/widget/tooltip_manager_aura.cc index dc812b8..6909001 100644 --- a/ui/views/widget/tooltip_manager_aura.cc +++ b/ui/views/widget/tooltip_manager_aura.cc @@ -48,9 +48,10 @@ const gfx::FontList& TooltipManagerAura::GetFontList() const { } void TooltipManagerAura::UpdateTooltip() { - aura::RootWindow* root_window = window_->GetRootWindow(); + aura::Window* root_window = window_->GetRootWindow(); if (aura::client::GetTooltipClient(root_window)) { - gfx::Point view_point = root_window->GetLastMouseLocationInRoot(); + gfx::Point view_point = + root_window->GetDispatcher()->GetLastMouseLocationInRoot(); aura::Window::ConvertPointToTarget(root_window, window_, &view_point); View* view = GetViewUnderPoint(view_point); UpdateTooltipForTarget(view, view_point, root_window); @@ -58,9 +59,10 @@ void TooltipManagerAura::UpdateTooltip() { } void TooltipManagerAura::TooltipTextChanged(View* view) { - aura::RootWindow* root_window = window_->GetRootWindow(); + aura::Window* root_window = window_->GetRootWindow(); if (aura::client::GetTooltipClient(root_window)) { - gfx::Point view_point = root_window->GetLastMouseLocationInRoot(); + gfx::Point view_point = + root_window->GetDispatcher()->GetLastMouseLocationInRoot(); aura::Window::ConvertPointToTarget(root_window, window_, &view_point); View* target = GetViewUnderPoint(view_point); if (target != view) @@ -78,7 +80,7 @@ View* TooltipManagerAura::GetViewUnderPoint(const gfx::Point& point) { void TooltipManagerAura::UpdateTooltipForTarget(View* target, const gfx::Point& point, - aura::RootWindow* root_window) { + aura::Window* root_window) { if (target) { gfx::Point view_point = point; View::ConvertPointFromWidget(target, &view_point); diff --git a/ui/views/widget/tooltip_manager_aura.h b/ui/views/widget/tooltip_manager_aura.h index 009d7e6..3915492 100644 --- a/ui/views/widget/tooltip_manager_aura.h +++ b/ui/views/widget/tooltip_manager_aura.h @@ -11,7 +11,6 @@ #include "ui/views/widget/tooltip_manager.h" namespace aura { -class RootWindow; class Window; } @@ -41,7 +40,7 @@ class TooltipManagerAura : public TooltipManager { View* GetViewUnderPoint(const gfx::Point& point); void UpdateTooltipForTarget(View* target, const gfx::Point& point, - aura::RootWindow* root_window); + aura::Window* root_window); aura::Window* window_; Widget* widget_; diff --git a/ui/views/widget/widget_interactive_uitest.cc b/ui/views/widget/widget_interactive_uitest.cc index 8c10ccc3..f08fe8b 100644 --- a/ui/views/widget/widget_interactive_uitest.cc +++ b/ui/views/widget/widget_interactive_uitest.cc @@ -171,7 +171,7 @@ TEST_F(WidgetTest, DesktopNativeWidgetAuraActivationAndFocusTest) { widget1.Init(init_params); widget1.SetContentsView(contents_view1); widget1.Show(); - aura::RootWindow* root_window1= widget1.GetNativeView()->GetRootWindow(); + aura::Window* root_window1= widget1.GetNativeView()->GetRootWindow(); contents_view1->RequestFocus(); EXPECT_TRUE(root_window1 != NULL); @@ -191,9 +191,9 @@ TEST_F(WidgetTest, DesktopNativeWidgetAuraActivationAndFocusTest) { widget2.Init(init_params2); widget2.SetContentsView(contents_view2); widget2.Show(); - aura::RootWindow* root_window2 = widget2.GetNativeView()->GetRootWindow(); + aura::Window* root_window2 = widget2.GetNativeView()->GetRootWindow(); contents_view2->RequestFocus(); - ::SetActiveWindow(root_window2->GetAcceleratedWidget()); + ::SetActiveWindow(root_window2->GetDispatcher()->GetAcceleratedWidget()); aura::client::ActivationClient* activation_client2 = aura::client::GetActivationClient(root_window2); @@ -205,7 +205,7 @@ TEST_F(WidgetTest, DesktopNativeWidgetAuraActivationAndFocusTest) { // Now set focus back to widget 1 and expect the active window to be its // window. contents_view1->RequestFocus(); - ::SetActiveWindow(root_window1->GetAcceleratedWidget()); + ::SetActiveWindow(root_window1->GetDispatcher()->GetAcceleratedWidget()); EXPECT_EQ(activation_client2->GetActiveWindow(), reinterpret_cast<aura::Window*>(NULL)); EXPECT_EQ(activation_client1->GetActiveWindow(), widget1.GetNativeView()); @@ -732,9 +732,8 @@ TEST_F(WidgetCaptureTest, MAYBE_MouseEventDispatchedToRightWindow) { // |widget2| has capture, |widget1| should still get the event. ui::MouseEvent mouse_event(ui::ET_MOUSE_EXITED, gfx::Point(), gfx::Point(), ui::EF_NONE); - static_cast<aura::RootWindowHostDelegate*>( - widget1.GetNativeWindow()->GetRootWindow())->OnHostMouseEvent( - &mouse_event); + widget1.GetNativeWindow()->GetDispatcher()->AsRootWindowHostDelegate()-> + OnHostMouseEvent(&mouse_event); EXPECT_TRUE(widget1.GetAndClearGotMouseEvent()); EXPECT_FALSE(widget2.GetAndClearGotMouseEvent()); } diff --git a/ui/views/widget/widget_unittest.cc b/ui/views/widget/widget_unittest.cc index dcc4f0d..abdb000 100644 --- a/ui/views/widget/widget_unittest.cc +++ b/ui/views/widget/widget_unittest.cc @@ -1310,7 +1310,7 @@ void GenerateMouseEvents(Widget* widget, ui::EventType last_event_type) { ui::MouseEvent move_event(ui::ET_MOUSE_MOVED, screen_bounds.CenterPoint(), screen_bounds.CenterPoint(), 0); aura::RootWindowHostDelegate* rwhd = - widget->GetNativeWindow()->GetRootWindow()->AsRootWindowHostDelegate(); + widget->GetNativeWindow()->GetDispatcher()->AsRootWindowHostDelegate(); rwhd->OnHostMouseEvent(&move_event); if (last_event_type == ui::ET_MOUSE_ENTERED) return; @@ -2017,7 +2017,7 @@ TEST_F(WidgetTest, WindowMouseModalityTest) { cursor_location_main, cursor_location_main, ui::EF_NONE); - top_level_widget.GetNativeView()->GetRootWindow()-> + top_level_widget.GetNativeView()->GetDispatcher()-> AsRootWindowHostDelegate()->OnHostMouseEvent(&move_main); EXPECT_EQ(1, widget_view->GetEventCount(ui::ET_MOUSE_ENTERED)); @@ -2043,7 +2043,7 @@ TEST_F(WidgetTest, WindowMouseModalityTest) { cursor_location_dialog, cursor_location_dialog, ui::EF_NONE); - top_level_widget.GetNativeView()->GetRootWindow()-> + top_level_widget.GetNativeView()->GetDispatcher()-> AsRootWindowHostDelegate()->OnHostMouseEvent(&mouse_down_dialog); EXPECT_EQ(1, dialog_widget_view->GetEventCount(ui::ET_MOUSE_PRESSED)); @@ -2054,7 +2054,7 @@ TEST_F(WidgetTest, WindowMouseModalityTest) { cursor_location_main2, cursor_location_main2, ui::EF_NONE); - top_level_widget.GetNativeView()->GetRootWindow()-> + top_level_widget.GetNativeView()->GetDispatcher()-> AsRootWindowHostDelegate()->OnHostMouseEvent(&mouse_down_main); EXPECT_EQ(0, widget_view->GetEventCount(ui::ET_MOUSE_MOVED)); diff --git a/ui/views/win/hwnd_util_aurawin.cc b/ui/views/win/hwnd_util_aurawin.cc index 6062478..a927df1 100644 --- a/ui/views/win/hwnd_util_aurawin.cc +++ b/ui/views/win/hwnd_util_aurawin.cc @@ -19,21 +19,21 @@ HWND HWNDForWidget(const Widget* widget) { HWND HWNDForNativeView(const gfx::NativeView view) { return view && view->GetRootWindow() ? - view->GetRootWindow()->GetAcceleratedWidget() : NULL; + view->GetDispatcher()->GetAcceleratedWidget() : NULL; } HWND HWNDForNativeWindow(const gfx::NativeWindow window) { return window && window->GetRootWindow() ? - window->GetRootWindow()->GetAcceleratedWidget() : NULL; + window->GetDispatcher()->GetAcceleratedWidget() : NULL; } gfx::Rect GetWindowBoundsForClientBounds(View* view, const gfx::Rect& client_bounds) { DCHECK(view); - aura::RootWindow* window = - view->GetWidget()->GetNativeWindow()->GetRootWindow(); - if (window) { - HWND hwnd = window->GetAcceleratedWidget(); + aura::WindowEventDispatcher* dispatcher = + view->GetWidget()->GetNativeWindow()->GetDispatcher(); + if (dispatcher) { + HWND hwnd = dispatcher->GetAcceleratedWidget(); RECT rect = client_bounds.ToRECT(); DWORD style = ::GetWindowLong(hwnd, GWL_STYLE); DWORD ex_style = ::GetWindowLong(hwnd, GWL_EXSTYLE); |