diff options
author | ben@chromium.org <ben@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2014-03-04 03:42:27 +0000 |
---|---|---|
committer | ben@chromium.org <ben@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2014-03-04 03:42:27 +0000 |
commit | 2374d1813659c2420eda25c884c5f943b292a64d (patch) | |
tree | 580d99257dd5a9d6a84de4fa70d583d17e985b4c | |
parent | b5126da4daa8f0f0f408afb93e0683f1cf34c82a (diff) | |
download | chromium_src-2374d1813659c2420eda25c884c5f943b292a64d.zip chromium_src-2374d1813659c2420eda25c884c5f943b292a64d.tar.gz chromium_src-2374d1813659c2420eda25c884c5f943b292a64d.tar.bz2 |
Window ownership -> WindowTreeHost
Replaces Window::GetDispatcher with Window::GetHost().
Had to clear ScreenPositionClient property prior to window teardown as tests on desktop delete it prior to destroying the window hierarchy. Unhooking the property appears to have no ill-effect.
R=sky@chromium.org
http://crbug.com/308843
Review URL: https://codereview.chromium.org/184903003
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@254642 0039d316-1c4b-4281-b951-d872f2087c98
123 files changed, 517 insertions, 520 deletions
diff --git a/ash/accelerators/accelerator_controller.cc b/ash/accelerators/accelerator_controller.cc index cae18ff..e7b4251 100644 --- a/ash/accelerators/accelerator_controller.cc +++ b/ash/accelerators/accelerator_controller.cc @@ -560,7 +560,7 @@ bool HandleToggleFullscreen(ui::KeyboardCode key_code) { } bool HandleToggleRootWindowFullScreen() { - Shell::GetPrimaryRootWindow()->GetDispatcher()->host()->ToggleFullScreen(); + Shell::GetPrimaryRootWindow()->GetHost()->ToggleFullScreen(); return true; } @@ -703,7 +703,7 @@ bool HandlePrintLayerHierarchy() { for (size_t i = 0; i < root_windows.size(); ++i) { ui::PrintLayerHierarchy( root_windows[i]->layer(), - root_windows[i]->GetDispatcher()->GetLastMouseLocationInRoot()); + root_windows[i]->GetHost()->dispatcher()->GetLastMouseLocationInRoot()); } return true; } diff --git a/ash/accelerators/accelerator_controller_unittest.cc b/ash/accelerators/accelerator_controller_unittest.cc index 06ce213..77bbe6f 100644 --- a/ash/accelerators/accelerator_controller_unittest.cc +++ b/ash/accelerators/accelerator_controller_unittest.cc @@ -636,7 +636,7 @@ TEST_F(AcceleratorControllerTest, MAYBE_ProcessOnce) { // The accelerator is processed only once. aura::WindowEventDispatcher* dispatcher = - Shell::GetPrimaryRootWindow()->GetDispatcher(); + Shell::GetPrimaryRootWindow()->GetHost()->dispatcher(); #if defined(OS_WIN) MSG msg1 = { NULL, WM_KEYDOWN, ui::VKEY_A, 0 }; ui::TranslatedKeyEvent key_event1(msg1, false); diff --git a/ash/accelerators/key_hold_detector.cc b/ash/accelerators/key_hold_detector.cc index 95ded1a..0908c2c 100644 --- a/ash/accelerators/key_hold_detector.cc +++ b/ash/accelerators/key_hold_detector.cc @@ -27,7 +27,7 @@ void DispatchPressedEvent(XEvent native_event, ui::KeyEvent event(&native_event, false); event.set_flags(event.flags() | ui::EF_IS_SYNTHESIZED); ui::EventDispatchDetails result ALLOW_UNUSED = - target->GetDispatcher()->OnEventFromSource(&event); + target->GetHost()->dispatcher()->OnEventFromSource(&event); } void PostPressedEvent(ui::KeyEvent* event) { diff --git a/ash/accelerators/nested_dispatcher_controller_unittest.cc b/ash/accelerators/nested_dispatcher_controller_unittest.cc index 67f528b..47dcce6b 100644 --- a/ash/accelerators/nested_dispatcher_controller_unittest.cc +++ b/ash/accelerators/nested_dispatcher_controller_unittest.cc @@ -84,11 +84,10 @@ void DispatchKeyReleaseA() { #elif defined(USE_X11) ui::ScopedXI2Event native_event; native_event.InitKeyEvent(ui::ET_KEY_PRESSED, ui::VKEY_A, 0); - aura::WindowEventDispatcher* dispatcher = - ash::Shell::GetPrimaryRootWindow()->GetDispatcher(); - dispatcher->host()->PostNativeEvent(native_event); + aura::WindowTreeHost* host = ash::Shell::GetPrimaryRootWindow()->GetHost(); + host->PostNativeEvent(native_event); native_event.InitKeyEvent(ui::ET_KEY_RELEASED, ui::VKEY_A, 0); - dispatcher->host()->PostNativeEvent(native_event); + host->PostNativeEvent(native_event); #endif // Make sure the inner message-loop terminates after dispatching the events. base::MessageLoop::current()->PostTask(FROM_HERE, diff --git a/ash/autoclick/autoclick_controller.cc b/ash/autoclick/autoclick_controller.cc index 062a9c3..dd5e4a0 100644 --- a/ash/autoclick/autoclick_controller.cc +++ b/ash/autoclick/autoclick_controller.cc @@ -186,8 +186,8 @@ void AutoclickControllerImpl::DoAutoclick() { anchor_location_ = click_location; wm::ConvertPointFromScreen(root_window, &click_location); - aura::WindowEventDispatcher* dispatcher = root_window->GetDispatcher(); - dispatcher->host()->ConvertPointToHost(&click_location); + aura::WindowTreeHost* host = root_window->GetHost(); + host->ConvertPointToHost(&click_location); ui::MouseEvent press_event(ui::ET_MOUSE_PRESSED, click_location, @@ -201,9 +201,9 @@ void AutoclickControllerImpl::DoAutoclick() { ui::EF_LEFT_MOUSE_BUTTON); ui::EventDispatchDetails details = - dispatcher->OnEventFromSource(&press_event); + host->dispatcher()->OnEventFromSource(&press_event); if (!details.dispatcher_destroyed) - details = dispatcher->OnEventFromSource(&release_event); + details = host->dispatcher()->OnEventFromSource(&release_event); if (details.dispatcher_destroyed) return; } diff --git a/ash/debug.cc b/ash/debug.cc index 68ff590..d72b58f 100644 --- a/ash/debug.cc +++ b/ash/debug.cc @@ -18,7 +18,7 @@ void ToggleShowDebugBorders() { scoped_ptr<bool> value; for (aura::Window::Windows::iterator it = root_windows.begin(); it != root_windows.end(); ++it) { - ui::Compositor* compositor = (*it)->GetDispatcher()->host()->compositor(); + ui::Compositor* compositor = (*it)->GetHost()->compositor(); cc::LayerTreeDebugState state = compositor->GetLayerTreeDebugState(); if (!value.get()) value.reset(new bool(!state.show_debug_borders)); @@ -33,7 +33,7 @@ void ToggleShowFpsCounter() { scoped_ptr<bool> value; for (aura::Window::Windows::iterator it = root_windows.begin(); it != root_windows.end(); ++it) { - ui::Compositor* compositor = (*it)->GetDispatcher()->host()->compositor(); + ui::Compositor* compositor = (*it)->GetHost()->compositor(); cc::LayerTreeDebugState state = compositor->GetLayerTreeDebugState(); if (!value.get()) value.reset(new bool(!state.show_fps_counter)); @@ -48,7 +48,7 @@ void ToggleShowPaintRects() { scoped_ptr<bool> value; for (aura::Window::Windows::iterator it = root_windows.begin(); it != root_windows.end(); ++it) { - ui::Compositor* compositor = (*it)->GetDispatcher()->host()->compositor(); + ui::Compositor* compositor = (*it)->GetHost()->compositor(); cc::LayerTreeDebugState state = compositor->GetLayerTreeDebugState(); if (!value.get()) value.reset(new bool(!state.show_paint_rects)); diff --git a/ash/display/cursor_window_controller.cc b/ash/display/cursor_window_controller.cc index 10ccd14..05f242d 100644 --- a/ash/display/cursor_window_controller.cc +++ b/ash/display/cursor_window_controller.cc @@ -147,8 +147,7 @@ void CursorWindowController::UpdateLocation() { gfx::Point point = aura::Env::GetInstance()->last_mouse_location(); if (!is_cursor_compositing_enabled_) { - Shell::GetPrimaryRootWindow()->GetDispatcher()->host()->ConvertPointToHost( - &point); + Shell::GetPrimaryRootWindow()->GetHost()->ConvertPointToHost(&point); } else { point.Offset(-bounds_in_screen_.x(), -bounds_in_screen_.y()); } diff --git a/ash/display/display_controller.cc b/ash/display/display_controller.cc index 43a457b..2b85a39 100644 --- a/ash/display/display_controller.cc +++ b/ash/display/display_controller.cc @@ -517,13 +517,13 @@ void DisplayController::EnsurePointerInDisplays() { aura::client::ScreenPositionClient* client = aura::client::GetScreenPositionClient(root_window); client->ConvertPointFromScreen(root_window, ¢er); - root_window->GetDispatcher()->host()->ConvertPointToNativeScreen(¢er); + root_window->GetHost()->ConvertPointToNativeScreen(¢er); dst_root_window = root_window; target_location_in_native = center; closest_distance_squared = distance_squared; } } - dst_root_window->GetDispatcher()->host()->ConvertPointFromNativeScreen( + dst_root_window->GetHost()->ConvertPointFromNativeScreen( &target_location_in_native); dst_root_window->MoveCursorTo(target_location_in_native); } @@ -542,10 +542,9 @@ void DisplayController::OnDisplayBoundsChanged(const gfx::Display& display) { const internal::DisplayInfo& display_info = GetDisplayManager()->GetDisplayInfo(display.id()); DCHECK(!display_info.bounds_in_native().IsEmpty()); - aura::WindowEventDispatcher* dispatcher = - root_windows_[display.id()]->GetDispatcher(); - dispatcher->host()->SetBounds(display_info.bounds_in_native()); - SetDisplayPropertiesOnHost(dispatcher->host(), display); + aura::WindowTreeHost* host = root_windows_[display.id()]->GetHost(); + host->SetBounds(display_info.bounds_in_native()); + SetDisplayPropertiesOnHost(host, display); } void DisplayController::OnDisplayAdded(const gfx::Display& display) { @@ -558,10 +557,9 @@ void DisplayController::OnDisplayAdded(const gfx::Display& display) { primary_root_window_for_replace_ = NULL; const internal::DisplayInfo& display_info = GetDisplayManager()->GetDisplayInfo(display.id()); - aura::WindowEventDispatcher* dispatcher = - root_windows_[display.id()]->GetDispatcher(); - dispatcher->host()->SetBounds(display_info.bounds_in_native()); - SetDisplayPropertiesOnHost(dispatcher->host(), display); + aura::WindowTreeHost* host = root_windows_[display.id()]->GetHost(); + host->SetBounds(display_info.bounds_in_native()); + SetDisplayPropertiesOnHost(host, display); } else { if (primary_display_id == gfx::Display::kInvalidDisplayID) primary_display_id = display.id(); @@ -664,8 +662,7 @@ void DisplayController::PreDisplayConfigurationChange(bool clear_focus) { aura::client::ScreenPositionClient* client = aura::client::GetScreenPositionClient(root_window); client->ConvertPointFromScreen(root_window, &point_in_screen); - root_window->GetDispatcher()->host()->ConvertPointToNativeScreen( - &point_in_screen); + root_window->GetHost()->ConvertPointToNativeScreen(&point_in_screen); cursor_location_in_native_coords_for_restore_ = point_in_screen; } @@ -748,7 +745,7 @@ void DisplayController::UpdateHostWindowNames() { std::string name = root_windows[i] == primary ? "aura_root_0" : "aura_root_x"; gfx::AcceleratedWidget xwindow = - root_windows[i]->GetDispatcher()->host()->GetAcceleratedWidget(); + root_windows[i]->GetHost()->GetAcceleratedWidget(); XStoreName(gfx::GetXDisplay(), xwindow, name.c_str()); } #endif diff --git a/ash/display/display_controller_unittest.cc b/ash/display/display_controller_unittest.cc index bf2eeb3..4e75ed2 100644 --- a/ash/display/display_controller_unittest.cc +++ b/ash/display/display_controller_unittest.cc @@ -964,11 +964,11 @@ TEST_F(DisplayControllerTest, CursorDeviceScaleFactorSwapPrimary) { test::CursorManagerTestApi test_api(Shell::GetInstance()->cursor_manager()); - EXPECT_EQ(1.0f, primary_root->GetDispatcher()->host()->compositor()-> + EXPECT_EQ(1.0f, primary_root->GetHost()->compositor()-> device_scale_factor()); primary_root->MoveCursorTo(gfx::Point(50, 50)); EXPECT_EQ(1.0f, test_api.GetDisplay().device_scale_factor()); - EXPECT_EQ(2.0f, secondary_root->GetDispatcher()->host()->compositor()-> + EXPECT_EQ(2.0f, secondary_root->GetHost()->compositor()-> device_scale_factor()); secondary_root->MoveCursorTo(gfx::Point(50, 50)); EXPECT_EQ(2.0f, test_api.GetDisplay().device_scale_factor()); @@ -978,12 +978,12 @@ 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->GetDispatcher()->host()->compositor()-> + EXPECT_EQ(1.0f, secondary_root->GetHost()->compositor()-> device_scale_factor()); 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->GetDispatcher()->host()->compositor()-> + EXPECT_EQ(2.0f, primary_root->GetHost()->compositor()-> device_scale_factor()); EXPECT_EQ(2.0f, test_api.GetDisplay().device_scale_factor()); @@ -995,7 +995,7 @@ 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->GetDispatcher()->host()->compositor()-> + EXPECT_EQ(1.0f, primary_root->GetHost()->compositor()-> device_scale_factor()); EXPECT_EQ(1.0f, test_api.GetDisplay().device_scale_factor()); } @@ -1037,13 +1037,13 @@ TEST_F(DisplayControllerTest, OverscanInsets) { UpdateDisplay("400x300*2,600x400/o"); root_windows = Shell::GetAllRootWindows(); gfx::Point point; - Shell::GetAllRootWindows()[1]->GetDispatcher()->host()-> + Shell::GetAllRootWindows()[1]->GetHost()-> GetRootTransform().TransformPoint(&point); EXPECT_EQ("15,10", point.ToString()); display_controller->SwapPrimaryDisplay(); point.SetPoint(0, 0); - Shell::GetAllRootWindows()[1]->GetDispatcher()->host()-> + Shell::GetAllRootWindows()[1]->GetHost()-> GetRootTransform().TransformPoint(&point); EXPECT_EQ("15,10", point.ToString()); @@ -1296,7 +1296,7 @@ TEST_F(DisplayControllerTest, DockToSingle) { display_info_list.push_back(external_display_info); display_manager->OnNativeDisplaysChanged(display_info_list); EXPECT_EQ(1U, display_manager->GetNumDisplays()); - EXPECT_FALSE(Shell::GetPrimaryRootWindow()->GetDispatcher()->host()-> + EXPECT_FALSE(Shell::GetPrimaryRootWindow()->GetHost()-> GetRootTransform().IsIdentityOrIntegerTranslation()); // Switch to single mode and make sure the transform is the one @@ -1304,33 +1304,33 @@ TEST_F(DisplayControllerTest, DockToSingle) { display_info_list.clear(); display_info_list.push_back(internal_display_info); display_manager->OnNativeDisplaysChanged(display_info_list); - EXPECT_TRUE(Shell::GetPrimaryRootWindow()->GetDispatcher()->host()-> + EXPECT_TRUE(Shell::GetPrimaryRootWindow()->GetHost()-> GetRootTransform().IsIdentityOrIntegerTranslation()); } #if defined(USE_X11) TEST_F(DisplayControllerTest, XWidowNameForRootWindow) { EXPECT_EQ("aura_root_0", GetXWindowName( - Shell::GetPrimaryRootWindow()->GetDispatcher()->host())); + Shell::GetPrimaryRootWindow()->GetHost())); // Multiple display. UpdateDisplay("200x200,300x300"); aura::Window* primary, *secondary; GetPrimaryAndSeconary(&primary, &secondary); - EXPECT_EQ("aura_root_0", GetXWindowName(primary->GetDispatcher()->host())); - EXPECT_EQ("aura_root_x", GetXWindowName(secondary->GetDispatcher()->host())); + EXPECT_EQ("aura_root_0", GetXWindowName(primary->GetHost())); + EXPECT_EQ("aura_root_x", GetXWindowName(secondary->GetHost())); // Swap primary. primary = secondary = NULL; Shell::GetInstance()->display_controller()->SwapPrimaryDisplay(); GetPrimaryAndSeconary(&primary, &secondary); - EXPECT_EQ("aura_root_0", GetXWindowName(primary->GetDispatcher()->host())); - EXPECT_EQ("aura_root_x", GetXWindowName(secondary->GetDispatcher()->host())); + EXPECT_EQ("aura_root_0", GetXWindowName(primary->GetHost())); + EXPECT_EQ("aura_root_x", GetXWindowName(secondary->GetHost())); // Switching back to single display. UpdateDisplay("300x400"); EXPECT_EQ("aura_root_0", GetXWindowName( - Shell::GetPrimaryRootWindow()->GetDispatcher()->host())); + Shell::GetPrimaryRootWindow()->GetHost())); } #endif diff --git a/ash/display/display_manager_unittest.cc b/ash/display/display_manager_unittest.cc index 70d2c18..c798b3d 100644 --- a/ash/display/display_manager_unittest.cc +++ b/ash/display/display_manager_unittest.cc @@ -384,13 +384,12 @@ TEST_F(DisplayManagerTest, TestDeviceScaleOnlyChange) { return; UpdateDisplay("1000x600"); - aura::WindowEventDispatcher* dispatcher = - Shell::GetPrimaryRootWindow()->GetDispatcher(); - EXPECT_EQ(1, dispatcher->host()->compositor()->device_scale_factor()); + aura::WindowTreeHost* host = Shell::GetPrimaryRootWindow()->GetHost(); + EXPECT_EQ(1, host->compositor()->device_scale_factor()); EXPECT_EQ("1000x600", Shell::GetPrimaryRootWindow()->bounds().size().ToString()); UpdateDisplay("1000x600*2"); - EXPECT_EQ(2, dispatcher->host()->compositor()->device_scale_factor()); + EXPECT_EQ(2, host->compositor()->device_scale_factor()); EXPECT_EQ("500x300", Shell::GetPrimaryRootWindow()->bounds().size().ToString()); } @@ -592,8 +591,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()->GetDispatcher()-> - host()->GetBounds().size().ToString()); + EXPECT_EQ("100x100", ash::Shell::GetPrimaryRootWindow()->GetHost()-> + GetBounds().size().ToString()); } #if defined(OS_WIN) @@ -1014,14 +1013,14 @@ class TestDisplayObserver : public gfx::DisplayObserver { } virtual void OnDisplayAdded(const gfx::Display& new_display) OVERRIDE { // Mirror window should already be delete before restoring - // the external dispay. - EXPECT_FALSE(test_api.GetDispatcher()); + // the external display. + EXPECT_FALSE(test_api.GetHost()); changed_ = true; } virtual void OnDisplayRemoved(const gfx::Display& old_display) OVERRIDE { // Mirror window should not be created until the external display // is removed. - EXPECT_FALSE(test_api.GetDispatcher()); + EXPECT_FALSE(test_api.GetHost()); changed_ = true; } @@ -1045,7 +1044,7 @@ TEST_F(DisplayManagerTest, SoftwareMirroring) { UpdateDisplay("300x400,400x500"); test::MirrorWindowTestApi test_api; - EXPECT_EQ(NULL, test_api.GetDispatcher()); + EXPECT_EQ(NULL, test_api.GetHost()); TestDisplayObserver display_observer; Shell::GetScreen()->AddObserver(&display_observer); @@ -1057,15 +1056,14 @@ TEST_F(DisplayManagerTest, SoftwareMirroring) { EXPECT_EQ(1U, display_manager->GetNumDisplays()); EXPECT_EQ("0,0 300x400", Shell::GetScreen()->GetPrimaryDisplay().bounds().ToString()); - EXPECT_EQ("400x500", - test_api.GetDispatcher()->host()->GetBounds().size().ToString()); + EXPECT_EQ("400x500", test_api.GetHost()->GetBounds().size().ToString()); EXPECT_EQ("300x400", - test_api.GetDispatcher()->window()->bounds().size().ToString()); + test_api.GetHost()->window()->bounds().size().ToString()); EXPECT_TRUE(display_manager->IsMirrored()); display_manager->SetMirrorMode(false); EXPECT_TRUE(display_observer.changed_and_reset()); - EXPECT_EQ(NULL, test_api.GetDispatcher()); + EXPECT_EQ(NULL, test_api.GetHost()); EXPECT_EQ(2U, display_manager->GetNumDisplays()); EXPECT_FALSE(display_manager->IsMirrored()); @@ -1077,28 +1075,28 @@ TEST_F(DisplayManagerTest, SoftwareMirroring) { UpdateDisplay("300x400@0.5,400x500"); EXPECT_FALSE(display_observer.changed_and_reset()); EXPECT_EQ("300x400", - test_api.GetDispatcher()->window()->bounds().size().ToString()); + test_api.GetHost()->window()->bounds().size().ToString()); UpdateDisplay("310x410*2,400x500"); EXPECT_FALSE(display_observer.changed_and_reset()); EXPECT_EQ("310x410", - test_api.GetDispatcher()->window()->bounds().size().ToString()); + test_api.GetHost()->window()->bounds().size().ToString()); UpdateDisplay("320x420/r,400x500"); EXPECT_FALSE(display_observer.changed_and_reset()); EXPECT_EQ("320x420", - test_api.GetDispatcher()->window()->bounds().size().ToString()); + test_api.GetHost()->window()->bounds().size().ToString()); UpdateDisplay("330x440/r,400x500"); EXPECT_FALSE(display_observer.changed_and_reset()); EXPECT_EQ("330x440", - test_api.GetDispatcher()->window()->bounds().size().ToString()); + test_api.GetHost()->window()->bounds().size().ToString()); // Overscan insets are ignored. UpdateDisplay("400x600/o,600x800/o"); EXPECT_FALSE(display_observer.changed_and_reset()); EXPECT_EQ("400x600", - test_api.GetDispatcher()->window()->bounds().size().ToString()); + test_api.GetHost()->window()->bounds().size().ToString()); Shell::GetScreen()->RemoveObserver(&display_observer); } @@ -1168,35 +1166,35 @@ TEST_F(DisplayManagerTest, MAYBE_UpdateDisplayWithHostOrigin) { aura::Window::Windows root_windows = Shell::GetInstance()->GetAllRootWindows(); ASSERT_EQ(2U, root_windows.size()); - aura::WindowEventDispatcher* dispatcher0 = root_windows[0]->GetDispatcher(); - aura::WindowEventDispatcher* dispatcher1 = root_windows[1]->GetDispatcher(); + aura::WindowTreeHost* host0 = root_windows[0]->GetHost(); + aura::WindowTreeHost* host1 = root_windows[1]->GetHost(); - EXPECT_EQ("1,1", dispatcher0->host()->GetBounds().origin().ToString()); - EXPECT_EQ("100x200", dispatcher0->host()->GetBounds().size().ToString()); + EXPECT_EQ("1,1", host0->GetBounds().origin().ToString()); + EXPECT_EQ("100x200", host0->GetBounds().size().ToString()); // UpdateDisplay set the origin if it's not set. - EXPECT_NE("1,1", dispatcher1->host()->GetBounds().origin().ToString()); - EXPECT_EQ("300x400", dispatcher1->host()->GetBounds().size().ToString()); + EXPECT_NE("1,1", host1->GetBounds().origin().ToString()); + EXPECT_EQ("300x400", host1->GetBounds().size().ToString()); UpdateDisplay("100x200,200+300-300x400"); ASSERT_EQ(2, Shell::GetScreen()->GetNumDisplays()); - EXPECT_EQ("0,0", dispatcher0->host()->GetBounds().origin().ToString()); - EXPECT_EQ("100x200", dispatcher0->host()->GetBounds().size().ToString()); - EXPECT_EQ("200,300", dispatcher1->host()->GetBounds().origin().ToString()); - EXPECT_EQ("300x400", dispatcher1->host()->GetBounds().size().ToString()); + EXPECT_EQ("0,0", host0->GetBounds().origin().ToString()); + EXPECT_EQ("100x200", host0->GetBounds().size().ToString()); + EXPECT_EQ("200,300", host1->GetBounds().origin().ToString()); + EXPECT_EQ("300x400", host1->GetBounds().size().ToString()); UpdateDisplay("400+500-200x300,300x400"); ASSERT_EQ(2, Shell::GetScreen()->GetNumDisplays()); - EXPECT_EQ("400,500", dispatcher0->host()->GetBounds().origin().ToString()); - EXPECT_EQ("200x300", dispatcher0->host()->GetBounds().size().ToString()); - EXPECT_EQ("0,0", dispatcher1->host()->GetBounds().origin().ToString()); - EXPECT_EQ("300x400", dispatcher1->host()->GetBounds().size().ToString()); + EXPECT_EQ("400,500", host0->GetBounds().origin().ToString()); + EXPECT_EQ("200x300", host0->GetBounds().size().ToString()); + EXPECT_EQ("0,0", host1->GetBounds().origin().ToString()); + EXPECT_EQ("300x400", host1->GetBounds().size().ToString()); UpdateDisplay("100+200-100x200,300+500-200x300"); ASSERT_EQ(2, Shell::GetScreen()->GetNumDisplays()); - EXPECT_EQ("100,200", dispatcher0->host()->GetBounds().origin().ToString()); - EXPECT_EQ("100x200", dispatcher0->host()->GetBounds().size().ToString()); - EXPECT_EQ("300,500", dispatcher1->host()->GetBounds().origin().ToString()); - EXPECT_EQ("200x300", dispatcher1->host()->GetBounds().size().ToString()); + EXPECT_EQ("100,200", host0->GetBounds().origin().ToString()); + EXPECT_EQ("100x200", host0->GetBounds().size().ToString()); + EXPECT_EQ("300,500", host1->GetBounds().origin().ToString()); + EXPECT_EQ("200x300", host1->GetBounds().size().ToString()); } diff --git a/ash/display/mirror_window_controller.cc b/ash/display/mirror_window_controller.cc index 6b1c69e..7902048 100644 --- a/ash/display/mirror_window_controller.cc +++ b/ash/display/mirror_window_controller.cc @@ -110,7 +110,7 @@ void MirrorWindowController::UpdateWindow(const DisplayInfo& display_info) { mirror_window->SetBounds(host_->window()->bounds()); mirror_window->Show(); reflector_ = ui::ContextFactory::GetInstance()->CreateReflector( - Shell::GetPrimaryRootWindow()->GetDispatcher()->host()->compositor(), + Shell::GetPrimaryRootWindow()->GetHost()->compositor(), mirror_window->layer()); } else { GetRootWindowSettings(host_->window())->display_id = display_info.id(); diff --git a/ash/display/mirror_window_controller_unittest.cc b/ash/display/mirror_window_controller_unittest.cc index dc3c357..a64a6aa 100644 --- a/ash/display/mirror_window_controller_unittest.cc +++ b/ash/display/mirror_window_controller_unittest.cc @@ -284,7 +284,7 @@ TEST_F(MirrorOnBootTest, MAYBE_MirrorOnBoot) { EXPECT_TRUE(display_manager->IsMirrored()); RunAllPendingInMessageLoop(); test::MirrorWindowTestApi test_api; - EXPECT_TRUE(test_api.GetDispatcher()); + EXPECT_TRUE(test_api.GetHost()); } } // namsspace internal diff --git a/ash/display/screen_position_controller.cc b/ash/display/screen_position_controller.cc index 13681c0..54f106c 100644 --- a/ash/display/screen_position_controller.cc +++ b/ash/display/screen_position_controller.cc @@ -92,18 +92,16 @@ std::pair<aura::Window*, gfx::Point> GetRootWindowRelativeToWindow( // extended root window's coordinates. gfx::Point location_in_native(location_in_root); - root_window->GetDispatcher()->host()->ConvertPointToNativeScreen( - &location_in_native); + root_window->GetHost()->ConvertPointToNativeScreen(&location_in_native); aura::Window::Windows root_windows = Shell::GetAllRootWindows(); for (size_t i = 0; i < root_windows.size(); ++i) { - aura::WindowEventDispatcher* dispatcher = - root_windows[i]->GetDispatcher(); - const gfx::Rect native_bounds = dispatcher->host()->GetBounds(); + aura::WindowTreeHost* host = root_windows[i]->GetHost(); + const gfx::Rect native_bounds = host->GetBounds(); if (native_bounds.Contains(location_in_native)) { root_window = root_windows[i]; location_in_root = location_in_native; - dispatcher->host()->ConvertPointFromNativeScreen(&location_in_root); + host->ConvertPointFromNativeScreen(&location_in_root); break; } } @@ -143,7 +141,7 @@ void ScreenPositionController::ConvertHostPointToScreen( aura::Window* root_window, gfx::Point* point) { aura::Window* root = root_window->GetRootWindow(); - root->GetDispatcher()->host()->ConvertPointFromHost(point); + root->GetHost()->ConvertPointFromHost(point); std::pair<aura::Window*, gfx::Point> pair = GetRootWindowRelativeToWindow(root, *point); *point = pair.second; diff --git a/ash/display/screen_position_controller_unittest.cc b/ash/display/screen_position_controller_unittest.cc index d51ec0a..347ff7f 100644 --- a/ash/display/screen_position_controller_unittest.cc +++ b/ash/display/screen_position_controller_unittest.cc @@ -89,14 +89,14 @@ TEST_F(ScreenPositionControllerTest, MAYBE_ConvertHostPointToScreen) { aura::Window::Windows root_windows = Shell::GetInstance()->GetAllRootWindows(); - EXPECT_EQ("100,100", root_windows[0]->GetDispatcher()->host()-> - GetBounds().origin().ToString()); - EXPECT_EQ("200x200", root_windows[0]->GetDispatcher()->host()-> - GetBounds().size().ToString()); - EXPECT_EQ("100,500", root_windows[1]->GetDispatcher()->host()-> - GetBounds().origin().ToString()); - EXPECT_EQ("200x200", root_windows[1]->GetDispatcher()->host()-> - GetBounds().size().ToString()); + EXPECT_EQ("100,100", + root_windows[0]->GetHost()->GetBounds().origin().ToString()); + EXPECT_EQ("200x200", + root_windows[0]->GetHost()->GetBounds().size().ToString()); + EXPECT_EQ("100,500", + root_windows[1]->GetHost()->GetBounds().origin().ToString()); + EXPECT_EQ("200x200", + root_windows[1]->GetHost()->GetBounds().size().ToString()); const gfx::Point window_pos(100, 100); window_->SetBoundsInScreen( @@ -178,16 +178,16 @@ TEST_F(ScreenPositionControllerTest, MAYBE_ConvertHostPointToScreenHiDPI) { aura::Window::Windows root_windows = Shell::GetInstance()->GetAllRootWindows(); EXPECT_EQ("100,100", - root_windows[0]->GetDispatcher()->host()-> + root_windows[0]->GetHost()-> GetBounds().origin().ToString()); EXPECT_EQ("200x200", - root_windows[0]->GetDispatcher()->host()-> + root_windows[0]->GetHost()-> GetBounds().size().ToString()); EXPECT_EQ("100,500", - root_windows[1]->GetDispatcher()->host()-> + root_windows[1]->GetHost()-> GetBounds().origin().ToString()); EXPECT_EQ("200x200", - root_windows[1]->GetDispatcher()->host()-> + root_windows[1]->GetHost()-> GetBounds().size().ToString()); // Put |window_| to the primary 2x display. diff --git a/ash/drag_drop/drag_drop_controller_unittest.cc b/ash/drag_drop/drag_drop_controller_unittest.cc index 85821a7..4a3e9a8 100644 --- a/ash/drag_drop/drag_drop_controller_unittest.cc +++ b/ash/drag_drop/drag_drop_controller_unittest.cc @@ -283,7 +283,7 @@ void DispatchGesture(ui::EventType gesture_type, gfx::Point location) { ui::EventTimeForNow(), ui::GestureEventDetails(gesture_type, 0, 0), 1); - Shell::GetPrimaryRootWindow()->GetDispatcher()->DispatchGestureEvent( + Shell::GetPrimaryRootWindow()->GetHost()->dispatcher()->DispatchGestureEvent( &gesture_event); } @@ -738,7 +738,7 @@ TEST_F(DragDropControllerTest, SyntheticEventsDuringDragDrop) { ui::MouseEvent mouse_move(ui::ET_MOUSE_MOVED, mouse_move_location, mouse_move_location, 0, 0); ui::EventDispatchDetails details = Shell::GetPrimaryRootWindow()-> - GetDispatcher()->OnEventFromSource(&mouse_move); + GetHost()->dispatcher()->OnEventFromSource(&mouse_move); ASSERT_FALSE(details.dispatcher_destroyed); } diff --git a/ash/extended_desktop_unittest.cc b/ash/extended_desktop_unittest.cc index 4276b5d..600cdef 100644 --- a/ash/extended_desktop_unittest.cc +++ b/ash/extended_desktop_unittest.cc @@ -252,15 +252,13 @@ TEST_F(ExtendedDesktopTest, TestCursor) { UpdateDisplay("1000x600,600x400"); aura::Window::Windows root_windows = Shell::GetAllRootWindows(); - aura::WindowEventDispatcher* dispatcher0 = root_windows[0]->GetDispatcher(); - aura::WindowEventDispatcher* dispatcher1 = root_windows[1]->GetDispatcher(); - EXPECT_EQ(ui::kCursorPointer, - dispatcher0->host()->last_cursor().native_type()); - EXPECT_EQ(ui::kCursorPointer, - dispatcher1->host()->last_cursor().native_type()); + aura::WindowTreeHost* host0 = root_windows[0]->GetHost(); + aura::WindowTreeHost* host1 = root_windows[1]->GetHost(); + EXPECT_EQ(ui::kCursorPointer, host0->last_cursor().native_type()); + EXPECT_EQ(ui::kCursorPointer, host1->last_cursor().native_type()); Shell::GetInstance()->cursor_manager()->SetCursor(ui::kCursorCopy); - EXPECT_EQ(ui::kCursorCopy, dispatcher0->host()->last_cursor().native_type()); - EXPECT_EQ(ui::kCursorCopy, dispatcher1->host()->last_cursor().native_type()); + EXPECT_EQ(ui::kCursorCopy, host0->last_cursor().native_type()); + EXPECT_EQ(ui::kCursorCopy, host1->last_cursor().native_type()); } TEST_F(ExtendedDesktopTest, TestCursorLocation) { @@ -790,13 +788,15 @@ TEST_F(ExtendedDesktopTest, KeyEventsOnLockScreen) { // The lock window should get events on both root windows. aura::test::EventGenerator& event_generator(GetEventGenerator()); - event_generator.set_current_dispatcher(root_windows[0]->GetDispatcher()); + event_generator.set_current_dispatcher( + root_windows[0]->GetHost()->dispatcher()); event_generator.PressKey(ui::VKEY_A, 0); event_generator.ReleaseKey(ui::VKEY_A, 0); EXPECT_EQ(lock_widget->GetNativeView(), focus_client->GetFocusedWindow()); EXPECT_EQ("a", UTF16ToASCII(textfield->text())); - event_generator.set_current_dispatcher(root_windows[1]->GetDispatcher()); + event_generator.set_current_dispatcher( + root_windows[1]->GetHost()->dispatcher()); event_generator.PressKey(ui::VKEY_B, 0); event_generator.ReleaseKey(ui::VKEY_B, 0); EXPECT_EQ(lock_widget->GetNativeView(), focus_client->GetFocusedWindow()); @@ -813,13 +813,15 @@ TEST_F(ExtendedDesktopTest, KeyEventsOnLockScreen) { // on both root windows. UpdateDisplay("100x100,200x200"); root_windows = Shell::GetAllRootWindows(); - event_generator.set_current_dispatcher(root_windows[0]->GetDispatcher()); + event_generator.set_current_dispatcher( + root_windows[0]->GetHost()->dispatcher()); event_generator.PressKey(ui::VKEY_D, 0); event_generator.ReleaseKey(ui::VKEY_D, 0); EXPECT_EQ(lock_widget->GetNativeView(), focus_client->GetFocusedWindow()); EXPECT_EQ("abcd", UTF16ToASCII(textfield->text())); - event_generator.set_current_dispatcher(root_windows[1]->GetDispatcher()); + event_generator.set_current_dispatcher( + root_windows[1]->GetHost()->dispatcher()); event_generator.PressKey(ui::VKEY_E, 0); event_generator.ReleaseKey(ui::VKEY_E, 0); EXPECT_EQ(lock_widget->GetNativeView(), focus_client->GetFocusedWindow()); diff --git a/ash/magnifier/magnification_controller.cc b/ash/magnifier/magnification_controller.cc index 1ffec45..36fb741 100644 --- a/ash/magnifier/magnification_controller.cc +++ b/ash/magnifier/magnification_controller.cc @@ -272,8 +272,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_->GetDispatcher()->host()->SetRootWindowTransformer( - transformer.Pass()); + root_window_->GetHost()->SetRootWindowTransformer(transformer.Pass()); if (animate) is_on_animation_ = true; @@ -361,7 +360,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_->GetDispatcher()->host(), mouse); + MoveCursorTo(root_window_->GetHost(), mouse); } } } @@ -418,8 +417,7 @@ void MagnificationControllerImpl::OnImplicitAnimationsCompleted() { return; if (move_cursor_after_animation_) { - MoveCursorTo(root_window_->GetDispatcher()->host(), - position_after_animation_); + MoveCursorTo(root_window_->GetHost(), position_after_animation_); move_cursor_after_animation_ = false; aura::client::CursorClient* cursor_client = diff --git a/ash/magnifier/magnification_controller_unittest.cc b/ash/magnifier/magnification_controller_unittest.cc index 98a6b08..889b0a8 100644 --- a/ash/magnifier/magnification_controller_unittest.cc +++ b/ash/magnifier/magnification_controller_unittest.cc @@ -55,7 +55,7 @@ class MagnificationControllerTest: public test::AshTestBase { std::string GetHostMouseLocation() { gfx::Point point; - GetRootWindow()->GetDispatcher()->host()->QueryMouseLocation(&point); + GetRootWindow()->GetHost()->QueryMouseLocation(&point); return point.ToString(); } diff --git a/ash/magnifier/partial_magnification_controller.cc b/ash/magnifier/partial_magnification_controller.cc index 681e443..4bc16b0 100644 --- a/ash/magnifier/partial_magnification_controller.cc +++ b/ash/magnifier/partial_magnification_controller.cc @@ -137,7 +137,8 @@ void PartialMagnificationController::CreateMagnifierWindow() { root_window->AddObserver(this); - gfx::Point mouse(root_window->GetDispatcher()->GetLastMouseLocationInRoot()); + gfx::Point mouse( + root_window->GetHost()->dispatcher()->GetLastMouseLocationInRoot()); zoom_widget_ = new views::Widget; views::Widget::InitParams params( @@ -202,7 +203,7 @@ aura::Window* PartialMagnificationController::GetCurrentRootWindow() { iter != root_windows.end(); ++iter) { aura::Window* root_window = *iter; if (root_window->ContainsPointInRoot( - root_window->GetDispatcher()->GetLastMouseLocationInRoot())) + root_window->GetHost()->dispatcher()->GetLastMouseLocationInRoot())) return root_window; } return NULL; diff --git a/ash/root_window_controller.cc b/ash/root_window_controller.cc index 0fbc980..06687e4 100644 --- a/ash/root_window_controller.cc +++ b/ash/root_window_controller.cc @@ -49,6 +49,7 @@ #include "base/time/time.h" #include "ui/aura/client/aura_constants.h" #include "ui/aura/client/drag_drop_client.h" +#include "ui/aura/client/screen_position_client.h" #include "ui/aura/client/tooltip_client.h" #include "ui/aura/window.h" #include "ui/aura/window_delegate.h" @@ -357,6 +358,7 @@ void RootWindowController::Shutdown() { dispatcher()->PrepareForShutdown(); system_background_.reset(); + aura::client::SetScreenPositionClient(root_window(), NULL); } SystemModalContainerLayoutManager* diff --git a/ash/shell.cc b/ash/shell.cc index de42e8a..d0cf6ec 100644 --- a/ash/shell.cc +++ b/ash/shell.cc @@ -864,7 +864,7 @@ void Shell::Init() { AddShellObserver(overlay_filter_.get()); input_method_filter_.reset(new views::corewm::InputMethodEventFilter( - root_window->GetDispatcher()->host()->GetAcceleratedWidget())); + root_window->GetHost()->GetAcceleratedWidget())); AddPreTargetHandler(input_method_filter_.get()); accelerator_filter_.reset(new internal::AcceleratorFilter); @@ -964,7 +964,7 @@ void Shell::Init() { // initialize controller/delegates above when initializing the // primary root window controller. internal::RootWindowController::CreateForPrimaryDisplay( - root_window->GetDispatcher()->host()); + root_window->GetHost()); display_controller_->InitSecondaryDisplays(); diff --git a/ash/shell/content_client/shell_browser_main_parts.cc b/ash/shell/content_client/shell_browser_main_parts.cc index 50622f4..42eee00 100644 --- a/ash/shell/content_client/shell_browser_main_parts.cc +++ b/ash/shell/content_client/shell_browser_main_parts.cc @@ -137,7 +137,7 @@ void ShellBrowserMainParts::PreMainMessageLoopRun() { Shell::GetInstance()->desktop_background_controller()->SetDefaultWallpaper( false /* is_guest */); - ash::Shell::GetPrimaryRootWindow()->GetDispatcher()->host()->Show(); + ash::Shell::GetPrimaryRootWindow()->GetHost()->Show(); } void ShellBrowserMainParts::PostMainMessageLoopRun() { diff --git a/ash/shell/window_watcher_unittest.cc b/ash/shell/window_watcher_unittest.cc index 25a26ec..b6fe61b 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()->GetDispatcher()->host()->Show(); + Shell::GetPrimaryRootWindow()->GetHost()->Show(); Shell::GetInstance()->CreateShelf(); Shell::GetInstance()->UpdateAfterLoginStatusChange( user::LOGGED_IN_USER); diff --git a/ash/shell_unittest.cc b/ash/shell_unittest.cc index f13cbf6..7dd9246 100644 --- a/ash/shell_unittest.cc +++ b/ash/shell_unittest.cc @@ -398,9 +398,8 @@ TEST_F(ShellTest, ManagedWindowModeBasics) { EXPECT_TRUE(shelf_widget->IsVisible()); // Shelf is at bottom-left of screen. EXPECT_EQ(0, shelf_widget->GetWindowBoundsInScreen().x()); - EXPECT_EQ(Shell::GetPrimaryRootWindow()->GetDispatcher()->host()-> - GetBounds().height(), - shelf_widget->GetWindowBoundsInScreen().bottom()); + EXPECT_EQ(Shell::GetPrimaryRootWindow()->GetHost()->GetBounds().height(), + shelf_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 = diff --git a/ash/sticky_keys/sticky_keys_controller.cc b/ash/sticky_keys/sticky_keys_controller.cc index ca7f6ee..9065e97 100644 --- a/ash/sticky_keys/sticky_keys_controller.cc +++ b/ash/sticky_keys/sticky_keys_controller.cc @@ -86,7 +86,7 @@ void StickyKeysHandlerDelegateImpl::DispatchEvent(ui::Event* event, aura::Window* target) { DCHECK(target); ui::EventDispatchDetails details = - target->GetDispatcher()->OnEventFromSource(event); + target->GetHost()->dispatcher()->OnEventFromSource(event); if (details.dispatcher_destroyed) return; } diff --git a/ash/sticky_keys/sticky_keys_overlay_unittest.cc b/ash/sticky_keys/sticky_keys_overlay_unittest.cc index 55a6ed1..5d13f31 100644 --- a/ash/sticky_keys/sticky_keys_overlay_unittest.cc +++ b/ash/sticky_keys/sticky_keys_overlay_unittest.cc @@ -42,7 +42,7 @@ class StickyKeysOverlayTest : public test::AshTestBase { dispatcher.set_target(Shell::GetInstance()->GetPrimaryRootWindow()); ui::EventDispatchDetails details = Shell::GetPrimaryRootWindow()-> - GetDispatcher()->OnEventFromSource(&event); + GetHost()->dispatcher()->OnEventFromSource(&event); CHECK(!details.dispatcher_destroyed); } diff --git a/ash/sticky_keys/sticky_keys_unittest.cc b/ash/sticky_keys/sticky_keys_unittest.cc index 0b3202c..6da0984 100644 --- a/ash/sticky_keys/sticky_keys_unittest.cc +++ b/ash/sticky_keys/sticky_keys_unittest.cc @@ -794,8 +794,8 @@ TEST_F(StickyKeysTest, KeyEventDispatchImpl) { // Test the actual key event dispatch implementation. EventBuffer buffer; ScopedVector<ui::Event> events; - aura::WindowEventDispatcher* dispatcher = Shell::GetPrimaryRootWindow() - ->GetDispatcher(); + aura::WindowEventDispatcher* dispatcher = + Shell::GetPrimaryRootWindow()->GetHost()->dispatcher(); Shell::GetInstance()->AddPreTargetHandler(&buffer); Shell::GetInstance()->sticky_keys_controller()->Enable(true); @@ -834,8 +834,8 @@ TEST_F(StickyKeysTest, MouseEventDispatchImpl) { // Test the actual sticky mouse event dispatch implementation. EventBuffer buffer; ScopedVector<ui::Event> events; - aura::WindowEventDispatcher* dispatcher = Shell::GetPrimaryRootWindow() - ->GetDispatcher(); + aura::WindowEventDispatcher* dispatcher = + Shell::GetPrimaryRootWindow()->GetHost()->dispatcher(); Shell::GetInstance()->AddPreTargetHandler(&buffer); Shell::GetInstance()->sticky_keys_controller()->Enable(true); @@ -871,8 +871,8 @@ TEST_F(StickyKeysTest, MouseWheelEventDispatchImpl) { // Test the actual mouse wheel event dispatch implementation. EventBuffer buffer; ScopedVector<ui::Event> events; - aura::WindowEventDispatcher* dispatcher = Shell::GetPrimaryRootWindow() - ->GetDispatcher(); + aura::WindowEventDispatcher* dispatcher = + Shell::GetPrimaryRootWindow()->GetHost()->dispatcher(); Shell::GetInstance()->AddPreTargetHandler(&buffer); Shell::GetInstance()->sticky_keys_controller()->Enable(true); diff --git a/ash/test/ash_test_base.cc b/ash/test/ash_test_base.cc index 7812730..ecc1e8f 100644 --- a/ash/test/ash_test_base.cc +++ b/ash/test/ash_test_base.cc @@ -63,7 +63,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())->GetDispatcher(); + GetRootWindowForDisplayId(display.id())->GetHost()->dispatcher(); } virtual aura::client::ScreenPositionClient* GetScreenPositionClient( @@ -123,7 +123,7 @@ void AshTestBase::SetUp() { ash_test_helper_->SetUp(start_session_); Shell::GetPrimaryRootWindow()->Show(); - Shell::GetPrimaryRootWindow()->GetDispatcher()->host()->Show(); + Shell::GetPrimaryRootWindow()->GetHost()->Show(); // Move the mouse cursor to far away so that native events doesn't // interfere test expectations. Shell::GetPrimaryRootWindow()->MoveCursorTo(gfx::Point(-1000, -1000)); diff --git a/ash/test/mirror_window_test_api.cc b/ash/test/mirror_window_test_api.cc index dd495f6..701b27e 100644 --- a/ash/test/mirror_window_test_api.cc +++ b/ash/test/mirror_window_test_api.cc @@ -14,10 +14,9 @@ namespace ash { namespace test { -const aura::WindowEventDispatcher* MirrorWindowTestApi::GetDispatcher() const { - aura::WindowTreeHost* host = Shell::GetInstance()->display_controller()-> +const aura::WindowTreeHost* MirrorWindowTestApi::GetHost() const { + return Shell::GetInstance()->display_controller()-> mirror_window_controller()->host_.get(); - return host ? host->dispatcher() : NULL; } int MirrorWindowTestApi::GetCurrentCursorType() const { diff --git a/ash/test/mirror_window_test_api.h b/ash/test/mirror_window_test_api.h index 72f062c..bef8a9f 100644 --- a/ash/test/mirror_window_test_api.h +++ b/ash/test/mirror_window_test_api.h @@ -11,7 +11,7 @@ namespace aura { class RootWindowTransformer; class Window; -class WindowEventDispatcher; +class WindowTreeHost; } namespace gfx { @@ -26,7 +26,7 @@ class MirrorWindowTestApi { MirrorWindowTestApi() {} ~MirrorWindowTestApi() {} - const aura::WindowEventDispatcher* GetDispatcher() const; + const aura::WindowTreeHost* GetHost() const; int GetCurrentCursorType() const; const gfx::Point& GetCursorHotPoint() const; diff --git a/ash/test/ui_controls_factory_ash.cc b/ash/test/ui_controls_factory_ash.cc index 0a31af5..0c3caa3 100644 --- a/ash/test/ui_controls_factory_ash.cc +++ b/ash/test/ui_controls_factory_ash.cc @@ -35,7 +35,7 @@ UIControlsAura* GetUIControlsForRootWindow(aura::Window* root_window) { root_window->GetProperty(kUIControlsKey); if (!native_ui_control) { native_ui_control = - aura::test::CreateUIControlsAura(root_window->GetDispatcher()); + aura::test::CreateUIControlsAura(root_window->GetHost()->dispatcher()); // Pass the ownership to the |root_window|. root_window->SetProperty(kUIControlsKey, native_ui_control); } diff --git a/ash/wm/ash_native_cursor_manager.cc b/ash/wm/ash_native_cursor_manager.cc index f3551f2..a8349c0 100644 --- a/ash/wm/ash_native_cursor_manager.cc +++ b/ash/wm/ash_native_cursor_manager.cc @@ -21,7 +21,7 @@ void SetCursorOnAllRootWindows(gfx::NativeCursor cursor) { Shell::GetInstance()->GetAllRootWindows(); for (aura::Window::Windows::iterator iter = root_windows.begin(); iter != root_windows.end(); ++iter) - (*iter)->GetDispatcher()->host()->SetCursor(cursor); + (*iter)->GetHost()->SetCursor(cursor); #if defined(OS_CHROMEOS) Shell::GetInstance()->display_controller()-> cursor_window_controller()->SetCursor(cursor); @@ -33,7 +33,7 @@ void NotifyCursorVisibilityChange(bool visible) { Shell::GetInstance()->GetAllRootWindows(); for (aura::Window::Windows::iterator iter = root_windows.begin(); iter != root_windows.end(); ++iter) - (*iter)->GetDispatcher()->host()->OnCursorVisibilityChanged(visible); + (*iter)->GetHost()->OnCursorVisibilityChanged(visible); #if defined(OS_CHROMEOS) Shell::GetInstance()->display_controller()->cursor_window_controller()-> SetVisibility(visible); @@ -45,7 +45,7 @@ void NotifyMouseEventsEnableStateChange(bool enabled) { Shell::GetInstance()->GetAllRootWindows(); for (aura::Window::Windows::iterator iter = root_windows.begin(); iter != root_windows.end(); ++iter) - (*iter)->GetDispatcher()->OnMouseEventsEnableStateChanged(enabled); + (*iter)->GetHost()->dispatcher()->OnMouseEventsEnableStateChanged(enabled); // Mirror window never process events. } diff --git a/ash/wm/ash_native_cursor_manager_interactive_uitest.cc b/ash/wm/ash_native_cursor_manager_interactive_uitest.cc index 1b24daf..97cefdb 100644 --- a/ash/wm/ash_native_cursor_manager_interactive_uitest.cc +++ b/ash/wm/ash_native_cursor_manager_interactive_uitest.cc @@ -39,7 +39,7 @@ void MoveMouseSync(aura::Window* window, int x, int y) { #if defined(USE_X11) XWarpPointer(base::MessagePumpX11::GetDefaultXDisplay(), None, - window->GetDispatcher()->host()->GetAcceleratedWidget(), + window->GetHost()->GetAcceleratedWidget(), 0, 0, 0, 0, x, y); #endif diff --git a/ash/wm/ash_native_cursor_manager_unittest.cc b/ash/wm/ash_native_cursor_manager_unittest.cc index 462b647..1e26f53 100644 --- a/ash/wm/ash_native_cursor_manager_unittest.cc +++ b/ash/wm/ash_native_cursor_manager_unittest.cc @@ -193,12 +193,12 @@ TEST_F(AshNativeCursorManagerTest, DisabledQueryMouseLocation) { Sleep(100); RunAllPendingInMessageLoop(); #endif - aura::WindowEventDispatcher* dispatcher = root_window->GetDispatcher(); + aura::WindowTreeHost* host = root_window->GetHost(); gfx::Point mouse_location; - EXPECT_TRUE(dispatcher->host()->QueryMouseLocation(&mouse_location)); + EXPECT_TRUE(host->QueryMouseLocation(&mouse_location)); EXPECT_EQ("10,10", mouse_location.ToString()); Shell::GetInstance()->cursor_manager()->DisableMouseEvents(); - EXPECT_FALSE(dispatcher->host()->QueryMouseLocation(&mouse_location)); + EXPECT_FALSE(host->QueryMouseLocation(&mouse_location)); EXPECT_EQ("0,0", mouse_location.ToString()); } diff --git a/ash/wm/caption_buttons/frame_maximize_button_unittest.cc b/ash/wm/caption_buttons/frame_maximize_button_unittest.cc index 69eb529..d3bccbd 100644 --- a/ash/wm/caption_buttons/frame_maximize_button_unittest.cc +++ b/ash/wm/caption_buttons/frame_maximize_button_unittest.cc @@ -485,7 +485,8 @@ TEST_F(FrameMaximizeButtonTest, MaximizeTap) { ui::GestureConfiguration::default_radius(); ui::GestureConfiguration::set_default_radius(0); - aura::WindowEventDispatcher* dispatcher = root_window->GetDispatcher(); + aura::WindowEventDispatcher* dispatcher = + root_window->GetHost()->dispatcher(); const int kTouchId = 2; ui::TouchEvent press(ui::ET_TOUCH_PRESSED, button_pos, diff --git a/ash/wm/lock_state_controller.cc b/ash/wm/lock_state_controller.cc index 2d4b84b..9897d40 100644 --- a/ash/wm/lock_state_controller.cc +++ b/ash/wm/lock_state_controller.cc @@ -167,12 +167,13 @@ LockStateController::LockStateController() shutdown_after_lock_(false), animating_lock_(false), can_cancel_lock_animation_(false) { - Shell::GetPrimaryRootWindow()->GetDispatcher()->AddRootWindowObserver(this); + Shell::GetPrimaryRootWindow()->GetHost()->dispatcher()->AddRootWindowObserver( + this); } LockStateController::~LockStateController() { - Shell::GetPrimaryRootWindow()->GetDispatcher()->RemoveRootWindowObserver( - this); + Shell::GetPrimaryRootWindow()->GetHost()->dispatcher()-> + RemoveRootWindowObserver(this); } void LockStateController::SetDelegate(LockStateControllerDelegate* delegate) { diff --git a/ash/wm/overview/window_selector_unittest.cc b/ash/wm/overview/window_selector_unittest.cc index c200c38..d0f63cd 100644 --- a/ash/wm/overview/window_selector_unittest.cc +++ b/ash/wm/overview/window_selector_unittest.cc @@ -269,7 +269,7 @@ TEST_F(WindowSelectorTest, Basic) { // The cursor should be visible and locked as a pointer EXPECT_EQ(ui::kCursorPointer, - root_window->GetDispatcher()->host()->last_cursor().native_type()); + root_window->GetHost()->last_cursor().native_type()); EXPECT_TRUE(aura::client::GetCursorClient(root_window)->IsCursorLocked()); EXPECT_TRUE(aura::client::GetCursorClient(root_window)->IsCursorVisible()); diff --git a/ash/wm/screen_dimmer_unittest.cc b/ash/wm/screen_dimmer_unittest.cc index 2925cd4..c339a9a 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::Rect kNewBounds(400, 300); - Shell::GetPrimaryRootWindow()->GetDispatcher()->host()->SetBounds(kNewBounds); + Shell::GetPrimaryRootWindow()->GetHost()->SetBounds(kNewBounds); EXPECT_EQ(kNewBounds.ToString(), dimming_layer->bounds().ToString()); } diff --git a/ash/wm/system_gesture_event_filter_unittest.cc b/ash/wm/system_gesture_event_filter_unittest.cc index 4af42d7..03f2ad4 100644 --- a/ash/wm/system_gesture_event_filter_unittest.cc +++ b/ash/wm/system_gesture_event_filter_unittest.cc @@ -192,7 +192,7 @@ TEST_P(SystemGestureEventFilterTest, LongPressAffordanceStateOnCaptureLoss) { kTouchId, ui::EventTimeForNow()); ui::EventDispatchDetails details = - root_window->GetDispatcher()->OnEventFromSource(&press); + root_window->GetHost()->dispatcher()->OnEventFromSource(&press); ASSERT_FALSE(details.dispatcher_destroyed); EXPECT_TRUE(window1->HasCapture()); diff --git a/ash/wm/toplevel_window_event_handler.cc b/ash/wm/toplevel_window_event_handler.cc index fad18a4..c5fab2a 100644 --- a/ash/wm/toplevel_window_event_handler.cc +++ b/ash/wm/toplevel_window_event_handler.cc @@ -383,7 +383,8 @@ aura::client::WindowMoveResult ToplevelWindowEventHandler::RunMoveLoop( drag_location = gfx::ToFlooredPoint(drag_location_f); DCHECK(has_point); } else { - drag_location = root_window->GetDispatcher()->GetLastMouseLocationInRoot(); + drag_location = + root_window->GetHost()->dispatcher()->GetLastMouseLocationInRoot(); aura::Window::ConvertPointToTarget( root_window, source->parent(), &drag_location); } diff --git a/ash/wm/window_manager_unittest.cc b/ash/wm/window_manager_unittest.cc index 2338378..af15f3e 100644 --- a/ash/wm/window_manager_unittest.cc +++ b/ash/wm/window_manager_unittest.cc @@ -183,7 +183,8 @@ TEST_F(WindowManagerTest, Focus) { aura::client::GetFocusClient(w121.get()); EXPECT_EQ(w121.get(), focus_client->GetFocusedWindow()); - aura::WindowEventDispatcher* dispatcher = root_window->GetDispatcher(); + aura::WindowEventDispatcher* dispatcher = + root_window->GetHost()->dispatcher(); // The key press should be sent to the focused sub-window. ui::KeyEvent keyev(ui::ET_KEY_PRESSED, ui::VKEY_E, 0, false); @@ -446,7 +447,8 @@ TEST_F(WindowManagerTest, ActivateOnTouch) { aura::Window::ConvertPointToTarget(w2->parent(), root_window, &press_point); ui::TouchEvent touchev1(ui::ET_TOUCH_PRESSED, press_point, 0, getTime()); - aura::WindowEventDispatcher* dispatcher = root_window->GetDispatcher(); + aura::WindowEventDispatcher* dispatcher = + root_window->GetHost()->dispatcher(); ui::EventDispatchDetails details = dispatcher->OnEventFromSource(&touchev1); ASSERT_FALSE(details.dispatcher_destroyed); @@ -508,7 +510,8 @@ 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(); + aura::WindowEventDispatcher* dispatcher = + root_window->GetHost()->dispatcher(); // Cursor starts as a pointer (set during Shell::Init()). EXPECT_EQ(ui::kCursorPointer, @@ -613,7 +616,7 @@ TEST_F(WindowManagerTest, MAYBE_TransformActivate) { gfx::Transform transform; transform.Translate(size.width(), 0); transform.Rotate(90.0f); - root_window->GetDispatcher()->host()->SetTransform(transform); + root_window->GetHost()->SetTransform(transform); test::TestActivationDelegate d1; aura::test::TestWindowDelegate wd; @@ -629,7 +632,8 @@ TEST_F(WindowManagerTest, MAYBE_TransformActivate) { miss_point, ui::EF_LEFT_MOUSE_BUTTON, ui::EF_LEFT_MOUSE_BUTTON); - aura::WindowEventDispatcher* dispatcher = root_window->GetDispatcher(); + aura::WindowEventDispatcher* dispatcher = + root_window->GetHost()->dispatcher(); ui::EventDispatchDetails details = dispatcher->OnEventFromSource(&mouseev1); ASSERT_FALSE(details.dispatcher_destroyed); EXPECT_EQ(NULL, aura::client::GetFocusClient(w1.get())->GetFocusedWindow()); @@ -681,7 +685,8 @@ TEST_F(WindowManagerTest, AdditionalFilters) { // Dispatches mouse and keyboard events. ui::KeyEvent key_event(ui::ET_KEY_PRESSED, ui::VKEY_A, 0, false); - aura::WindowEventDispatcher* dispatcher = root_window->GetDispatcher(); + aura::WindowEventDispatcher* dispatcher = + root_window->GetHost()->dispatcher(); ui::EventDispatchDetails details = dispatcher->OnEventFromSource(&key_event); ASSERT_FALSE(details.dispatcher_destroyed); ui::MouseEvent mouse_pressed( diff --git a/ash/wm/workspace/workspace_event_handler_unittest.cc b/ash/wm/workspace/workspace_event_handler_unittest.cc index 7e5584f..b849b15 100644 --- a/ash/wm/workspace/workspace_event_handler_unittest.cc +++ b/ash/wm/workspace/workspace_event_handler_unittest.cc @@ -376,7 +376,7 @@ TEST_F(WorkspaceEventHandlerTest, generator.current_location(), ui::EF_MIDDLE_MOUSE_BUTTON | ui::EF_IS_DOUBLE_CLICK, ui::EF_MIDDLE_MOUSE_BUTTON); - aura::WindowEventDispatcher* dispatcher = root->GetDispatcher(); + aura::WindowEventDispatcher* dispatcher = root->GetHost()->dispatcher(); ui::EventDispatchDetails details = dispatcher->OnEventFromSource(&press); ASSERT_FALSE(details.dispatcher_destroyed); ui::MouseEvent release(ui::ET_MOUSE_RELEASED, generator.current_location(), diff --git a/chrome/browser/chrome_plugin_browsertest.cc b/chrome/browser/chrome_plugin_browsertest.cc index 6b79fae..5ad3d44 100644 --- a/chrome/browser/chrome_plugin_browsertest.cc +++ b/chrome/browser/chrome_plugin_browsertest.cc @@ -327,8 +327,8 @@ IN_PROC_BROWSER_TEST_F(ChromePluginTest, WindowedNPAPIPluginHidden) { EXPECT_EQ(expected_title2, title_watcher2.WaitAndGetTitle()); HWND child = NULL; - HWND hwnd = tab->GetView()->GetNativeView()->GetDispatcher()->host()-> - GetAcceleratedWidget(); + HWND hwnd = + tab->GetView()->GetNativeView()->GetHost()->GetAcceleratedWidget(); EnumChildWindows(hwnd, EnumerateChildren,reinterpret_cast<LPARAM>(&child)); RECT region; diff --git a/chrome/browser/chromeos/events/event_rewriter.cc b/chrome/browser/chromeos/events/event_rewriter.cc index a34f90f..567cb99 100644 --- a/chrome/browser/chromeos/events/event_rewriter.cc +++ b/chrome/browser/chromeos/events/event_rewriter.cc @@ -143,7 +143,7 @@ EventRewriter::EventRewriter() pref_service_for_testing_(NULL) { // The ash shell isn't instantiated for our unit tests. if (ash::Shell::HasInstance()) { - ash::Shell::GetPrimaryRootWindow()->GetDispatcher()-> + ash::Shell::GetPrimaryRootWindow()->GetHost()->dispatcher()-> AddRootWindowObserver(this); } base::MessageLoopForUI::current()->AddObserver(this); @@ -156,7 +156,7 @@ EventRewriter::EventRewriter() EventRewriter::~EventRewriter() { base::MessageLoopForUI::current()->RemoveObserver(this); if (ash::Shell::HasInstance()) { - ash::Shell::GetPrimaryRootWindow()->GetDispatcher()-> + ash::Shell::GetPrimaryRootWindow()->GetHost()->dispatcher()-> RemoveRootWindowObserver(this); } if (base::SysInfo::IsRunningOnChromeOS()) { diff --git a/chrome/browser/chromeos/input_method/input_method_engine.cc b/chrome/browser/chromeos/input_method/input_method_engine.cc index 487a24c..39660a8 100644 --- a/chrome/browser/chromeos/input_method/input_method_engine.cc +++ b/chrome/browser/chromeos/input_method/input_method_engine.cc @@ -222,7 +222,7 @@ bool InputMethodEngine::SendKeyEvents( } aura::WindowEventDispatcher* dispatcher = - ash::Shell::GetPrimaryRootWindow()->GetDispatcher(); + ash::Shell::GetPrimaryRootWindow()->GetHost()->dispatcher(); for (size_t i = 0; i < events.size(); ++i) { const KeyboardEvent& event = events[i]; diff --git a/chrome/browser/extensions/api/input/input.cc b/chrome/browser/extensions/api/input/input.cc index 4797ce9..d0a8ab5 100644 --- a/chrome/browser/extensions/api/input/input.cc +++ b/chrome/browser/extensions/api/input/input.cc @@ -58,7 +58,7 @@ bool VirtualKeyboardPrivateMoveCursorFunction::RunImpl() { return keyboard::MoveCursor( swipe_direction, modifier_flags, - ash::Shell::GetPrimaryRootWindow()->GetDispatcher()); + ash::Shell::GetPrimaryRootWindow()->GetHost()->dispatcher()); #endif error_ = kNotYetImplementedError; return false; @@ -89,7 +89,7 @@ bool VirtualKeyboardPrivateSendKeyEventFunction::RunImpl() { key_code, key_name, modifiers, - ash::Shell::GetPrimaryRootWindow()->GetDispatcher()); + ash::Shell::GetPrimaryRootWindow()->GetHost()->dispatcher()); #endif error_ = kNotYetImplementedError; return false; diff --git a/chrome/browser/extensions/extension_tabs_apitest.cc b/chrome/browser/extensions/extension_tabs_apitest.cc index 7cb35c7..14f1dff 100644 --- a/chrome/browser/extensions/extension_tabs_apitest.cc +++ b/chrome/browser/extensions/extension_tabs_apitest.cc @@ -226,8 +226,8 @@ IN_PROC_BROWSER_TEST_F(ExtensionApiTest, #if defined(OS_WIN) IN_PROC_BROWSER_TEST_F(ExtensionApiTest, FocusWindowDoesNotUnmaximize) { - HWND window = browser()->window()->GetNativeWindow()-> - GetDispatcher()->host()->GetAcceleratedWidget(); + HWND window = + browser()->window()->GetNativeWindow()->GetHost()->GetAcceleratedWidget(); ::SendMessage(window, WM_SYSCOMMAND, SC_MAXIMIZE, 0); ASSERT_TRUE(RunExtensionTest("window_update/focus")) << message_; ASSERT_TRUE(::IsZoomed(window)); diff --git a/chrome/browser/first_run/try_chrome_dialog_view.cc b/chrome/browser/first_run/try_chrome_dialog_view.cc index 7cc74ab..dd0fed7 100644 --- a/chrome/browser/first_run/try_chrome_dialog_view.cc +++ b/chrome/browser/first_run/try_chrome_dialog_view.cc @@ -283,8 +283,7 @@ TryChromeDialogView::Result TryChromeDialogView::ShowModal( // Carve the toast shape into the window. HWND toast_window; #if defined(USE_AURA) - toast_window = - popup_->GetNativeView()->GetDispatcher()->host()->GetAcceleratedWidget(); + toast_window = popup_->GetNativeView()->GetHost()->GetAcceleratedWidget(); #else toast_window = popup_->GetNativeView(); #endif diff --git a/chrome/browser/password_manager/password_manager_util_win.cc b/chrome/browser/password_manager/password_manager_util_win.cc index 667ad4f..b916e26 100644 --- a/chrome/browser/password_manager/password_manager_util_win.cc +++ b/chrome/browser/password_manager/password_manager_util_win.cc @@ -186,7 +186,7 @@ bool AuthenticateUser(gfx::NativeWindow window) { cui.cbSize = sizeof(CREDUI_INFO); cui.hwndParent = NULL; #if defined(USE_AURA) - cui.hwndParent = window->GetDispatcher()->host()->GetAcceleratedWidget(); + cui.hwndParent = window->GetHost()->GetAcceleratedWidget(); #else cui.hwndParent = window; #endif diff --git a/chrome/browser/printing/print_dialog_cloud.cc b/chrome/browser/printing/print_dialog_cloud.cc index d6c2535..5b67d69 100644 --- a/chrome/browser/printing/print_dialog_cloud.cc +++ b/chrome/browser/printing/print_dialog_cloud.cc @@ -635,7 +635,7 @@ void CreateDialogImpl(content::BrowserContext* browser_context, if (window) { HWND dialog_handle; #if defined(USE_AURA) - dialog_handle = window->GetDispatcher()->host()->GetAcceleratedWidget(); + dialog_handle = window->GetHost()->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 ddf8f62..2f1b631 100644 --- a/chrome/browser/renderer_host/pepper/pepper_flash_drm_host.cc +++ b/chrome/browser/renderer_host/pepper/pepper_flash_drm_host.cc @@ -77,10 +77,10 @@ class MonitorFinder : public base::RefCountedThreadSafe<MonitorFinder> { return; gfx::NativeView native_view = rfh->GetNativeView(); #if defined(USE_AURA) - aura::WindowEventDispatcher* dispatcher = native_view->GetDispatcher(); - if (!dispatcher) + aura::WindowTreeHost* host = native_view->GetHost(); + if (!host) return; - HWND window = dispatcher->host()->GetAcceleratedWidget(); + HWND window = host->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 5f7e40a..3c78a1c 100644 --- a/chrome/browser/ui/ash/ash_init.cc +++ b/chrome/browser/ui/ash/ash_init.cc @@ -79,7 +79,7 @@ void OpenAsh() { chrome::IncrementKeepAliveCount(); } #endif - ash::Shell::GetPrimaryRootWindow()->GetDispatcher()->host()->Show(); + ash::Shell::GetPrimaryRootWindow()->GetHost()->Show(); } void CloseAsh() { diff --git a/chrome/browser/ui/ash/multi_user/multi_user_window_manager_chromeos.cc b/chrome/browser/ui/ash/multi_user/multi_user_window_manager_chromeos.cc index 3a285ef..c44cbbc 100644 --- a/chrome/browser/ui/ash/multi_user/multi_user_window_manager_chromeos.cc +++ b/chrome/browser/ui/ash/multi_user/multi_user_window_manager_chromeos.cc @@ -96,7 +96,7 @@ bool IsProcessingUserEvent() { for (aura::Window::Windows::iterator it = root_window_list.begin(); it != root_window_list.end(); ++it) { - if (IsUserEvent((*it)->GetDispatcher()->current_event())) + if (IsUserEvent((*it)->GetHost()->dispatcher()->current_event())) return true; } return false; diff --git a/chrome/browser/ui/find_bar/find_bar_host_browsertest.cc b/chrome/browser/ui/find_bar/find_bar_host_browsertest.cc index 756e7f2..dc18d50 100644 --- a/chrome/browser/ui/find_bar/find_bar_host_browsertest.cc +++ b/chrome/browser/ui/find_bar/find_bar_host_browsertest.cc @@ -1583,8 +1583,8 @@ IN_PROC_BROWSER_TEST_F(FindInPageControllerTest, WindowedNPAPIPluginHidden) { EXPECT_EQ(expected_title, title_watcher.WaitAndGetTitle()); // Now get the region of the plugin before the find bar is shown. - HWND hwnd = tab->GetView()->GetNativeView()->GetDispatcher()->host()-> - GetAcceleratedWidget(); + HWND hwnd = + tab->GetView()->GetNativeView()->GetHost()->GetAcceleratedWidget(); HWND child = NULL; EnumChildWindows(hwnd, EnumerateChildren,reinterpret_cast<LPARAM>(&child)); 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 6654a5c..9bf5709 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->GetDispatcher()->host()->GetAcceleratedWidget()); + parent->GetHost()->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/libgtk2ui/select_file_dialog_impl_kde.cc b/chrome/browser/ui/libgtk2ui/select_file_dialog_impl_kde.cc index cb3ac82..564ecfb 100644 --- a/chrome/browser/ui/libgtk2ui/select_file_dialog_impl_kde.cc +++ b/chrome/browser/ui/libgtk2ui/select_file_dialog_impl_kde.cc @@ -299,7 +299,7 @@ void SelectFileDialogImplKDE::GetKDialogCommandLine(const std::string& type, CHECK(command_line); // Attach to the current Chrome window. - int window_id = parent->GetDispatcher()->host()->GetAcceleratedWidget(); + int window_id = parent->GetHost()->GetAcceleratedWidget(); command_line->AppendSwitchNative( desktop_ == base::nix::DESKTOP_ENVIRONMENT_KDE3 ? "--embed" : "--attach", base::IntToString(window_id)); diff --git a/chrome/browser/ui/views/certificate_viewer_win.cc b/chrome/browser/ui/views/certificate_viewer_win.cc index 1946bd5..2c355d7 100644 --- a/chrome/browser/ui/views/certificate_viewer_win.cc +++ b/chrome/browser/ui/views/certificate_viewer_win.cc @@ -63,7 +63,7 @@ void ShowCertificateViewer(content::WebContents* web_contents, chrome::HOST_DESKTOP_TYPE_ASH) { ShowCertificateViewerImpl( web_contents, - parent->GetDispatcher()->host()->GetAcceleratedWidget(), cert); + parent->GetHost()->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 ccb2204..aaf752e 100644 --- a/chrome/browser/ui/views/desktop_media_picker_views.cc +++ b/chrome/browser/ui/views/desktop_media_picker_views.cc @@ -522,7 +522,7 @@ DesktopMediaPickerDialogView::DesktopMediaPickerDialogView( #endif { dialog_window_id = AcceleratedWidgetToDesktopMediaId( - GetWidget()->GetNativeWindow()->GetDispatcher()->host()-> + GetWidget()->GetNativeWindow()->GetHost()-> GetAcceleratedWidget()); } diff --git a/chrome/browser/ui/views/frame/browser_view.cc b/chrome/browser/ui/views/frame/browser_view.cc index e559c9a..80c703d 100644 --- a/chrome/browser/ui/views/frame/browser_view.cc +++ b/chrome/browser/ui/views/frame/browser_view.cc @@ -2334,7 +2334,7 @@ void BrowserView::InitHangMonitor() { int hung_plugin_detect_freq = pref_service->GetInteger(prefs::kHungPluginDetectFrequency); #if defined(USE_AURA) - HWND window = GetWidget()->GetNativeView()->GetDispatcher()->host()-> + HWND window = GetWidget()->GetNativeView()->GetHost()-> GetAcceleratedWidget(); #else HWND window = GetWidget()->GetNativeView(); diff --git a/chrome/browser/ui/views/location_bar/star_view_browsertest.cc b/chrome/browser/ui/views/location_bar/star_view_browsertest.cc index 8f1c598..1275273 100644 --- a/chrome/browser/ui/views/location_bar/star_view_browsertest.cc +++ b/chrome/browser/ui/views/location_bar/star_view_browsertest.cc @@ -113,7 +113,7 @@ IN_PROC_BROWSER_TEST_F(StarViewTestNoDWM, WindowedNPAPIPluginHidden) { EXPECT_EQ(expected_title, title_watcher.WaitAndGetTitle()); // Now get the region of the plugin before the star view is shown. - HWND hwnd = tab->GetView()->GetNativeView()->GetDispatcher()->host()-> + HWND hwnd = tab->GetView()->GetNativeView()->GetHost()-> GetAcceleratedWidget(); HWND child = NULL; EnumChildWindows(hwnd, EnumerateChildren,reinterpret_cast<LPARAM>(&child)); diff --git a/chrome/browser/ui/views/omnibox/omnibox_view_views_browsertest.cc b/chrome/browser/ui/views/omnibox/omnibox_view_views_browsertest.cc index 14ee42b..905747f 100644 --- a/chrome/browser/ui/views/omnibox/omnibox_view_views_browsertest.cc +++ b/chrome/browser/ui/views/omnibox/omnibox_view_views_browsertest.cc @@ -78,7 +78,7 @@ class OmniboxViewViewsTest : public InProcessBrowserTest { void Tap(const gfx::Point& press_location, const gfx::Point& release_location) { aura::WindowEventDispatcher* dispatcher = - browser()->window()->GetNativeWindow()->GetDispatcher(); + browser()->window()->GetNativeWindow()->GetHost()->dispatcher(); ui::TouchEvent press(ui::ET_TOUCH_PRESSED, press_location, 5, base::TimeDelta::FromMilliseconds(0)); 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 18b043be..7415e90 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 @@ -222,7 +222,7 @@ class ScreenEventGeneratorDelegate : public aura::test::EventGeneratorDelegate { // EventGeneratorDelegate overrides: virtual aura::WindowEventDispatcher* GetDispatcherAt( const gfx::Point& point) const OVERRIDE { - return root_window_->GetDispatcher(); + return root_window_->GetHost()->dispatcher(); } virtual aura::client::ScreenPositionClient* GetScreenPositionClient( diff --git a/chrome/browser/ui/views/tabs/window_finder_win.cc b/chrome/browser/ui/views/tabs/window_finder_win.cc index 27d2eee..eff768e 100644 --- a/chrome/browser/ui/views/tabs/window_finder_win.cc +++ b/chrome/browser/ui/views/tabs/window_finder_win.cc @@ -207,7 +207,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)->GetDispatcher()->host()->GetAcceleratedWidget(); + HWND w = (*it)->GetHost()->GetAcceleratedWidget(); if (w) hwnd_set.insert(w); } diff --git a/chrome/browser/ui/views/tabs/window_finder_x11.cc b/chrome/browser/ui/views/tabs/window_finder_x11.cc index 65b15ac..eeca3e7 100644 --- a/chrome/browser/ui/views/tabs/window_finder_x11.cc +++ b/chrome/browser/ui/views/tabs/window_finder_x11.cc @@ -7,7 +7,7 @@ #include "base/debug/trace_event.h" #include "chrome/browser/ui/host_desktop.h" #include "ui/aura/window.h" -#include "ui/aura/window_event_dispatcher.h" +#include "ui/aura/window_tree_host.h" #include "ui/base/x/x11_util.h" #include "ui/views/widget/desktop_aura/desktop_window_tree_host_x11.h" @@ -29,7 +29,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)->GetDispatcher()->host()->GetAcceleratedWidget(); + XID xid = (*iter)->GetHost()->GetAcceleratedWidget(); ignore_.insert(xid); } } @@ -142,7 +142,7 @@ class LocalProcessWindowFinder : public BaseWindowFinder { return false; // Check if this window is in our process. - if (!aura::WindowEventDispatcher::GetForAcceleratedWidget(window)) + if (!aura::WindowTreeHost::GetForAcceleratedWidget(window)) return false; if (!ui::IsWindowVisible(window)) diff --git a/chrome/browser/ui/webui/print_preview/print_preview_ui_browsertest.cc b/chrome/browser/ui/webui/print_preview/print_preview_ui_browsertest.cc index 11621a2..d24c993 100644 --- a/chrome/browser/ui/webui/print_preview/print_preview_ui_browsertest.cc +++ b/chrome/browser/ui/webui/print_preview/print_preview_ui_browsertest.cc @@ -110,7 +110,7 @@ IN_PROC_BROWSER_TEST_F(PrintPreviewTest, WindowedNPAPIPluginHidden) { // Now get the region of the plugin before and after the print preview is // shown. They should be different. - HWND hwnd = tab->GetView()->GetNativeView()->GetDispatcher()->host()-> + HWND hwnd = tab->GetView()->GetNativeView()->GetHost()-> GetAcceleratedWidget(); HWND child = NULL; EnumChildWindows(hwnd, EnumerateChildren,reinterpret_cast<LPARAM>(&child)); diff --git a/chrome/test/base/interactive_test_utils_win.cc b/chrome/test/base/interactive_test_utils_win.cc index 6ee8640..af33edd 100644 --- a/chrome/test/base/interactive_test_utils_win.cc +++ b/chrome/test/base/interactive_test_utils_win.cc @@ -28,7 +28,7 @@ void HideNativeWindow(gfx::NativeWindow window) { HideNativeWindowAura(window); return; } - HWND hwnd = window->GetDispatcher()->host()->GetAcceleratedWidget(); + HWND hwnd = window->GetHost()->GetAcceleratedWidget(); #else HWND hwnd = window; #endif @@ -42,7 +42,7 @@ bool ShowAndFocusNativeWindow(gfx::NativeWindow window) { ShowAndFocusNativeWindowAura(window); window->Show(); // Always make sure the window hosting ash is visible and focused. - HWND hwnd = window->GetDispatcher()->host()->GetAcceleratedWidget(); + HWND hwnd = window->GetHost()->GetAcceleratedWidget(); #else HWND hwnd = window; #endif diff --git a/chrome/test/base/view_event_test_base.cc b/chrome/test/base/view_event_test_base.cc index 917e335..245f439a 100644 --- a/chrome/test/base/view_event_test_base.cc +++ b/chrome/test/base/view_event_test_base.cc @@ -131,7 +131,7 @@ void ViewEventTestBase::SetUp() { shell_delegate->test_session_state_delegate() ->SetActiveUserSessionStarted(true); context = ash::Shell::GetPrimaryRootWindow(); - context->GetDispatcher()->host()->Show(); + context->GetHost()->Show(); #endif // !OS_WIN aura::Env::CreateInstance(); #elif defined(USE_AURA) diff --git a/content/browser/media/capture/desktop_capture_device_aura.cc b/content/browser/media/capture/desktop_capture_device_aura.cc index 42cae93..ce58cb7 100644 --- a/content/browser/media/capture/desktop_capture_device_aura.cc +++ b/content/browser/media/capture/desktop_capture_device_aura.cc @@ -356,7 +356,7 @@ gfx::Point DesktopVideoCaptureMachine::UpdateCursorState( const gfx::Rect& region_in_frame) { const gfx::Rect desktop_bounds = desktop_layer_->bounds(); gfx::NativeCursor cursor = - desktop_window_->GetDispatcher()->host()->last_cursor(); + desktop_window_->GetHost()->last_cursor(); if (last_cursor_ != cursor) { SkBitmap cursor_bitmap; if (ui::GetCursorBitmap(cursor, &cursor_bitmap, &cursor_hot_point_)) { diff --git a/content/browser/renderer_host/input/synthetic_gesture_target_aura.cc b/content/browser/renderer_host/input/synthetic_gesture_target_aura.cc index 123999e..5dad88d 100644 --- a/content/browser/renderer_host/input/synthetic_gesture_target_aura.cc +++ b/content/browser/renderer_host/input/synthetic_gesture_target_aura.cc @@ -31,11 +31,12 @@ void SyntheticGestureTargetAura::DispatchWebTouchEventToPlatform( DCHECK(conversion_success); aura::Window* window = GetWindow(); - aura::WindowEventDispatcher* dispatcher = window->GetDispatcher(); + aura::WindowTreeHost* host = window->GetHost(); for (ScopedVector<ui::TouchEvent>::iterator iter = events.begin(), end = events.end(); iter != end; ++iter) { - (*iter)->ConvertLocationToTarget(window, dispatcher->window()); - ui::EventDispatchDetails details = dispatcher->OnEventFromSource(*iter); + (*iter)->ConvertLocationToTarget(window, host->window()); + ui::EventDispatchDetails details = + host->dispatcher()->OnEventFromSource(*iter); if (details.dispatcher_destroyed) break; } @@ -53,7 +54,7 @@ void SyntheticGestureTargetAura::DispatchWebMouseWheelEventToPlatform( aura::Window* window = GetWindow(); wheel_event.ConvertLocationToTarget(window, window->GetRootWindow()); ui::EventDispatchDetails details = - window->GetDispatcher()->OnEventFromSource(&wheel_event); + window->GetHost()->dispatcher()->OnEventFromSource(&wheel_event); if (details.dispatcher_destroyed) return; } @@ -120,7 +121,7 @@ void SyntheticGestureTargetAura::DispatchWebMouseEventToPlatform( aura::Window* window = GetWindow(); mouse_event.ConvertLocationToTarget(window, window->GetRootWindow()); ui::EventDispatchDetails details = - window->GetDispatcher()->OnEventFromSource(&mouse_event); + window->GetHost()->dispatcher()->OnEventFromSource(&mouse_event); if (details.dispatcher_destroyed) return; } 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 21619c4..7fd951d 100644 --- a/content/browser/renderer_host/render_widget_host_view_aura.cc +++ b/content/browser/renderer_host/render_widget_host_view_aura.cc @@ -148,9 +148,8 @@ BOOL CALLBACK ShowWindowsCallback(HWND window, LPARAM param) { reinterpret_cast<RenderWidgetHostViewAura*>(param); if (GetProp(window, kWidgetOwnerProperty) == widget && - widget->GetNativeView()->GetDispatcher()) { - HWND parent = widget->GetNativeView()->GetDispatcher()->host()-> - GetAcceleratedWidget(); + widget->GetNativeView()->GetHost()) { + HWND parent = widget->GetNativeView()->GetHost()->GetAcceleratedWidget(); SetParent(window, parent); } return TRUE; @@ -172,8 +171,8 @@ 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()->GetDispatcher()-> - host()->GetAcceleratedWidget(); + HWND parent = + params->widget->GetNativeView()->GetHost()->GetAcceleratedWidget(); POINT offset; offset.x = offset.y = 0; MapWindowPoints(window, parent, &offset, 1); @@ -622,7 +621,7 @@ void RenderWidgetHostViewAura::WasShown() { // windows stay on top of the child Zorder in the parent and receive // mouse events, etc. legacy_render_widget_host_HWND_->UpdateParent( - GetNativeView()->GetDispatcher()->host()->GetAcceleratedWidget()); + GetNativeView()->GetHost()->GetAcceleratedWidget()); legacy_render_widget_host_HWND_->SetBounds( window_->GetBoundsInRootWindow()); } @@ -641,9 +640,9 @@ void RenderWidgetHostViewAura::WasHidden() { #if defined(OS_WIN) constrained_rects_.clear(); - aura::WindowEventDispatcher* dispatcher = window_->GetDispatcher(); - if (dispatcher) { - HWND parent = dispatcher->host()->GetAcceleratedWidget(); + aura::WindowTreeHost* host = window_->GetHost(); + if (host) { + HWND parent = host->GetAcceleratedWidget(); LPARAM lparam = reinterpret_cast<LPARAM>(this); EnumChildWindows(parent, HideWindowsCallback, lparam); // We reparent the legacy Chrome_RenderWidgetHostHWND window to the global @@ -682,11 +681,11 @@ void RenderWidgetHostViewAura::SetBounds(const gfx::Rect& rect) { void RenderWidgetHostViewAura::MaybeCreateResizeLock() { if (!ShouldCreateResizeLock()) return; - DCHECK(window_->GetDispatcher()); - DCHECK(window_->GetDispatcher()->host()->compositor()); + DCHECK(window_->GetHost()); + DCHECK(window_->GetHost()->compositor()); // Listen to changes in the compositor lock state. - ui::Compositor* compositor = window_->GetDispatcher()->host()->compositor(); + ui::Compositor* compositor = window_->GetHost()->compositor(); if (!compositor->HasObserver(this)) compositor->AddObserver(this); @@ -724,11 +723,11 @@ bool RenderWidgetHostViewAura::ShouldCreateResizeLock() { if (desired_size == current_frame_size_) return false; - aura::WindowEventDispatcher* dispatcher = window_->GetDispatcher(); - if (!dispatcher) + aura::WindowTreeHost* host = window_->GetHost(); + if (!host) return false; - ui::Compositor* compositor = dispatcher->host()->compositor(); + ui::Compositor* compositor = host->compositor(); if (!compositor) return false; @@ -739,7 +738,7 @@ scoped_ptr<ResizeLock> RenderWidgetHostViewAura::CreateResizeLock( bool defer_compositor_lock) { gfx::Size desired_size = window_->bounds().size(); return scoped_ptr<ResizeLock>(new CompositorResizeLock( - window_->GetDispatcher(), + window_->GetHost()->dispatcher(), desired_size, defer_compositor_lock, base::TimeDelta::FromMilliseconds(kResizeLockTimeoutMs))); @@ -756,20 +755,19 @@ gfx::NativeView RenderWidgetHostViewAura::GetNativeView() const { gfx::NativeViewId RenderWidgetHostViewAura::GetNativeViewId() const { #if defined(OS_WIN) - aura::WindowEventDispatcher* dispatcher = window_->GetDispatcher(); - if (dispatcher) - return reinterpret_cast<gfx::NativeViewId>( - dispatcher->host()->GetAcceleratedWidget()); + aura::WindowTreeHost* host = window_->GetHost(); + if (host) + return reinterpret_cast<gfx::NativeViewId>(host->GetAcceleratedWidget()); #endif return static_cast<gfx::NativeViewId>(NULL); } gfx::NativeViewAccessible RenderWidgetHostViewAura::GetNativeViewAccessible() { #if defined(OS_WIN) - aura::WindowEventDispatcher* dispatcher = window_->GetDispatcher(); - if (!dispatcher) + aura::WindowTreeHost* host = window_->GetHost(); + if (!host) return static_cast<gfx::NativeViewAccessible>(NULL); - HWND hwnd = dispatcher->host()->GetAcceleratedWidget(); + HWND hwnd = host->GetAcceleratedWidget(); CreateBrowserAccessibilityManagerIfNeeded(); BrowserAccessibilityManager* manager = GetBrowserAccessibilityManager(); @@ -784,9 +782,9 @@ gfx::NativeViewAccessible RenderWidgetHostViewAura::GetNativeViewAccessible() { void RenderWidgetHostViewAura::SetKeyboardFocus() { #if defined(OS_WIN) if (CanFocus()) { - aura::WindowEventDispatcher* dispatcher = window_->GetDispatcher(); - if (dispatcher) - ::SetFocus(dispatcher->host()->GetAcceleratedWidget()); + aura::WindowTreeHost* host = window_->GetHost(); + if (host) + ::SetFocus(host->GetAcceleratedWidget()); } #endif } @@ -801,7 +799,7 @@ void RenderWidgetHostViewAura::MovePluginWindows( DCHECK(plugin_window_moves.empty()); return; } - HWND parent = window_->GetDispatcher()->host()->GetAcceleratedWidget(); + HWND parent = window_->GetHost()->GetAcceleratedWidget(); gfx::Rect view_bounds = window_->GetBoundsInRootWindow(); std::vector<WebPluginGeometry> moves = plugin_window_moves; @@ -986,7 +984,7 @@ void RenderWidgetHostViewAura::DidUpdateBackingStore( SchedulePaintIfNotInClip(scroll_rect, clip_rect); #if defined(OS_WIN) - aura::WindowEventDispatcher* dispatcher = window_->GetDispatcher(); + aura::WindowTreeHost* host = window_->GetHost(); #endif for (size_t i = 0; i < copy_rects.size(); ++i) { gfx::Rect rect = gfx::SubtractRects(copy_rects[i], scroll_rect); @@ -996,12 +994,12 @@ void RenderWidgetHostViewAura::DidUpdateBackingStore( SchedulePaintIfNotInClip(rect, clip_rect); #if defined(OS_WIN) - if (dispatcher) { + if (host) { // 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 = dispatcher->host()->GetAcceleratedWidget(); + HWND hwnd = host->GetAcceleratedWidget(); PaintPluginWindowsHelper(hwnd, invalid_screen_rect); } #endif // defined(OS_WIN) @@ -1367,7 +1365,7 @@ void RenderWidgetHostViewAura::UpdateConstrainedWindowRects( const std::vector<gfx::Rect>& rects) { // Check this before setting constrained_rects_, so that next time they're set // and we have a root window we don't early return. - if (!window_->GetDispatcher()) + if (!window_->GetHost()) return; if (rects == constrained_rects_) @@ -1375,7 +1373,7 @@ void RenderWidgetHostViewAura::UpdateConstrainedWindowRects( constrained_rects_ = rects; - HWND parent = window_->GetDispatcher()->host()->GetAcceleratedWidget(); + HWND parent = window_->GetHost()->GetAcceleratedWidget(); CutoutRectsParams params; params.widget = this; params.cutout_rects = constrained_rects_; @@ -2142,10 +2140,10 @@ gfx::Rect RenderWidgetHostViewAura::GetBoundsInRootWindow() { RECT window_rect = {0}; aura::Window* top_level = window_->GetToplevelWindow(); - aura::WindowEventDispatcher* dispatcher = top_level->GetDispatcher(); - if (!dispatcher) + aura::WindowTreeHost* host = top_level->GetHost(); + if (!host) return top_level->GetBoundsInScreen(); - HWND hwnd = dispatcher->host()->GetAcceleratedWidget(); + HWND hwnd = host->GetAcceleratedWidget(); ::GetWindowRect(hwnd, &window_rect); gfx::Rect rect(window_rect); @@ -2178,16 +2176,16 @@ void RenderWidgetHostViewAura::ProcessAckedTouchEvent( SCREEN_COORDINATES)) return; - aura::WindowEventDispatcher* dispatcher = window_->GetDispatcher(); + aura::WindowTreeHost* host = window_->GetHost(); // |dispatcher| is NULL during tests. - if (!dispatcher) + if (!host) 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) { - dispatcher->ProcessedTouchEvent((*iter), window_, result); + host->dispatcher()->ProcessedTouchEvent((*iter), window_, result); } } @@ -2213,10 +2211,10 @@ void RenderWidgetHostViewAura::CreateBrowserAccessibilityManagerIfNeeded() { BrowserAccessibilityManager* manager = NULL; #if defined(OS_WIN) - aura::WindowEventDispatcher* dispatcher = window_->GetDispatcher(); - if (!dispatcher) + aura::WindowTreeHost* host = window_->GetHost(); + if (!host) return; - HWND hwnd = dispatcher->host()->GetAcceleratedWidget(); + HWND hwnd = host->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 @@ -2266,7 +2264,7 @@ bool RenderWidgetHostViewAura::LockMouse() { } tooltip_disabler_.reset(new aura::client::ScopedTooltipDisabler(root_window)); - root_window->GetDispatcher()->host()->ConfineCursorToRootWindow(); + root_window->GetHost()->ConfineCursorToRootWindow(); return true; } @@ -2291,7 +2289,7 @@ void RenderWidgetHostViewAura::UnlockMouse() { } host_->LostMouseLock(); - root_window->GetDispatcher()->host()->UnConfineCursor(); + root_window->GetHost()->UnConfineCursor(); } //////////////////////////////////////////////////////////////////////////////// @@ -2662,7 +2660,7 @@ void RenderWidgetHostViewAura::OnWindowDestroying(aura::Window* window) { if (!window_->GetRootWindow() || host_->is_hidden()) { parent = ui::GetHiddenWindow(); } else { - parent = window_->GetDispatcher()->host()->GetAcceleratedWidget(); + parent = window_->GetHost()->GetAcceleratedWidget(); } LPARAM lparam = reinterpret_cast<LPARAM>(this); EnumChildWindows(parent, WindowDestroyingCallback, lparam); @@ -2889,9 +2887,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::WindowEventDispatcher* dispatcher = window_->GetDispatcher(); - if (dispatcher) { - HWND parent = dispatcher->host()->GetAcceleratedWidget(); + aura::WindowTreeHost* host = window_->GetHost(); + if (host) { + HWND parent = host->GetAcceleratedWidget(); HWND toplevel_hwnd = ::GetAncestor(parent, GA_ROOT); EnumThreadWindows(GetCurrentThreadId(), DismissOwnedPopups, @@ -3056,10 +3054,10 @@ void RenderWidgetHostViewAura::OnGestureEvent(ui::GestureEvent* event) { // RenderWidgetHostViewAura, aura::client::ActivationDelegate implementation: bool RenderWidgetHostViewAura::ShouldActivate() const { - aura::WindowEventDispatcher* dispatcher = window_->GetDispatcher(); - if (!dispatcher) + aura::WindowTreeHost* host = window_->GetHost(); + if (!host) return true; - const ui::Event* event = dispatcher->current_event(); + const ui::Event* event = host->dispatcher()->current_event(); if (!event) return true; return is_fullscreen_; @@ -3073,7 +3071,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_->GetDispatcher()->current_event(); + const ui::Event* event = window_->GetHost()->dispatcher()->current_event(); if (event && PointerEventActivates(*event)) host_->OnPointerEventActivate(); } @@ -3310,8 +3308,8 @@ RenderWidgetHostViewAura::~RenderWidgetHostViewAura() { ImageTransportFactory::GetInstance()->RemoveObserver(this); window_observer_.reset(); - if (window_->GetDispatcher()) - window_->GetDispatcher()->RemoveRootWindowObserver(this); + if (window_->GetHost()) + window_->GetHost()->dispatcher()->RemoveRootWindowObserver(this); UnlockMouse(); if (popup_parent_host_view_) { DCHECK(popup_parent_host_view_->popup_child_host_view_ == NULL || @@ -3494,7 +3492,7 @@ void RenderWidgetHostViewAura::AddOnCommitCallbackAndDisableLocks( } void RenderWidgetHostViewAura::AddedToRootWindow() { - window_->GetDispatcher()->AddRootWindowObserver(this); + window_->GetHost()->dispatcher()->AddRootWindowObserver(this); UpdateScreenInfo(window_); aura::client::CursorClient* cursor_client = @@ -3535,7 +3533,7 @@ void RenderWidgetHostViewAura::RemovingFromRootWindow() { DetachFromInputMethod(); - window_->GetDispatcher()->RemoveRootWindowObserver(this); + window_->GetHost()->dispatcher()->RemoveRootWindowObserver(this); ui::Compositor* compositor = GetCompositor(); if (current_surface_.get()) { // We can't get notification for commits after this point, which would @@ -3566,8 +3564,8 @@ void RenderWidgetHostViewAura::RemovingFromRootWindow() { } ui::Compositor* RenderWidgetHostViewAura::GetCompositor() const { - aura::WindowEventDispatcher* dispatcher = window_->GetDispatcher(); - return dispatcher ? dispatcher->host()->compositor() : NULL; + aura::WindowTreeHost* host = window_->GetHost(); + return host ? host->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 75d2551..0e8f92b 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 @@ -181,7 +181,7 @@ class FakeRenderWidgetHostViewAura : public RenderWidgetHostViewAura { } void RunOnCompositingDidCommit() { - OnCompositingDidCommit(window()->GetDispatcher()->host()->compositor()); + OnCompositingDidCommit(window()->GetHost()->compositor()); } // A lock that doesn't actually do anything to the compositor, and does not @@ -925,7 +925,7 @@ TEST_F(RenderWidgetHostViewAuraTest, FullscreenResize) { gfx::Rect(params.a.new_size), owned_mailbox.get())); ui::DrawWaiterForTest::WaitForCommit( - root_window->GetDispatcher()->host()->compositor()); + root_window->GetHost()->compositor()); } widget_host_->ResetSizeAndRepaintPendingFlags(); @@ -949,7 +949,7 @@ TEST_F(RenderWidgetHostViewAuraTest, FullscreenResize) { gfx::Rect(params.a.new_size), owned_mailbox.get())); ui::DrawWaiterForTest::WaitForCommit( - root_window->GetDispatcher()->host()->compositor()); + root_window->GetHost()->compositor()); } } diff --git a/content/browser/web_contents/aura/window_slider_unittest.cc b/content/browser/web_contents/aura/window_slider_unittest.cc index ba5691b..94816e3 100644 --- a/content/browser/web_contents/aura/window_slider_unittest.cc +++ b/content/browser/web_contents/aura/window_slider_unittest.cc @@ -265,7 +265,7 @@ TEST_F(WindowSliderTest, WindowSlideIsCancelledOnEvent) { base::TimeDelta::FromMilliseconds(10), 1, base::Bind(&DispatchEventDuringScrollCallback, - root_window()->GetDispatcher(), + root_window()->GetHost()->dispatcher(), base::Owned(events[i]))); EXPECT_TRUE(slider_delegate.created_back_layer()); EXPECT_TRUE(slider_delegate.slide_aborted()); 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 d46c5fc..c2527ec 100644 --- a/content/browser/web_contents/touch_editable_impl_aura_browsertest.cc +++ b/content/browser/web_contents/touch_editable_impl_aura_browsertest.cc @@ -137,7 +137,7 @@ class TouchEditableImplAuraTest : public ContentBrowserTest { NavigateToURL(shell(), test_url); aura::Window* content = shell()->web_contents()->GetView()->GetContentNativeView(); - content->GetDispatcher()->host()->SetBounds(gfx::Rect(800, 600)); + content->GetHost()->SetBounds(gfx::Rect(800, 600)); } void TestTouchSelectionOriginatingFromWebpage() { diff --git a/content/browser/web_contents/web_contents_view_aura.cc b/content/browser/web_contents/web_contents_view_aura.cc index 1b780d0..0ab1fbf 100644 --- a/content/browser/web_contents/web_contents_view_aura.cc +++ b/content/browser/web_contents/web_contents_view_aura.cc @@ -460,8 +460,8 @@ class WebContentsViewAura::WindowObserver virtual ~WindowObserver() { view_->window_->RemoveObserver(this); - if (view_->window_->GetDispatcher()) - view_->window_->GetDispatcher()->RemoveRootWindowObserver(this); + if (view_->window_->GetHost()) + view_->window_->GetHost()->dispatcher()->RemoveRootWindowObserver(this); if (parent_) parent_->RemoveObserver(this); @@ -592,7 +592,7 @@ class WebContentsViewAura::WindowObserver virtual void OnWindowAddedToRootWindow(aura::Window* window) OVERRIDE { if (window == view_->window_) { - window->GetDispatcher()->AddRootWindowObserver(this); + window->GetHost()->dispatcher()->AddRootWindowObserver(this); #if defined(OS_WIN) if (!window->GetRootWindow()->HasObserver(this)) window->GetRootWindow()->AddObserver(this); @@ -602,7 +602,7 @@ class WebContentsViewAura::WindowObserver virtual void OnWindowRemovingFromRootWindow(aura::Window* window) OVERRIDE { if (window == view_->window_) { - window->GetDispatcher()->RemoveRootWindowObserver(this); + window->GetHost()->dispatcher()->RemoveRootWindowObserver(this); #if defined(OS_WIN) window->GetRootWindow()->RemoveObserver(this); 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 e861b3d..95e41b8 100644 --- a/content/browser/web_contents/web_contents_view_aura_browsertest.cc +++ b/content/browser/web_contents/web_contents_view_aura_browsertest.cc @@ -322,7 +322,7 @@ IN_PROC_BROWSER_TEST_F(WebContentsViewAuraTest, EXPECT_EQ(1, GetCurrentIndex()); aura::Window* content = web_contents->GetView()->GetContentNativeView(); - aura::WindowEventDispatcher* dispatcher = content->GetDispatcher(); + aura::WindowEventDispatcher* dispatcher = content->GetHost()->dispatcher(); gfx::Rect bounds = content->GetBoundsInRootWindow(); base::TimeDelta timestamp; diff --git a/content/shell/browser/shell_download_manager_delegate.cc b/content/shell/browser/shell_download_manager_delegate.cc index 572d79e..31f9d94 100644 --- a/content/shell/browser/shell_download_manager_delegate.cc +++ b/content/shell/browser/shell_download_manager_delegate.cc @@ -176,7 +176,7 @@ void ShellDownloadManagerDelegate::ChooseDownloadPath( ZeroMemory(&save_as, sizeof(save_as)); save_as.lStructSize = sizeof(OPENFILENAME); save_as.hwndOwner = item->GetWebContents()->GetView()->GetNativeView()-> - GetDispatcher()->host()->GetAcceleratedWidget(); + GetHost()->GetAcceleratedWidget(); save_as.lpstrFile = file_name; save_as.nMaxFile = arraysize(file_name); diff --git a/content/shell/browser/shell_views.cc b/content/shell/browser/shell_views.cc index df8199a..47aab24 100644 --- a/content/shell/browser/shell_views.cc +++ b/content/shell/browser/shell_views.cc @@ -150,7 +150,7 @@ class ShellWindowDelegateView : public views::WidgetDelegateView, // Resizing a widget on chromeos doesn't automatically resize the root, need // to explicitly do that. #if defined(OS_CHROMEOS) - GetWidget()->GetNativeWindow()->GetDispatcher()->host()->SetBounds(bounds); + GetWidget()->GetNativeWindow()->GetHost()->SetBounds(bounds); #endif } @@ -504,7 +504,7 @@ void Shell::PlatformCreateWindow(int width, int height) { window_ = window_widget_->GetNativeWindow(); // Call ShowRootWindow on RootWindow created by WMTestHelper without // which XWindow owned by RootWindow doesn't get mapped. - window_->GetDispatcher()->host()->Show(); + window_->GetHost()->Show(); window_widget_->Show(); } diff --git a/mojo/examples/launcher/launcher.cc b/mojo/examples/launcher/launcher.cc index a86bb25..ae3944b 100644 --- a/mojo/examples/launcher/launcher.cc +++ b/mojo/examples/launcher/launcher.cc @@ -98,7 +98,7 @@ class MinimalInputEventFilter : public ui::internal::InputMethodDelegate, virtual bool DispatchKeyEventPostIME(const ui::KeyEvent& event) OVERRIDE { ui::TranslatedKeyEvent aura_event(event); ui::EventDispatchDetails details = - root_->GetDispatcher()->OnEventFromSource(&aura_event); + root_->GetHost()->dispatcher()->OnEventFromSource(&aura_event); return aura_event.handled() || details.dispatcher_destroyed; } diff --git a/printing/printing_context_win.cc b/printing/printing_context_win.cc index 4ba013e..78dd47f 100644 --- a/printing/printing_context_win.cc +++ b/printing/printing_context_win.cc @@ -41,7 +41,7 @@ HWND GetRootWindow(gfx::NativeView view) { HWND window = NULL; #if defined(USE_AURA) if (view) - window = view->GetDispatcher()->host()->GetAcceleratedWidget(); + window = view->GetHost()->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 79a1b29..99e7552 100644 --- a/ui/app_list/views/app_list_view.cc +++ b/ui/app_list/views/app_list_view.cc @@ -249,7 +249,7 @@ HWND AppListView::GetHWND() const { #if defined(USE_AURA) gfx::NativeWindow window = GetWidget()->GetTopLevelWidget()->GetNativeWindow(); - return window->GetDispatcher()->host()->GetAcceleratedWidget(); + return window->GetHost()->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 b0a1055..3cde703 100644 --- a/ui/aura/client/default_capture_client.cc +++ b/ui/aura/client/default_capture_client.cc @@ -31,7 +31,7 @@ void DefaultCaptureClient::SetCapture(Window* window) { Window* old_capture_window = capture_window_; capture_window_ = window; - CaptureDelegate* capture_delegate = root_window_->GetDispatcher(); + CaptureDelegate* capture_delegate = root_window_->GetHost()->dispatcher(); if (capture_window_) capture_delegate->SetNativeCapture(); else diff --git a/ui/aura/remote_window_tree_host_win.cc b/ui/aura/remote_window_tree_host_win.cc index 3fe87b7..92a37c2 100644 --- a/ui/aura/remote_window_tree_host_win.cc +++ b/ui/aura/remote_window_tree_host_win.cc @@ -369,7 +369,7 @@ bool RemoteWindowTreeHostWin::IsForegroundWindow() { } Window* RemoteWindowTreeHostWin::GetAshWindow() { - return GetDispatcher()->window(); + return window(); } gfx::AcceleratedWidget RemoteWindowTreeHostWin::GetAcceleratedWidget() { @@ -421,7 +421,7 @@ void RemoteWindowTreeHostWin::ReleaseCapture() { bool RemoteWindowTreeHostWin::QueryMouseLocation(gfx::Point* location_return) { aura::client::CursorClient* cursor_client = - aura::client::GetCursorClient(GetDispatcher()->window()); + aura::client::GetCursorClient(window()); if (cursor_client && !cursor_client->IsMouseEventsEnabled()) { *location_return = gfx::Point(0, 0); return false; diff --git a/ui/aura/test/event_generator.cc b/ui/aura/test/event_generator.cc index 705df12..b1dcab5 100644 --- a/ui/aura/test/event_generator.cc +++ b/ui/aura/test/event_generator.cc @@ -41,7 +41,7 @@ class DefaultEventGeneratorDelegate : public EventGeneratorDelegate { // EventGeneratorDelegate overrides: virtual WindowEventDispatcher* GetDispatcherAt( const gfx::Point& point) const OVERRIDE { - return root_window_->GetDispatcher(); + return root_window_->GetHost()->dispatcher(); } virtual client::ScreenPositionClient* GetScreenPositionClient( diff --git a/ui/aura/test/ui_controls_factory_aurawin.cc b/ui/aura/test/ui_controls_factory_aurawin.cc index 8cbf927..a505fbb 100644 --- a/ui/aura/test/ui_controls_factory_aurawin.cc +++ b/ui/aura/test/ui_controls_factory_aurawin.cc @@ -38,7 +38,7 @@ class UIControlsWin : public UIControlsAura { bool command) { DCHECK(!command); // No command key on Aura HWND window = - native_window->GetDispatcher()->host()->GetAcceleratedWidget(); + native_window->GetHost()->GetAcceleratedWidget(); return SendKeyPressImpl( window, key, control, shift, alt, base::Closure()); } @@ -51,7 +51,7 @@ class UIControlsWin : public UIControlsAura { const base::Closure& task) { DCHECK(!command); // No command key on Aura HWND window = - native_window->GetDispatcher()->host()->GetAcceleratedWidget(); + native_window->GetHost()->GetAcceleratedWidget(); return SendKeyPressImpl(window, key, control, shift, alt, task); } virtual bool SendMouseMove(long screen_x, long screen_y) { diff --git a/ui/aura/window.cc b/ui/aura/window.cc index 59dfc4c..bae67a9 100644 --- a/ui/aura/window.cc +++ b/ui/aura/window.cc @@ -162,7 +162,7 @@ class ScopedCursorHider { explicit ScopedCursorHider(Window* window) : window_(window), hid_cursor_(false) { - if (!window_->HasDispatcher()) + if (!window_->IsRootWindow()) return; const bool cursor_is_in_bounds = window_->GetBoundsInScreen().Contains( Env::GetInstance()->last_mouse_location()); @@ -174,7 +174,7 @@ class ScopedCursorHider { } } ~ScopedCursorHider() { - if (!window_->HasDispatcher()) + if (!window_->IsRootWindow()) return; // Update the device scale factor of the cursor client only when the last @@ -199,7 +199,7 @@ class ScopedCursorHider { }; Window::Window(WindowDelegate* delegate) - : dispatcher_(NULL), + : host_(NULL), type_(ui::wm::WINDOW_TYPE_UNKNOWN), owned_by_parent_(true), delegate_(delegate), @@ -227,9 +227,9 @@ Window::~Window() { FOR_EACH_OBSERVER(WindowObserver, observers_, OnWindowDestroying(this)); // Let the root know so that it can remove any references to us. - WindowEventDispatcher* dispatcher = GetDispatcher(); - if (dispatcher) - dispatcher->OnWindowDestroying(this); + WindowTreeHost* host = GetHost(); + if (host) + host->dispatcher()->OnWindowDestroying(this); // Then destroy the children. RemoveOrDestroyChildren(); @@ -343,17 +343,17 @@ Window* Window::GetRootWindow() { } const Window* Window::GetRootWindow() const { - return dispatcher_ ? this : parent_ ? parent_->GetRootWindow() : NULL; + return IsRootWindow() ? this : parent_ ? parent_->GetRootWindow() : NULL; } -WindowEventDispatcher* Window::GetDispatcher() { - return const_cast<WindowEventDispatcher*>(const_cast<const Window*>(this)-> - GetDispatcher()); +WindowTreeHost* Window::GetHost() { + return const_cast<WindowTreeHost*>(const_cast<const Window*>(this)-> + GetHost()); } -const WindowEventDispatcher* Window::GetDispatcher() const { +const WindowTreeHost* Window::GetHost() const { const Window* root_window = GetRootWindow(); - return root_window ? root_window->dispatcher_ : NULL; + return root_window ? root_window->host_ : NULL; } void Window::Show() { @@ -411,7 +411,7 @@ void Window::SetTransform(const gfx::Transform& transform) { NOTREACHED(); return; } - WindowEventDispatcher* dispatcher = GetDispatcher(); + WindowEventDispatcher* dispatcher = GetHost()->dispatcher(); bool contained_mouse = IsVisible() && dispatcher && ContainsPointInRoot(dispatcher->GetLastMouseLocationInRoot()); layer_->SetTransform(transform); @@ -548,7 +548,7 @@ void Window::AddChild(Window* child) { Window* root_window = GetRootWindow(); if (root_window && old_root != root_window) { - root_window->GetDispatcher()->OnWindowAddedToRootWindow(child); + root_window->GetHost()->dispatcher()->OnWindowAddedToRootWindow(child); child->NotifyAddedToRootWindow(); } @@ -630,7 +630,7 @@ void Window::MoveCursorTo(const gfx::Point& point_in_window) { DCHECK(root_window); gfx::Point point_in_root(point_in_window); ConvertPointToTarget(this, root_window, &point_in_root); - root_window->GetDispatcher()->host()->MoveCursorTo(point_in_root); + root_window->GetHost()->MoveCursorTo(point_in_root); } gfx::NativeCursor Window::GetCursor(const gfx::Point& point) const { @@ -705,7 +705,7 @@ bool Window::HasFocus() const { } bool Window::CanFocus() const { - if (dispatcher_) + if (IsRootWindow()) return IsVisible(); // NOTE: as part of focusing the window the ActivationClient may make the @@ -724,7 +724,7 @@ bool Window::CanFocus() const { } bool Window::CanReceiveEvents() const { - if (dispatcher_) + if (IsRootWindow()) return IsVisible(); // The client may forbid certain windows from receiving events at a given @@ -779,8 +779,8 @@ void* Window::GetNativeWindowProperty(const char* key) const { void Window::OnDeviceScaleFactorChanged(float device_scale_factor) { ScopedCursorHider hider(this); - if (dispatcher_) - dispatcher_->host()->OnDeviceScaleFactorChanged(device_scale_factor); + if (IsRootWindow()) + host_->OnDeviceScaleFactorChanged(device_scale_factor); if (delegate_) delegate_->OnDeviceScaleFactorChanged(device_scale_factor); } @@ -920,9 +920,9 @@ void Window::SetVisible(bool visible) { FOR_EACH_OBSERVER(WindowObserver, observers_, OnWindowVisibilityChanging(this, visible)); - WindowEventDispatcher* dispatcher = GetDispatcher(); - if (dispatcher) - dispatcher->DispatchMouseExitToHidingWindow(this); + WindowTreeHost* host = GetHost(); + if (host) + host->dispatcher()->DispatchMouseExitToHidingWindow(this); client::VisibilityClient* visibility_client = client::GetVisibilityClient(this); @@ -940,8 +940,8 @@ void Window::SetVisible(bool visible) { NotifyWindowVisibilityChanged(this, visible); - if (dispatcher) - dispatcher->OnWindowVisibilityChanged(this, visible); + if (host) + host->dispatcher()->OnWindowVisibilityChanged(this, visible); } void Window::SchedulePaint() { @@ -1030,7 +1030,7 @@ void Window::RemoveChildImpl(Window* child, Window* new_parent) { 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->GetDispatcher()->OnWindowRemovedFromRootWindow( + root_window->GetHost()->dispatcher()->OnWindowRemovedFromRootWindow( child, new_root_window); child->NotifyRemovingFromRootWindow(); } @@ -1344,9 +1344,9 @@ void Window::OnWindowBoundsChanged(const gfx::Rect& old_bounds, FOR_EACH_OBSERVER(WindowObserver, observers_, OnWindowBoundsChanged(this, old_bounds, bounds())); - WindowEventDispatcher* dispatcher = GetDispatcher(); - if (dispatcher) - dispatcher->OnWindowBoundsChanged(this, contained_mouse); + WindowTreeHost* host = GetHost(); + if (host) + host->dispatcher()->OnWindowBoundsChanged(this, contained_mouse); } void Window::OnPaintLayer(gfx::Canvas* canvas) { @@ -1385,7 +1385,7 @@ bool Window::CanAcceptEvent(const ui::Event& event) { } ui::EventTarget* Window::GetParentTarget() { - if (dispatcher_) { + if (IsRootWindow()) { return client::GetEventClient(this) ? client::GetEventClient(this)->GetToplevelEventTarget() : Env::GetInstance(); @@ -1426,9 +1426,9 @@ void Window::UpdateLayerName(const std::string& name) { bool Window::ContainsMouse() { bool contains_mouse = false; if (IsVisible()) { - WindowEventDispatcher* dispatcher = GetDispatcher(); - contains_mouse = dispatcher && - ContainsPointInRoot(dispatcher->GetLastMouseLocationInRoot()); + WindowTreeHost* host = GetHost(); + contains_mouse = host && + ContainsPointInRoot(host->dispatcher()->GetLastMouseLocationInRoot()); } return contains_mouse; } diff --git a/ui/aura/window.h b/ui/aura/window.h index 010bf95..d01a331 100644 --- a/ui/aura/window.h +++ b/ui/aura/window.h @@ -45,8 +45,8 @@ namespace aura { class LayoutManager; class WindowDelegate; -class WindowEventDispatcher; class WindowObserver; +class WindowTreeHost; // Defined in window_property.h (which we do not include) template<typename T> @@ -123,12 +123,10 @@ class AURA_EXPORT Window : public ui::LayerDelegate, 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_; } + WindowTreeHost* GetHost(); + const WindowTreeHost* GetHost() const; + void set_host(WindowTreeHost* host) { host_ = host; } + bool IsRootWindow() const { return !!host_; } // The Window does not own this object. void set_user_data(void* user_data) { user_data_ = user_data; } @@ -337,7 +335,6 @@ class AURA_EXPORT Window : public ui::LayerDelegate, private: friend class test::WindowTestApi; friend class LayoutManager; - friend class WindowEventDispatcher; friend class WindowTargeter; // Called by the public {Set,Get,Clear}Property functions. @@ -492,7 +489,7 @@ class AURA_EXPORT Window : public ui::LayerDelegate, // is relative to the parent Window. gfx::Rect bounds_; - WindowEventDispatcher* dispatcher_; + WindowTreeHost* host_; ui::wm::WindowType type_; diff --git a/ui/aura/window_event_dispatcher.cc b/ui/aura/window_event_dispatcher.cc index a071830..98d268e 100644 --- a/ui/aura/window_event_dispatcher.cc +++ b/ui/aura/window_event_dispatcher.cc @@ -1,4 +1,4 @@ -// Copyright (c) 2012 The Chromium Authors. All rights reserved. +// Copyright 2014 The Chromium Authors. All rights reserved. // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. @@ -24,7 +24,6 @@ #include "ui/aura/window_tracker.h" #include "ui/aura/window_tree_host.h" #include "ui/base/hit_test.h" -#include "ui/base/view_prop.h" #include "ui/compositor/dip_util.h" #include "ui/compositor/layer.h" #include "ui/compositor/layer_animator.h" @@ -41,9 +40,6 @@ namespace aura { namespace { -const char kRootWindowForAcceleratedWidget[] = - "__AURA_ROOT_WINDOW_ACCELERATED_WIDGET__"; - // Returns true if |target| has a non-client (frame) component at |location|, // in window coordinates. bool IsNonClientLocation(Window* target, const gfx::Point& location) { @@ -86,8 +82,7 @@ bool IsEventCandidateForHold(const ui::Event& event) { // WindowEventDispatcher, public: WindowEventDispatcher::WindowEventDispatcher(WindowTreeHost* host) - : window_(new Window(NULL)), - host_(host), + : host_(host), touch_ids_down_(0), mouse_pressed_handler_(NULL), mouse_moved_handler_(NULL), @@ -98,40 +93,12 @@ WindowEventDispatcher::WindowEventDispatcher(WindowTreeHost* host) dispatching_held_event_(false), repost_event_factory_(this), held_event_factory_(this) { - window()->Init(WINDOW_LAYER_NOT_DRAWN); - window()->set_dispatcher(this); - window()->SetName("RootWindow"); - window()->SetEventTargeter( - scoped_ptr<ui::EventTargeter>(new WindowTargeter())); - - prop_.reset(new ui::ViewProp(host_->GetAcceleratedWidget(), - kRootWindowForAcceleratedWidget, - this)); ui::GestureRecognizer::Get()->AddGestureEventHelper(this); } WindowEventDispatcher::~WindowEventDispatcher() { TRACE_EVENT0("shutdown", "WindowEventDispatcher::Destructor"); - ui::GestureRecognizer::Get()->RemoveGestureEventHelper(this); - - // An observer may have been added by an animation on the - // WindowEventDispatcher. - window()->layer()->GetAnimator()->RemoveObserver(this); - - // Destroy child windows while we're still valid. This is also done by - // ~Window, but by that time any calls to virtual methods overriden here (such - // as GetRootWindow()) result in Window's implementation. By destroying here - // we ensure GetRootWindow() still returns this. - window()->RemoveOrDestroyChildren(); - window()->set_dispatcher(NULL); -} - -// static -WindowEventDispatcher* WindowEventDispatcher::GetForAcceleratedWidget( - gfx::AcceleratedWidget widget) { - return reinterpret_cast<WindowEventDispatcher*>( - ui::ViewProp::GetValue(widget, kRootWindowForAcceleratedWidget)); } void WindowEventDispatcher::PrepareForShutdown() { diff --git a/ui/aura/window_event_dispatcher.h b/ui/aura/window_event_dispatcher.h index 94ecd77..d1b6bfa 100644 --- a/ui/aura/window_event_dispatcher.h +++ b/ui/aura/window_event_dispatcher.h @@ -1,4 +1,4 @@ -// Copyright (c) 2012 The Chromium Authors. All rights reserved. +// Copyright 2014 The Chromium Authors. All rights reserved. // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. @@ -41,7 +41,6 @@ class LayerAnimationSequence; class MouseEvent; class ScrollEvent; class TouchEvent; -class ViewProp; } namespace aura { @@ -49,7 +48,10 @@ class RootWindowObserver; class TestScreen; class WindowTargeter; -// RootWindow is responsible for hosting a set of windows. +// WindowEventDispatcher orchestrates event dispatch within a window tree +// owned by WindowTreeHost. WTH also owns the WED. +// TODO(beng): In progress, remove functionality not directly related to +// event dispatch. class AURA_EXPORT WindowEventDispatcher : public ui::EventProcessor, public ui::GestureEventHelper, public ui::LayerAnimationObserver, @@ -59,16 +61,8 @@ class AURA_EXPORT WindowEventDispatcher : public ui::EventProcessor, explicit WindowEventDispatcher(WindowTreeHost* host); virtual ~WindowEventDispatcher(); - // Returns the WindowTreeHost for the specified accelerated widget, or NULL - // if there is none associated. - static WindowEventDispatcher* GetForAcceleratedWidget( - gfx::AcceleratedWidget widget); - - Window* window() { - return const_cast<Window*>( - const_cast<const WindowEventDispatcher*>(this)->window()); - } - const Window* window() const { return window_.get(); } + Window* window() { return host()->window(); } + const Window* window() const { return host()->window(); } WindowTreeHost* host() { return const_cast<WindowTreeHost*>( const_cast<const WindowEventDispatcher*>(this)->host()); @@ -105,7 +99,7 @@ class AURA_EXPORT WindowEventDispatcher : public ui::EventProcessor, // the bounds before change contained the |last_moust_location()|. void OnWindowBoundsChanged(Window* window, bool contained_mouse); - // Dispatches OnMouseExited to the |window| which is hiding if nessessary. + // Dispatches OnMouseExited to the |window| which is hiding if necessary. void DispatchMouseExitToHidingWindow(Window* window); // Dispatches a ui::ET_MOUSE_EXITED event at |point|. @@ -114,13 +108,13 @@ class AURA_EXPORT WindowEventDispatcher : public ui::EventProcessor, // Invoked when |window|'s visibility has changed. void OnWindowVisibilityChanged(Window* window, bool is_visible); - // Invoked when |window|'s tranfrom has changed. |contained_mouse| + // Invoked when |window|'s transform has changed. |contained_mouse| // indicates if the bounds before change contained the // |last_moust_location()|. void OnWindowTransformed(Window* window, bool contained_mouse); // Invoked when the keyboard mapping (in X11 terms: the mapping between - // keycodes and keysyms) has changed. + // key-codes and key-syms) has changed. void OnKeyboardMappingChanged(); // The system windowing system has sent a request that we close our window. @@ -271,9 +265,6 @@ class AURA_EXPORT WindowEventDispatcher : public ui::EventProcessor, void PreDispatchMouseEvent(Window* target, ui::MouseEvent* event); void PreDispatchTouchEvent(Window* target, ui::TouchEvent* event); - // TODO(beng): should be owned by WindowTreeHost. - scoped_ptr<Window> window_; - WindowTreeHost* host_; // Touch ids that are currently down. @@ -300,8 +291,6 @@ class AURA_EXPORT WindowEventDispatcher : public ui::EventProcessor, // Set when dispatching a held event. bool dispatching_held_event_; - scoped_ptr<ui::ViewProp> prop_; - // Used to schedule reposting an event. base::WeakPtrFactory<WindowEventDispatcher> repost_event_factory_; diff --git a/ui/aura/window_event_dispatcher_unittest.cc b/ui/aura/window_event_dispatcher_unittest.cc index e919c64..f091110 100644 --- a/ui/aura/window_event_dispatcher_unittest.cc +++ b/ui/aura/window_event_dispatcher_unittest.cc @@ -1133,7 +1133,7 @@ class RepostGestureEventRecorder : public EventFilterRecorder { if (!reposted_) { EXPECT_NE(repost_target_, event->target()); reposted_ = true; - repost_target_->GetDispatcher()->RepostEvent(*event); + repost_target_->GetHost()->dispatcher()->RepostEvent(*event); // Ensure that the reposted gesture event above goes to the // repost_target_; repost_source_->GetRootWindow()->RemoveChild(repost_source_); @@ -1351,7 +1351,7 @@ class DontResetHeldEventWindowDelegate : public test::TestWindowDelegate { ui::MouseEvent mouse_event(ui::ET_MOUSE_PRESSED, gfx::Point(10, 10), gfx::Point(10, 10), ui::EF_SHIFT_DOWN, 0); - root_->GetDispatcher()->RepostEvent(mouse_event); + root_->GetHost()->dispatcher()->RepostEvent(mouse_event); } } @@ -1376,7 +1376,7 @@ TEST_F(WindowEventDispatcherTest, DontResetHeldEvent) { ui::MouseEvent pressed(ui::ET_MOUSE_PRESSED, gfx::Point(10, 10), gfx::Point(10, 10), ui::EF_SHIFT_DOWN, 0); - root_window()->GetDispatcher()->RepostEvent(pressed); + root_window()->GetHost()->dispatcher()->RepostEvent(pressed); ui::MouseEvent pressed2(ui::ET_MOUSE_PRESSED, gfx::Point(10, 10), gfx::Point(10, 10), 0, 0); // Dispatch an event to flush event scheduled by way of RepostEvent(). @@ -1853,7 +1853,7 @@ class DispatchEventHandler : public ui::EventHandler { ui::MouseEvent move(ui::ET_MOUSE_MOVED, target_->bounds().CenterPoint(), target_->bounds().CenterPoint(), ui::EF_NONE, ui::EF_NONE); ui::EventDispatchDetails details = - target_->GetDispatcher()->OnEventFromSource(&move); + target_->GetHost()->dispatcher()->OnEventFromSource(&move); ASSERT_FALSE(details.dispatcher_destroyed); EXPECT_FALSE(details.target_destroyed); EXPECT_EQ(target_, move.target()); diff --git a/ui/aura/window_targeter.cc b/ui/aura/window_targeter.cc index a50f981..c0c194e 100644 --- a/ui/aura/window_targeter.cc +++ b/ui/aura/window_targeter.cc @@ -56,7 +56,7 @@ ui::EventTarget* WindowTargeter::FindTargetForEvent(ui::EventTarget* root, // from here. Instead, dispatch the event through the // WindowEventDispatcher that owns |target|. ui::EventDispatchDetails details ALLOW_UNUSED = - target->GetDispatcher()->OnEventFromSource(event); + target->GetHost()->dispatcher()->OnEventFromSource(event); target = NULL; } } @@ -113,7 +113,7 @@ Window* WindowTargeter::FindTargetInRootWindow(Window* root_window, // Mouse events should be dispatched to the window that processed the // mouse-press events (if any). if (event.IsScrollEvent() || event.IsMouseEvent()) { - WindowEventDispatcher* dispatcher = root_window->GetDispatcher(); + WindowEventDispatcher* dispatcher = root_window->GetHost()->dispatcher(); if (dispatcher->mouse_pressed_handler()) return dispatcher->mouse_pressed_handler(); } diff --git a/ui/aura/window_tree_host.cc b/ui/aura/window_tree_host.cc index fd3d217..ebaf15c 100644 --- a/ui/aura/window_tree_host.cc +++ b/ui/aura/window_tree_host.cc @@ -9,7 +9,9 @@ #include "ui/aura/root_window_transformer.h" #include "ui/aura/window.h" #include "ui/aura/window_event_dispatcher.h" +#include "ui/aura/window_targeter.h" #include "ui/aura/window_tree_host_delegate.h" +#include "ui/base/view_prop.h" #include "ui/compositor/dip_util.h" #include "ui/compositor/layer.h" #include "ui/gfx/display.h" @@ -22,6 +24,9 @@ namespace aura { +const char kWindowTreeHostForAcceleratedWidget[] = + "__AURA_WINDOW_TREE_HOST_ACCELERATED_WIDGET__"; + float GetDeviceScaleFactorFromDisplay(Window* window) { gfx::Display display = gfx::Screen::GetScreenFor(window)-> GetDisplayNearestWindow(window); @@ -77,6 +82,13 @@ WindowTreeHost::~WindowTreeHost() { DCHECK(!compositor_) << "compositor must be destroyed before root window"; } +// static +WindowTreeHost* WindowTreeHost::GetForAcceleratedWidget( + gfx::AcceleratedWidget widget) { + return reinterpret_cast<WindowTreeHost*>( + ui::ViewProp::GetValue(widget, kWindowTreeHostForAcceleratedWidget)); +} + void WindowTreeHost::InitHost() { InitCompositor(); UpdateRootWindowSize(GetBounds().size()); @@ -92,14 +104,6 @@ void WindowTreeHost::InitCompositor() { new SimpleRootWindowTransformer(window(), gfx::Transform())); } -aura::Window* WindowTreeHost::window() { - return const_cast<Window*>(const_cast<const WindowTreeHost*>(this)->window()); -} - -const aura::Window* WindowTreeHost::window() const { - return delegate_->AsDispatcher()->window(); -} - void WindowTreeHost::SetRootWindowTransformer( scoped_ptr<RootWindowTransformer> transformer) { transformer_ = transformer.Pass(); @@ -201,6 +205,7 @@ WindowEventDispatcher* WindowTreeHost::GetDispatcher() { WindowTreeHost::WindowTreeHost() : delegate_(NULL), + window_(new Window(NULL)), last_cursor_(ui::kCursorNull) { } @@ -210,7 +215,22 @@ void WindowTreeHost::DestroyCompositor() { } void WindowTreeHost::DestroyDispatcher() { + // An observer may have been added by an animation on the + // WindowEventDispatcher. + window()->layer()->GetAnimator()->RemoveObserver(dispatcher()); + + delete window_; + window_ = NULL; dispatcher_.reset(); + + // TODO(beng): this comment is no longer quite valid since this function + // isn't called from WED, and WED isn't a subclass of Window. So it seems + // like we could just rely on ~Window now. + // Destroy child windows while we're still valid. This is also done by + // ~Window, but by that time any calls to virtual methods overriden here (such + // as GetRootWindow()) result in Window's implementation. By destroying here + // we ensure GetRootWindow() still returns this. + //window()->RemoveOrDestroyChildren(); } void WindowTreeHost::CreateCompositor( @@ -219,8 +239,17 @@ void WindowTreeHost::CreateCompositor( DCHECK(compositor_.get()); // TODO(beng): I think this setup should probably all move to a "accelerated // widget available" function. - if (!dispatcher()) + if (!dispatcher()) { + window()->Init(WINDOW_LAYER_NOT_DRAWN); + window()->set_host(this); + window()->SetName("RootWindow"); + window()->SetEventTargeter( + scoped_ptr<ui::EventTargeter>(new WindowTargeter())); + prop_.reset(new ui::ViewProp(GetAcceleratedWidget(), + kWindowTreeHostForAcceleratedWidget, + this)); dispatcher_.reset(new WindowEventDispatcher(this)); + } delegate_ = dispatcher(); } diff --git a/ui/aura/window_tree_host.h b/ui/aura/window_tree_host.h index 6418791..71e990e 100644 --- a/ui/aura/window_tree_host.h +++ b/ui/aura/window_tree_host.h @@ -23,6 +23,7 @@ class Transform; namespace ui { class Compositor; +class ViewProp; } namespace aura { @@ -40,13 +41,16 @@ class AURA_EXPORT WindowTreeHost { // Creates a new WindowTreeHost. The caller owns the returned value. static WindowTreeHost* Create(const gfx::Rect& bounds); + // Returns the WindowTreeHost for the specified accelerated widget, or NULL + // if there is none associated. + static WindowTreeHost* GetForAcceleratedWidget(gfx::AcceleratedWidget widget); + void InitHost(); void InitCompositor(); - // TODO(beng): these will become trivial accessors in a future CL. - Window* window(); - const Window* window() const; + Window* window() { return window_; } + const Window* window() const { return window_; } WindowEventDispatcher* dispatcher() { return const_cast<WindowEventDispatcher*>( @@ -193,6 +197,12 @@ class AURA_EXPORT WindowTreeHost { void MoveCursorToInternal(const gfx::Point& root_location, const gfx::Point& host_location); + // We don't use a scoped_ptr for |window_| since we need this ptr to be valid + // during its deletion. (Window's dtor notifies observers that may attempt to + // reach back up to access this object which will be valid until the end of + // the dtor). + Window* window_; // Owning. + scoped_ptr<WindowEventDispatcher> dispatcher_; scoped_ptr<ui::Compositor> compositor_; @@ -202,6 +212,8 @@ class AURA_EXPORT WindowTreeHost { // Last cursor set. Used for testing. gfx::NativeCursor last_cursor_; + scoped_ptr<ui::ViewProp> prop_; + DISALLOW_COPY_AND_ASSIGN(WindowTreeHost); }; diff --git a/ui/aura/window_tree_host_win.cc b/ui/aura/window_tree_host_win.cc index 2d592e5..33d50e6 100644 --- a/ui/aura/window_tree_host_win.cc +++ b/ui/aura/window_tree_host_win.cc @@ -170,8 +170,7 @@ void WindowTreeHostWin::ReleaseCapture() { } bool WindowTreeHostWin::QueryMouseLocation(gfx::Point* location_return) { - client::CursorClient* cursor_client = - client::GetCursorClient(GetDispatcher()->window()); + client::CursorClient* cursor_client = client::GetCursorClient(window()); if (cursor_client && !cursor_client->IsMouseEventsEnabled()) { *location_return = gfx::Point(0, 0); return false; diff --git a/ui/aura/window_tree_host_x11.cc b/ui/aura/window_tree_host_x11.cc index 5f0c6ac..aa8d0c2 100644 --- a/ui/aura/window_tree_host_x11.cc +++ b/ui/aura/window_tree_host_x11.cc @@ -363,7 +363,7 @@ uint32_t WindowTreeHostX11::Dispatch(const base::NativeEvent& event) { switch (xev->type) { case EnterNotify: { - aura::Window* root_window = GetDispatcher()->window(); + aura::Window* root_window = window(); client::CursorClient* cursor_client = client::GetCursorClient(root_window); if (cursor_client) { @@ -635,7 +635,7 @@ void WindowTreeHostX11::ReleaseCapture() { bool WindowTreeHostX11::QueryMouseLocation(gfx::Point* location_return) { client::CursorClient* cursor_client = - client::GetCursorClient(GetDispatcher()->window()); + client::GetCursorClient(window()); if (cursor_client && !cursor_client->IsMouseEventsEnabled()) { *location_return = gfx::Point(0, 0); return false; @@ -767,7 +767,7 @@ void WindowTreeHostX11::OnWindowInitialized(Window* window) { } void WindowTreeHostX11::OnRootWindowInitialized( - WindowEventDispatcher* dispatcher) { + WindowEventDispatcher* d) { // UpdateIsInternalDisplay relies on: // 1. delegate_ pointing to WindowEventDispatcher - available after // SetDelegate. @@ -775,7 +775,7 @@ void WindowTreeHostX11::OnRootWindowInitialized( // WED::Init is called. // (set in DisplayManager::CreateRootWindowForDisplay) // Ready when NotifyRootWindowInitialized is called from WED::Init. - if (!delegate_ || dispatcher != GetDispatcher()) + if (!delegate_ || d != dispatcher()) return; UpdateIsInternalDisplay(); @@ -930,7 +930,7 @@ void WindowTreeHostX11::SetCursorInternal(gfx::NativeCursor cursor) { void WindowTreeHostX11::TranslateAndDispatchMouseEvent( ui::MouseEvent* event) { - Window* root_window = GetDispatcher()->window(); + Window* root_window = window(); client::ScreenPositionClient* screen_position_client = client::GetScreenPositionClient(root_window); gfx::Rect local(bounds_.size()); @@ -951,7 +951,7 @@ void WindowTreeHostX11::TranslateAndDispatchMouseEvent( } void WindowTreeHostX11::UpdateIsInternalDisplay() { - Window* root_window = GetDispatcher()->window(); + Window* root_window = window(); gfx::Screen* screen = gfx::Screen::GetScreenFor(root_window); gfx::Display display = screen->GetDisplayNearestWindow(root_window); is_internal_display_ = display.IsInternal(); diff --git a/ui/keyboard/keyboard_ui_handler.cc b/ui/keyboard/keyboard_ui_handler.cc index c2398ca..c0873b8 100644 --- a/ui/keyboard/keyboard_ui_handler.cc +++ b/ui/keyboard/keyboard_ui_handler.cc @@ -115,8 +115,8 @@ void KeyboardUIHandler::HandleSendKeyEventMessage( return; } - aura::WindowEventDispatcher* dispatcher = - web_ui()->GetWebContents()->GetView()->GetNativeView()->GetDispatcher(); + aura::WindowEventDispatcher* dispatcher = web_ui()->GetWebContents()-> + GetView()->GetNativeView()->GetHost()->dispatcher(); if (!dispatcher) { LOG(ERROR) << "sendKeyEvent failed: no dispatcher"; return; diff --git a/ui/keyboard/keyboard_util.h b/ui/keyboard/keyboard_util.h index 51001fe..2e37a2e 100644 --- a/ui/keyboard/keyboard_util.h +++ b/ui/keyboard/keyboard_util.h @@ -14,6 +14,10 @@ struct GritResourceMap; +namespace aura { +class WindowEventDispatcher; +} + namespace keyboard { // Enumeration of swipe directions. diff --git a/ui/shell_dialogs/select_file_dialog_win.cc b/ui/shell_dialogs/select_file_dialog_win.cc index 9ae2137..7a8e2e6 100644 --- a/ui/shell_dialogs/select_file_dialog_win.cc +++ b/ui/shell_dialogs/select_file_dialog_win.cc @@ -601,7 +601,7 @@ void SelectFileDialogImpl::SelectFileImpl( } } HWND owner = owning_window && owning_window->GetRootWindow() - ? owning_window->GetDispatcher()->host()->GetAcceleratedWidget() : NULL; + ? owning_window->GetHost()->GetAcceleratedWidget() : NULL; #else HWND owner = owning_window; #endif @@ -623,7 +623,7 @@ bool SelectFileDialogImpl::IsRunning(gfx::NativeWindow owning_window) const { #if defined(USE_AURA) if (!owning_window->GetRootWindow()) return false; - HWND owner = owning_window->GetDispatcher()->host()->GetAcceleratedWidget(); + HWND owner = owning_window->GetHost()->GetAcceleratedWidget(); #else HWND owner = owning_window; #endif diff --git a/ui/views/corewm/capture_controller.cc b/ui/views/corewm/capture_controller.cc index 686e877..daa34dd1 100644 --- a/ui/views/corewm/capture_controller.cc +++ b/ui/views/corewm/capture_controller.cc @@ -57,7 +57,7 @@ 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)->GetDispatcher(); + aura::client::CaptureDelegate* delegate = (*i)->GetHost()->dispatcher(); delegate->UpdateCapture(old_capture_window, new_capture_window); } @@ -66,11 +66,12 @@ void CaptureController::SetCapture(aura::Window* new_capture_window) { if (capture_root != old_capture_root) { if (old_capture_root) { aura::client::CaptureDelegate* delegate = - old_capture_root->GetDispatcher(); + old_capture_root->GetHost()->dispatcher(); delegate->ReleaseNativeCapture(); } if (capture_root) { - aura::client::CaptureDelegate* delegate = capture_root->GetDispatcher(); + aura::client::CaptureDelegate* delegate = + capture_root->GetHost()->dispatcher(); delegate->SetNativeCapture(); } } diff --git a/ui/views/corewm/capture_controller_unittest.cc b/ui/views/corewm/capture_controller_unittest.cc index cf622d4..9f53768 100644 --- a/ui/views/corewm/capture_controller_unittest.cc +++ b/ui/views/corewm/capture_controller_unittest.cc @@ -42,14 +42,11 @@ class CaptureControllerTest : public aura::test::AuraTestBase { new corewm::ScopedCaptureClient(second_host_->window())); #if !defined(OS_CHROMEOS) - desktop_position_client_.reset(new DesktopScreenPositionClient()); - aura::client::SetScreenPositionClient(root_window(), - desktop_position_client_.get()); - - second_desktop_position_client_.reset(new DesktopScreenPositionClient()); - aura::client::SetScreenPositionClient( - second_host_->window(), - second_desktop_position_client_.get()); + desktop_position_client_.reset( + new DesktopScreenPositionClient(root_window())); + + second_desktop_position_client_.reset( + new DesktopScreenPositionClient(second_host_->window())); #endif } diff --git a/ui/views/corewm/desktop_capture_controller_unittest.cc b/ui/views/corewm/desktop_capture_controller_unittest.cc index 504b3dd..18b3976 100644 --- a/ui/views/corewm/desktop_capture_controller_unittest.cc +++ b/ui/views/corewm/desktop_capture_controller_unittest.cc @@ -73,7 +73,7 @@ TEST_F(DesktopCaptureControllerTest, ResetMouseHandlers) { generator1.PressLeftButton(); EXPECT_FALSE(w1->HasCapture()); aura::WindowEventDispatcher* w1_dispatcher = - w1->GetNativeView()->GetDispatcher(); + w1->GetNativeView()->GetHost()->dispatcher(); EXPECT_TRUE(w1_dispatcher->mouse_pressed_handler() != NULL); EXPECT_TRUE(w1_dispatcher->mouse_moved_handler() != NULL); w2->SetCapture(w2->GetRootView()); @@ -105,7 +105,8 @@ TEST_F(DesktopCaptureControllerTest, CaptureWindowInputEventTest) { internal::RootView* root1 = static_cast<internal::RootView*>(widget1->GetRootView()); - desktop_position_client1.reset(new DesktopScreenPositionClient()); + desktop_position_client1.reset( + new DesktopScreenPositionClient(params.context->GetRootWindow())); aura::client::SetScreenPositionClient( widget1->GetNativeView()->GetRootWindow(), desktop_position_client1.get()); @@ -124,7 +125,8 @@ TEST_F(DesktopCaptureControllerTest, CaptureWindowInputEventTest) { internal::RootView* root2 = static_cast<internal::RootView*>(widget2->GetRootView()); - desktop_position_client2.reset(new DesktopScreenPositionClient()); + desktop_position_client2.reset( + new DesktopScreenPositionClient(params.context->GetRootWindow())); aura::client::SetScreenPositionClient( widget2->GetNativeView()->GetRootWindow(), desktop_position_client2.get()); diff --git a/ui/views/corewm/input_method_event_filter.cc b/ui/views/corewm/input_method_event_filter.cc index 0d1672a..cd7943c 100644 --- a/ui/views/corewm/input_method_event_filter.cc +++ b/ui/views/corewm/input_method_event_filter.cc @@ -47,7 +47,7 @@ void InputMethodEventFilter::OnKeyEvent(ui::KeyEvent* event) { // If the focused window is changed, all requests to IME will be // discarded so it's safe to update the target_dispatcher_ here. aura::Window* target = static_cast<aura::Window*>(event->target()); - target_dispatcher_ = target->GetRootWindow()->GetDispatcher(); + target_dispatcher_ = target->GetRootWindow()->GetHost()->dispatcher(); DCHECK(target_dispatcher_); if (input_method_->DispatchKeyEvent(*event)) event->StopPropagation(); diff --git a/ui/views/corewm/input_method_event_filter.h b/ui/views/corewm/input_method_event_filter.h index 6f6e6b8..cb76c1f 100644 --- a/ui/views/corewm/input_method_event_filter.h +++ b/ui/views/corewm/input_method_event_filter.h @@ -13,6 +13,10 @@ #include "ui/events/event_handler.h" #include "ui/views/views_export.h" +namespace aura { +class WindowEventDispatcher; +} + namespace ui { class InputMethod; } diff --git a/ui/views/corewm/tooltip_aura.cc b/ui/views/corewm/tooltip_aura.cc index 5ba5989..eb2149c 100644 --- a/ui/views/corewm/tooltip_aura.cc +++ b/ui/views/corewm/tooltip_aura.cc @@ -169,7 +169,7 @@ gfx::Rect TooltipAura::GetBoundsForTooltip( // (which comes from the RootWindow). if (screen_type_ == gfx::SCREEN_TYPE_NATIVE && gfx::SCREEN_TYPE_NATIVE != gfx::SCREEN_TYPE_ALTERNATE) { - widget_bounds = tooltip_window_->GetDispatcher()->host()->GetBounds(); + widget_bounds = tooltip_window_->GetHost()->GetBounds(); } gfx::Screen* screen = gfx::Screen::GetScreenByType(screen_type_); gfx::Rect bounds(screen->GetDisplayNearestPoint(origin).bounds()); diff --git a/ui/views/event_utils_aura.cc b/ui/views/event_utils_aura.cc index 4ac21d1..6bdc2ea3 100644 --- a/ui/views/event_utils_aura.cc +++ b/ui/views/event_utils_aura.cc @@ -31,7 +31,7 @@ bool RepostLocatedEvent(gfx::NativeWindow window, } else { if (ViewsDelegate::views_delegate && !ViewsDelegate::views_delegate->IsWindowInMetro(window)) - target_window = window->GetDispatcher()->host()->GetAcceleratedWidget(); + target_window = window->GetHost()->GetAcceleratedWidget(); } return RepostLocatedEventWin(target_window, event); #endif @@ -63,7 +63,7 @@ bool RepostLocatedEvent(gfx::NativeWindow window, relocated->set_location(root_loc); relocated->set_root_location(root_loc); - root_window->GetDispatcher()->RepostEvent(*relocated); + root_window->GetHost()->dispatcher()->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 2819c5b..75abae60 100644 --- a/ui/views/test/ui_controls_factory_desktop_aurax11.cc +++ b/ui/views/test/ui_controls_factory_desktop_aurax11.cc @@ -125,33 +125,31 @@ class UIControlsDesktopX11 : public UIControlsAura { const base::Closure& closure) OVERRIDE { DCHECK(!command); // No command key on Aura - aura::WindowEventDispatcher* dispatcher = window->GetDispatcher(); + aura::WindowTreeHost* host = window->GetHost(); XEvent xevent = {0}; xevent.xkey.type = KeyPress; if (control) { - SetKeycodeAndSendThenMask(dispatcher, &xevent, XK_Control_L, - ControlMask); + SetKeycodeAndSendThenMask(host, &xevent, XK_Control_L, ControlMask); } if (shift) - SetKeycodeAndSendThenMask(dispatcher, &xevent, XK_Shift_L, ShiftMask); + SetKeycodeAndSendThenMask(host, &xevent, XK_Shift_L, ShiftMask); if (alt) - SetKeycodeAndSendThenMask(dispatcher, &xevent, XK_Alt_L, Mod1Mask); + SetKeycodeAndSendThenMask(host, &xevent, XK_Alt_L, Mod1Mask); xevent.xkey.keycode = XKeysymToKeycode(x_display_, ui::XKeysymForWindowsKeyCode(key, shift)); - dispatcher->host()->PostNativeEvent(&xevent); + host->PostNativeEvent(&xevent); // Send key release events. xevent.xkey.type = KeyRelease; - dispatcher->host()->PostNativeEvent(&xevent); + host->PostNativeEvent(&xevent); if (alt) - UnmaskAndSetKeycodeThenSend(dispatcher, &xevent, Mod1Mask, XK_Alt_L); + UnmaskAndSetKeycodeThenSend(host, &xevent, Mod1Mask, XK_Alt_L); if (shift) - UnmaskAndSetKeycodeThenSend(dispatcher, &xevent, ShiftMask, XK_Shift_L); + UnmaskAndSetKeycodeThenSend(host, &xevent, ShiftMask, XK_Shift_L); if (control) { - UnmaskAndSetKeycodeThenSend(dispatcher, &xevent, ControlMask, - XK_Control_L); + UnmaskAndSetKeycodeThenSend(host, &xevent, ControlMask, XK_Control_L); } DCHECK(!xevent.xkey.state); RunClosureAfterAllPendingUIEvents(closure); @@ -176,10 +174,10 @@ class UIControlsDesktopX11 : public UIControlsAura { &root_location); } - aura::WindowEventDispatcher* dispatcher = root_window->GetDispatcher(); + aura::WindowTreeHost* host = root_window->GetHost(); gfx::Point root_current_location; - dispatcher->host()->QueryMouseLocation(&root_current_location); - dispatcher->host()->ConvertPointFromHost(&root_current_location); + host->QueryMouseLocation(&root_current_location); + host->ConvertPointFromHost(&root_current_location); if (root_location != root_current_location && button_down_mask == 0) { // Move the cursor because EnterNotify/LeaveNotify are generated with the @@ -194,7 +192,7 @@ class UIControlsDesktopX11 : public UIControlsAura { xmotion->state = button_down_mask; xmotion->same_screen = True; // RootWindow will take care of other necessary fields. - dispatcher->host()->PostNativeEvent(&xevent); + host->PostNativeEvent(&xevent); } RunClosureAfterAllPendingUIEvents(closure); return true; @@ -234,12 +232,12 @@ class UIControlsDesktopX11 : public UIControlsAura { // RootWindow will take care of other necessary fields. if (state & DOWN) { xevent.xbutton.type = ButtonPress; - root_window->GetDispatcher()->host()->PostNativeEvent(&xevent); + root_window->GetHost()->PostNativeEvent(&xevent); button_down_mask |= xbutton->state; } if (state & UP) { xevent.xbutton.type = ButtonRelease; - root_window->GetDispatcher()->host()->PostNativeEvent(&xevent); + root_window->GetHost()->PostNativeEvent(&xevent); button_down_mask = (button_down_mask | xbutton->state) ^ xbutton->state; } RunClosureAfterAllPendingUIEvents(closure); @@ -285,22 +283,22 @@ class UIControlsDesktopX11 : public UIControlsAura { return NULL; } - void SetKeycodeAndSendThenMask(aura::WindowEventDispatcher* dispatcher, + void SetKeycodeAndSendThenMask(aura::WindowTreeHost* host, XEvent* xevent, KeySym keysym, unsigned int mask) { xevent->xkey.keycode = XKeysymToKeycode(x_display_, keysym); - dispatcher->host()->PostNativeEvent(xevent); + host->PostNativeEvent(xevent); xevent->xkey.state |= mask; } - void UnmaskAndSetKeycodeThenSend(aura::WindowEventDispatcher* dispatcher, + void UnmaskAndSetKeycodeThenSend(aura::WindowTreeHost* host, XEvent* xevent, unsigned int mask, KeySym keysym) { xevent->xkey.state ^= mask; xevent->xkey.keycode = XKeysymToKeycode(x_display_, keysym); - dispatcher->host()->PostNativeEvent(xevent); + host->PostNativeEvent(xevent); } // Our X11 state. diff --git a/ui/views/widget/desktop_aura/desktop_capture_client.cc b/ui/views/widget/desktop_aura/desktop_capture_client.cc index 121c0a2..3367f86 100644 --- a/ui/views/widget/desktop_aura/desktop_capture_client.cc +++ b/ui/views/widget/desktop_aura/desktop_capture_client.cc @@ -52,7 +52,7 @@ void DesktopCaptureClient::SetCapture(aura::Window* new_capture_window) { capture_window_ = new_capture_window; - aura::client::CaptureDelegate* delegate = root_->GetDispatcher(); + aura::client::CaptureDelegate* delegate = root_->GetHost()->dispatcher(); delegate->UpdateCapture(old_capture_window, new_capture_window); // Initiate native capture updating. @@ -67,7 +67,8 @@ void DesktopCaptureClient::SetCapture(aura::Window* new_capture_window) { for (CaptureClients::iterator i = capture_clients.begin(); i != capture_clients.end(); ++i) { if (*i != this) { - aura::client::CaptureDelegate* delegate = (*i)->root_->GetDispatcher(); + aura::client::CaptureDelegate* delegate = + (*i)->root_->GetHost()->dispatcher(); delegate->OnOtherRootGotCapture(); } } 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 ef65d68..e92b270 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 @@ -691,7 +691,7 @@ void DesktopDragDropClientAuraX11::DragTranslate( scoped_ptr<ui::DropTargetEvent>* event, aura::client::DragDropDelegate** delegate) { gfx::Point root_location = root_window_location; - root_window_->GetDispatcher()->host()->ConvertPointFromNativeScreen( + root_window_->GetHost()->ConvertPointFromNativeScreen( &root_location); aura::Window* target_window = root_window_->GetEventHandlerForPoint(root_location); 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 665f282..26eeb89 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_->GetDispatcher()->host()->ConvertPointFromNativeScreen( + root_window_->GetHost()->ConvertPointFromNativeScreen( &root_location); aura::Window* target_window = root_window_->GetEventHandlerForPoint(root_location); diff --git a/ui/views/widget/desktop_aura/desktop_native_widget_aura.cc b/ui/views/widget/desktop_aura/desktop_native_widget_aura.cc index d373a0c..f6ecab3 100644 --- a/ui/views/widget/desktop_aura/desktop_native_widget_aura.cc +++ b/ui/views/widget/desktop_aura/desktop_native_widget_aura.cc @@ -470,9 +470,7 @@ void DesktopNativeWidgetAura::InitNativeWidget( aura::client::SetDispatcherClient(host_->window(), dispatcher_client_.get()); - position_client_.reset(new DesktopScreenPositionClient()); - aura::client::SetScreenPositionClient(host_->window(), - position_client_.get()); + position_client_.reset(new DesktopScreenPositionClient(host_->window())); InstallInputMethodEventFilter(); 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 23018c5..b5187f5 100644 --- a/ui/views/widget/desktop_aura/desktop_screen_position_client.cc +++ b/ui/views/widget/desktop_aura/desktop_screen_position_client.cc @@ -16,7 +16,7 @@ namespace { gfx::Point GetOrigin(const aura::Window* root_window) { gfx::Point origin_in_pixels = - root_window->GetDispatcher()->host()->GetBounds().origin(); + root_window->GetHost()->GetBounds().origin(); aura::Window* window = const_cast<aura::Window*>(root_window); float scale = gfx::Screen::GetScreenFor(window)-> GetDisplayNearestWindow(window).device_scale_factor(); @@ -37,10 +37,13 @@ bool PositionWindowInScreenCoordinates(aura::Window* window) { } // namespace -DesktopScreenPositionClient::DesktopScreenPositionClient() { +DesktopScreenPositionClient::DesktopScreenPositionClient( + aura::Window* root_window) : root_window_(root_window) { + aura::client::SetScreenPositionClient(root_window_, this); } DesktopScreenPositionClient::~DesktopScreenPositionClient() { + aura::client::SetScreenPositionClient(root_window_, NULL); } void DesktopScreenPositionClient::ConvertPointToScreen( @@ -92,7 +95,7 @@ void DesktopScreenPositionClient::SetBounds( desktop_native_widget->GetNativeView() == window) { // |window| is the content_window. // Setting bounds of root resizes |window|. - root->GetDispatcher()->host()->SetBounds(bounds); + root->GetHost()->SetBounds(bounds); } else { window->SetBounds(bounds); } diff --git a/ui/views/widget/desktop_aura/desktop_screen_position_client.h b/ui/views/widget/desktop_aura/desktop_screen_position_client.h index da8ad40..222c2a1 100644 --- a/ui/views/widget/desktop_aura/desktop_screen_position_client.h +++ b/ui/views/widget/desktop_aura/desktop_screen_position_client.h @@ -15,7 +15,7 @@ namespace views { class VIEWS_EXPORT DesktopScreenPositionClient : public aura::client::ScreenPositionClient { public: - DesktopScreenPositionClient(); + explicit DesktopScreenPositionClient(aura::Window* root_window); virtual ~DesktopScreenPositionClient(); // aura::client::ScreenPositionClient overrides: @@ -28,6 +28,11 @@ class VIEWS_EXPORT DesktopScreenPositionClient virtual void SetBounds(aura::Window* window, const gfx::Rect& bounds, const gfx::Display& display) OVERRIDE; + + private: + aura::Window* root_window_; + + DISALLOW_COPY_AND_ASSIGN(DesktopScreenPositionClient); }; } // namespace views diff --git a/ui/views/widget/desktop_aura/desktop_screen_win.cc b/ui/views/widget/desktop_aura/desktop_screen_win.cc index 5cf42f5..c5edf76 100644 --- a/ui/views/widget/desktop_aura/desktop_screen_win.cc +++ b/ui/views/widget/desktop_aura/desktop_screen_win.cc @@ -54,8 +54,8 @@ gfx::Display DesktopScreenWin::GetDisplayMatching( } HWND DesktopScreenWin::GetHWNDFromNativeView(gfx::NativeView window) const { - aura::WindowEventDispatcher* dispatcher = window->GetDispatcher(); - return dispatcher ? dispatcher->host()->GetAcceleratedWidget() : NULL; + aura::WindowTreeHost* host = window->GetHost(); + return host ? host->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 a72b503..c47a2d2 100644 --- a/ui/views/widget/desktop_aura/desktop_screen_x11.cc +++ b/ui/views/widget/desktop_aura/desktop_screen_x11.cc @@ -249,10 +249,10 @@ gfx::Display DesktopScreenX11::GetDisplayNearestWindow( // created before we create the aura::WindowEventDispatcher. So we ask what // the DRWHX11 believes the window bounds are instead of going through the // aura::Window's screen bounds. - aura::WindowEventDispatcher* dispatcher = window->GetDispatcher(); - if (dispatcher) { + aura::WindowTreeHost* host = window->GetHost(); + if (host) { DesktopWindowTreeHostX11* rwh = DesktopWindowTreeHostX11::GetHostForXID( - dispatcher->host()->GetAcceleratedWidget()); + host->GetAcceleratedWidget()); if (rwh) return GetDisplayMatching(rwh->GetX11RootWindowBounds()); } diff --git a/ui/views/widget/desktop_aura/desktop_screen_x11_unittest.cc b/ui/views/widget/desktop_aura/desktop_screen_x11_unittest.cc index da4d1fd..3f2a610 100644 --- a/ui/views/widget/desktop_aura/desktop_screen_x11_unittest.cc +++ b/ui/views/widget/desktop_aura/desktop_screen_x11_unittest.cc @@ -39,7 +39,7 @@ class ActivationWaiter : public base::MessagePumpDispatcher { NULL }; atom_cache_.reset(new ui::X11AtomCache(gfx::GetXDisplay(), kAtomToCache)); - widget_xid_ = widget->GetNativeWindow()->GetDispatcher()->host()-> + widget_xid_ = widget->GetNativeWindow()->GetHost()-> GetAcceleratedWidget(); base::MessagePumpX11::Current()->AddDispatcherForRootWindow(this); } diff --git a/ui/views/widget/desktop_aura/desktop_window_tree_host_win.cc b/ui/views/widget/desktop_aura/desktop_window_tree_host_win.cc index 02a7e43..8375e6d 100644 --- a/ui/views/widget/desktop_aura/desktop_window_tree_host_win.cc +++ b/ui/views/widget/desktop_aura/desktop_window_tree_host_win.cc @@ -98,20 +98,18 @@ DesktopWindowTreeHostWin::~DesktopWindowTreeHostWin() { // static aura::Window* DesktopWindowTreeHostWin::GetContentWindowForHWND(HWND hwnd) { - aura::WindowEventDispatcher* dispatcher = - aura::WindowEventDispatcher::GetForAcceleratedWidget(hwnd); - return dispatcher ? - dispatcher->window()->GetProperty(kContentWindowForRootWindow) : NULL; + aura::WindowTreeHost* host = + aura::WindowTreeHost::GetForAcceleratedWidget(hwnd); + return host ? host->window()->GetProperty(kContentWindowForRootWindow) : NULL; } // static ui::NativeTheme* DesktopWindowTreeHost::GetNativeTheme(aura::Window* window) { // Use NativeThemeWin for windows shown on the desktop, those not on the // desktop come from Ash and get NativeThemeAura. - aura::WindowEventDispatcher* dispatcher = - window ? window->GetDispatcher() : NULL; - if (dispatcher) { - HWND host_hwnd = dispatcher->host()->GetAcceleratedWidget(); + aura::WindowTreeHost* host = window ? window->GetHost() : NULL; + if (host) { + HWND host_hwnd = host->GetAcceleratedWidget(); if (host_hwnd && DesktopWindowTreeHostWin::GetContentWindowForHWND(host_hwnd)) { return ui::NativeThemeWin::instance(); @@ -135,10 +133,8 @@ void DesktopWindowTreeHostWin::Init(aura::Window* content_window, native_widget_delegate_); HWND parent_hwnd = NULL; - if (params.parent && params.parent->GetDispatcher()) { - parent_hwnd = - params.parent->GetDispatcher()->host()->GetAcceleratedWidget(); - } + if (params.parent && params.parent->GetHost()) + parent_hwnd = params.parent->GetHost()->GetAcceleratedWidget(); message_handler_->set_remove_standard_frame(params.remove_standard_frame); @@ -880,11 +876,11 @@ void DesktopWindowTreeHostWin::HandleTouchEvent( return; // Currently we assume the window that has capture gets touch events too. - aura::WindowEventDispatcher* dispatcher = - aura::WindowEventDispatcher::GetForAcceleratedWidget(GetCapture()); - if (dispatcher) { + aura::WindowTreeHost* host = + aura::WindowTreeHost::GetForAcceleratedWidget(GetCapture()); + if (host) { DesktopWindowTreeHostWin* target = - dispatcher->window()->GetProperty(kDesktopWindowTreeHostKey); + host->window()->GetProperty(kDesktopWindowTreeHostKey); if (target && target->HasCapture() && target != this) { POINT target_location(event.location().ToPOINT()); ClientToScreen(GetHWND(), &target_location); diff --git a/ui/views/widget/desktop_aura/desktop_window_tree_host_x11.cc b/ui/views/widget/desktop_aura/desktop_window_tree_host_x11.cc index 9cbe512..785a816 100644 --- a/ui/views/widget/desktop_aura/desktop_window_tree_host_x11.cc +++ b/ui/views/widget/desktop_aura/desktop_window_tree_host_x11.cc @@ -154,18 +154,16 @@ DesktopWindowTreeHostX11::~DesktopWindowTreeHostX11() { // static aura::Window* DesktopWindowTreeHostX11::GetContentWindowForXID(XID xid) { - aura::WindowEventDispatcher* dispatcher = - aura::WindowEventDispatcher::GetForAcceleratedWidget(xid); - return dispatcher ? - dispatcher->window()->GetProperty(kViewsWindowForRootWindow) : NULL; + aura::WindowTreeHost* host = + aura::WindowTreeHost::GetForAcceleratedWidget(xid); + return host ? host->window()->GetProperty(kViewsWindowForRootWindow) : NULL; } // static DesktopWindowTreeHostX11* DesktopWindowTreeHostX11::GetHostForXID(XID xid) { - aura::WindowEventDispatcher* dispatcher = - aura::WindowEventDispatcher::GetForAcceleratedWidget(xid); - return dispatcher ? - dispatcher->window()->GetProperty(kHostForRootWindow) : NULL; + aura::WindowTreeHost* host = + aura::WindowTreeHost::GetForAcceleratedWidget(xid); + return host ? host->window()->GetProperty(kHostForRootWindow) : NULL; } // static @@ -839,7 +837,7 @@ void DesktopWindowTreeHostX11::ReleaseCapture() { bool DesktopWindowTreeHostX11::QueryMouseLocation( gfx::Point* location_return) { aura::client::CursorClient* cursor_client = - aura::client::GetCursorClient(GetDispatcher()->window()); + aura::client::GetCursorClient(window()); if (cursor_client && !cursor_client->IsMouseEventsEnabled()) { *location_return = gfx::Point(0, 0); return false; @@ -1078,9 +1076,9 @@ void DesktopWindowTreeHostX11::InitX11Window( // If we have a parent, record the parent/child relationship. We use this // data during destruction to make sure that when we try to close a parent // window, we also destroy all child windows. - if (params.parent && params.parent->GetDispatcher()) { + if (params.parent && params.parent->GetHost()) { XID parent_xid = - params.parent->GetDispatcher()->host()->GetAcceleratedWidget(); + params.parent->GetHost()->GetAcceleratedWidget(); window_parent_ = GetHostForXID(parent_xid); DCHECK(window_parent_); window_parent_->window_children_.insert(this); 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 1c3da3b..072d1ef 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 @@ -76,7 +76,7 @@ aura::client::WindowMoveResult X11DesktopWindowMoveClient::RunMoveLoop( const gfx::Vector2d& drag_offset, aura::client::WindowMoveSource move_source) { window_offset_ = drag_offset; - dispatcher_ = source->GetDispatcher(); + dispatcher_ = source->GetHost()->dispatcher(); bool success = move_loop_.RunMoveLoop(source, dispatcher_->host()->last_cursor()); diff --git a/ui/views/widget/desktop_aura/x11_whole_screen_move_loop.cc b/ui/views/widget/desktop_aura/x11_whole_screen_move_loop.cc index ce066da5..9fd02a3 100644 --- a/ui/views/widget/desktop_aura/x11_whole_screen_move_loop.cc +++ b/ui/views/widget/desktop_aura/x11_whole_screen_move_loop.cc @@ -110,7 +110,7 @@ bool X11WholeScreenMoveLoop::RunMoveLoop(aura::Window* source, // get released while we still need the pointer grab, which is why we restrict // the scope here. { - ScopedCapturer capturer(source->GetDispatcher()->host()); + ScopedCapturer capturer(source->GetHost()); DCHECK(!in_move_loop_); // Can only handle one nested loop at a time. in_move_loop_ = true; diff --git a/ui/views/widget/native_widget_aura_unittest.cc b/ui/views/widget/native_widget_aura_unittest.cc index ecf524f..e4c6670 100644 --- a/ui/views/widget/native_widget_aura_unittest.cc +++ b/ui/views/widget/native_widget_aura_unittest.cc @@ -46,7 +46,7 @@ class NativeWidgetAuraTest : public ViewsTestBase { protected: aura::Window* root_window() { return GetContext(); } aura::WindowEventDispatcher* dispatcher() { - return root_window()->GetDispatcher(); + return root_window()->GetHost()->dispatcher(); } private: diff --git a/ui/views/widget/tooltip_manager_aura.cc b/ui/views/widget/tooltip_manager_aura.cc index 05a96e5..8208063 100644 --- a/ui/views/widget/tooltip_manager_aura.cc +++ b/ui/views/widget/tooltip_manager_aura.cc @@ -49,7 +49,7 @@ void TooltipManagerAura::UpdateTooltipManagerForCapture(Widget* source) { return; gfx::Point screen_loc( - root_window->GetDispatcher()->GetLastMouseLocationInRoot()); + root_window->GetHost()->dispatcher()->GetLastMouseLocationInRoot()); aura::client::ScreenPositionClient* screen_position_client = aura::client::GetScreenPositionClient(root_window); if (!screen_position_client) @@ -91,7 +91,7 @@ void TooltipManagerAura::UpdateTooltip() { aura::Window* root_window = GetWindow()->GetRootWindow(); if (aura::client::GetTooltipClient(root_window)) { gfx::Point view_point = - root_window->GetDispatcher()->GetLastMouseLocationInRoot(); + root_window->GetHost()->dispatcher()->GetLastMouseLocationInRoot(); aura::Window::ConvertPointToTarget(root_window, GetWindow(), &view_point); View* view = GetViewUnderPoint(view_point); UpdateTooltipForTarget(view, view_point, root_window); @@ -102,7 +102,7 @@ void TooltipManagerAura::TooltipTextChanged(View* view) { aura::Window* root_window = GetWindow()->GetRootWindow(); if (aura::client::GetTooltipClient(root_window)) { gfx::Point view_point = - root_window->GetDispatcher()->GetLastMouseLocationInRoot(); + root_window->GetHost()->dispatcher()->GetLastMouseLocationInRoot(); aura::Window::ConvertPointToTarget(root_window, GetWindow(), &view_point); View* target = GetViewUnderPoint(view_point); if (target != view) diff --git a/ui/views/widget/widget_interactive_uitest.cc b/ui/views/widget/widget_interactive_uitest.cc index f39cbfc..8c8bbe2 100644 --- a/ui/views/widget/widget_interactive_uitest.cc +++ b/ui/views/widget/widget_interactive_uitest.cc @@ -192,7 +192,7 @@ TEST_F(WidgetTest, DesktopNativeWidgetAuraActivationAndFocusTest) { aura::Window* root_window2 = widget2.GetNativeView()->GetRootWindow(); contents_view2->RequestFocus(); ::SetActiveWindow( - root_window2->GetDispatcher()->host()->GetAcceleratedWidget()); + root_window2->GetHost()->GetAcceleratedWidget()); aura::client::ActivationClient* activation_client2 = aura::client::GetActivationClient(root_window2); @@ -205,7 +205,7 @@ TEST_F(WidgetTest, DesktopNativeWidgetAuraActivationAndFocusTest) { // window. contents_view1->RequestFocus(); ::SetActiveWindow( - root_window1->GetDispatcher()->host()->GetAcceleratedWidget()); + root_window1->GetHost()->GetAcceleratedWidget()); EXPECT_EQ(activation_client2->GetActiveWindow(), reinterpret_cast<aura::Window*>(NULL)); EXPECT_EQ(activation_client1->GetActiveWindow(), widget1.GetNativeView()); @@ -778,7 +778,7 @@ TEST_F(WidgetCaptureTest, MAYBE_MouseEventDispatchedToRightWindow) { ui::MouseEvent mouse_event(ui::ET_MOUSE_EXITED, gfx::Point(), gfx::Point(), ui::EF_NONE, ui::EF_NONE); ui::EventDispatchDetails details = widget1.GetNativeWindow()-> - GetDispatcher()->OnEventFromSource(&mouse_event); + GetHost()->dispatcher()->OnEventFromSource(&mouse_event); ASSERT_FALSE(details.dispatcher_destroyed); 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 adecf03..1b10418 100644 --- a/ui/views/widget/widget_unittest.cc +++ b/ui/views/widget/widget_unittest.cc @@ -1295,7 +1295,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, 0); aura::WindowEventDispatcher* dispatcher = - widget->GetNativeWindow()->GetDispatcher(); + widget->GetNativeWindow()->GetHost()->dispatcher(); ui::EventDispatchDetails details = dispatcher->OnEventFromSource(&move_event); if (last_event_type == ui::ET_MOUSE_ENTERED || details.dispatcher_destroyed) return; @@ -2065,7 +2065,7 @@ TEST_F(WidgetTest, WindowMouseModalityTest) { ui::EF_NONE, ui::EF_NONE); ui::EventDispatchDetails details = top_level_widget.GetNativeView()-> - GetDispatcher()->OnEventFromSource(&move_main); + GetHost()->dispatcher()->OnEventFromSource(&move_main); ASSERT_FALSE(details.dispatcher_destroyed); EXPECT_EQ(1, widget_view->GetEventCount(ui::ET_MOUSE_ENTERED)); @@ -2092,7 +2092,7 @@ TEST_F(WidgetTest, WindowMouseModalityTest) { cursor_location_dialog, ui::EF_NONE, ui::EF_NONE); - details = top_level_widget.GetNativeView()->GetDispatcher()-> + details = top_level_widget.GetNativeView()->GetHost()->dispatcher()-> OnEventFromSource(&mouse_down_dialog); ASSERT_FALSE(details.dispatcher_destroyed); EXPECT_EQ(1, dialog_widget_view->GetEventCount(ui::ET_MOUSE_PRESSED)); @@ -2105,7 +2105,7 @@ TEST_F(WidgetTest, WindowMouseModalityTest) { cursor_location_main2, ui::EF_NONE, ui::EF_NONE); - details = top_level_widget.GetNativeView()->GetDispatcher()-> + details = top_level_widget.GetNativeView()->GetHost()->dispatcher()-> OnEventFromSource(&mouse_down_main); ASSERT_FALSE(details.dispatcher_destroyed); 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 da4275e..76e6e90 100644 --- a/ui/views/win/hwnd_util_aurawin.cc +++ b/ui/views/win/hwnd_util_aurawin.cc @@ -20,21 +20,20 @@ HWND HWNDForWidget(const Widget* widget) { HWND HWNDForNativeView(const gfx::NativeView view) { return view && view->GetRootWindow() ? - view->GetDispatcher()->host()->GetAcceleratedWidget() : NULL; + view->GetHost()->GetAcceleratedWidget() : NULL; } HWND HWNDForNativeWindow(const gfx::NativeWindow window) { return window && window->GetRootWindow() ? - window->GetDispatcher()->host()->GetAcceleratedWidget() : NULL; + window->GetHost()->GetAcceleratedWidget() : NULL; } gfx::Rect GetWindowBoundsForClientBounds(View* view, const gfx::Rect& client_bounds) { DCHECK(view); - aura::WindowEventDispatcher* dispatcher = - view->GetWidget()->GetNativeWindow()->GetDispatcher(); - if (dispatcher) { - HWND hwnd = dispatcher->host()->GetAcceleratedWidget(); + aura::WindowTreeHost* host = view->GetWidget()->GetNativeWindow()->GetHost(); + if (host) { + HWND hwnd = host->GetAcceleratedWidget(); RECT rect = client_bounds.ToRECT(); DWORD style = ::GetWindowLong(hwnd, GWL_STYLE); DWORD ex_style = ::GetWindowLong(hwnd, GWL_EXSTYLE); |