summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorben@chromium.org <ben@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2013-11-10 06:16:08 +0000
committerben@chromium.org <ben@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2013-11-10 06:16:08 +0000
commit688c225e6f3825179e1b8d706f05e4438fa1e36a (patch)
treea4b7ce2c97553f52b6fb89a75b37b3e00bc62505
parent6ed843366f5ee413ca48f1ad245ab0000981b8f6 (diff)
downloadchromium_src-688c225e6f3825179e1b8d706f05e4438fa1e36a.zip
chromium_src-688c225e6f3825179e1b8d706f05e4438fa1e36a.tar.gz
chromium_src-688c225e6f3825179e1b8d706f05e4438fa1e36a.tar.bz2
Use Window instead of RootWindow in many more places throughout the codebase
TBR=sky@chromium.org http://crbug.com/308843 Review URL: https://codereview.chromium.org/66653005 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@234166 0039d316-1c4b-4281-b951-d872f2087c98
-rw-r--r--chrome/browser/ui/ash/launcher/browser_status_monitor.cc4
-rw-r--r--chrome/browser/ui/ash/screenshot_taker.cc2
-rw-r--r--content/browser/renderer_host/render_widget_host_view_aura.cc24
-rw-r--r--content/browser/renderer_host/render_widget_host_view_aura_unittest.cc12
-rw-r--r--content/browser/web_contents/aura/window_slider_unittest.cc6
-rw-r--r--content/public/test/test_renderer_host.h2
-rw-r--r--ui/aura/bench/bench_main.cc12
-rw-r--r--ui/aura/demo/demo_main.cc8
-rw-r--r--ui/aura/gestures/gesture_recognizer_unittest.cc406
-rw-r--r--ui/aura/remote_root_window_host_win.cc4
-rw-r--r--ui/aura/root_window.cc134
-rw-r--r--ui/aura/root_window_host_win.cc7
-rw-r--r--ui/aura/root_window_host_x11.cc12
-rw-r--r--ui/aura/root_window_unittest.cc108
-rw-r--r--ui/aura/test/aura_test_base.h3
-rw-r--r--ui/aura/test/aura_test_helper.cc16
-rw-r--r--ui/aura/test/aura_test_helper.h5
-rw-r--r--ui/aura/test/event_generator.cc6
-rw-r--r--ui/aura/test/test_screen.cc8
-rw-r--r--ui/aura/window_unittest.cc78
-rw-r--r--ui/keyboard/keyboard_controller_unittest.cc4
-rw-r--r--ui/keyboard/keyboard_util.cc2
-rw-r--r--ui/shell/minimal_shell.cc14
-rw-r--r--ui/snapshot/snapshot_aura_unittest.cc7
-rw-r--r--ui/views/corewm/capture_controller_unittest.cc21
-rw-r--r--ui/views/corewm/compound_event_filter_unittest.cc24
-rw-r--r--ui/views/corewm/focus_controller_unittest.cc4
-rw-r--r--ui/views/corewm/input_method_event_filter_unittest.cc4
-rw-r--r--ui/views/corewm/tooltip_controller_unittest.cc4
-rw-r--r--ui/views/widget/desktop_aura/desktop_capture_client.cc6
-rw-r--r--ui/views/widget/desktop_aura/desktop_capture_client.h4
-rw-r--r--ui/views/widget/desktop_aura/desktop_native_widget_aura.cc71
-rw-r--r--ui/views/widget/desktop_aura/desktop_root_window_host_win.cc22
-rw-r--r--ui/views/widget/desktop_aura/desktop_root_window_host_x11.cc2
-rw-r--r--ui/views/widget/native_widget_aura_unittest.cc13
35 files changed, 538 insertions, 521 deletions
diff --git a/chrome/browser/ui/ash/launcher/browser_status_monitor.cc b/chrome/browser/ui/ash/launcher/browser_status_monitor.cc
index 8d889dc..8731710 100644
--- a/chrome/browser/ui/ash/launcher/browser_status_monitor.cc
+++ b/chrome/browser/ui/ash/launcher/browser_status_monitor.cc
@@ -145,8 +145,8 @@ void BrowserStatusMonitor::OnWindowActivated(aura::Window* gained_active,
void BrowserStatusMonitor::OnWindowDestroyed(aura::Window* window) {
// Remove RootWindow and its ActivationClient from observed list.
observed_root_windows_.Remove(window);
- observed_activation_clients_.Remove(aura::client::GetActivationClient(
- static_cast<aura::RootWindow*>(window)));
+ observed_activation_clients_.Remove(
+ aura::client::GetActivationClient(window));
}
void BrowserStatusMonitor::OnBrowserAdded(Browser* browser) {
diff --git a/chrome/browser/ui/ash/screenshot_taker.cc b/chrome/browser/ui/ash/screenshot_taker.cc
index 880d0f8..89c0dd4 100644
--- a/chrome/browser/ui/ash/screenshot_taker.cc
+++ b/chrome/browser/ui/ash/screenshot_taker.cc
@@ -347,7 +347,7 @@ void ScreenshotTaker::HandleTakeScreenshotForAllRootWindows() {
if (*(root_windows.begin()) != primary_root) {
root_windows.erase(std::find(
root_windows.begin(), root_windows.end(), primary_root));
- root_windows.insert(root_windows.begin(), primary_root->GetDispatcher());
+ root_windows.insert(root_windows.begin(), primary_root);
}
for (size_t i = 0; i < root_windows.size(); ++i) {
aura::Window* root_window = root_windows[i];
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 b9da0e9..f005a78 100644
--- a/content/browser/renderer_host/render_widget_host_view_aura.cc
+++ b/content/browser/renderer_host/render_widget_host_view_aura.cc
@@ -2050,8 +2050,8 @@ gfx::GLSurfaceHandle RenderWidgetHostViewAura::GetCompositingSurface() {
}
bool RenderWidgetHostViewAura::LockMouse() {
- aura::WindowEventDispatcher* dispatcher = window_->GetDispatcher();
- if (!dispatcher)
+ aura::Window* root_window = window_->GetRootWindow();
+ if (!root_window)
return false;
if (mouse_locked_)
@@ -2062,7 +2062,7 @@ bool RenderWidgetHostViewAura::LockMouse() {
window_->SetCapture();
#endif
aura::client::CursorClient* cursor_client =
- aura::client::GetCursorClient(dispatcher);
+ aura::client::GetCursorClient(root_window);
if (cursor_client) {
cursor_client->HideCursor();
cursor_client->LockCursor();
@@ -2072,16 +2072,16 @@ bool RenderWidgetHostViewAura::LockMouse() {
synthetic_move_sent_ = true;
window_->MoveCursorTo(gfx::Rect(window_->bounds().size()).CenterPoint());
}
- if (aura::client::GetTooltipClient(dispatcher))
- aura::client::GetTooltipClient(dispatcher)->SetTooltipsEnabled(false);
+ if (aura::client::GetTooltipClient(root_window))
+ aura::client::GetTooltipClient(root_window)->SetTooltipsEnabled(false);
- dispatcher->ConfineCursorToWindow();
+ root_window->GetDispatcher()->ConfineCursorToWindow();
return true;
}
void RenderWidgetHostViewAura::UnlockMouse() {
- aura::WindowEventDispatcher* dispatcher = window_->GetDispatcher();
- if (!mouse_locked_ || !dispatcher)
+ aura::Window* root_window = window_->GetRootWindow();
+ if (!mouse_locked_ || !root_window)
return;
mouse_locked_ = false;
@@ -2091,17 +2091,17 @@ void RenderWidgetHostViewAura::UnlockMouse() {
#endif
window_->MoveCursorTo(unlocked_mouse_position_);
aura::client::CursorClient* cursor_client =
- aura::client::GetCursorClient(dispatcher);
+ aura::client::GetCursorClient(root_window);
if (cursor_client) {
cursor_client->UnlockCursor();
cursor_client->ShowCursor();
}
- if (aura::client::GetTooltipClient(dispatcher))
- aura::client::GetTooltipClient(dispatcher)->SetTooltipsEnabled(true);
+ if (aura::client::GetTooltipClient(root_window))
+ aura::client::GetTooltipClient(root_window)->SetTooltipsEnabled(true);
host_->LostMouseLock();
- dispatcher->UnConfineCursor();
+ root_window->GetDispatcher()->UnConfineCursor();
}
////////////////////////////////////////////////////////////////////////////////
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 2c27071..ee93871 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
@@ -226,7 +226,7 @@ class RenderWidgetHostViewAuraTest : public testing::Test {
// A layout manager that always resizes a child to the root window size.
class FullscreenLayoutManager : public aura::LayoutManager {
public:
- explicit FullscreenLayoutManager(aura::RootWindow* owner)
+ explicit FullscreenLayoutManager(aura::Window* owner)
: owner_(owner) {}
virtual ~FullscreenLayoutManager() {}
@@ -253,7 +253,7 @@ class FullscreenLayoutManager : public aura::LayoutManager {
}
private:
- aura::RootWindow* owner_;
+ aura::Window* owner_;
DISALLOW_COPY_AND_ASSIGN(FullscreenLayoutManager);
};
@@ -725,7 +725,7 @@ scoped_ptr<cc::CompositorFrame> MakeDelegatedFrame(float scale_factor,
// Resizing in fullscreen mode should send the up-to-date screen info.
TEST_F(RenderWidgetHostViewAuraTest, FullscreenResize) {
- aura::RootWindow* root_window = aura_test_helper_->root_window();
+ aura::Window* root_window = aura_test_helper_->root_window();
root_window->SetLayoutManager(new FullscreenLayoutManager(root_window));
view_->InitAsFullscreen(parent_view_);
view_->WasShown();
@@ -747,7 +747,8 @@ TEST_F(RenderWidgetHostViewAuraTest, FullscreenResize) {
// we've committed it.
view_->OnSwapCompositorFrame(
0, MakeGLFrame(1.f, params.a.new_size, gfx::Rect(params.a.new_size)));
- ui::DrawWaiterForTest::WaitForCommit(root_window->compositor());
+ ui::DrawWaiterForTest::WaitForCommit(
+ root_window->GetDispatcher()->compositor());
}
widget_host_->ResetSizeAndRepaintPendingFlags();
@@ -767,7 +768,8 @@ TEST_F(RenderWidgetHostViewAuraTest, FullscreenResize) {
EXPECT_EQ("1600x1200", params.a.new_size.ToString());
view_->OnSwapCompositorFrame(
0, MakeGLFrame(1.f, params.a.new_size, gfx::Rect(params.a.new_size)));
- ui::DrawWaiterForTest::WaitForCommit(root_window->compositor());
+ ui::DrawWaiterForTest::WaitForCommit(
+ root_window->GetDispatcher()->compositor());
}
}
diff --git a/content/browser/web_contents/aura/window_slider_unittest.cc b/content/browser/web_contents/aura/window_slider_unittest.cc
index c1ffe98..d56d1e7 100644
--- a/content/browser/web_contents/aura/window_slider_unittest.cc
+++ b/content/browser/web_contents/aura/window_slider_unittest.cc
@@ -15,14 +15,14 @@
namespace content {
-void DispatchEventDuringScrollCallback(aura::RootWindow* root_window,
+void DispatchEventDuringScrollCallback(aura::WindowEventDispatcher* dispatcher,
ui::Event* event,
ui::EventType type,
const gfx::Vector2dF& delta) {
if (type != ui::ET_GESTURE_SCROLL_UPDATE)
return;
aura::RootWindowHostDelegate* delegate =
- root_window->AsRootWindowHostDelegate();
+ dispatcher->AsRootWindowHostDelegate();
if (event->IsMouseEvent())
delegate->OnHostMouseEvent(static_cast<ui::MouseEvent*>(event));
else if (event->IsKeyEvent())
@@ -269,7 +269,7 @@ TEST_F(WindowSliderTest, WindowSlideIsCancelledOnEvent) {
base::TimeDelta::FromMilliseconds(10),
1,
base::Bind(&DispatchEventDuringScrollCallback,
- root_window(),
+ root_window()->GetDispatcher(),
base::Owned(events[i])));
EXPECT_TRUE(slider_delegate.created_back_layer());
EXPECT_TRUE(slider_delegate.slide_aborted());
diff --git a/content/public/test/test_renderer_host.h b/content/public/test/test_renderer_host.h
index 38f4ede..192632d 100644
--- a/content/public/test/test_renderer_host.h
+++ b/content/public/test/test_renderer_host.h
@@ -172,7 +172,7 @@ class RenderViewHostTestHarness : public testing::Test {
TestBrowserThreadBundle* thread_bundle() { return thread_bundle_.get(); }
#if defined(USE_AURA)
- aura::RootWindow* root_window() { return aura_test_helper_->root_window(); }
+ aura::Window* root_window() { return aura_test_helper_->root_window(); }
#endif
// Replaces the RPH being used.
diff --git a/ui/aura/bench/bench_main.cc b/ui/aura/bench/bench_main.cc
index 372c17a..9ebfb39 100644
--- a/ui/aura/bench/bench_main.cc
+++ b/ui/aura/bench/bench_main.cc
@@ -316,17 +316,17 @@ int main(int argc, char** argv) {
scoped_ptr<aura::RootWindow> root_window(
test_screen->CreateRootWindowForPrimaryDisplay());
aura::client::SetCaptureClient(
- root_window.get(),
- new aura::client::DefaultCaptureClient(root_window.get()));
+ root_window->window(),
+ new aura::client::DefaultCaptureClient(root_window->window()));
scoped_ptr<aura::client::FocusClient> focus_client(
new aura::test::TestFocusClient);
- aura::client::SetFocusClient(root_window.get(), focus_client.get());
+ aura::client::SetFocusClient(root_window->window(), focus_client.get());
// add layers
ColoredLayer background(SK_ColorRED);
- background.SetBounds(root_window->bounds());
- root_window->layer()->Add(&background);
+ background.SetBounds(root_window->window()->bounds());
+ root_window->window()->layer()->Add(&background);
ColoredLayer window(SK_ColorBLUE);
window.SetBounds(gfx::Rect(background.bounds().size()));
@@ -360,7 +360,7 @@ int main(int argc, char** argv) {
}
#ifndef NDEBUG
- ui::PrintLayerHierarchy(root_window->layer(), gfx::Point(100, 100));
+ ui::PrintLayerHierarchy(root_window->window()->layer(), gfx::Point(100, 100));
#endif
root_window->ShowRootWindow();
diff --git a/ui/aura/demo/demo_main.cc b/ui/aura/demo/demo_main.cc
index 75b1d60..68fa062 100644
--- a/ui/aura/demo/demo_main.cc
+++ b/ui/aura/demo/demo_main.cc
@@ -120,9 +120,9 @@ int DemoMain() {
scoped_ptr<aura::RootWindow> root_window(
test_screen->CreateRootWindowForPrimaryDisplay());
scoped_ptr<DemoWindowTreeClient> window_tree_client(new DemoWindowTreeClient(
- root_window.get()));
+ root_window->window()));
aura::test::TestFocusClient focus_client;
- aura::client::SetFocusClient(root_window.get(), &focus_client);
+ aura::client::SetFocusClient(root_window->window(), &focus_client);
// Create a hierarchy of test windows.
DemoWindowDelegate window_delegate1(SK_ColorBLUE);
@@ -132,7 +132,7 @@ int DemoMain() {
window1.SetBounds(gfx::Rect(100, 100, 400, 400));
window1.Show();
aura::client::ParentWindowWithContext(
- &window1, root_window.get(), gfx::Rect());
+ &window1, root_window->window(), gfx::Rect());
DemoWindowDelegate window_delegate2(SK_ColorRED);
aura::Window window2(&window_delegate2);
@@ -141,7 +141,7 @@ int DemoMain() {
window2.SetBounds(gfx::Rect(200, 200, 350, 350));
window2.Show();
aura::client::ParentWindowWithContext(
- &window2, root_window.get(), gfx::Rect());
+ &window2, root_window->window(), gfx::Rect());
DemoWindowDelegate window_delegate3(SK_ColorGREEN);
aura::Window window3(&window_delegate3);
diff --git a/ui/aura/gestures/gesture_recognizer_unittest.cc b/ui/aura/gestures/gesture_recognizer_unittest.cc
index 911f8d3..2d0a09c 100644
--- a/ui/aura/gestures/gesture_recognizer_unittest.cc
+++ b/ui/aura/gestures/gesture_recognizer_unittest.cc
@@ -698,7 +698,7 @@ TEST_F(GestureRecognizerTest, GestureEventTap) {
delegate->Reset();
ui::TouchEvent press(ui::ET_TOUCH_PRESSED, gfx::Point(101, 201),
kTouchId, tes.Now());
- root_window()->AsRootWindowHostDelegate()->OnHostTouchEvent(&press);
+ dispatcher()->AsRootWindowHostDelegate()->OnHostTouchEvent(&press);
EXPECT_FALSE(delegate->tap());
EXPECT_FALSE(delegate->show_press());
EXPECT_TRUE(delegate->tap_down());
@@ -720,7 +720,7 @@ TEST_F(GestureRecognizerTest, GestureEventTap) {
ui::TouchEvent release(ui::ET_TOUCH_RELEASED, gfx::Point(101, 201),
kTouchId, tes.LeapForward(50));
- root_window()->AsRootWindowHostDelegate()->OnHostTouchEvent(&release);
+ dispatcher()->AsRootWindowHostDelegate()->OnHostTouchEvent(&release);
EXPECT_TRUE(delegate->tap());
EXPECT_FALSE(delegate->tap_down());
EXPECT_FALSE(delegate->tap_cancel());
@@ -753,7 +753,7 @@ TEST_F(GestureRecognizerTest, GestureEventTapRegion) {
kTouchId, tes.Now());
press.set_radius_x(5);
press.set_radius_y(12);
- root_window()->AsRootWindowHostDelegate()->OnHostTouchEvent(&press);
+ dispatcher()->AsRootWindowHostDelegate()->OnHostTouchEvent(&press);
EXPECT_FALSE(delegate->tap());
EXPECT_TRUE(delegate->tap_down());
EXPECT_FALSE(delegate->tap_cancel());
@@ -771,7 +771,7 @@ TEST_F(GestureRecognizerTest, GestureEventTapRegion) {
release.set_radius_x(5);
release.set_radius_y(12);
- root_window()->AsRootWindowHostDelegate()->OnHostTouchEvent(&release);
+ dispatcher()->AsRootWindowHostDelegate()->OnHostTouchEvent(&release);
EXPECT_TRUE(delegate->tap());
EXPECT_FALSE(delegate->tap_down());
EXPECT_FALSE(delegate->tap_cancel());
@@ -796,7 +796,7 @@ TEST_F(GestureRecognizerTest, GestureEventTapRegion) {
kTouchId, tes.Now());
press.set_radius_x(8);
press.set_radius_y(14);
- root_window()->AsRootWindowHostDelegate()->OnHostTouchEvent(&press);
+ dispatcher()->AsRootWindowHostDelegate()->OnHostTouchEvent(&press);
EXPECT_FALSE(delegate->tap());
EXPECT_TRUE(delegate->tap_down());
EXPECT_FALSE(delegate->tap_cancel());
@@ -812,7 +812,7 @@ TEST_F(GestureRecognizerTest, GestureEventTapRegion) {
release.set_radius_x(20);
release.set_radius_y(13);
- root_window()->AsRootWindowHostDelegate()->OnHostTouchEvent(&release);
+ dispatcher()->AsRootWindowHostDelegate()->OnHostTouchEvent(&release);
EXPECT_TRUE(delegate->tap());
EXPECT_FALSE(delegate->tap_down());
EXPECT_FALSE(delegate->tap_cancel());
@@ -837,7 +837,7 @@ TEST_F(GestureRecognizerTest, GestureEventTapRegion) {
kTouchId, tes.Now());
press.set_radius_x(6);
press.set_radius_y(10);
- root_window()->AsRootWindowHostDelegate()->OnHostTouchEvent(&press);
+ dispatcher()->AsRootWindowHostDelegate()->OnHostTouchEvent(&press);
EXPECT_FALSE(delegate->tap());
EXPECT_TRUE(delegate->tap_down());
EXPECT_FALSE(delegate->tap_cancel());
@@ -853,7 +853,7 @@ TEST_F(GestureRecognizerTest, GestureEventTapRegion) {
kTouchId, tes.LeapForward(50));
move.set_radius_x(8);
move.set_radius_y(12);
- root_window()->AsRootWindowHostDelegate()->OnHostTouchEvent(&move);
+ dispatcher()->AsRootWindowHostDelegate()->OnHostTouchEvent(&move);
EXPECT_FALSE(delegate->tap());
EXPECT_FALSE(delegate->tap_down());
EXPECT_FALSE(delegate->tap_cancel());
@@ -869,7 +869,7 @@ TEST_F(GestureRecognizerTest, GestureEventTapRegion) {
release.set_radius_x(4);
release.set_radius_y(8);
- root_window()->AsRootWindowHostDelegate()->OnHostTouchEvent(&release);
+ dispatcher()->AsRootWindowHostDelegate()->OnHostTouchEvent(&release);
EXPECT_TRUE(delegate->tap());
EXPECT_FALSE(delegate->tap_down());
EXPECT_FALSE(delegate->tap_cancel());
@@ -894,7 +894,7 @@ TEST_F(GestureRecognizerTest, GestureEventTapRegion) {
kTouchId, tes.Now());
press.set_radius_x(7);
press.set_radius_y(10);
- root_window()->AsRootWindowHostDelegate()->OnHostTouchEvent(&press);
+ dispatcher()->AsRootWindowHostDelegate()->OnHostTouchEvent(&press);
EXPECT_FALSE(delegate->tap());
EXPECT_TRUE(delegate->tap_down());
EXPECT_FALSE(delegate->tap_cancel());
@@ -909,7 +909,7 @@ TEST_F(GestureRecognizerTest, GestureEventTapRegion) {
kTouchId, tes.LeapForward(50));
move.set_radius_x(13);
move.set_radius_y(12);
- root_window()->AsRootWindowHostDelegate()->OnHostTouchEvent(&move);
+ dispatcher()->AsRootWindowHostDelegate()->OnHostTouchEvent(&move);
EXPECT_FALSE(delegate->tap());
EXPECT_FALSE(delegate->tap_down());
EXPECT_FALSE(delegate->tap_cancel());
@@ -924,7 +924,7 @@ TEST_F(GestureRecognizerTest, GestureEventTapRegion) {
kTouchId, tes.LeapForward(50));
move1.set_radius_x(16);
move1.set_radius_y(16);
- root_window()->AsRootWindowHostDelegate()->OnHostTouchEvent(&move1);
+ dispatcher()->AsRootWindowHostDelegate()->OnHostTouchEvent(&move1);
EXPECT_FALSE(delegate->tap());
EXPECT_FALSE(delegate->tap_down());
EXPECT_FALSE(delegate->tap_cancel());
@@ -939,7 +939,7 @@ TEST_F(GestureRecognizerTest, GestureEventTapRegion) {
kTouchId, tes.LeapForward(50));
move2.set_radius_x(14);
move2.set_radius_y(10);
- root_window()->AsRootWindowHostDelegate()->OnHostTouchEvent(&move2);
+ dispatcher()->AsRootWindowHostDelegate()->OnHostTouchEvent(&move2);
EXPECT_FALSE(delegate->tap());
EXPECT_FALSE(delegate->tap_down());
EXPECT_FALSE(delegate->tap_cancel());
@@ -955,7 +955,7 @@ TEST_F(GestureRecognizerTest, GestureEventTapRegion) {
release.set_radius_x(8);
release.set_radius_y(9);
- root_window()->AsRootWindowHostDelegate()->OnHostTouchEvent(&release);
+ dispatcher()->AsRootWindowHostDelegate()->OnHostTouchEvent(&release);
EXPECT_TRUE(delegate->tap());
EXPECT_FALSE(delegate->tap_down());
EXPECT_FALSE(delegate->tap_cancel());
@@ -989,7 +989,7 @@ TEST_F(GestureRecognizerTest, GestureEventScroll) {
delegate->Reset();
ui::TouchEvent press(ui::ET_TOUCH_PRESSED, gfx::Point(101, 201),
kTouchId, tes.Now());
- root_window()->AsRootWindowHostDelegate()->OnHostTouchEvent(&press);
+ dispatcher()->AsRootWindowHostDelegate()->OnHostTouchEvent(&press);
EXPECT_2_EVENTS(delegate->events(),
ui::ET_GESTURE_BEGIN,
ui::ET_GESTURE_TAP_DOWN);
@@ -998,7 +998,7 @@ TEST_F(GestureRecognizerTest, GestureEventScroll) {
// should generate both SCROLL_BEGIN and SCROLL_UPDATE gestures.
// The first movement is diagonal, to ensure that we have a free scroll,
// and not a rail scroll.
- tes.SendScrollEvent(root_window(), 130, 230, kTouchId, delegate.get());
+ tes.SendScrollEvent(dispatcher(), 130, 230, kTouchId, delegate.get());
EXPECT_3_EVENTS(delegate->events(),
ui::ET_GESTURE_TAP_CANCEL,
ui::ET_GESTURE_SCROLL_BEGIN,
@@ -1013,13 +1013,13 @@ TEST_F(GestureRecognizerTest, GestureEventScroll) {
EXPECT_TRUE(delegate->bounding_box().IsEmpty());
// Move some more to generate a few more scroll updates.
- tes.SendScrollEvent(root_window(), 110, 211, kTouchId, delegate.get());
+ tes.SendScrollEvent(dispatcher(), 110, 211, kTouchId, delegate.get());
EXPECT_1_EVENT(delegate->events(), ui::ET_GESTURE_SCROLL_UPDATE);
EXPECT_EQ(-20, delegate->scroll_x());
EXPECT_EQ(-19, delegate->scroll_y());
EXPECT_TRUE(delegate->bounding_box().IsEmpty());
- tes.SendScrollEvent(root_window(), 140, 215, kTouchId, delegate.get());
+ tes.SendScrollEvent(dispatcher(), 140, 215, kTouchId, delegate.get());
EXPECT_1_EVENT(delegate->events(), ui::ET_GESTURE_SCROLL_UPDATE);
EXPECT_EQ(30, delegate->scroll_x());
EXPECT_EQ(4, delegate->scroll_y());
@@ -1030,7 +1030,7 @@ TEST_F(GestureRecognizerTest, GestureEventScroll) {
ui::TouchEvent release(ui::ET_TOUCH_RELEASED, gfx::Point(101, 201),
kTouchId,
tes.LeapForward(50));
- root_window()->AsRootWindowHostDelegate()->OnHostTouchEvent(&release);
+ dispatcher()->AsRootWindowHostDelegate()->OnHostTouchEvent(&release);
EXPECT_2_EVENTS(delegate->events(),
ui::ET_SCROLL_FLING_START,
ui::ET_GESTURE_END);
@@ -1057,7 +1057,7 @@ TEST_F(GestureRecognizerTest, GestureEventScrollPrediction) {
gfx::Vector2dF total_scroll;
ui::TouchEvent press(ui::ET_TOUCH_PRESSED, gfx::Point(101, 201),
kTouchId, tes.Now());
- root_window()->AsRootWindowHostDelegate()->OnHostTouchEvent(&press);
+ dispatcher()->AsRootWindowHostDelegate()->OnHostTouchEvent(&press);
EXPECT_2_EVENTS(delegate->events(),
ui::ET_GESTURE_BEGIN,
ui::ET_GESTURE_TAP_DOWN);
@@ -1067,7 +1067,7 @@ TEST_F(GestureRecognizerTest, GestureEventScrollPrediction) {
// The first movement is diagonal, to ensure that we have a free scroll,
// and not a rail scroll.
tes.LeapForward(30);
- tes.SendScrollEvent(root_window(), 130, 230, kTouchId, delegate.get());
+ tes.SendScrollEvent(dispatcher(), 130, 230, kTouchId, delegate.get());
EXPECT_3_EVENTS(delegate->events(),
ui::ET_GESTURE_TAP_CANCEL,
ui::ET_GESTURE_SCROLL_BEGIN,
@@ -1083,7 +1083,7 @@ TEST_F(GestureRecognizerTest, GestureEventScrollPrediction) {
// Move some more to generate a few more scroll updates.
tes.LeapForward(30);
- tes.SendScrollEvent(root_window(), 110, 211, kTouchId, delegate.get());
+ tes.SendScrollEvent(dispatcher(), 110, 211, kTouchId, delegate.get());
EXPECT_1_EVENT(delegate->events(), ui::ET_GESTURE_SCROLL_UPDATE);
total_scroll.set_x(total_scroll.x() + delegate->scroll_x());
total_scroll.set_y(total_scroll.y() + delegate->scroll_y());
@@ -1093,7 +1093,7 @@ TEST_F(GestureRecognizerTest, GestureEventScrollPrediction) {
(int)(total_scroll.y()));
tes.LeapForward(30);
- tes.SendScrollEvent(root_window(), 140, 215, kTouchId, delegate.get());
+ tes.SendScrollEvent(dispatcher(), 140, 215, kTouchId, delegate.get());
EXPECT_1_EVENT(delegate->events(), ui::ET_GESTURE_SCROLL_UPDATE);
total_scroll.set_x(total_scroll.x() + delegate->scroll_x());
total_scroll.set_y(total_scroll.y() + delegate->scroll_y());
@@ -1107,7 +1107,7 @@ TEST_F(GestureRecognizerTest, GestureEventScrollPrediction) {
ui::TouchEvent release(ui::ET_TOUCH_RELEASED, gfx::Point(101, 201),
kTouchId,
tes.LeapForward(50));
- root_window()->AsRootWindowHostDelegate()->OnHostTouchEvent(&release);
+ dispatcher()->AsRootWindowHostDelegate()->OnHostTouchEvent(&release);
}
// Check that the bounding box during a scroll event is correct.
@@ -1131,7 +1131,7 @@ TEST_F(GestureRecognizerTest, GestureEventScrollBoundingBox) {
gfx::Point(kPositionX, kPositionY),
kTouchId,
tes.Now());
- root_window()->AsRootWindowHostDelegate()->OnHostTouchEvent(&press);
+ dispatcher()->AsRootWindowHostDelegate()->OnHostTouchEvent(&press);
EXPECT_EQ(gfx::Rect(kPositionX - radius,
kPositionY - radius,
radius * 2,
@@ -1139,7 +1139,7 @@ TEST_F(GestureRecognizerTest, GestureEventScrollBoundingBox) {
delegate->bounding_box().ToString());
const int kScrollAmount = 50;
- tes.SendScrollEvents(root_window(), kPositionX, kPositionY,
+ tes.SendScrollEvents(dispatcher(), kPositionX, kPositionY,
1, 1, kTouchId, 1, kScrollAmount, delegate.get());
EXPECT_EQ(gfx::Point(1, 1).ToString(),
delegate->scroll_begin_position().ToString());
@@ -1156,7 +1156,7 @@ TEST_F(GestureRecognizerTest, GestureEventScrollBoundingBox) {
kPositionY + kScrollAmount),
kTouchId, press.time_stamp() +
base::TimeDelta::FromMilliseconds(50));
- root_window()->AsRootWindowHostDelegate()->OnHostTouchEvent(&release);
+ dispatcher()->AsRootWindowHostDelegate()->OnHostTouchEvent(&release);
EXPECT_EQ(gfx::Rect(kPositionX + kScrollAmount - radius,
kPositionY + kScrollAmount - radius,
radius * 2,
@@ -1179,18 +1179,18 @@ TEST_F(GestureRecognizerTest, GestureEventHorizontalRailFling) {
ui::TouchEvent press(ui::ET_TOUCH_PRESSED, gfx::Point(0, 0),
kTouchId, tes.Now());
- root_window()->AsRootWindowHostDelegate()->OnHostTouchEvent(&press);
+ dispatcher()->AsRootWindowHostDelegate()->OnHostTouchEvent(&press);
// Move the touch-point horizontally enough that it is considered a
// horizontal scroll.
- tes.SendScrollEvent(root_window(), 20, 1, kTouchId, delegate.get());
+ tes.SendScrollEvent(dispatcher(), 20, 1, kTouchId, delegate.get());
EXPECT_EQ(0, delegate->scroll_y());
EXPECT_EQ(1, delegate->scroll_y_ordinal());
EXPECT_EQ(20, delegate->scroll_x());
EXPECT_EQ(20, delegate->scroll_x_ordinal());
// Get a high x velocity, while still staying on the rail
- tes.SendScrollEvents(root_window(), 1, 1,
+ tes.SendScrollEvents(dispatcher(), 1, 1,
100, 10, kTouchId, 1,
ui::GestureConfiguration::points_buffered_for_velocity(),
delegate.get());
@@ -1202,7 +1202,7 @@ TEST_F(GestureRecognizerTest, GestureEventHorizontalRailFling) {
delegate->Reset();
ui::TouchEvent release(ui::ET_TOUCH_RELEASED, gfx::Point(101, 201),
kTouchId, tes.Now());
- root_window()->AsRootWindowHostDelegate()->OnHostTouchEvent(&release);
+ dispatcher()->AsRootWindowHostDelegate()->OnHostTouchEvent(&release);
EXPECT_TRUE(delegate->fling());
EXPECT_FALSE(delegate->scroll_end());
@@ -1223,11 +1223,11 @@ TEST_F(GestureRecognizerTest, GestureEventVerticalRailFling) {
ui::TouchEvent press(ui::ET_TOUCH_PRESSED, gfx::Point(0, 0),
kTouchId, tes.Now());
- root_window()->AsRootWindowHostDelegate()->OnHostTouchEvent(&press);
+ dispatcher()->AsRootWindowHostDelegate()->OnHostTouchEvent(&press);
// Move the touch-point vertically enough that it is considered a
// vertical scroll.
- tes.SendScrollEvent(root_window(), 1, 20, kTouchId, delegate.get());
+ tes.SendScrollEvent(dispatcher(), 1, 20, kTouchId, delegate.get());
EXPECT_EQ(20, delegate->scroll_y());
EXPECT_EQ(20, delegate->scroll_y_ordinal());
EXPECT_EQ(0, delegate->scroll_x());
@@ -1236,7 +1236,7 @@ TEST_F(GestureRecognizerTest, GestureEventVerticalRailFling) {
EXPECT_GT(delegate->scroll_velocity_x_ordinal(), 0);
// Get a high y velocity, while still staying on the rail
- tes.SendScrollEvents(root_window(), 1, 1,
+ tes.SendScrollEvents(dispatcher(), 1, 1,
10, 100, kTouchId, 1,
ui::GestureConfiguration::points_buffered_for_velocity(),
delegate.get());
@@ -1246,7 +1246,7 @@ TEST_F(GestureRecognizerTest, GestureEventVerticalRailFling) {
delegate->Reset();
ui::TouchEvent release(ui::ET_TOUCH_RELEASED, gfx::Point(101, 201),
kTouchId, tes.Now());
- root_window()->AsRootWindowHostDelegate()->OnHostTouchEvent(&release);
+ dispatcher()->AsRootWindowHostDelegate()->OnHostTouchEvent(&release);
EXPECT_TRUE(delegate->fling());
EXPECT_FALSE(delegate->scroll_end());
@@ -1267,14 +1267,14 @@ TEST_F(GestureRecognizerTest, GestureEventNonRailFling) {
ui::TouchEvent press(ui::ET_TOUCH_PRESSED, gfx::Point(0, 0),
kTouchId, tes.Now());
- root_window()->AsRootWindowHostDelegate()->OnHostTouchEvent(&press);
+ dispatcher()->AsRootWindowHostDelegate()->OnHostTouchEvent(&press);
// Move the touch-point such that a non-rail scroll begins
- tes.SendScrollEvent(root_window(), 20, 20, kTouchId, delegate.get());
+ tes.SendScrollEvent(dispatcher(), 20, 20, kTouchId, delegate.get());
EXPECT_EQ(20, delegate->scroll_y());
EXPECT_EQ(20, delegate->scroll_x());
- tes.SendScrollEvents(root_window(), 1, 1,
+ tes.SendScrollEvents(dispatcher(), 1, 1,
10, 100, kTouchId, 1,
ui::GestureConfiguration::points_buffered_for_velocity(),
delegate.get());
@@ -1282,7 +1282,7 @@ TEST_F(GestureRecognizerTest, GestureEventNonRailFling) {
delegate->Reset();
ui::TouchEvent release(ui::ET_TOUCH_RELEASED, gfx::Point(101, 201),
kTouchId, tes.Now());
- root_window()->AsRootWindowHostDelegate()->OnHostTouchEvent(&release);
+ dispatcher()->AsRootWindowHostDelegate()->OnHostTouchEvent(&release);
EXPECT_TRUE(delegate->fling());
EXPECT_FALSE(delegate->scroll_end());
@@ -1311,7 +1311,7 @@ TEST_F(GestureRecognizerTest, GestureEventLongPress) {
ui::TouchEvent press1(ui::ET_TOUCH_PRESSED, gfx::Point(101, 201),
kTouchId, tes.Now());
- root_window()->AsRootWindowHostDelegate()->OnHostTouchEvent(&press1);
+ dispatcher()->AsRootWindowHostDelegate()->OnHostTouchEvent(&press1);
EXPECT_TRUE(delegate->tap_down());
EXPECT_TRUE(delegate->begin());
EXPECT_FALSE(delegate->tap_cancel());
@@ -1328,7 +1328,7 @@ TEST_F(GestureRecognizerTest, GestureEventLongPress) {
delegate->Reset();
ui::TouchEvent release1(ui::ET_TOUCH_RELEASED, gfx::Point(101, 201),
kTouchId, tes.Now());
- root_window()->AsRootWindowHostDelegate()->OnHostTouchEvent(&release1);
+ dispatcher()->AsRootWindowHostDelegate()->OnHostTouchEvent(&release1);
EXPECT_FALSE(delegate->long_press());
// Note the tap down isn't cancelled until the release
@@ -1360,7 +1360,7 @@ TEST_F(GestureRecognizerTest, GestureEventLongPressCancelledByScroll) {
ui::TouchEvent press1(ui::ET_TOUCH_PRESSED, gfx::Point(101, 201),
kTouchId, tes.Now());
- root_window()->AsRootWindowHostDelegate()->OnHostTouchEvent(&press1);
+ dispatcher()->AsRootWindowHostDelegate()->OnHostTouchEvent(&press1);
EXPECT_TRUE(delegate->tap_down());
// We haven't pressed long enough for a long press to occur
@@ -1368,7 +1368,7 @@ TEST_F(GestureRecognizerTest, GestureEventLongPressCancelledByScroll) {
EXPECT_FALSE(delegate->tap_cancel());
// Scroll around, to cancel the long press
- tes.SendScrollEvent(root_window(), 130, 230, kTouchId, delegate.get());
+ tes.SendScrollEvent(dispatcher(), 130, 230, kTouchId, delegate.get());
// Wait until the timer runs out
gesture_sequence->ForceTimeout();
EXPECT_FALSE(delegate->long_press());
@@ -1377,7 +1377,7 @@ TEST_F(GestureRecognizerTest, GestureEventLongPressCancelledByScroll) {
delegate->Reset();
ui::TouchEvent release1(ui::ET_TOUCH_RELEASED, gfx::Point(101, 201),
kTouchId, tes.LeapForward(10));
- root_window()->AsRootWindowHostDelegate()->OnHostTouchEvent(&release1);
+ dispatcher()->AsRootWindowHostDelegate()->OnHostTouchEvent(&release1);
EXPECT_FALSE(delegate->long_press());
EXPECT_FALSE(delegate->tap_cancel());
}
@@ -1403,7 +1403,7 @@ TEST_F(GestureRecognizerTest, GestureEventLongTap) {
ui::TouchEvent press1(ui::ET_TOUCH_PRESSED, gfx::Point(101, 201),
kTouchId, tes.Now());
- root_window()->AsRootWindowHostDelegate()->OnHostTouchEvent(&press1);
+ dispatcher()->AsRootWindowHostDelegate()->OnHostTouchEvent(&press1);
EXPECT_TRUE(delegate->tap_down());
EXPECT_TRUE(delegate->begin());
EXPECT_FALSE(delegate->tap_cancel());
@@ -1420,7 +1420,7 @@ TEST_F(GestureRecognizerTest, GestureEventLongTap) {
delegate->Reset();
ui::TouchEvent release1(ui::ET_TOUCH_RELEASED, gfx::Point(101, 201),
kTouchId, tes.Now());
- root_window()->AsRootWindowHostDelegate()->OnHostTouchEvent(&release1);
+ dispatcher()->AsRootWindowHostDelegate()->OnHostTouchEvent(&release1);
EXPECT_FALSE(delegate->long_press());
EXPECT_TRUE(delegate->long_tap());
@@ -1453,7 +1453,7 @@ TEST_F(GestureRecognizerTest, GestureEventLongPressCancelledBySecondTap) {
delegate->Reset();
ui::TouchEvent press(ui::ET_TOUCH_PRESSED, gfx::Point(101, 201),
kTouchId1, tes.Now());
- root_window()->AsRootWindowHostDelegate()->OnHostTouchEvent(&press);
+ dispatcher()->AsRootWindowHostDelegate()->OnHostTouchEvent(&press);
EXPECT_TRUE(delegate->tap_down());
EXPECT_TRUE(delegate->begin());
@@ -1464,7 +1464,7 @@ TEST_F(GestureRecognizerTest, GestureEventLongPressCancelledBySecondTap) {
delegate->Reset();
ui::TouchEvent press2(ui::ET_TOUCH_PRESSED, gfx::Point(10, 10),
kTouchId2, tes.Now());
- root_window()->AsRootWindowHostDelegate()->OnHostTouchEvent(&press2);
+ dispatcher()->AsRootWindowHostDelegate()->OnHostTouchEvent(&press2);
EXPECT_FALSE(delegate->tap_down()); // no touch down for second tap.
EXPECT_TRUE(delegate->tap_cancel());
EXPECT_TRUE(delegate->begin());
@@ -1478,7 +1478,7 @@ TEST_F(GestureRecognizerTest, GestureEventLongPressCancelledBySecondTap) {
delegate->Reset();
ui::TouchEvent release1(ui::ET_TOUCH_RELEASED, gfx::Point(101, 201),
kTouchId1, tes.Now());
- root_window()->AsRootWindowHostDelegate()->OnHostTouchEvent(&release1);
+ dispatcher()->AsRootWindowHostDelegate()->OnHostTouchEvent(&release1);
EXPECT_FALSE(delegate->long_press());
EXPECT_TRUE(delegate->two_finger_tap());
EXPECT_FALSE(delegate->tap_cancel());
@@ -1497,15 +1497,15 @@ TEST_F(GestureRecognizerTest, GestureEventHorizontalRailScroll) {
ui::TouchEvent press(ui::ET_TOUCH_PRESSED, gfx::Point(0, 0),
kTouchId, tes.Now());
- root_window()->AsRootWindowHostDelegate()->OnHostTouchEvent(&press);
+ dispatcher()->AsRootWindowHostDelegate()->OnHostTouchEvent(&press);
// Move the touch-point horizontally enough that it is considered a
// horizontal scroll.
- tes.SendScrollEvent(root_window(), 20, 1, kTouchId, delegate.get());
+ tes.SendScrollEvent(dispatcher(), 20, 1, kTouchId, delegate.get());
EXPECT_EQ(0, delegate->scroll_y());
EXPECT_EQ(20, delegate->scroll_x());
- tes.SendScrollEvent(root_window(), 25, 6, kTouchId, delegate.get());
+ tes.SendScrollEvent(dispatcher(), 25, 6, kTouchId, delegate.get());
EXPECT_TRUE(delegate->scroll_update());
EXPECT_EQ(5, delegate->scroll_x());
// y shouldn't change, as we're on a horizontal rail.
@@ -1513,7 +1513,7 @@ TEST_F(GestureRecognizerTest, GestureEventHorizontalRailScroll) {
// Send enough information that a velocity can be calculated for the gesture,
// and we can break the rail
- tes.SendScrollEvents(root_window(), 1, 1,
+ tes.SendScrollEvents(dispatcher(), 1, 1,
1, 100, kTouchId, 1,
ui::GestureConfiguration::points_buffered_for_velocity(),
delegate.get());
@@ -1522,8 +1522,8 @@ TEST_F(GestureRecognizerTest, GestureEventHorizontalRailScroll) {
EXPECT_GT(delegate->scroll_velocity_x(), 0);
EXPECT_GT(delegate->scroll_velocity_y(), 0);
- tes.SendScrollEvent(root_window(), 0, 0, kTouchId, delegate.get());
- tes.SendScrollEvent(root_window(), 5, 5, kTouchId, delegate.get());
+ tes.SendScrollEvent(dispatcher(), 0, 0, kTouchId, delegate.get());
+ tes.SendScrollEvent(dispatcher(), 5, 5, kTouchId, delegate.get());
// The rail should be broken
EXPECT_TRUE(delegate->scroll_update());
@@ -1544,15 +1544,15 @@ TEST_F(GestureRecognizerTest, GestureEventVerticalRailScroll) {
ui::TouchEvent press(ui::ET_TOUCH_PRESSED, gfx::Point(0, 0),
kTouchId, tes.Now());
- root_window()->AsRootWindowHostDelegate()->OnHostTouchEvent(&press);
+ dispatcher()->AsRootWindowHostDelegate()->OnHostTouchEvent(&press);
// Move the touch-point vertically enough that it is considered a
// vertical scroll.
- tes.SendScrollEvent(root_window(), 1, 20, kTouchId, delegate.get());
+ tes.SendScrollEvent(dispatcher(), 1, 20, kTouchId, delegate.get());
EXPECT_EQ(0, delegate->scroll_x());
EXPECT_EQ(20, delegate->scroll_y());
- tes.SendScrollEvent(root_window(), 6, 25, kTouchId, delegate.get());
+ tes.SendScrollEvent(dispatcher(), 6, 25, kTouchId, delegate.get());
EXPECT_TRUE(delegate->scroll_update());
EXPECT_EQ(5, delegate->scroll_y());
// x shouldn't change, as we're on a vertical rail.
@@ -1561,15 +1561,15 @@ TEST_F(GestureRecognizerTest, GestureEventVerticalRailScroll) {
// Send enough information that a velocity can be calculated for the gesture,
// and we can break the rail
- tes.SendScrollEvents(root_window(), 1, 1,
+ tes.SendScrollEvents(dispatcher(), 1, 1,
100, 1, kTouchId, 1,
ui::GestureConfiguration::points_buffered_for_velocity(),
delegate.get());
EXPECT_GT(delegate->scroll_velocity_x(), 0);
EXPECT_GT(delegate->scroll_velocity_y(), 0);
- tes.SendScrollEvent(root_window(), 0, 0, kTouchId, delegate.get());
- tes.SendScrollEvent(root_window(), 5, 5, kTouchId, delegate.get());
+ tes.SendScrollEvent(dispatcher(), 0, 0, kTouchId, delegate.get());
+ tes.SendScrollEvent(dispatcher(), 5, 5, kTouchId, delegate.get());
// The rail should be broken
EXPECT_TRUE(delegate->scroll_update());
@@ -1592,7 +1592,7 @@ TEST_F(GestureRecognizerTest, GestureTapFollowedByScroll) {
delegate->Reset();
ui::TouchEvent press(ui::ET_TOUCH_PRESSED, gfx::Point(101, 201),
kTouchId, tes.Now());
- root_window()->AsRootWindowHostDelegate()->OnHostTouchEvent(&press);
+ dispatcher()->AsRootWindowHostDelegate()->OnHostTouchEvent(&press);
EXPECT_FALSE(delegate->tap());
EXPECT_TRUE(delegate->tap_down());
EXPECT_FALSE(delegate->tap_cancel());
@@ -1605,7 +1605,7 @@ TEST_F(GestureRecognizerTest, GestureTapFollowedByScroll) {
delegate->Reset();
ui::TouchEvent release(ui::ET_TOUCH_RELEASED, gfx::Point(101, 201),
kTouchId, tes.LeapForward(50));
- root_window()->AsRootWindowHostDelegate()->OnHostTouchEvent(&release);
+ dispatcher()->AsRootWindowHostDelegate()->OnHostTouchEvent(&release);
EXPECT_TRUE(delegate->tap());
EXPECT_FALSE(delegate->tap_down());
EXPECT_FALSE(delegate->tap_cancel());
@@ -1618,7 +1618,7 @@ TEST_F(GestureRecognizerTest, GestureTapFollowedByScroll) {
delegate->Reset();
ui::TouchEvent press1(ui::ET_TOUCH_PRESSED, gfx::Point(101, 201),
kTouchId, tes.LeapForward(1000));
- root_window()->AsRootWindowHostDelegate()->OnHostTouchEvent(&press1);
+ dispatcher()->AsRootWindowHostDelegate()->OnHostTouchEvent(&press1);
EXPECT_FALSE(delegate->tap());
EXPECT_TRUE(delegate->tap_down());
EXPECT_FALSE(delegate->tap_cancel());
@@ -1633,7 +1633,7 @@ TEST_F(GestureRecognizerTest, GestureTapFollowedByScroll) {
delegate->Reset();
ui::TouchEvent move(ui::ET_TOUCH_MOVED, gfx::Point(130, 230),
kTouchId, tes.Now());
- root_window()->AsRootWindowHostDelegate()->OnHostTouchEvent(&move);
+ dispatcher()->AsRootWindowHostDelegate()->OnHostTouchEvent(&move);
EXPECT_FALSE(delegate->tap());
EXPECT_FALSE(delegate->tap_down());
EXPECT_TRUE(delegate->tap_cancel());
@@ -1647,7 +1647,7 @@ TEST_F(GestureRecognizerTest, GestureTapFollowedByScroll) {
delegate->Reset();
ui::TouchEvent move1(ui::ET_TOUCH_MOVED, gfx::Point(110, 211),
kTouchId, tes.Now());
- root_window()->AsRootWindowHostDelegate()->OnHostTouchEvent(&move1);
+ dispatcher()->AsRootWindowHostDelegate()->OnHostTouchEvent(&move1);
EXPECT_FALSE(delegate->tap());
EXPECT_FALSE(delegate->tap_down());
EXPECT_FALSE(delegate->tap_cancel());
@@ -1660,7 +1660,7 @@ TEST_F(GestureRecognizerTest, GestureTapFollowedByScroll) {
delegate->Reset();
ui::TouchEvent move2(ui::ET_TOUCH_MOVED, gfx::Point(140, 215),
kTouchId, tes.Now());
- root_window()->AsRootWindowHostDelegate()->OnHostTouchEvent(&move2);
+ dispatcher()->AsRootWindowHostDelegate()->OnHostTouchEvent(&move2);
EXPECT_FALSE(delegate->tap());
EXPECT_FALSE(delegate->tap_down());
EXPECT_FALSE(delegate->tap_cancel());
@@ -1674,7 +1674,7 @@ TEST_F(GestureRecognizerTest, GestureTapFollowedByScroll) {
delegate->Reset();
ui::TouchEvent release1(ui::ET_TOUCH_RELEASED, gfx::Point(101, 201),
kTouchId, tes.Now());
- root_window()->AsRootWindowHostDelegate()->OnHostTouchEvent(&release1);
+ dispatcher()->AsRootWindowHostDelegate()->OnHostTouchEvent(&release1);
EXPECT_FALSE(delegate->tap());
EXPECT_FALSE(delegate->tap_down());
EXPECT_FALSE(delegate->tap_cancel());
@@ -1686,7 +1686,7 @@ TEST_F(GestureRecognizerTest, GestureTapFollowedByScroll) {
TEST_F(GestureRecognizerTest, AsynchronousGestureRecognition) {
scoped_ptr<QueueTouchEventDelegate> queued_delegate(
- new QueueTouchEventDelegate(root_window()));
+ new QueueTouchEventDelegate(dispatcher()));
const int kWindowWidth = 123;
const int kWindowHeight = 45;
const int kTouchId1 = 6;
@@ -1701,7 +1701,7 @@ TEST_F(GestureRecognizerTest, AsynchronousGestureRecognition) {
queued_delegate->Reset();
ui::TouchEvent press(ui::ET_TOUCH_PRESSED, gfx::Point(101, 201),
kTouchId1, GetTime());
- root_window()->AsRootWindowHostDelegate()->OnHostTouchEvent(&press);
+ dispatcher()->AsRootWindowHostDelegate()->OnHostTouchEvent(&press);
EXPECT_FALSE(queued_delegate->tap());
EXPECT_FALSE(queued_delegate->tap_down());
EXPECT_FALSE(queued_delegate->tap_cancel());
@@ -1716,7 +1716,7 @@ TEST_F(GestureRecognizerTest, AsynchronousGestureRecognition) {
ui::TouchEvent release(ui::ET_TOUCH_RELEASED, gfx::Point(101, 201),
kTouchId1, press.time_stamp() +
base::TimeDelta::FromMilliseconds(50));
- root_window()->AsRootWindowHostDelegate()->OnHostTouchEvent(&release);
+ dispatcher()->AsRootWindowHostDelegate()->OnHostTouchEvent(&release);
EXPECT_FALSE(queued_delegate->tap());
EXPECT_FALSE(queued_delegate->tap_down());
EXPECT_FALSE(queued_delegate->tap_cancel());
@@ -1735,7 +1735,7 @@ TEST_F(GestureRecognizerTest, AsynchronousGestureRecognition) {
delegate->Reset();
ui::TouchEvent press2(ui::ET_TOUCH_PRESSED, gfx::Point(10, 20),
kTouchId2, GetTime());
- root_window()->AsRootWindowHostDelegate()->OnHostTouchEvent(&press2);
+ dispatcher()->AsRootWindowHostDelegate()->OnHostTouchEvent(&press2);
EXPECT_FALSE(delegate->tap());
EXPECT_TRUE(delegate->tap_down());
EXPECT_FALSE(delegate->tap_cancel());
@@ -1747,7 +1747,7 @@ TEST_F(GestureRecognizerTest, AsynchronousGestureRecognition) {
ui::TouchEvent release2(ui::ET_TOUCH_RELEASED, gfx::Point(10, 20),
kTouchId2, GetTime());
- root_window()->AsRootWindowHostDelegate()->OnHostTouchEvent(&release2);
+ dispatcher()->AsRootWindowHostDelegate()->OnHostTouchEvent(&release2);
// Process the first queued event.
queued_delegate->Reset();
@@ -1778,7 +1778,7 @@ TEST_F(GestureRecognizerTest, AsynchronousGestureRecognition) {
queued_delegate->Reset();
ui::TouchEvent press3(ui::ET_TOUCH_PRESSED, gfx::Point(101, 201),
kTouchId1, GetTime());
- root_window()->AsRootWindowHostDelegate()->OnHostTouchEvent(&press3);
+ dispatcher()->AsRootWindowHostDelegate()->OnHostTouchEvent(&press3);
EXPECT_FALSE(queued_delegate->tap());
EXPECT_FALSE(queued_delegate->tap_down());
EXPECT_FALSE(queued_delegate->tap_cancel());
@@ -1794,7 +1794,7 @@ TEST_F(GestureRecognizerTest, AsynchronousGestureRecognition) {
delegate->Reset();
ui::TouchEvent press4(ui::ET_TOUCH_PRESSED, gfx::Point(103, 203),
kTouchId2, GetTime());
- root_window()->AsRootWindowHostDelegate()->OnHostTouchEvent(&press4);
+ dispatcher()->AsRootWindowHostDelegate()->OnHostTouchEvent(&press4);
EXPECT_FALSE(delegate->tap());
EXPECT_FALSE(delegate->tap_down());
EXPECT_FALSE(delegate->tap_cancel());
@@ -1819,7 +1819,7 @@ TEST_F(GestureRecognizerTest, AsynchronousGestureRecognition) {
int x_move = ui::GestureConfiguration::max_touch_move_in_pixels_for_click();
ui::TouchEvent move(ui::ET_TOUCH_MOVED, gfx::Point(103 + x_move, 203),
kTouchId2, GetTime());
- root_window()->AsRootWindowHostDelegate()->OnHostTouchEvent(&move);
+ dispatcher()->AsRootWindowHostDelegate()->OnHostTouchEvent(&move);
EXPECT_FALSE(delegate->tap());
EXPECT_FALSE(delegate->tap_down());
EXPECT_FALSE(delegate->tap_cancel());
@@ -1888,7 +1888,7 @@ TEST_F(GestureRecognizerTest, GestureEventPinchFromScroll) {
scoped_ptr<aura::Window> window(CreateTestWindowWithDelegate(
delegate.get(), -1234, bounds, root_window()));
- aura::RootWindow* root = root_window();
+ aura::RootWindow* root = dispatcher();
delegate->Reset();
ui::TouchEvent press(ui::ET_TOUCH_PRESSED, gfx::Point(101, 201),
@@ -1977,20 +1977,20 @@ scoped_ptr<GestureEventConsumeDelegate> delegate(
ui::TouchEvent press(ui::ET_TOUCH_PRESSED, gfx::Point(101, 301),
kTouchId1, tes.Now());
- root_window()->AsRootWindowHostDelegate()->OnHostTouchEvent(&press);
+ dispatcher()->AsRootWindowHostDelegate()->OnHostTouchEvent(&press);
delegate->Reset();
ui::TouchEvent press2(ui::ET_TOUCH_PRESSED, gfx::Point(10, 10),
kTouchId2, tes.Now());
- root_window()->AsRootWindowHostDelegate()->OnHostTouchEvent(&press2);
+ dispatcher()->AsRootWindowHostDelegate()->OnHostTouchEvent(&press2);
EXPECT_FALSE(delegate->pinch_begin());
// Touch move triggers pinch begin.
- tes.SendScrollEvent(root_window(), 130, 230, kTouchId1, delegate.get());
+ tes.SendScrollEvent(dispatcher(), 130, 230, kTouchId1, delegate.get());
EXPECT_TRUE(delegate->pinch_begin());
EXPECT_FALSE(delegate->pinch_update());
// Touch move triggers pinch update.
- tes.SendScrollEvent(root_window(), 160, 200, kTouchId1, delegate.get());
+ tes.SendScrollEvent(dispatcher(), 160, 200, kTouchId1, delegate.get());
EXPECT_FALSE(delegate->pinch_begin());
EXPECT_TRUE(delegate->pinch_update());
@@ -1998,25 +1998,25 @@ scoped_ptr<GestureEventConsumeDelegate> delegate(
delegate->Reset();
ui::TouchEvent release(ui::ET_TOUCH_RELEASED, gfx::Point(101, 201),
kTouchId1, tes.Now());
- root_window()->AsRootWindowHostDelegate()->OnHostTouchEvent(&release);
+ dispatcher()->AsRootWindowHostDelegate()->OnHostTouchEvent(&release);
EXPECT_TRUE(delegate->pinch_end());
- tes.SendScrollEvent(root_window(), 130, 230, kTouchId2, delegate.get());
+ tes.SendScrollEvent(dispatcher(), 130, 230, kTouchId2, delegate.get());
EXPECT_TRUE(delegate->scroll_update());
// Pinch again
delegate->Reset();
ui::TouchEvent press3(ui::ET_TOUCH_PRESSED, gfx::Point(10, 10),
kTouchId1, tes.Now());
- root_window()->AsRootWindowHostDelegate()->OnHostTouchEvent(&press3);
+ dispatcher()->AsRootWindowHostDelegate()->OnHostTouchEvent(&press3);
// Now the touch points are close. So we will go into two finger tap.
// Move the touch-point enough to break two-finger-tap and enter pinch.
ui::TouchEvent move2(ui::ET_TOUCH_MOVED, gfx::Point(101, 202),
kTouchId1, tes.Now());
- root_window()->AsRootWindowHostDelegate()->OnHostTouchEvent(&move2);
+ dispatcher()->AsRootWindowHostDelegate()->OnHostTouchEvent(&move2);
EXPECT_TRUE(delegate->pinch_begin());
- tes.SendScrollEvent(root_window(), 130, 230, kTouchId1, delegate.get());
+ tes.SendScrollEvent(dispatcher(), 130, 230, kTouchId1, delegate.get());
EXPECT_TRUE(delegate->pinch_update());
}
@@ -2032,7 +2032,7 @@ TEST_F(GestureRecognizerTest, GestureEventPinchFromTap) {
scoped_ptr<aura::Window> window(CreateTestWindowWithDelegate(
delegate.get(), -1234, bounds, root_window()));
- aura::RootWindow* root = root_window();
+ aura::RootWindow* root = dispatcher();
delegate->Reset();
ui::TouchEvent press(ui::ET_TOUCH_PRESSED, gfx::Point(101, 301),
@@ -2103,7 +2103,7 @@ TEST_F(GestureRecognizerTest, GestureEventIgnoresDisconnectedEvents) {
ui::TouchEvent release1(ui::ET_TOUCH_RELEASED, gfx::Point(101, 201),
6, tes.Now());
- root_window()->AsRootWindowHostDelegate()->OnHostTouchEvent(&release1);
+ dispatcher()->AsRootWindowHostDelegate()->OnHostTouchEvent(&release1);
EXPECT_FALSE(delegate->tap());
EXPECT_FALSE(delegate->tap_down());
}
@@ -2141,7 +2141,7 @@ TEST_F(GestureRecognizerTest, GestureEventTouchLockSelectsCorrectWindow) {
windows[i]->set_id(i);
ui::TouchEvent press(ui::ET_TOUCH_PRESSED, window_bounds[i].origin(),
i, tes.Now());
- root_window()->AsRootWindowHostDelegate()->OnHostTouchEvent(&press);
+ dispatcher()->AsRootWindowHostDelegate()->OnHostTouchEvent(&press);
}
// Touches should now be associated with the closest touch within
@@ -2158,10 +2158,10 @@ TEST_F(GestureRecognizerTest, GestureEventTouchLockSelectsCorrectWindow) {
// Add a touch in the middle associated with windows[2]
ui::TouchEvent press(ui::ET_TOUCH_PRESSED, gfx::Point(0, 500),
kNumWindows, tes.Now());
- root_window()->AsRootWindowHostDelegate()->OnHostTouchEvent(&press);
+ dispatcher()->AsRootWindowHostDelegate()->OnHostTouchEvent(&press);
ui::TouchEvent move(ui::ET_TOUCH_MOVED, gfx::Point(250, 250),
kNumWindows, tes.Now());
- root_window()->AsRootWindowHostDelegate()->OnHostTouchEvent(&move);
+ dispatcher()->AsRootWindowHostDelegate()->OnHostTouchEvent(&move);
target = gesture_recognizer->GetTargetForLocation(gfx::Point(250, 250));
EXPECT_EQ("2", WindowIDAsString(target));
@@ -2182,7 +2182,7 @@ TEST_F(GestureRecognizerTest, GestureEventTouchLockSelectsCorrectWindow) {
// Move a touch associated with windows[2] to 1000, 1000
ui::TouchEvent move2(ui::ET_TOUCH_MOVED, gfx::Point(1000, 1000),
kNumWindows, tes.Now());
- root_window()->AsRootWindowHostDelegate()->OnHostTouchEvent(&move2);
+ dispatcher()->AsRootWindowHostDelegate()->OnHostTouchEvent(&move2);
target = gesture_recognizer->GetTargetForLocation(gfx::Point(1000, 1000));
EXPECT_EQ("2", WindowIDAsString(target));
@@ -2213,11 +2213,11 @@ TEST_F(GestureRecognizerTest, GestureEventOutsideRootWindowTap) {
gfx::Point pos1(-10, -10);
ui::TouchEvent press1(ui::ET_TOUCH_PRESSED, pos1, 0, tes.Now());
- root_window()->AsRootWindowHostDelegate()->OnHostTouchEvent(&press1);
+ dispatcher()->AsRootWindowHostDelegate()->OnHostTouchEvent(&press1);
gfx::Point pos2(1000, 1000);
ui::TouchEvent press2(ui::ET_TOUCH_PRESSED, pos2, 1, tes.Now());
- root_window()->AsRootWindowHostDelegate()->OnHostTouchEvent(&press2);
+ dispatcher()->AsRootWindowHostDelegate()->OnHostTouchEvent(&press2);
// As these presses were outside the root window, they should be
// associated with the root window.
@@ -2227,7 +2227,7 @@ TEST_F(GestureRecognizerTest, GestureEventOutsideRootWindowTap) {
TEST_F(GestureRecognizerTest, NoTapWithPreventDefaultedRelease) {
scoped_ptr<QueueTouchEventDelegate> delegate(
- new QueueTouchEventDelegate(root_window()));
+ new QueueTouchEventDelegate(dispatcher()));
TimedEvents tes;
const int kTouchId = 2;
gfx::Rect bounds(100, 200, 100, 100);
@@ -2238,10 +2238,10 @@ TEST_F(GestureRecognizerTest, NoTapWithPreventDefaultedRelease) {
delegate->Reset();
ui::TouchEvent press(ui::ET_TOUCH_PRESSED, gfx::Point(101, 201),
kTouchId, tes.Now());
- root_window()->AsRootWindowHostDelegate()->OnHostTouchEvent(&press);
+ dispatcher()->AsRootWindowHostDelegate()->OnHostTouchEvent(&press);
ui::TouchEvent release(ui::ET_TOUCH_RELEASED, gfx::Point(101, 201),
kTouchId, tes.LeapForward(50));
- root_window()->AsRootWindowHostDelegate()->OnHostTouchEvent(&release);
+ dispatcher()->AsRootWindowHostDelegate()->OnHostTouchEvent(&release);
delegate->Reset();
delegate->ReceivedAck();
@@ -2254,7 +2254,7 @@ TEST_F(GestureRecognizerTest, NoTapWithPreventDefaultedRelease) {
TEST_F(GestureRecognizerTest, PinchScrollWithPreventDefaultedRelease) {
scoped_ptr<QueueTouchEventDelegate> delegate(
- new QueueTouchEventDelegate(root_window()));
+ new QueueTouchEventDelegate(dispatcher()));
TimedEvents tes;
const int kTouchId1 = 7;
const int kTouchId2 = 5;
@@ -2271,9 +2271,9 @@ TEST_F(GestureRecognizerTest, PinchScrollWithPreventDefaultedRelease) {
tes.LeapForward(200));
ui::TouchEvent release(ui::ET_TOUCH_RELEASED, gfx::Point(15, 25), kTouchId1,
tes.LeapForward(50));
- root_window()->AsRootWindowHostDelegate()->OnHostTouchEvent(&press);
- root_window()->AsRootWindowHostDelegate()->OnHostTouchEvent(&move);
- root_window()->AsRootWindowHostDelegate()->OnHostTouchEvent(&release);
+ dispatcher()->AsRootWindowHostDelegate()->OnHostTouchEvent(&press);
+ dispatcher()->AsRootWindowHostDelegate()->OnHostTouchEvent(&move);
+ dispatcher()->AsRootWindowHostDelegate()->OnHostTouchEvent(&release);
delegate->Reset();
// Ack the press event.
@@ -2307,12 +2307,12 @@ TEST_F(GestureRecognizerTest, PinchScrollWithPreventDefaultedRelease) {
tes.LeapForward(14));
// Do a pinch.
- root_window()->AsRootWindowHostDelegate()->OnHostTouchEvent(&press);
- root_window()->AsRootWindowHostDelegate()->OnHostTouchEvent(&move);
- root_window()->AsRootWindowHostDelegate()->OnHostTouchEvent(&press2);
- root_window()->AsRootWindowHostDelegate()->OnHostTouchEvent(&move2);
- root_window()->AsRootWindowHostDelegate()->OnHostTouchEvent(&release);
- root_window()->AsRootWindowHostDelegate()->OnHostTouchEvent(&release2);
+ dispatcher()->AsRootWindowHostDelegate()->OnHostTouchEvent(&press);
+ dispatcher()->AsRootWindowHostDelegate()->OnHostTouchEvent(&move);
+ dispatcher()->AsRootWindowHostDelegate()->OnHostTouchEvent(&press2);
+ dispatcher()->AsRootWindowHostDelegate()->OnHostTouchEvent(&move2);
+ dispatcher()->AsRootWindowHostDelegate()->OnHostTouchEvent(&release);
+ dispatcher()->AsRootWindowHostDelegate()->OnHostTouchEvent(&release2);
// Ack the press and move events.
delegate->Reset();
@@ -2439,14 +2439,14 @@ TEST_F(GestureRecognizerTest, PressDoesNotCrash) {
ui::TouchEvent press(ui::ET_TOUCH_PRESSED, gfx::Point(45, 45), 7, tes.Now());
press.set_radius_x(40);
- root_window()->AsRootWindowHostDelegate()->OnHostTouchEvent(&press);
+ dispatcher()->AsRootWindowHostDelegate()->OnHostTouchEvent(&press);
EXPECT_TRUE(delegate->tap_down());
EXPECT_EQ(gfx::Rect(5, 5, 80, 80).ToString(),
delegate->bounding_box().ToString());
delegate->Reset();
ui::TouchEvent press2(ui::ET_TOUCH_PRESSED, gfx::Point(55, 45), 7, tes.Now());
- root_window()->AsRootWindowHostDelegate()->OnHostTouchEvent(&press2);
+ dispatcher()->AsRootWindowHostDelegate()->OnHostTouchEvent(&press2);
// This new press should not generate a tap-down.
EXPECT_FALSE(delegate->begin());
@@ -2470,7 +2470,7 @@ TEST_F(GestureRecognizerTest, TwoFingerTap) {
delegate->Reset();
ui::TouchEvent press1(ui::ET_TOUCH_PRESSED, gfx::Point(101, 201),
kTouchId1, tes.Now());
- root_window()->AsRootWindowHostDelegate()->OnHostTouchEvent(&press1);
+ dispatcher()->AsRootWindowHostDelegate()->OnHostTouchEvent(&press1);
EXPECT_FALSE(delegate->tap());
EXPECT_TRUE(delegate->tap_down());
EXPECT_FALSE(delegate->tap_cancel());
@@ -2483,7 +2483,7 @@ TEST_F(GestureRecognizerTest, TwoFingerTap) {
delegate->Reset();
ui::TouchEvent press2(ui::ET_TOUCH_PRESSED, gfx::Point(130, 201),
kTouchId2, tes.Now());
- root_window()->AsRootWindowHostDelegate()->OnHostTouchEvent(&press2);
+ dispatcher()->AsRootWindowHostDelegate()->OnHostTouchEvent(&press2);
EXPECT_FALSE(delegate->tap());
EXPECT_FALSE(delegate->tap_down()); // no touch down for second tap.
EXPECT_TRUE(delegate->tap_cancel());
@@ -2497,10 +2497,10 @@ TEST_F(GestureRecognizerTest, TwoFingerTap) {
delegate->Reset();
ui::TouchEvent move1(ui::ET_TOUCH_MOVED, gfx::Point(102, 202),
kTouchId1, tes.Now());
- root_window()->AsRootWindowHostDelegate()->OnHostTouchEvent(&move1);
+ dispatcher()->AsRootWindowHostDelegate()->OnHostTouchEvent(&move1);
ui::TouchEvent move2(ui::ET_TOUCH_MOVED, gfx::Point(131, 202),
kTouchId2, tes.Now());
- root_window()->AsRootWindowHostDelegate()->OnHostTouchEvent(&move2);
+ dispatcher()->AsRootWindowHostDelegate()->OnHostTouchEvent(&move2);
EXPECT_FALSE(delegate->tap());
EXPECT_FALSE(delegate->tap_down());
EXPECT_FALSE(delegate->tap_cancel());
@@ -2516,7 +2516,7 @@ TEST_F(GestureRecognizerTest, TwoFingerTap) {
ui::TouchEvent release1(ui::ET_TOUCH_RELEASED, gfx::Point(101, 201),
kTouchId1, tes.LeapForward(50));
- root_window()->AsRootWindowHostDelegate()->OnHostTouchEvent(&release1);
+ dispatcher()->AsRootWindowHostDelegate()->OnHostTouchEvent(&release1);
EXPECT_FALSE(delegate->tap());
EXPECT_FALSE(delegate->tap_down());
EXPECT_FALSE(delegate->tap_cancel());
@@ -2532,7 +2532,7 @@ TEST_F(GestureRecognizerTest, TwoFingerTap) {
ui::TouchEvent release2(ui::ET_TOUCH_RELEASED, gfx::Point(130, 201),
kTouchId2, tes.LeapForward(50));
- root_window()->AsRootWindowHostDelegate()->OnHostTouchEvent(&release2);
+ dispatcher()->AsRootWindowHostDelegate()->OnHostTouchEvent(&release2);
EXPECT_FALSE(delegate->tap());
EXPECT_FALSE(delegate->tap_down());
EXPECT_FALSE(delegate->tap_cancel());
@@ -2558,19 +2558,19 @@ TEST_F(GestureRecognizerTest, TwoFingerTapExpired) {
delegate->Reset();
ui::TouchEvent press1(ui::ET_TOUCH_PRESSED, gfx::Point(101, 201),
kTouchId1, tes.Now());
- root_window()->AsRootWindowHostDelegate()->OnHostTouchEvent(&press1);
+ dispatcher()->AsRootWindowHostDelegate()->OnHostTouchEvent(&press1);
delegate->Reset();
ui::TouchEvent press2(ui::ET_TOUCH_PRESSED, gfx::Point(130, 201),
kTouchId2, tes.Now());
- root_window()->AsRootWindowHostDelegate()->OnHostTouchEvent(&press2);
+ dispatcher()->AsRootWindowHostDelegate()->OnHostTouchEvent(&press2);
// Send release event after sufficient delay so that two finger time expires.
delegate->Reset();
ui::TouchEvent release1(ui::ET_TOUCH_RELEASED, gfx::Point(101, 201),
kTouchId1, tes.LeapForward(1000));
- root_window()->AsRootWindowHostDelegate()->OnHostTouchEvent(&release1);
+ dispatcher()->AsRootWindowHostDelegate()->OnHostTouchEvent(&release1);
EXPECT_FALSE(delegate->two_finger_tap());
// Lift second finger.
@@ -2580,7 +2580,7 @@ TEST_F(GestureRecognizerTest, TwoFingerTapExpired) {
ui::TouchEvent release2(ui::ET_TOUCH_RELEASED, gfx::Point(130, 201),
kTouchId2, tes.LeapForward(50));
- root_window()->AsRootWindowHostDelegate()->OnHostTouchEvent(&release2);
+ dispatcher()->AsRootWindowHostDelegate()->OnHostTouchEvent(&release2);
EXPECT_FALSE(delegate->two_finger_tap());
}
@@ -2602,14 +2602,14 @@ TEST_F(GestureRecognizerTest, TwoFingerTapChangesToPinch) {
delegate->Reset();
ui::TouchEvent press1(ui::ET_TOUCH_PRESSED, gfx::Point(101, 201),
kTouchId1, tes.Now());
- root_window()->AsRootWindowHostDelegate()->OnHostTouchEvent(&press1);
+ dispatcher()->AsRootWindowHostDelegate()->OnHostTouchEvent(&press1);
delegate->Reset();
ui::TouchEvent press2(ui::ET_TOUCH_PRESSED, gfx::Point(130, 201),
kTouchId2, tes.Now());
- root_window()->AsRootWindowHostDelegate()->OnHostTouchEvent(&press2);
+ dispatcher()->AsRootWindowHostDelegate()->OnHostTouchEvent(&press2);
- tes.SendScrollEvent(root_window(), 130, 230, kTouchId1, delegate.get());
+ tes.SendScrollEvent(dispatcher(), 130, 230, kTouchId1, delegate.get());
EXPECT_FALSE(delegate->two_finger_tap());
EXPECT_TRUE(delegate->pinch_begin());
@@ -2619,7 +2619,7 @@ TEST_F(GestureRecognizerTest, TwoFingerTapChangesToPinch) {
ui::TouchEvent release(ui::ET_TOUCH_RELEASED, gfx::Point(101, 201),
kTouchId2, tes.LeapForward(50));
- root_window()->AsRootWindowHostDelegate()->OnHostTouchEvent(&release);
+ dispatcher()->AsRootWindowHostDelegate()->OnHostTouchEvent(&release);
EXPECT_FALSE(delegate->two_finger_tap());
EXPECT_TRUE(delegate->pinch_end());
}
@@ -2633,14 +2633,14 @@ TEST_F(GestureRecognizerTest, TwoFingerTapChangesToPinch) {
delegate->Reset();
ui::TouchEvent press1(ui::ET_TOUCH_PRESSED, gfx::Point(101, 201),
kTouchId1, tes.Now());
- root_window()->AsRootWindowHostDelegate()->OnHostTouchEvent(&press1);
+ dispatcher()->AsRootWindowHostDelegate()->OnHostTouchEvent(&press1);
delegate->Reset();
ui::TouchEvent press2(ui::ET_TOUCH_PRESSED, gfx::Point(130, 201),
kTouchId2, tes.Now());
- root_window()->AsRootWindowHostDelegate()->OnHostTouchEvent(&press2);
+ dispatcher()->AsRootWindowHostDelegate()->OnHostTouchEvent(&press2);
- tes.SendScrollEvent(root_window(), 101, 230, kTouchId2, delegate.get());
+ tes.SendScrollEvent(dispatcher(), 101, 230, kTouchId2, delegate.get());
EXPECT_FALSE(delegate->two_finger_tap());
EXPECT_TRUE(delegate->pinch_begin());
@@ -2650,7 +2650,7 @@ TEST_F(GestureRecognizerTest, TwoFingerTapChangesToPinch) {
ui::TouchEvent release(ui::ET_TOUCH_RELEASED, gfx::Point(101, 201),
kTouchId1, tes.LeapForward(50));
- root_window()->AsRootWindowHostDelegate()->OnHostTouchEvent(&release);
+ dispatcher()->AsRootWindowHostDelegate()->OnHostTouchEvent(&release);
EXPECT_FALSE(delegate->two_finger_tap());
EXPECT_TRUE(delegate->pinch_end());
}
@@ -2672,13 +2672,13 @@ TEST_F(GestureRecognizerTest, NoTwoFingerTapWhenFirstFingerHasScrolled) {
delegate->Reset();
ui::TouchEvent press1(ui::ET_TOUCH_PRESSED, gfx::Point(101, 201),
kTouchId1, tes.Now());
- root_window()->AsRootWindowHostDelegate()->OnHostTouchEvent(&press1);
- tes.SendScrollEvent(root_window(), 130, 230, kTouchId1, delegate.get());
+ dispatcher()->AsRootWindowHostDelegate()->OnHostTouchEvent(&press1);
+ tes.SendScrollEvent(dispatcher(), 130, 230, kTouchId1, delegate.get());
delegate->Reset();
ui::TouchEvent press2(ui::ET_TOUCH_PRESSED, gfx::Point(130, 201),
kTouchId2, tes.Now());
- root_window()->AsRootWindowHostDelegate()->OnHostTouchEvent(&press2);
+ dispatcher()->AsRootWindowHostDelegate()->OnHostTouchEvent(&press2);
EXPECT_TRUE(delegate->pinch_begin());
@@ -2688,7 +2688,7 @@ TEST_F(GestureRecognizerTest, NoTwoFingerTapWhenFirstFingerHasScrolled) {
ui::TouchEvent release(ui::ET_TOUCH_RELEASED, gfx::Point(101, 201),
kTouchId2, tes.LeapForward(50));
- root_window()->AsRootWindowHostDelegate()->OnHostTouchEvent(&release);
+ dispatcher()->AsRootWindowHostDelegate()->OnHostTouchEvent(&release);
EXPECT_FALSE(delegate->two_finger_tap());
EXPECT_TRUE(delegate->pinch_end());
}
@@ -2751,17 +2751,17 @@ TEST_F(GestureRecognizerTest, TwoFingerTapCancelled) {
delegate->Reset();
ui::TouchEvent press1(ui::ET_TOUCH_PRESSED, gfx::Point(101, 201),
kTouchId1, tes.Now());
- root_window()->AsRootWindowHostDelegate()->OnHostTouchEvent(&press1);
+ dispatcher()->AsRootWindowHostDelegate()->OnHostTouchEvent(&press1);
delegate->Reset();
ui::TouchEvent press2(ui::ET_TOUCH_PRESSED, gfx::Point(130, 201),
kTouchId2, tes.Now());
- root_window()->AsRootWindowHostDelegate()->OnHostTouchEvent(&press2);
+ dispatcher()->AsRootWindowHostDelegate()->OnHostTouchEvent(&press2);
delegate->Reset();
ui::TouchEvent cancel(ui::ET_TOUCH_CANCELLED, gfx::Point(130, 201),
kTouchId1, tes.Now());
- root_window()->AsRootWindowHostDelegate()->OnHostTouchEvent(&cancel);
+ dispatcher()->AsRootWindowHostDelegate()->OnHostTouchEvent(&cancel);
EXPECT_FALSE(delegate->two_finger_tap());
// Make sure there is enough delay before the touch is released so that it
@@ -2770,7 +2770,7 @@ TEST_F(GestureRecognizerTest, TwoFingerTapCancelled) {
ui::TouchEvent release(ui::ET_TOUCH_RELEASED, gfx::Point(101, 201),
kTouchId2, tes.LeapForward(50));
- root_window()->AsRootWindowHostDelegate()->OnHostTouchEvent(&release);
+ dispatcher()->AsRootWindowHostDelegate()->OnHostTouchEvent(&release);
EXPECT_FALSE(delegate->two_finger_tap());
}
@@ -2783,17 +2783,17 @@ TEST_F(GestureRecognizerTest, TwoFingerTapCancelled) {
delegate->Reset();
ui::TouchEvent press1(ui::ET_TOUCH_PRESSED, gfx::Point(101, 201),
kTouchId1, tes.Now());
- root_window()->AsRootWindowHostDelegate()->OnHostTouchEvent(&press1);
+ dispatcher()->AsRootWindowHostDelegate()->OnHostTouchEvent(&press1);
delegate->Reset();
ui::TouchEvent press2(ui::ET_TOUCH_PRESSED, gfx::Point(130, 201),
kTouchId2, tes.Now());
- root_window()->AsRootWindowHostDelegate()->OnHostTouchEvent(&press2);
+ dispatcher()->AsRootWindowHostDelegate()->OnHostTouchEvent(&press2);
delegate->Reset();
ui::TouchEvent cancel(ui::ET_TOUCH_CANCELLED, gfx::Point(130, 201),
kTouchId2, tes.Now());
- root_window()->AsRootWindowHostDelegate()->OnHostTouchEvent(&cancel);
+ dispatcher()->AsRootWindowHostDelegate()->OnHostTouchEvent(&cancel);
EXPECT_FALSE(delegate->two_finger_tap());
// Make sure there is enough delay before the touch is released so that it
@@ -2802,7 +2802,7 @@ TEST_F(GestureRecognizerTest, TwoFingerTapCancelled) {
ui::TouchEvent release(ui::ET_TOUCH_RELEASED, gfx::Point(101, 201),
kTouchId1, tes.LeapForward(50));
- root_window()->AsRootWindowHostDelegate()->OnHostTouchEvent(&release);
+ dispatcher()->AsRootWindowHostDelegate()->OnHostTouchEvent(&release);
EXPECT_FALSE(delegate->two_finger_tap());
}
}
@@ -2822,7 +2822,7 @@ TEST_F(GestureRecognizerTest, VeryWideTwoFingerTouchDownShouldBeAPinch) {
delegate->Reset();
ui::TouchEvent press1(ui::ET_TOUCH_PRESSED, gfx::Point(101, 201),
kTouchId1, tes.Now());
- root_window()->AsRootWindowHostDelegate()->OnHostTouchEvent(&press1);
+ dispatcher()->AsRootWindowHostDelegate()->OnHostTouchEvent(&press1);
EXPECT_FALSE(delegate->tap());
EXPECT_TRUE(delegate->tap_down());
EXPECT_FALSE(delegate->tap_cancel());
@@ -2835,7 +2835,7 @@ TEST_F(GestureRecognizerTest, VeryWideTwoFingerTouchDownShouldBeAPinch) {
delegate->Reset();
ui::TouchEvent press2(ui::ET_TOUCH_PRESSED, gfx::Point(430, 201),
kTouchId2, tes.Now());
- root_window()->AsRootWindowHostDelegate()->OnHostTouchEvent(&press2);
+ dispatcher()->AsRootWindowHostDelegate()->OnHostTouchEvent(&press2);
EXPECT_FALSE(delegate->tap());
EXPECT_FALSE(delegate->tap_down()); // no touch down for second tap.
EXPECT_TRUE(delegate->tap_cancel());
@@ -2849,7 +2849,7 @@ TEST_F(GestureRecognizerTest, VeryWideTwoFingerTouchDownShouldBeAPinch) {
delegate->Reset();
ui::TouchEvent move2(ui::ET_TOUCH_MOVED, gfx::Point(530, 301),
kTouchId2, tes.Now());
- root_window()->AsRootWindowHostDelegate()->OnHostTouchEvent(&move2);
+ dispatcher()->AsRootWindowHostDelegate()->OnHostTouchEvent(&move2);
EXPECT_FALSE(delegate->tap());
EXPECT_FALSE(delegate->tap_down());
EXPECT_FALSE(delegate->tap_cancel());
@@ -2876,10 +2876,10 @@ TEST_F(GestureRecognizerTest, FlushAllOnHide) {
ui::TouchEvent press1(ui::ET_TOUCH_PRESSED, gfx::Point(10, 10),
kTouchId1, tes.Now());
- root_window()->AsRootWindowHostDelegate()->OnHostTouchEvent(&press1);
+ dispatcher()->AsRootWindowHostDelegate()->OnHostTouchEvent(&press1);
ui::TouchEvent press2(ui::ET_TOUCH_PRESSED, gfx::Point(20, 20),
kTouchId2, tes.Now());
- root_window()->AsRootWindowHostDelegate()->OnHostTouchEvent(&press2);
+ dispatcher()->AsRootWindowHostDelegate()->OnHostTouchEvent(&press2);
window->Hide();
EXPECT_EQ(NULL,
ui::GestureRecognizer::Get()->GetTouchLockedTarget(&press1));
@@ -2889,7 +2889,7 @@ TEST_F(GestureRecognizerTest, FlushAllOnHide) {
TEST_F(GestureRecognizerTest, LongPressTimerStopsOnPreventDefaultedTouchMoves) {
scoped_ptr<QueueTouchEventDelegate> delegate(
- new QueueTouchEventDelegate(root_window()));
+ new QueueTouchEventDelegate(dispatcher()));
const int kTouchId = 2;
gfx::Rect bounds(100, 200, 100, 100);
scoped_ptr<aura::Window> window(CreateTestWindowWithDelegate(
@@ -2908,9 +2908,9 @@ TEST_F(GestureRecognizerTest, LongPressTimerStopsOnPreventDefaultedTouchMoves) {
delegate->Reset();
ui::TouchEvent press(ui::ET_TOUCH_PRESSED, gfx::Point(101, 201),
kTouchId, tes.Now());
- root_window()->AsRootWindowHostDelegate()->OnHostTouchEvent(&press);
+ dispatcher()->AsRootWindowHostDelegate()->OnHostTouchEvent(&press);
// Scroll around, to cancel the long press
- tes.SendScrollEvent(root_window(), 130, 230, kTouchId, delegate.get());
+ tes.SendScrollEvent(dispatcher(), 130, 230, kTouchId, delegate.get());
delegate->Reset();
delegate->ReceivedAck();
@@ -2961,7 +2961,7 @@ TEST_F(GestureRecognizerTest, GestureEventScrollTouchMoveConsumed) {
delegate->Reset();
ui::TouchEvent press(ui::ET_TOUCH_PRESSED, gfx::Point(101, 201),
kTouchId, tes.Now());
- root_window()->AsRootWindowHostDelegate()->OnHostTouchEvent(&press);
+ dispatcher()->AsRootWindowHostDelegate()->OnHostTouchEvent(&press);
EXPECT_FALSE(delegate->tap());
EXPECT_TRUE(delegate->tap_down());
EXPECT_FALSE(delegate->tap_cancel());
@@ -2973,7 +2973,7 @@ TEST_F(GestureRecognizerTest, GestureEventScrollTouchMoveConsumed) {
// Move the touch-point enough so that it would normally be considered a
// scroll. But since the touch-moves will be consumed, the scroll should not
// start.
- tes.SendScrollEvent(root_window(), 130, 230, kTouchId, delegate.get());
+ tes.SendScrollEvent(dispatcher(), 130, 230, kTouchId, delegate.get());
EXPECT_FALSE(delegate->tap());
EXPECT_FALSE(delegate->tap_down());
EXPECT_TRUE(delegate->tap_cancel());
@@ -2987,7 +2987,7 @@ TEST_F(GestureRecognizerTest, GestureEventScrollTouchMoveConsumed) {
delegate->Reset();
ui::TouchEvent release(ui::ET_TOUCH_RELEASED, gfx::Point(130, 230),
kTouchId, tes.LeapForward(50));
- root_window()->AsRootWindowHostDelegate()->OnHostTouchEvent(&release);
+ dispatcher()->AsRootWindowHostDelegate()->OnHostTouchEvent(&release);
EXPECT_FALSE(delegate->tap());
EXPECT_FALSE(delegate->tap_down());
EXPECT_FALSE(delegate->tap_cancel());
@@ -3015,8 +3015,8 @@ TEST_F(GestureRecognizerTest, GestureEventScrollTwoFingerTouchMoveConsumed) {
delegate->Reset();
ui::TouchEvent press1(ui::ET_TOUCH_PRESSED, gfx::Point(101, 201),
kTouchId1, tes.Now());
- root_window()->AsRootWindowHostDelegate()->OnHostTouchEvent(&press1);
- tes.SendScrollEvent(root_window(), 131, 231, kTouchId1, delegate.get());
+ dispatcher()->AsRootWindowHostDelegate()->OnHostTouchEvent(&press1);
+ tes.SendScrollEvent(dispatcher(), 131, 231, kTouchId1, delegate.get());
// First finger touches down and moves.
EXPECT_FALSE(delegate->tap());
@@ -3028,8 +3028,8 @@ TEST_F(GestureRecognizerTest, GestureEventScrollTwoFingerTouchMoveConsumed) {
// Second finger touches down and moves.
ui::TouchEvent press2(ui::ET_TOUCH_PRESSED, gfx::Point(130, 201),
kTouchId2, tes.LeapForward(50));
- root_window()->AsRootWindowHostDelegate()->OnHostTouchEvent(&press2);
- tes.SendScrollEvent(root_window(), 161, 231, kTouchId2, delegate.get());
+ dispatcher()->AsRootWindowHostDelegate()->OnHostTouchEvent(&press2);
+ tes.SendScrollEvent(dispatcher(), 161, 231, kTouchId2, delegate.get());
// PinchBegin & ScrollBegin were not sent if the touch-move events were
// consumed.
@@ -3047,7 +3047,7 @@ TEST_F(GestureRecognizerTest, GestureEventScrollTwoFingerTouchMoveConsumed) {
delegate->Reset();
// Moves First finger again, no PinchUpdate & ScrollUpdate.
- tes.SendScrollEvent(root_window(), 161, 261, kTouchId1, delegate.get());
+ tes.SendScrollEvent(dispatcher(), 161, 261, kTouchId1, delegate.get());
EXPECT_FALSE(delegate->pinch_update());
EXPECT_FALSE(delegate->pinch_end());
@@ -3059,7 +3059,7 @@ TEST_F(GestureRecognizerTest, GestureEventScrollTwoFingerTouchMoveConsumed) {
delegate->Reset();
// Making a pinch gesture.
- tes.SendScrollEvent(root_window(), 161, 251, kTouchId1, delegate.get());
+ tes.SendScrollEvent(dispatcher(), 161, 251, kTouchId1, delegate.get());
// If touch moves are ever consumed, we should not see PinchBegin/Update
// even touch moves become not consumed.
EXPECT_FALSE(delegate->scroll_begin());
@@ -3071,7 +3071,7 @@ TEST_F(GestureRecognizerTest, GestureEventScrollTwoFingerTouchMoveConsumed) {
EXPECT_FALSE(delegate->pinch_end());
delegate->Reset();
- tes.SendScrollEvent(root_window(), 161, 241, kTouchId2, delegate.get());
+ tes.SendScrollEvent(dispatcher(), 161, 241, kTouchId2, delegate.get());
EXPECT_FALSE(delegate->scroll_begin());
EXPECT_FALSE(delegate->scroll_update());
EXPECT_FALSE(delegate->scroll_end());
@@ -3085,8 +3085,8 @@ TEST_F(GestureRecognizerTest, GestureEventScrollTwoFingerTouchMoveConsumed) {
kTouchId1, tes.Now());
ui::TouchEvent release2(ui::ET_TOUCH_RELEASED, gfx::Point(130, 201),
kTouchId2, tes.Now());
- root_window()->AsRootWindowHostDelegate()->OnHostTouchEvent(&release1);
- root_window()->AsRootWindowHostDelegate()->OnHostTouchEvent(&release2);
+ dispatcher()->AsRootWindowHostDelegate()->OnHostTouchEvent(&release1);
+ dispatcher()->AsRootWindowHostDelegate()->OnHostTouchEvent(&release2);
EXPECT_FALSE(delegate->tap());
// Touch release is not consumed, so we still see two finger tap.
@@ -3119,7 +3119,7 @@ TEST_F(GestureRecognizerTest, GestureEventScrollTouchMovePartialConsumed) {
delegate->Reset();
ui::TouchEvent press(ui::ET_TOUCH_PRESSED, gfx::Point(101, 201),
kTouchId, tes.Now());
- root_window()->AsRootWindowHostDelegate()->OnHostTouchEvent(&press);
+ dispatcher()->AsRootWindowHostDelegate()->OnHostTouchEvent(&press);
EXPECT_FALSE(delegate->tap());
EXPECT_TRUE(delegate->tap_down());
EXPECT_FALSE(delegate->tap_cancel());
@@ -3131,7 +3131,7 @@ TEST_F(GestureRecognizerTest, GestureEventScrollTouchMovePartialConsumed) {
// Move the touch-point enough so that it would normally be considered a
// scroll. But since the touch-moves will be consumed, the scroll should not
// start.
- tes.SendScrollEvent(root_window(), 130, 230, kTouchId, delegate.get());
+ tes.SendScrollEvent(dispatcher(), 130, 230, kTouchId, delegate.get());
EXPECT_FALSE(delegate->tap());
EXPECT_FALSE(delegate->tap_down());
EXPECT_TRUE(delegate->tap_cancel());
@@ -3142,7 +3142,7 @@ TEST_F(GestureRecognizerTest, GestureEventScrollTouchMovePartialConsumed) {
// Now, stop consuming touch-move events, and move the touch-point again.
delegate->set_consume_touch_move(false);
- tes.SendScrollEvent(root_window(), 159, 259, kTouchId, delegate.get());
+ tes.SendScrollEvent(dispatcher(), 159, 259, kTouchId, delegate.get());
EXPECT_FALSE(delegate->tap());
EXPECT_FALSE(delegate->tap_down());
EXPECT_FALSE(delegate->tap_cancel());
@@ -3160,7 +3160,7 @@ TEST_F(GestureRecognizerTest, GestureEventScrollTouchMovePartialConsumed) {
delegate->set_consume_touch_move(true);
// Move some more to generate a few more scroll updates.
- tes.SendScrollEvent(root_window(), 110, 211, kTouchId, delegate.get());
+ tes.SendScrollEvent(dispatcher(), 110, 211, kTouchId, delegate.get());
EXPECT_FALSE(delegate->tap());
EXPECT_FALSE(delegate->tap_down());
EXPECT_FALSE(delegate->tap_cancel());
@@ -3171,7 +3171,7 @@ TEST_F(GestureRecognizerTest, GestureEventScrollTouchMovePartialConsumed) {
EXPECT_EQ(0, delegate->scroll_x());
EXPECT_EQ(0, delegate->scroll_y());
- tes.SendScrollEvent(root_window(), 140, 215, kTouchId, delegate.get());
+ tes.SendScrollEvent(dispatcher(), 140, 215, kTouchId, delegate.get());
EXPECT_FALSE(delegate->tap());
EXPECT_FALSE(delegate->tap_down());
EXPECT_FALSE(delegate->tap_cancel());
@@ -3186,7 +3186,7 @@ TEST_F(GestureRecognizerTest, GestureEventScrollTouchMovePartialConsumed) {
delegate->Reset();
ui::TouchEvent release(ui::ET_TOUCH_RELEASED, gfx::Point(101, 201),
kTouchId, tes.LeapForward(50));
- root_window()->AsRootWindowHostDelegate()->OnHostTouchEvent(&release);
+ dispatcher()->AsRootWindowHostDelegate()->OnHostTouchEvent(&release);
EXPECT_FALSE(delegate->tap());
EXPECT_FALSE(delegate->tap_down());
EXPECT_FALSE(delegate->tap_cancel());
@@ -3213,19 +3213,19 @@ TEST_F(GestureRecognizerTest, GestureEventDoubleTap) {
// First tap (tested in GestureEventTap)
ui::TouchEvent press1(ui::ET_TOUCH_PRESSED, gfx::Point(104, 201),
kTouchId, tes.Now());
- root_window()->AsRootWindowHostDelegate()->OnHostTouchEvent(&press1);
+ dispatcher()->AsRootWindowHostDelegate()->OnHostTouchEvent(&press1);
ui::TouchEvent release1(ui::ET_TOUCH_RELEASED, gfx::Point(104, 201),
kTouchId, tes.LeapForward(50));
- root_window()->AsRootWindowHostDelegate()->OnHostTouchEvent(&release1);
+ dispatcher()->AsRootWindowHostDelegate()->OnHostTouchEvent(&release1);
delegate->Reset();
// Second tap
ui::TouchEvent press2(ui::ET_TOUCH_PRESSED, gfx::Point(101, 203),
kTouchId, tes.LeapForward(200));
- root_window()->AsRootWindowHostDelegate()->OnHostTouchEvent(&press2);
+ dispatcher()->AsRootWindowHostDelegate()->OnHostTouchEvent(&press2);
ui::TouchEvent release2(ui::ET_TOUCH_RELEASED, gfx::Point(102, 206),
kTouchId, tes.LeapForward(50));
- root_window()->AsRootWindowHostDelegate()->OnHostTouchEvent(&release2);
+ dispatcher()->AsRootWindowHostDelegate()->OnHostTouchEvent(&release2);
EXPECT_TRUE(delegate->tap());
EXPECT_TRUE(delegate->tap_down());
@@ -3254,10 +3254,10 @@ TEST_F(GestureRecognizerTest, GestureEventTripleTap) {
// First tap (tested in GestureEventTap)
ui::TouchEvent press1(ui::ET_TOUCH_PRESSED, gfx::Point(104, 201),
kTouchId, tes.Now());
- root_window()->AsRootWindowHostDelegate()->OnHostTouchEvent(&press1);
+ dispatcher()->AsRootWindowHostDelegate()->OnHostTouchEvent(&press1);
ui::TouchEvent release1(ui::ET_TOUCH_RELEASED, gfx::Point(104, 201),
kTouchId, tes.LeapForward(50));
- root_window()->AsRootWindowHostDelegate()->OnHostTouchEvent(&release1);
+ dispatcher()->AsRootWindowHostDelegate()->OnHostTouchEvent(&release1);
EXPECT_EQ(1, delegate->tap_count());
delegate->Reset();
@@ -3265,10 +3265,10 @@ TEST_F(GestureRecognizerTest, GestureEventTripleTap) {
// Second tap (tested in GestureEventDoubleTap)
ui::TouchEvent press2(ui::ET_TOUCH_PRESSED, gfx::Point(101, 203),
kTouchId, tes.LeapForward(200));
- root_window()->AsRootWindowHostDelegate()->OnHostTouchEvent(&press2);
+ dispatcher()->AsRootWindowHostDelegate()->OnHostTouchEvent(&press2);
ui::TouchEvent release2(ui::ET_TOUCH_RELEASED, gfx::Point(102, 206),
kTouchId, tes.LeapForward(50));
- root_window()->AsRootWindowHostDelegate()->OnHostTouchEvent(&release2);
+ dispatcher()->AsRootWindowHostDelegate()->OnHostTouchEvent(&release2);
EXPECT_EQ(2, delegate->tap_count());
delegate->Reset();
@@ -3276,10 +3276,10 @@ TEST_F(GestureRecognizerTest, GestureEventTripleTap) {
// Third tap
ui::TouchEvent press3(ui::ET_TOUCH_PRESSED, gfx::Point(102, 206),
kTouchId, tes.LeapForward(200));
- root_window()->AsRootWindowHostDelegate()->OnHostTouchEvent(&press3);
+ dispatcher()->AsRootWindowHostDelegate()->OnHostTouchEvent(&press3);
ui::TouchEvent release3(ui::ET_TOUCH_RELEASED, gfx::Point(102, 206),
kTouchId, tes.LeapForward(50));
- root_window()->AsRootWindowHostDelegate()->OnHostTouchEvent(&release3);
+ dispatcher()->AsRootWindowHostDelegate()->OnHostTouchEvent(&release3);
EXPECT_TRUE(delegate->tap());
@@ -3309,19 +3309,19 @@ TEST_F(GestureRecognizerTest, TwoTapsFarApart) {
// First tap (tested in GestureEventTap)
ui::TouchEvent press1(ui::ET_TOUCH_PRESSED, gfx::Point(101, 201),
kTouchId, tes.Now());
- root_window()->AsRootWindowHostDelegate()->OnHostTouchEvent(&press1);
+ dispatcher()->AsRootWindowHostDelegate()->OnHostTouchEvent(&press1);
ui::TouchEvent release1(ui::ET_TOUCH_RELEASED, gfx::Point(101, 201),
kTouchId, tes.LeapForward(50));
- root_window()->AsRootWindowHostDelegate()->OnHostTouchEvent(&release1);
+ dispatcher()->AsRootWindowHostDelegate()->OnHostTouchEvent(&release1);
delegate->Reset();
// Second tap, close in time but far in distance
ui::TouchEvent press2(ui::ET_TOUCH_PRESSED, gfx::Point(201, 201),
kTouchId, tes.LeapForward(200));
- root_window()->AsRootWindowHostDelegate()->OnHostTouchEvent(&press2);
+ dispatcher()->AsRootWindowHostDelegate()->OnHostTouchEvent(&press2);
ui::TouchEvent release2(ui::ET_TOUCH_RELEASED, gfx::Point(201, 201),
kTouchId, tes.LeapForward(50));
- root_window()->AsRootWindowHostDelegate()->OnHostTouchEvent(&release2);
+ dispatcher()->AsRootWindowHostDelegate()->OnHostTouchEvent(&release2);
EXPECT_TRUE(delegate->tap());
EXPECT_TRUE(delegate->tap_down());
@@ -3351,19 +3351,19 @@ TEST_F(GestureRecognizerTest, TwoTapsWithDelayBetween) {
// First tap (tested in GestureEventTap)
ui::TouchEvent press1(ui::ET_TOUCH_PRESSED, gfx::Point(101, 201),
kTouchId, tes.Now());
- root_window()->AsRootWindowHostDelegate()->OnHostTouchEvent(&press1);
+ dispatcher()->AsRootWindowHostDelegate()->OnHostTouchEvent(&press1);
ui::TouchEvent release1(ui::ET_TOUCH_RELEASED, gfx::Point(101, 201),
kTouchId, tes.LeapForward(50));
- root_window()->AsRootWindowHostDelegate()->OnHostTouchEvent(&release1);
+ dispatcher()->AsRootWindowHostDelegate()->OnHostTouchEvent(&release1);
delegate->Reset();
// Second tap, close in distance but after some delay
ui::TouchEvent press2(ui::ET_TOUCH_PRESSED, gfx::Point(101, 201),
kTouchId, tes.LeapForward(2000));
- root_window()->AsRootWindowHostDelegate()->OnHostTouchEvent(&press2);
+ dispatcher()->AsRootWindowHostDelegate()->OnHostTouchEvent(&press2);
ui::TouchEvent release2(ui::ET_TOUCH_RELEASED, gfx::Point(101, 201),
kTouchId, tes.LeapForward(50));
- root_window()->AsRootWindowHostDelegate()->OnHostTouchEvent(&release2);
+ dispatcher()->AsRootWindowHostDelegate()->OnHostTouchEvent(&release2);
EXPECT_TRUE(delegate->tap());
EXPECT_TRUE(delegate->tap_down());
@@ -3393,7 +3393,7 @@ TEST_F(GestureRecognizerTest, BoundingBoxRadiusChange) {
ui::TouchEvent press1(
ui::ET_TOUCH_PRESSED, gfx::Point(101, 201), kTouchId, tes.Now());
- root_window()->AsRootWindowHostDelegate()->OnHostTouchEvent(&press1);
+ dispatcher()->AsRootWindowHostDelegate()->OnHostTouchEvent(&press1);
EXPECT_TRUE(delegate->bounding_box().IsEmpty());
delegate->Reset();
@@ -3402,7 +3402,7 @@ TEST_F(GestureRecognizerTest, BoundingBoxRadiusChange) {
ui::ET_TOUCH_PRESSED, gfx::Point(201, 201), kTouchId2,
tes.LeapForward(400));
press2.set_radius_x(5);
- root_window()->AsRootWindowHostDelegate()->OnHostTouchEvent(&press2);
+ dispatcher()->AsRootWindowHostDelegate()->OnHostTouchEvent(&press2);
EXPECT_FALSE(delegate->pinch_begin());
EXPECT_EQ(gfx::Rect(101, 201, 100, 0).ToString(),
delegate->bounding_box().ToString());
@@ -3411,7 +3411,7 @@ TEST_F(GestureRecognizerTest, BoundingBoxRadiusChange) {
ui::TouchEvent move1(ui::ET_TOUCH_MOVED, gfx::Point(141, 201), kTouchId,
tes.LeapForward(40));
- root_window()->AsRootWindowHostDelegate()->OnHostTouchEvent(&move1);
+ dispatcher()->AsRootWindowHostDelegate()->OnHostTouchEvent(&move1);
EXPECT_TRUE(delegate->pinch_begin());
EXPECT_EQ(gfx::Rect(141, 201, 60, 0).ToString(),
delegate->bounding_box().ToString());
@@ -3423,7 +3423,7 @@ TEST_F(GestureRecognizerTest, BoundingBoxRadiusChange) {
tes.LeapForward(40));
move2.set_radius_x(50);
move2.set_radius_y(60);
- root_window()->AsRootWindowHostDelegate()->OnHostTouchEvent(&move2);
+ dispatcher()->AsRootWindowHostDelegate()->OnHostTouchEvent(&move2);
EXPECT_FALSE(delegate->tap());
EXPECT_FALSE(delegate->tap_cancel());
EXPECT_FALSE(delegate->scroll_update());
@@ -3449,21 +3449,21 @@ TEST_F(GestureRecognizerTest, NoDriftInScroll) {
ui::TouchEvent press1(
ui::ET_TOUCH_PRESSED, gfx::Point(101, 208), kTouchId, tes.Now());
- root_window()->AsRootWindowHostDelegate()->OnHostTouchEvent(&press1);
+ dispatcher()->AsRootWindowHostDelegate()->OnHostTouchEvent(&press1);
EXPECT_TRUE(delegate->begin());
delegate->Reset();
ui::TouchEvent move1(ui::ET_TOUCH_MOVED, gfx::Point(101, 206), kTouchId,
tes.LeapForward(40));
- root_window()->AsRootWindowHostDelegate()->OnHostTouchEvent(&move1);
+ dispatcher()->AsRootWindowHostDelegate()->OnHostTouchEvent(&move1);
EXPECT_FALSE(delegate->scroll_begin());
delegate->Reset();
ui::TouchEvent move2(ui::ET_TOUCH_MOVED, gfx::Point(101, 204), kTouchId,
tes.LeapForward(40));
- root_window()->AsRootWindowHostDelegate()->OnHostTouchEvent(&move2);
+ dispatcher()->AsRootWindowHostDelegate()->OnHostTouchEvent(&move2);
EXPECT_TRUE(delegate->tap_cancel());
EXPECT_TRUE(delegate->scroll_begin());
EXPECT_TRUE(delegate->scroll_update());
@@ -3473,14 +3473,14 @@ TEST_F(GestureRecognizerTest, NoDriftInScroll) {
ui::TouchEvent move3(ui::ET_TOUCH_MOVED, gfx::Point(101, 204), kTouchId,
tes.LeapForward(40));
- root_window()->AsRootWindowHostDelegate()->OnHostTouchEvent(&move3);
+ dispatcher()->AsRootWindowHostDelegate()->OnHostTouchEvent(&move3);
EXPECT_FALSE(delegate->scroll_update());
delegate->Reset();
ui::TouchEvent move4(ui::ET_TOUCH_MOVED, gfx::Point(101, 203), kTouchId,
tes.LeapForward(40));
- root_window()->AsRootWindowHostDelegate()->OnHostTouchEvent(&move4);
+ dispatcher()->AsRootWindowHostDelegate()->OnHostTouchEvent(&move4);
EXPECT_TRUE(delegate->scroll_update());
EXPECT_EQ(-1, delegate->scroll_y());
@@ -3504,13 +3504,13 @@ TEST_F(GestureRecognizerTest, GestureEventConsumedTouchMoveCanFireTapCancel) {
kTouchId, tes.Now());
delegate->set_consume_touch_move(false);
- root_window()->AsRootWindowHostDelegate()->OnHostTouchEvent(&press);
+ dispatcher()->AsRootWindowHostDelegate()->OnHostTouchEvent(&press);
delegate->set_consume_touch_move(true);
delegate->Reset();
// Move the touch-point enough so that it would normally be considered a
// scroll. But since the touch-moves will be consumed, the scroll should not
// start.
- tes.SendScrollEvent(root_window(), 130, 230, kTouchId, delegate.get());
+ tes.SendScrollEvent(dispatcher(), 130, 230, kTouchId, delegate.get());
EXPECT_FALSE(delegate->tap());
EXPECT_FALSE(delegate->tap_down());
EXPECT_TRUE(delegate->tap_cancel());
@@ -3541,8 +3541,8 @@ TEST_F(GestureRecognizerTest,
ui::TouchEvent press(ui::ET_TOUCH_PRESSED, gfx::Point(101, 201),
kTouchId, tes.Now());
ui::TouchEvent p2(ui::ET_TOUCH_PRESSED, gfx::Point(50, 50), 1, tes.Now());
- root_window()->AsRootWindowHostDelegate()->OnHostTouchEvent(&press);
- root_window()->AsRootWindowHostDelegate()->OnHostTouchEvent(&p2);
+ dispatcher()->AsRootWindowHostDelegate()->OnHostTouchEvent(&press);
+ dispatcher()->AsRootWindowHostDelegate()->OnHostTouchEvent(&p2);
EXPECT_FALSE(delegate->tap());
EXPECT_TRUE(delegate->tap_down());
EXPECT_TRUE(delegate->tap_cancel());
@@ -3583,7 +3583,7 @@ TEST_F(GestureRecognizerTest, GestureEventShowPress) {
ui::TouchEvent press1(ui::ET_TOUCH_PRESSED, gfx::Point(101, 201),
kTouchId, tes.Now());
- root_window()->AsRootWindowHostDelegate()->OnHostTouchEvent(&press1);
+ dispatcher()->AsRootWindowHostDelegate()->OnHostTouchEvent(&press1);
EXPECT_TRUE(delegate->tap_down());
EXPECT_TRUE(delegate->begin());
EXPECT_FALSE(delegate->tap_cancel());
@@ -3599,7 +3599,7 @@ TEST_F(GestureRecognizerTest, GestureEventShowPress) {
delegate->Reset();
ui::TouchEvent release1(ui::ET_TOUCH_RELEASED, gfx::Point(101, 201),
kTouchId, tes.Now());
- root_window()->AsRootWindowHostDelegate()->OnHostTouchEvent(&release1);
+ dispatcher()->AsRootWindowHostDelegate()->OnHostTouchEvent(&release1);
EXPECT_FALSE(delegate->long_press());
// Note the tap down isn't cancelled until the release
@@ -3631,7 +3631,7 @@ TEST_F(GestureRecognizerTest, GestureEventShowPressCancelledByScroll) {
ui::TouchEvent press1(ui::ET_TOUCH_PRESSED, gfx::Point(101, 201),
kTouchId, tes.Now());
- root_window()->AsRootWindowHostDelegate()->OnHostTouchEvent(&press1);
+ dispatcher()->AsRootWindowHostDelegate()->OnHostTouchEvent(&press1);
EXPECT_TRUE(delegate->tap_down());
// We haven't pressed long enough for a show press to occur
@@ -3639,7 +3639,7 @@ TEST_F(GestureRecognizerTest, GestureEventShowPressCancelledByScroll) {
EXPECT_FALSE(delegate->tap_cancel());
// Scroll around, to cancel the show press
- tes.SendScrollEvent(root_window(), 130, 230, kTouchId, delegate.get());
+ tes.SendScrollEvent(dispatcher(), 130, 230, kTouchId, delegate.get());
// Wait until the timer runs out
gesture_sequence->ForceTimeout();
EXPECT_FALSE(delegate->show_press());
@@ -3648,7 +3648,7 @@ TEST_F(GestureRecognizerTest, GestureEventShowPressCancelledByScroll) {
delegate->Reset();
ui::TouchEvent release1(ui::ET_TOUCH_RELEASED, gfx::Point(101, 201),
kTouchId, tes.LeapForward(10));
- root_window()->AsRootWindowHostDelegate()->OnHostTouchEvent(&release1);
+ dispatcher()->AsRootWindowHostDelegate()->OnHostTouchEvent(&release1);
EXPECT_FALSE(delegate->show_press());
EXPECT_FALSE(delegate->tap_cancel());
}
@@ -3669,7 +3669,7 @@ TEST_F(GestureRecognizerTest, GestureEventShowPressSentOnTap) {
ui::TouchEvent press1(ui::ET_TOUCH_PRESSED, gfx::Point(101, 201),
kTouchId, tes.Now());
- root_window()->AsRootWindowHostDelegate()->OnHostTouchEvent(&press1);
+ dispatcher()->AsRootWindowHostDelegate()->OnHostTouchEvent(&press1);
EXPECT_TRUE(delegate->tap_down());
// We haven't pressed long enough for a show press to occur
@@ -3679,7 +3679,7 @@ TEST_F(GestureRecognizerTest, GestureEventShowPressSentOnTap) {
delegate->Reset();
ui::TouchEvent release1(ui::ET_TOUCH_RELEASED, gfx::Point(101, 201),
kTouchId, tes.LeapForward(50));
- root_window()->AsRootWindowHostDelegate()->OnHostTouchEvent(&release1);
+ dispatcher()->AsRootWindowHostDelegate()->OnHostTouchEvent(&release1);
EXPECT_TRUE(delegate->show_press());
EXPECT_FALSE(delegate->tap_cancel());
EXPECT_TRUE(delegate->tap());
diff --git a/ui/aura/remote_root_window_host_win.cc b/ui/aura/remote_root_window_host_win.cc
index 2b575c4..326f9cf 100644
--- a/ui/aura/remote_root_window_host_win.cc
+++ b/ui/aura/remote_root_window_host_win.cc
@@ -296,7 +296,7 @@ void RemoteRootWindowHostWin::HandleSelectFolder(
}
Window* RemoteRootWindowHostWin::GetAshWindow() {
- return GetRootWindow();
+ return GetRootWindow()->window();
}
void RemoteRootWindowHostWin::SetDelegate(RootWindowHostDelegate* delegate) {
@@ -359,7 +359,7 @@ void RemoteRootWindowHostWin::ReleaseCapture() {
bool RemoteRootWindowHostWin::QueryMouseLocation(gfx::Point* location_return) {
aura::client::CursorClient* cursor_client =
- aura::client::GetCursorClient(GetRootWindow());
+ aura::client::GetCursorClient(GetRootWindow()->window());
if (cursor_client && !cursor_client->IsMouseEventsEnabled()) {
*location_return = gfx::Point(0, 0);
return false;
diff --git a/ui/aura/root_window.cc b/ui/aura/root_window.cc
index 419cd4a..b9d103c 100644
--- a/ui/aura/root_window.cc
+++ b/ui/aura/root_window.cc
@@ -68,7 +68,7 @@ Window* ConsumerToWindow(ui::GestureConsumer* consumer) {
return consumer ? static_cast<Window*>(consumer) : NULL;
}
-void SetLastMouseLocation(const RootWindow* root_window,
+void SetLastMouseLocation(const Window* root_window,
const gfx::Point& location_in_root) {
client::ScreenPositionClient* client =
client::GetScreenPositionClient(root_window);
@@ -91,7 +91,7 @@ RootWindowHost* CreateHost(RootWindow* root_window,
class SimpleRootWindowTransformer : public RootWindowTransformer {
public:
- SimpleRootWindowTransformer(const RootWindow* root_window,
+ SimpleRootWindowTransformer(const Window* root_window,
const gfx::Transform& transform)
: root_window_(root_window),
transform_(transform) {
@@ -124,7 +124,7 @@ class SimpleRootWindowTransformer : public RootWindowTransformer {
private:
virtual ~SimpleRootWindowTransformer() {}
- const RootWindow* root_window_;
+ const Window* root_window_;
const gfx::Transform transform_;
DISALLOW_COPY_AND_ASSIGN(SimpleRootWindowTransformer);
@@ -152,8 +152,8 @@ RootWindow::RootWindow(const CreateParams& params)
move_hold_count_(0),
repost_event_factory_(this),
held_event_factory_(this) {
- set_dispatcher(this);
- SetName("RootWindow");
+ window()->set_dispatcher(this);
+ window()->SetName("RootWindow");
// Some GPUs have trouble drawing windows that are less than 64 pixels wide
// or tall, so force those windows to use the software renderer.
@@ -180,7 +180,7 @@ RootWindow::~RootWindow() {
compositor_.reset();
// An observer may have been added by an animation on the RootWindow.
- layer()->GetAnimator()->RemoveObserver(this);
+ 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
@@ -192,7 +192,7 @@ RootWindow::~RootWindow() {
// GetAcceleratedWidget())
host_.reset(NULL);
- set_dispatcher(NULL);
+ window()->set_dispatcher(NULL);
}
// static
@@ -203,14 +203,15 @@ RootWindow* RootWindow::GetForAcceleratedWidget(
}
void RootWindow::Init() {
- compositor()->SetScaleAndSize(GetDeviceScaleFactorFromDisplay(this),
+ compositor()->SetScaleAndSize(GetDeviceScaleFactorFromDisplay(window()),
host_->GetBounds().size());
Window::Init(ui::LAYER_NOT_DRAWN);
- compositor()->SetRootLayer(layer());
- transformer_.reset(new SimpleRootWindowTransformer(this, gfx::Transform()));
+ compositor()->SetRootLayer(window()->layer());
+ transformer_.reset(
+ new SimpleRootWindowTransformer(window(), gfx::Transform()));
UpdateRootWindowSize(GetHostSize());
Env::GetInstance()->NotifyRootWindowInitialized(this);
- Show();
+ window()->Show();
}
void RootWindow::ShowRootWindow() {
@@ -237,7 +238,7 @@ void RootWindow::RepostEvent(const ui::LocatedEvent& event) {
new ui::MouseEvent(
static_cast<const ui::MouseEvent&>(event),
static_cast<aura::Window*>(event.target()),
- static_cast<aura::Window*>(this)));
+ window()));
base::MessageLoop::current()->PostTask(
FROM_HERE,
base::Bind(&RootWindow::DispatchHeldEventsAsync,
@@ -264,8 +265,10 @@ void RootWindow::SetHostSize(const gfx::Size& size_in_pixel) {
// Requery the location to constrain it within the new root window size.
gfx::Point point;
- if (host_->QueryMouseLocation(&point))
- SetLastMouseLocation(this, ui::ConvertPointToDIP(layer(), point));
+ if (host_->QueryMouseLocation(&point)) {
+ SetLastMouseLocation(window(),
+ ui::ConvertPointToDIP(window()->layer(), point));
+ }
synthesize_mouse_move_ = false;
}
@@ -341,7 +344,7 @@ void RootWindow::ScheduleRedrawRect(const gfx::Rect& damage_rect) {
}
Window* RootWindow::GetGestureTarget(ui::GestureEvent* event) {
- Window* target = client::GetCaptureWindow(this);
+ Window* target = client::GetCaptureWindow(window());
if (!target) {
target = ConsumerToWindow(
ui::GestureRecognizer::Get()->GetTargetForGestureEvent(event));
@@ -357,7 +360,7 @@ void RootWindow::DispatchGestureEvent(ui::GestureEvent* event) {
Window* target = GetGestureTarget(event);
if (target) {
- event->ConvertLocationToTarget(static_cast<Window*>(this), target);
+ event->ConvertLocationToTarget(window(), target);
DispatchDetails details = ProcessEvent(target, event);
if (details.dispatcher_destroyed)
return;
@@ -513,9 +516,10 @@ void RootWindow::SetFocusWhenShown(bool focused) {
gfx::Point RootWindow::GetLastMouseLocationInRoot() const {
gfx::Point location = Env::GetInstance()->last_mouse_location();
- client::ScreenPositionClient* client = client::GetScreenPositionClient(this);
+ client::ScreenPositionClient* client =
+ client::GetScreenPositionClient(window());
if (client)
- client->ConvertPointFromScreen(this, &location);
+ client->ConvertPointFromScreen(window(), &location);
return location;
}
@@ -530,12 +534,12 @@ void RootWindow::SetRootWindowTransformer(
Window::SetTransform(transformer_->GetTransform());
// If the layer is not animating, then we need to update the root window
// size immediately.
- if (!layer()->GetAnimator()->is_animating())
+ if (!window()->layer()->GetAnimator()->is_animating())
UpdateRootWindowSize(GetHostSize());
}
gfx::Transform RootWindow::GetRootTransform() const {
- float scale = ui::GetDeviceScaleFactor(layer());
+ float scale = ui::GetDeviceScaleFactor(window()->layer());
gfx::Transform transform;
transform.Scale(scale, scale);
transform *= transformer_->GetTransform();
@@ -555,7 +559,7 @@ const Window* RootWindow::GetRootWindow() const {
void RootWindow::SetTransform(const gfx::Transform& transform) {
scoped_ptr<RootWindowTransformer> transformer(
- new SimpleRootWindowTransformer(this, transform));
+ new SimpleRootWindowTransformer(window(), transform));
SetRootWindowTransformer(transformer.Pass());
}
@@ -577,11 +581,11 @@ void RootWindow::TransformEventForDeviceScaleFactor(ui::LocatedEvent* event) {
void RootWindow::MoveCursorToInternal(const gfx::Point& root_location,
const gfx::Point& host_location) {
host_->MoveCursorTo(host_location);
- SetLastMouseLocation(this, root_location);
- client::CursorClient* cursor_client = client::GetCursorClient(this);
+ SetLastMouseLocation(window(), root_location);
+ client::CursorClient* cursor_client = client::GetCursorClient(window());
if (cursor_client) {
const gfx::Display& display =
- gfx::Screen::GetScreenFor(this)->GetDisplayNearestWindow(this);
+ gfx::Screen::GetScreenFor(this)->GetDisplayNearestWindow(window());
cursor_client->SetDisplay(display);
}
synthesize_mouse_move_ = false;
@@ -594,7 +598,7 @@ ui::EventDispatchDetails RootWindow::DispatchMouseEnterOrExit(
return DispatchDetails();
ui::MouseEvent translated_event(event,
- static_cast<Window*>(this),
+ window(),
mouse_moved_handler_,
type,
event.flags() | ui::EF_IS_SYNTHESIZED);
@@ -623,7 +627,7 @@ ui::EventDispatchDetails RootWindow::ProcessGestures(
Window* target = GetGestureTarget(gestures->get().at(0));
for (size_t i = 0; i < gestures->size(); ++i) {
ui::GestureEvent* event = gestures->get().at(i);
- event->ConvertLocationToTarget(static_cast<Window*>(this), target);
+ event->ConvertLocationToTarget(window(), target);
details = ProcessEvent(target, event);
if (details.dispatcher_destroyed || details.target_destroyed)
break;
@@ -640,7 +644,7 @@ void RootWindow::OnWindowAddedToRootWindow(Window* attached) {
void RootWindow::OnWindowRemovedFromRootWindow(Window* detached,
Window* new_root) {
- DCHECK(aura::client::GetCaptureWindow(this) != this);
+ DCHECK(aura::client::GetCaptureWindow(window()) != window());
DispatchMouseExitToHidingWindow(detached);
OnWindowHidden(detached, new_root ? WINDOW_MOVING : WINDOW_HIDDEN);
@@ -658,10 +662,10 @@ void RootWindow::OnWindowHidden(Window* invisible, WindowHiddenReason reason) {
// processing, which can cause unexpected behaviors. See
// crbug.com/157583
if (reason != WINDOW_MOVING) {
- Window* capture_window = aura::client::GetCaptureWindow(this);
+ Window* capture_window = aura::client::GetCaptureWindow(window());
// If the ancestor of the capture window is hidden,
// release the capture.
- if (invisible->Contains(capture_window) && invisible != this)
+ if (invisible->Contains(capture_window) && invisible != window())
capture_window->ReleaseCapture();
if (invisible->Contains(event_dispatch_target_))
@@ -680,8 +684,8 @@ void RootWindow::OnWindowHidden(Window* invisible, WindowHiddenReason reason) {
void RootWindow::CleanupGestureRecognizerState(Window* window) {
ui::GestureRecognizer::Get()->CleanupStateForConsumer(window);
- const Windows& windows = window->children();
- for (Windows::const_iterator iter = windows.begin();
+ const Window::Windows& windows = window->children();
+ for (Window::Windows::const_iterator iter = windows.begin();
iter != windows.end();
++iter) {
CleanupGestureRecognizerState(*iter);
@@ -689,7 +693,7 @@ void RootWindow::CleanupGestureRecognizerState(Window* window) {
}
void RootWindow::UpdateRootWindowSize(const gfx::Size& host_size) {
- SetBounds(transformer_->GetRootWindowBounds(host_size));
+ window()->SetBounds(transformer_->GetRootWindowBounds(host_size));
}
////////////////////////////////////////////////////////////////////////////////
@@ -738,10 +742,10 @@ void RootWindow::UpdateCapture(Window* old_capture,
// |mouse_moved_handler_| may have been set to a Window in a different root
// (see below). Clear it here to ensure we don't end up referencing a stale
// Window.
- if (mouse_moved_handler_ && !Contains(mouse_moved_handler_))
+ if (mouse_moved_handler_ && !window()->Contains(mouse_moved_handler_))
mouse_moved_handler_ = NULL;
- if (old_capture && old_capture->GetRootWindow() == this &&
+ if (old_capture && old_capture->GetRootWindow() == window() &&
old_capture->delegate()) {
// Send a capture changed event with bogus location data.
ui::MouseEvent event(ui::ET_MOUSE_CAPTURE_CHANGED, gfx::Point(),
@@ -792,8 +796,8 @@ bool RootWindow::CanDispatchToTarget(ui::EventTarget* target) {
// RootWindow, ui::GestureEventHelper implementation:
bool RootWindow::CanDispatchToConsumer(ui::GestureConsumer* consumer) {
- Window* window = ConsumerToWindow(consumer);;
- return (window && window->GetRootWindow() == this);
+ Window* consumer_window = ConsumerToWindow(consumer);;
+ return (consumer_window && consumer_window->GetRootWindow() == window());
}
void RootWindow::DispatchPostponedGestureEvent(ui::GestureEvent* event) {
@@ -829,13 +833,13 @@ bool RootWindow::OnHostKeyEvent(ui::KeyEvent* event) {
return false;
if (event->key_code() == ui::VKEY_UNKNOWN)
return false;
- client::EventClient* client = client::GetEventClient(GetRootWindow());
- Window* focused_window = client::GetFocusClient(this)->GetFocusedWindow();
+ client::EventClient* client = client::GetEventClient(window());
+ Window* focused_window = client::GetFocusClient(window())->GetFocusedWindow();
if (client && !client->CanProcessEventsWithinSubtree(focused_window)) {
- client::GetFocusClient(this)->FocusWindow(NULL);
+ client::GetFocusClient(window())->FocusWindow(NULL);
return false;
}
- details = ProcessEvent(focused_window ? focused_window : this, event);
+ details = ProcessEvent(focused_window ? focused_window : window(), event);
if (details.dispatcher_destroyed)
return true;
return event->handled();
@@ -852,19 +856,19 @@ bool RootWindow::OnHostScrollEvent(ui::ScrollEvent* event) {
return false;
TransformEventForDeviceScaleFactor(event);
- SetLastMouseLocation(this, event->location());
+ SetLastMouseLocation(window(), event->location());
synthesize_mouse_move_ = false;
Window* target = mouse_pressed_handler_ ?
- mouse_pressed_handler_ : client::GetCaptureWindow(this);
+ mouse_pressed_handler_ : client::GetCaptureWindow(window());
if (!target)
- target = GetEventHandlerForPoint(event->location());
+ target = window()->GetEventHandlerForPoint(event->location());
if (!target)
- target = this;
+ target = window();
- event->ConvertLocationToTarget(static_cast<Window*>(this), target);
+ event->ConvertLocationToTarget(window(), target);
int flags = event->flags();
if (IsNonClientLocation(target, event->location()))
flags |= ui::EF_IS_NON_CLIENT;
@@ -901,9 +905,9 @@ bool RootWindow::OnHostTouchEvent(ui::TouchEvent* event) {
void RootWindow::OnHostCancelMode() {
ui::CancelModeEvent event;
- Window* focused_window = client::GetFocusClient(this)->GetFocusedWindow();
- DispatchDetails details = ProcessEvent(focused_window ? focused_window : this,
- &event);
+ Window* focused_window = client::GetFocusClient(window())->GetFocusedWindow();
+ DispatchDetails details =
+ ProcessEvent(focused_window ? focused_window : window(), &event);
if (details.dispatcher_destroyed)
return;
}
@@ -913,8 +917,8 @@ void RootWindow::OnHostActivated() {
}
void RootWindow::OnHostLostWindowCapture() {
- Window* capture_window = client::GetCaptureWindow(this);
- if (capture_window && capture_window->GetRootWindow() == this)
+ Window* capture_window = client::GetCaptureWindow(window());
+ if (capture_window && capture_window->GetRootWindow() == window())
capture_window->ReleaseCapture();
}
@@ -944,7 +948,7 @@ void RootWindow::OnHostResized(const gfx::Size& size) {
return;
// The compositor should have the same size as the native root window host.
// Get the latest scale from display because it might have been changed.
- compositor_->SetScaleAndSize(GetDeviceScaleFactorFromDisplay(this), size);
+ compositor_->SetScaleAndSize(GetDeviceScaleFactorFromDisplay(window()), size);
// The layer, and the observers should be notified of the
// transformed size of the root window.
@@ -991,9 +995,9 @@ ui::EventDispatchDetails RootWindow::DispatchMouseEventImpl(
ui::MouseEvent* event) {
TransformEventForDeviceScaleFactor(event);
Window* target = mouse_pressed_handler_ ?
- mouse_pressed_handler_ : client::GetCaptureWindow(this);
+ mouse_pressed_handler_ : client::GetCaptureWindow(window());
if (!target)
- target = GetEventHandlerForPoint(event->location());
+ target = window()->GetEventHandlerForPoint(event->location());
return DispatchMouseEventToTarget(event, target);
}
@@ -1001,10 +1005,10 @@ ui::EventDispatchDetails RootWindow::DispatchMouseEventRepost(
ui::MouseEvent* event) {
if (event->type() != ui::ET_MOUSE_PRESSED)
return DispatchDetails();
- Window* target = client::GetCaptureWindow(this);
+ Window* target = client::GetCaptureWindow(window());
WindowEventDispatcher* dispatcher = this;
if (!target) {
- target = GetEventHandlerForPoint(event->location());
+ target = window()->GetEventHandlerForPoint(event->location());
} else {
dispatcher = target->GetDispatcher();
CHECK(dispatcher); // Capture window better be in valid root.
@@ -1016,7 +1020,7 @@ ui::EventDispatchDetails RootWindow::DispatchMouseEventRepost(
ui::EventDispatchDetails RootWindow::DispatchMouseEventToTarget(
ui::MouseEvent* event,
Window* target) {
- client::CursorClient* cursor_client = client::GetCursorClient(this);
+ client::CursorClient* cursor_client = client::GetCursorClient(window());
if (cursor_client &&
!cursor_client->IsMouseEventsEnabled() &&
(event->flags() & ui::EF_IS_SYNTHESIZED))
@@ -1028,7 +1032,7 @@ ui::EventDispatchDetails RootWindow::DispatchMouseEventToTarget(
ui::EF_RIGHT_MOUSE_BUTTON;
// WARNING: because of nested message loops |this| may be deleted after
// dispatching any event. Do not use AutoReset or the like here.
- SetLastMouseLocation(this, event->location());
+ SetLastMouseLocation(window(), event->location());
synthesize_mouse_move_ = false;
switch (event->type()) {
case ui::ET_MOUSE_EXITED:
@@ -1089,7 +1093,7 @@ ui::EventDispatchDetails RootWindow::DispatchMouseEventToTarget(
break;
}
if (target) {
- event->ConvertLocationToTarget(static_cast<Window*>(this), target);
+ event->ConvertLocationToTarget(window(), target);
if (IsNonClientLocation(target, event->location()))
event->set_flags(event->flags() | ui::EF_IS_NON_CLIENT);
return ProcessEvent(target, event);
@@ -1120,7 +1124,7 @@ ui::EventDispatchDetails RootWindow::DispatchTouchEventImpl(
break;
}
TransformEventForDeviceScaleFactor(event);
- Window* target = client::GetCaptureWindow(this);
+ Window* target = client::GetCaptureWindow(window());
if (!target) {
target = ConsumerToWindow(
ui::GestureRecognizer::Get()->GetTouchLockedTarget(event));
@@ -1136,9 +1140,9 @@ ui::EventDispatchDetails RootWindow::DispatchTouchEventImpl(
ui::TouchEvent event_for_gr(*event);
ui::EventResult result = ui::ER_UNHANDLED;
- if (!target && !bounds().Contains(event->location())) {
+ if (!target && !window()->bounds().Contains(event->location())) {
// If the initial touch is outside the root window, target the root.
- target = this;
+ target = window();
DispatchDetails details = ProcessEvent(target ? target : NULL, event);
if (details.dispatcher_destroyed)
return details;
@@ -1146,12 +1150,12 @@ ui::EventDispatchDetails RootWindow::DispatchTouchEventImpl(
} else {
// We only come here when the first contact was within the root window.
if (!target) {
- target = GetEventHandlerForPoint(event->location());
+ target = window()->GetEventHandlerForPoint(event->location());
if (!target)
return DispatchDetails();
}
- event->ConvertLocationToTarget(static_cast<Window*>(this), target);
+ event->ConvertLocationToTarget(window(), target);
DispatchDetails details = ProcessEvent(target, event);
if (details.dispatcher_destroyed)
return details;
@@ -1221,7 +1225,7 @@ ui::EventDispatchDetails RootWindow::SynthesizeMouseMoveEvent() {
return details;
synthesize_mouse_move_ = false;
gfx::Point root_mouse_location = GetLastMouseLocationInRoot();
- if (!bounds().Contains(root_mouse_location))
+ if (!window()->bounds().Contains(root_mouse_location))
return details;
gfx::Point host_mouse_location = root_mouse_location;
ConvertPointToHost(&host_mouse_location);
@@ -1240,7 +1244,7 @@ void RootWindow::SynthesizeMouseMoveEventAsync() {
}
gfx::Transform RootWindow::GetInverseRootTransform() const {
- float scale = ui::GetDeviceScaleFactor(layer());
+ float scale = ui::GetDeviceScaleFactor(window()->layer());
gfx::Transform transform;
transform.Scale(1.0f / scale, 1.0f / scale);
return transformer_->GetInverseTransform() * transform;
diff --git a/ui/aura/root_window_host_win.cc b/ui/aura/root_window_host_win.cc
index 020a766..a70c204 100644
--- a/ui/aura/root_window_host_win.cc
+++ b/ui/aura/root_window_host_win.cc
@@ -140,8 +140,9 @@ void RootWindowHostWin::SetBounds(const gfx::Rect& bounds) {
// Explicity call OnHostResized when the scale has changed because
// the window size may not have changed.
float current_scale = delegate_->GetDeviceScaleFactor();
- float new_scale = gfx::Screen::GetScreenFor(delegate_->AsRootWindow())->
- GetDisplayNearestWindow(delegate_->AsRootWindow()).device_scale_factor();
+ float new_scale = gfx::Screen::GetScreenFor(
+ delegate_->AsRootWindow()->window())->GetDisplayNearestWindow(
+ delegate_->AsRootWindow()->window()).device_scale_factor();
if (current_scale != new_scale)
delegate_->OnHostResized(bounds.size());
}
@@ -186,7 +187,7 @@ void RootWindowHostWin::ReleaseCapture() {
bool RootWindowHostWin::QueryMouseLocation(gfx::Point* location_return) {
client::CursorClient* cursor_client =
- client::GetCursorClient(GetRootWindow());
+ client::GetCursorClient(GetRootWindow()->window());
if (cursor_client && !cursor_client->IsMouseEventsEnabled()) {
*location_return = gfx::Point(0, 0);
return false;
diff --git a/ui/aura/root_window_host_x11.cc b/ui/aura/root_window_host_x11.cc
index bba9279..af20138 100644
--- a/ui/aura/root_window_host_x11.cc
+++ b/ui/aura/root_window_host_x11.cc
@@ -725,7 +725,7 @@ void RootWindowHostX11::SetCursor(gfx::NativeCursor cursor) {
bool RootWindowHostX11::QueryMouseLocation(gfx::Point* location_return) {
client::CursorClient* cursor_client =
- client::GetCursorClient(GetRootWindow());
+ client::GetCursorClient(GetRootWindow()->window());
if (cursor_client && !cursor_client->IsMouseEventsEnabled()) {
*location_return = gfx::Point(0, 0);
return false;
@@ -867,7 +867,7 @@ void RootWindowHostX11::OnRootWindowInitialized(RootWindow* root_window) {
// RootWindow::Init is called.
// (set in DisplayManager::CreateRootWindowForDisplay)
// Ready when NotifyRootWindowInitialized is called from RootWindow::Init.
- if (!delegate_ || root_window != GetRootWindow())
+ if (!delegate_ || root_window != GetRootWindow()->window())
return;
UpdateIsInternalDisplay();
@@ -1038,9 +1038,9 @@ void RootWindowHostX11::SetCursorInternal(gfx::NativeCursor cursor) {
void RootWindowHostX11::TranslateAndDispatchMouseEvent(
ui::MouseEvent* event) {
- RootWindow* root_window = GetRootWindow();
+ Window* root_window = GetRootWindow()->window();
client::ScreenPositionClient* screen_position_client =
- GetScreenPositionClient(root_window);
+ client::GetScreenPositionClient(root_window);
gfx::Rect local(bounds_.size());
if (screen_position_client && !local.Contains(event->location())) {
@@ -1051,7 +1051,7 @@ void RootWindowHostX11::TranslateAndDispatchMouseEvent(
// host window, then convert it back to this host window's coordinate.
screen_position_client->ConvertHostPointToScreen(root_window, &location);
screen_position_client->ConvertPointFromScreen(root_window, &location);
- root_window->ConvertPointToHost(&location);
+ root_window->GetDispatcher()->ConvertPointToHost(&location);
event->set_location(location);
event->set_root_location(location);
}
@@ -1059,7 +1059,7 @@ void RootWindowHostX11::TranslateAndDispatchMouseEvent(
}
void RootWindowHostX11::UpdateIsInternalDisplay() {
- RootWindow* root_window = GetRootWindow();
+ Window* root_window = GetRootWindow()->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/aura/root_window_unittest.cc b/ui/aura/root_window_unittest.cc
index e222bc5..2ef4430 100644
--- a/ui/aura/root_window_unittest.cc
+++ b/ui/aura/root_window_unittest.cc
@@ -112,7 +112,7 @@ TEST_F(RootWindowTest, OnHostMouseEvent) {
gfx::Point point(101, 201);
ui::MouseEvent event1(
ui::ET_MOUSE_PRESSED, point, point, ui::EF_LEFT_MOUSE_BUTTON);
- root_window()->AsRootWindowHostDelegate()->OnHostMouseEvent(&event1);
+ dispatcher()->AsRootWindowHostDelegate()->OnHostMouseEvent(&event1);
// Event was tested for non-client area for the target window.
EXPECT_EQ(1, delegate1->non_client_count());
@@ -134,7 +134,7 @@ TEST_F(RootWindowTest, RepostEvent) {
gfx::Point point(10, 10);
ui::MouseEvent event(
ui::ET_MOUSE_PRESSED, point, point, ui::EF_LEFT_MOUSE_BUTTON);
- root_window()->RepostEvent(event);
+ dispatcher()->RepostEvent(event);
RunAllPendingInMessageLoop();
EXPECT_TRUE(Env::GetInstance()->IsMouseButtonDown());
}
@@ -153,7 +153,7 @@ TEST_F(RootWindowTest, MouseButtonState) {
location,
location,
ui::EF_LEFT_MOUSE_BUTTON));
- root_window()->AsRootWindowHostDelegate()->OnHostMouseEvent(event.get());
+ dispatcher()->AsRootWindowHostDelegate()->OnHostMouseEvent(event.get());
EXPECT_TRUE(Env::GetInstance()->IsMouseButtonDown());
// Additionally press the right.
@@ -162,7 +162,7 @@ TEST_F(RootWindowTest, MouseButtonState) {
location,
location,
ui::EF_LEFT_MOUSE_BUTTON | ui::EF_RIGHT_MOUSE_BUTTON));
- root_window()->AsRootWindowHostDelegate()->OnHostMouseEvent(event.get());
+ dispatcher()->AsRootWindowHostDelegate()->OnHostMouseEvent(event.get());
EXPECT_TRUE(Env::GetInstance()->IsMouseButtonDown());
// Release the left button.
@@ -171,7 +171,7 @@ TEST_F(RootWindowTest, MouseButtonState) {
location,
location,
ui::EF_RIGHT_MOUSE_BUTTON));
- root_window()->AsRootWindowHostDelegate()->OnHostMouseEvent(event.get());
+ dispatcher()->AsRootWindowHostDelegate()->OnHostMouseEvent(event.get());
EXPECT_TRUE(Env::GetInstance()->IsMouseButtonDown());
// Release the right button. We should ignore the Shift-is-down flag.
@@ -180,7 +180,7 @@ TEST_F(RootWindowTest, MouseButtonState) {
location,
location,
ui::EF_SHIFT_DOWN));
- root_window()->AsRootWindowHostDelegate()->OnHostMouseEvent(event.get());
+ dispatcher()->AsRootWindowHostDelegate()->OnHostMouseEvent(event.get());
EXPECT_FALSE(Env::GetInstance()->IsMouseButtonDown());
// Press the middle button.
@@ -189,7 +189,7 @@ TEST_F(RootWindowTest, MouseButtonState) {
location,
location,
ui::EF_MIDDLE_MOUSE_BUTTON));
- root_window()->AsRootWindowHostDelegate()->OnHostMouseEvent(event.get());
+ dispatcher()->AsRootWindowHostDelegate()->OnHostMouseEvent(event.get());
EXPECT_TRUE(Env::GetInstance()->IsMouseButtonDown());
}
@@ -217,7 +217,7 @@ class TestEventClient : public client::EventClient {
static const int kNonLockWindowId = 100;
static const int kLockWindowId = 200;
- explicit TestEventClient(RootWindow* root_window)
+ explicit TestEventClient(Window* root_window)
: root_window_(root_window),
lock_(false) {
client::SetEventClient(root_window_, this);
@@ -265,7 +265,7 @@ class TestEventClient : public client::EventClient {
return NULL;
}
- RootWindow* root_window_;
+ Window* root_window_;
bool lock_;
DISALLOW_COPY_AND_ASSIGN(TestEventClient);
@@ -333,12 +333,12 @@ TEST_F(RootWindowTest, IgnoreUnknownKeys) {
root_window()->SetEventFilter(filter); // passes ownership
ui::KeyEvent unknown_event(ui::ET_KEY_PRESSED, ui::VKEY_UNKNOWN, 0, false);
- EXPECT_FALSE(root_window()->AsRootWindowHostDelegate()->OnHostKeyEvent(
+ EXPECT_FALSE(dispatcher()->AsRootWindowHostDelegate()->OnHostKeyEvent(
&unknown_event));
EXPECT_EQ(0, filter->num_key_events());
ui::KeyEvent known_event(ui::ET_KEY_PRESSED, ui::VKEY_A, 0, false);
- EXPECT_TRUE(root_window()->AsRootWindowHostDelegate()->OnHostKeyEvent(
+ EXPECT_TRUE(dispatcher()->AsRootWindowHostDelegate()->OnHostKeyEvent(
&known_event));
EXPECT_EQ(1, filter->num_key_events());
}
@@ -352,14 +352,14 @@ TEST_F(RootWindowTest, TouchEventsOutsideBounds) {
gfx::Point position = root_window()->bounds().origin();
position.Offset(-10, -10);
ui::TouchEvent press(ui::ET_TOUCH_PRESSED, position, 0, base::TimeDelta());
- root_window()->AsRootWindowHostDelegate()->OnHostTouchEvent(&press);
+ dispatcher()->AsRootWindowHostDelegate()->OnHostTouchEvent(&press);
EXPECT_EQ(1, filter->num_touch_events());
position = root_window()->bounds().origin();
position.Offset(root_window()->bounds().width() + 10,
root_window()->bounds().height() + 10);
ui::TouchEvent release(ui::ET_TOUCH_RELEASED, position, 0, base::TimeDelta());
- root_window()->AsRootWindowHostDelegate()->OnHostTouchEvent(&release);
+ dispatcher()->AsRootWindowHostDelegate()->OnHostTouchEvent(&release);
EXPECT_EQ(2, filter->num_touch_events());
}
@@ -381,7 +381,7 @@ TEST_F(RootWindowTest, ScrollEventDispatch) {
0, -10,
0, -10,
2);
- root_window()->AsRootWindowHostDelegate()->OnHostScrollEvent(&scroll1);
+ dispatcher()->AsRootWindowHostDelegate()->OnHostScrollEvent(&scroll1);
EXPECT_EQ(1, filter->num_scroll_events());
// Scroll event on a window should be dispatched properly.
@@ -392,7 +392,7 @@ TEST_F(RootWindowTest, ScrollEventDispatch) {
-10, 0,
-10, 0,
2);
- root_window()->AsRootWindowHostDelegate()->OnHostScrollEvent(&scroll2);
+ dispatcher()->AsRootWindowHostDelegate()->OnHostScrollEvent(&scroll2);
EXPECT_EQ(2, filter->num_scroll_events());
}
@@ -524,7 +524,7 @@ TEST_F(RootWindowTest, RepostTargetsCaptureWindow) {
const ui::MouseEvent press_event(
ui::ET_MOUSE_PRESSED, gfx::Point(), gfx::Point(),
ui::EF_LEFT_MOUSE_BUTTON);
- root_window()->RepostEvent(press_event);
+ dispatcher()->RepostEvent(press_event);
RunAllPendingInMessageLoop(); // Necessitated by RepostEvent().
// Mouse moves/enters may be generated. We only care about a pressed.
EXPECT_TRUE(EventTypesToString(recorder->events()).find("MOUSE_PRESSED") !=
@@ -541,17 +541,17 @@ TEST_F(RootWindowTest, MouseMovesHeld) {
ui::MouseEvent mouse_move_event(ui::ET_MOUSE_MOVED, gfx::Point(0, 0),
gfx::Point(0, 0), 0);
- root_window()->AsRootWindowHostDelegate()->OnHostMouseEvent(
+ dispatcher()->AsRootWindowHostDelegate()->OnHostMouseEvent(
&mouse_move_event);
// Discard MOUSE_ENTER.
filter->events().clear();
- root_window()->HoldPointerMoves();
+ dispatcher()->HoldPointerMoves();
// Check that we don't immediately dispatch the MOUSE_DRAGGED event.
ui::MouseEvent mouse_dragged_event(ui::ET_MOUSE_DRAGGED, gfx::Point(0, 0),
gfx::Point(0, 0), 0);
- root_window()->AsRootWindowHostDelegate()->OnHostMouseEvent(
+ dispatcher()->AsRootWindowHostDelegate()->OnHostMouseEvent(
&mouse_dragged_event);
EXPECT_TRUE(filter->events().empty());
@@ -559,7 +559,7 @@ TEST_F(RootWindowTest, MouseMovesHeld) {
// of event.
ui::MouseEvent mouse_pressed_event(ui::ET_MOUSE_PRESSED, gfx::Point(0, 0),
gfx::Point(0, 0), 0);
- root_window()->AsRootWindowHostDelegate()->OnHostMouseEvent(
+ dispatcher()->AsRootWindowHostDelegate()->OnHostMouseEvent(
&mouse_pressed_event);
EXPECT_EQ("MOUSE_DRAGGED MOUSE_PRESSED",
EventTypesToString(filter->events()));
@@ -568,12 +568,12 @@ TEST_F(RootWindowTest, MouseMovesHeld) {
// Check that we coalesce held MOUSE_DRAGGED events.
ui::MouseEvent mouse_dragged_event2(ui::ET_MOUSE_DRAGGED, gfx::Point(1, 1),
gfx::Point(1, 1), 0);
- root_window()->AsRootWindowHostDelegate()->OnHostMouseEvent(
+ dispatcher()->AsRootWindowHostDelegate()->OnHostMouseEvent(
&mouse_dragged_event);
- root_window()->AsRootWindowHostDelegate()->OnHostMouseEvent(
+ dispatcher()->AsRootWindowHostDelegate()->OnHostMouseEvent(
&mouse_dragged_event2);
EXPECT_TRUE(filter->events().empty());
- root_window()->AsRootWindowHostDelegate()->OnHostMouseEvent(
+ dispatcher()->AsRootWindowHostDelegate()->OnHostMouseEvent(
&mouse_pressed_event);
EXPECT_EQ("MOUSE_DRAGGED MOUSE_PRESSED",
EventTypesToString(filter->events()));
@@ -581,9 +581,9 @@ TEST_F(RootWindowTest, MouseMovesHeld) {
// Check that on ReleasePointerMoves, held events are not dispatched
// immediately, but posted instead.
- root_window()->AsRootWindowHostDelegate()->OnHostMouseEvent(
+ dispatcher()->AsRootWindowHostDelegate()->OnHostMouseEvent(
&mouse_dragged_event);
- root_window()->ReleasePointerMoves();
+ dispatcher()->ReleasePointerMoves();
EXPECT_TRUE(filter->events().empty());
RunAllPendingInMessageLoop();
EXPECT_EQ("MOUSE_DRAGGED", EventTypesToString(filter->events()));
@@ -592,11 +592,11 @@ TEST_F(RootWindowTest, MouseMovesHeld) {
// However if another message comes in before the dispatch,
// the Check that on ReleasePointerMoves, held events are not dispatched
// immediately, but posted instead.
- root_window()->HoldPointerMoves();
- root_window()->AsRootWindowHostDelegate()->OnHostMouseEvent(
+ dispatcher()->HoldPointerMoves();
+ dispatcher()->AsRootWindowHostDelegate()->OnHostMouseEvent(
&mouse_dragged_event);
- root_window()->ReleasePointerMoves();
- root_window()->AsRootWindowHostDelegate()->OnHostMouseEvent(
+ dispatcher()->ReleasePointerMoves();
+ dispatcher()->AsRootWindowHostDelegate()->OnHostMouseEvent(
&mouse_pressed_event);
EXPECT_EQ("MOUSE_DRAGGED MOUSE_PRESSED",
EventTypesToString(filter->events()));
@@ -606,11 +606,11 @@ TEST_F(RootWindowTest, MouseMovesHeld) {
// Check that if the other message is another MOUSE_DRAGGED, we still coalesce
// them.
- root_window()->HoldPointerMoves();
- root_window()->AsRootWindowHostDelegate()->OnHostMouseEvent(
+ dispatcher()->HoldPointerMoves();
+ dispatcher()->AsRootWindowHostDelegate()->OnHostMouseEvent(
&mouse_dragged_event);
- root_window()->ReleasePointerMoves();
- root_window()->AsRootWindowHostDelegate()->OnHostMouseEvent(
+ dispatcher()->ReleasePointerMoves();
+ dispatcher()->AsRootWindowHostDelegate()->OnHostMouseEvent(
&mouse_dragged_event2);
EXPECT_EQ("MOUSE_DRAGGED", EventTypesToString(filter->events()));
filter->events().clear();
@@ -631,25 +631,25 @@ TEST_F(RootWindowTest, TouchMovesHeld) {
// test.
ui::TouchEvent touch_pressed_event(ui::ET_TOUCH_PRESSED, gfx::Point(0, 0),
0, base::TimeDelta());
- root_window()->AsRootWindowHostDelegate()->OnHostTouchEvent(
+ dispatcher()->AsRootWindowHostDelegate()->OnHostTouchEvent(
&touch_pressed_event);
RunAllPendingInMessageLoop();
filter->events().clear();
- root_window()->HoldPointerMoves();
+ dispatcher()->HoldPointerMoves();
// Check that we don't immediately dispatch the TOUCH_MOVED event.
ui::TouchEvent touch_moved_event(ui::ET_TOUCH_MOVED, gfx::Point(0, 0),
0, base::TimeDelta());
- root_window()->AsRootWindowHostDelegate()->OnHostTouchEvent(
+ dispatcher()->AsRootWindowHostDelegate()->OnHostTouchEvent(
&touch_moved_event);
EXPECT_TRUE(filter->events().empty());
// Check that on ReleasePointerMoves, held events are not dispatched
// immediately, but posted instead.
- root_window()->AsRootWindowHostDelegate()->OnHostTouchEvent(
+ dispatcher()->AsRootWindowHostDelegate()->OnHostTouchEvent(
&touch_moved_event);
- root_window()->ReleasePointerMoves();
+ dispatcher()->ReleasePointerMoves();
EXPECT_TRUE(filter->events().empty());
RunAllPendingInMessageLoop();
EXPECT_EQ("TOUCH_MOVED", EventTypesToString(filter->events()));
@@ -660,15 +660,15 @@ TEST_F(RootWindowTest, TouchMovesHeld) {
ui::TouchEvent touch_released_event(ui::ET_TOUCH_RELEASED, gfx::Point(0, 0),
0, base::TimeDelta());
filter->events().clear();
- root_window()->HoldPointerMoves();
- root_window()->AsRootWindowHostDelegate()->OnHostTouchEvent(
+ dispatcher()->HoldPointerMoves();
+ dispatcher()->AsRootWindowHostDelegate()->OnHostTouchEvent(
&touch_moved_event);
- root_window()->AsRootWindowHostDelegate()->OnHostTouchEvent(
+ dispatcher()->AsRootWindowHostDelegate()->OnHostTouchEvent(
&touch_released_event);
EXPECT_EQ("TOUCH_MOVED TOUCH_RELEASED GESTURE_END",
EventTypesToString(filter->events()));
filter->events().clear();
- root_window()->ReleasePointerMoves();
+ dispatcher()->ReleasePointerMoves();
RunAllPendingInMessageLoop();
EXPECT_TRUE(filter->events().empty());
}
@@ -690,20 +690,20 @@ TEST_F(RootWindowTest, DispatchSyntheticMouseEvents) {
// Dispatch a non-synthetic mouse event when mouse events are enabled.
ui::MouseEvent mouse1(ui::ET_MOUSE_MOVED, gfx::Point(10, 10),
gfx::Point(10, 10), 0);
- root_window()->AsRootWindowHostDelegate()->OnHostMouseEvent(&mouse1);
+ dispatcher()->AsRootWindowHostDelegate()->OnHostMouseEvent(&mouse1);
EXPECT_FALSE(filter->events().empty());
filter->events().clear();
// Dispatch a synthetic mouse event when mouse events are enabled.
ui::MouseEvent mouse2(ui::ET_MOUSE_MOVED, gfx::Point(10, 10),
gfx::Point(10, 10), ui::EF_IS_SYNTHESIZED);
- root_window()->AsRootWindowHostDelegate()->OnHostMouseEvent(&mouse2);
+ dispatcher()->AsRootWindowHostDelegate()->OnHostMouseEvent(&mouse2);
EXPECT_FALSE(filter->events().empty());
filter->events().clear();
// Dispatch a synthetic mouse event when mouse events are disabled.
cursor_client.DisableMouseEvents();
- root_window()->AsRootWindowHostDelegate()->OnHostMouseEvent(&mouse2);
+ dispatcher()->AsRootWindowHostDelegate()->OnHostMouseEvent(&mouse2);
EXPECT_TRUE(filter->events().empty());
}
@@ -725,12 +725,12 @@ TEST_F(RootWindowTest, DispatchMouseExitWhenCursorHidden) {
ui::MouseEvent mouse1(ui::ET_MOUSE_MOVED, mouse_location,
mouse_location, 0);
EXPECT_TRUE(filter->events().empty());
- root_window()->AsRootWindowHostDelegate()->OnHostMouseEvent(&mouse1);
+ dispatcher()->AsRootWindowHostDelegate()->OnHostMouseEvent(&mouse1);
EXPECT_FALSE(filter->events().empty());
filter->events().clear();
// Hide the cursor and verify a mouse exit was dispatched.
- root_window()->OnCursorVisibilityChanged(false);
+ dispatcher()->OnCursorVisibilityChanged(false);
EXPECT_FALSE(filter->events().empty());
EXPECT_EQ("MOUSE_EXITED", EventTypesToString(filter->events()));
@@ -964,7 +964,7 @@ TEST_F(RootWindowTest, RepostTapdownGestureTest) {
ui::EventTimeForNow(),
details,
0);
- root_window()->RepostEvent(event);
+ dispatcher()->RepostEvent(event);
RunAllPendingInMessageLoop();
// TODO(rbyers): Currently disabled - crbug.com/170987
EXPECT_FALSE(EventTypesToString(filter->events()).find("GESTURE_TAP_DOWN") !=
@@ -1108,14 +1108,14 @@ TEST_F(RootWindowTest, DeleteWindowDuringMouseMovedDispatch) {
new OnMouseExitDeletingEventFilter();
w1->SetEventFilter(w1_filter);
w1->SetBounds(gfx::Rect(20, 20, 60, 60));
- EXPECT_EQ(NULL, root_window()->mouse_moved_handler());
+ EXPECT_EQ(NULL, dispatcher()->mouse_moved_handler());
test::EventGenerator generator(root_window(), w1.get());
// Move mouse over window 1 to set it as the |mouse_moved_handler_| for the
// root window.
generator.MoveMouseTo(51, 51);
- EXPECT_EQ(w1.get(), root_window()->mouse_moved_handler());
+ EXPECT_EQ(w1.get(), dispatcher()->mouse_moved_handler());
// Create window 2 under the mouse cursor and stack it above window 1.
Window* w2 = CreateNormalWindow(2, root_window(), NULL);
@@ -1131,7 +1131,7 @@ TEST_F(RootWindowTest, DeleteWindowDuringMouseMovedDispatch) {
// that was targeted to window 2 should be dropped since window 2 is
// destroyed. This test passes if no crash happens.
generator.MoveMouseTo(52, 52);
- EXPECT_EQ(NULL, root_window()->mouse_moved_handler());
+ EXPECT_EQ(NULL, dispatcher()->mouse_moved_handler());
// Check events received by window 1.
EXPECT_EQ("MOUSE_ENTERED MOUSE_MOVED MOUSE_EXITED",
@@ -1176,7 +1176,7 @@ TEST_F(RootWindowTest, ValidRootDuringDestruction) {
new RootWindow(RootWindow::CreateParams(gfx::Rect(0, 0, 100, 100))));
root_window->Init();
// Owned by RootWindow.
- Window* w1 = CreateNormalWindow(1, root_window.get(), NULL);
+ Window* w1 = CreateNormalWindow(1, root_window->window(), NULL);
w1->AddObserver(&observer);
}
EXPECT_TRUE(got_destroying);
@@ -1287,12 +1287,12 @@ TEST_F(RootWindowTest, DeleteRootFromHeldMouseEvent) {
r2->Init();
DeleteRootFromHeldMouseEventDelegate delegate(r2);
// Owned by |r2|.
- Window* w1 = CreateNormalWindow(1, r2, &delegate);
+ Window* w1 = CreateNormalWindow(1, r2->window(), &delegate);
w1->SetBounds(gfx::Rect(0, 0, 40, 40));
ui::MouseEvent pressed(ui::ET_MOUSE_PRESSED,
gfx::Point(10, 10), gfx::Point(10, 10),
ui::EF_SHIFT_DOWN);
- r2->GetDispatcher()->RepostEvent(pressed);
+ r2->RepostEvent(pressed);
// RunAllPendingInMessageLoop() to make sure the |pressed| is run.
RunAllPendingInMessageLoop();
EXPECT_TRUE(delegate.got_mouse_event());
diff --git a/ui/aura/test/aura_test_base.h b/ui/aura/test/aura_test_base.h
index fd6d29e..52cccf0 100644
--- a/ui/aura/test/aura_test_base.h
+++ b/ui/aura/test/aura_test_base.h
@@ -40,7 +40,8 @@ class AuraTestBase : public testing::Test {
void ParentWindow(Window* window);
- RootWindow* root_window() { return helper_->root_window(); }
+ Window* root_window() { return helper_->root_window(); }
+ RootWindow* dispatcher() { return helper_->dispatcher(); }
TestScreen* test_screen() { return helper_->test_screen(); }
private:
diff --git a/ui/aura/test/aura_test_helper.cc b/ui/aura/test/aura_test_helper.cc
index 4d2e6a2..f04b46b 100644
--- a/ui/aura/test/aura_test_helper.cc
+++ b/ui/aura/test/aura_test_helper.cc
@@ -82,19 +82,19 @@ void AuraTestHelper::SetUp() {
root_window_.reset(test_screen_->CreateRootWindowForPrimaryDisplay());
focus_client_.reset(new TestFocusClient);
- client::SetFocusClient(root_window_.get(), focus_client_.get());
- stacking_client_.reset(new TestWindowTreeClient(root_window_.get()));
+ client::SetFocusClient(root_window(), focus_client_.get());
+ stacking_client_.reset(new TestWindowTreeClient(root_window()));
activation_client_.reset(
- new client::DefaultActivationClient(root_window_.get()));
- capture_client_.reset(new client::DefaultCaptureClient(root_window_.get()));
+ new client::DefaultActivationClient(root_window()));
+ capture_client_.reset(new client::DefaultCaptureClient(root_window()));
test_input_method_.reset(new ui::DummyInputMethod);
- root_window_->SetProperty(
+ root_window()->SetProperty(
client::kRootWindowInputMethodKey,
test_input_method_.get());
- root_window_->Show();
+ root_window()->Show();
// Ensure width != height so tests won't confuse them.
- root_window_->SetHostSize(gfx::Size(800, 600));
+ dispatcher()->SetHostSize(gfx::Size(800, 600));
}
void AuraTestHelper::TearDown() {
@@ -104,7 +104,7 @@ void AuraTestHelper::TearDown() {
activation_client_.reset();
capture_client_.reset();
focus_client_.reset();
- client::SetFocusClient(root_window_.get(), NULL);
+ client::SetFocusClient(root_window(), NULL);
root_window_.reset();
test_screen_.reset();
gfx::Screen::SetScreenInstance(gfx::SCREEN_TYPE_NATIVE, NULL);
diff --git a/ui/aura/test/aura_test_helper.h b/ui/aura/test/aura_test_helper.h
index 27cd442..adcff269 100644
--- a/ui/aura/test/aura_test_helper.h
+++ b/ui/aura/test/aura_test_helper.h
@@ -7,6 +7,7 @@
#include "base/basictypes.h"
#include "base/memory/scoped_ptr.h"
+#include "ui/aura/root_window.h"
namespace base {
class MessageLoopForUI;
@@ -22,7 +23,6 @@ class ScopedAnimationDurationScaleMode;
}
namespace aura {
-class RootWindow;
class TestScreen;
namespace client {
class DefaultActivationClient;
@@ -50,7 +50,8 @@ class AuraTestHelper {
// Flushes message loop.
void RunAllPendingInMessageLoop();
- RootWindow* root_window() { return root_window_.get(); }
+ Window* root_window() { return root_window_->window(); }
+ RootWindow* dispatcher() { return root_window_.get(); }
TestScreen* test_screen() { return test_screen_.get(); }
diff --git a/ui/aura/test/event_generator.cc b/ui/aura/test/event_generator.cc
index dea96a5e..f11ab21 100644
--- a/ui/aura/test/event_generator.cc
+++ b/ui/aura/test/event_generator.cc
@@ -148,7 +148,7 @@ void EventGenerator::ReleaseRightButton() {
void EventGenerator::SendMouseExit() {
gfx::Point exit_location(current_location_);
- ConvertPointToTarget(current_root_window_, &exit_location);
+ ConvertPointToTarget(current_root_window_->window(), &exit_location);
ui::MouseEvent mouseev(ui::ET_MOUSE_EXITED, exit_location, exit_location,
flags_);
Dispatch(&mouseev);
@@ -177,7 +177,7 @@ void EventGenerator::MoveMouseTo(const gfx::Point& point_in_screen,
gfx::Point move_point = current_location_ + gfx::ToRoundedVector2d(step);
if (!grab_)
UpdateCurrentRootWindow(move_point);
- ConvertPointToTarget(current_root_window_, &move_point);
+ ConvertPointToTarget(current_root_window_->window(), &move_point);
ui::MouseEvent mouseev(event_type, move_point, move_point, flags_);
Dispatch(&mouseev);
}
@@ -551,7 +551,7 @@ void EventGenerator::ConvertPointToTarget(const aura::Window* target,
gfx::Point EventGenerator::GetLocationInCurrentRoot() const {
gfx::Point p(current_location_);
- ConvertPointToTarget(current_root_window_, &p);
+ ConvertPointToTarget(current_root_window_->window(), &p);
return p;
}
diff --git a/ui/aura/test/test_screen.cc b/ui/aura/test/test_screen.cc
index c43ffb4..e26b7e5 100644
--- a/ui/aura/test/test_screen.cc
+++ b/ui/aura/test/test_screen.cc
@@ -33,7 +33,7 @@ TestScreen::~TestScreen() {
RootWindow* TestScreen::CreateRootWindowForPrimaryDisplay() {
DCHECK(!root_window_);
root_window_ = new RootWindow(RootWindow::CreateParams(display_.bounds()));
- root_window_->AddObserver(this);
+ root_window_->window()->AddObserver(this);
root_window_->Init();
return root_window_;
}
@@ -95,12 +95,12 @@ bool TestScreen::IsDIPEnabled() {
void TestScreen::OnWindowBoundsChanged(
Window* window, const gfx::Rect& old_bounds, const gfx::Rect& new_bounds) {
- DCHECK_EQ(root_window_, window);
+ DCHECK_EQ(root_window_->window(), window);
display_.SetSize(new_bounds.size());
}
void TestScreen::OnWindowDestroying(Window* window) {
- if (root_window_ == window)
+ if (root_window_->window() == window)
root_window_ = NULL;
}
@@ -113,7 +113,7 @@ gfx::NativeWindow TestScreen::GetWindowUnderCursor() {
}
gfx::NativeWindow TestScreen::GetWindowAtScreenPoint(const gfx::Point& point) {
- return root_window_->GetTopWindowContainingPoint(point);
+ return root_window_->window()->GetTopWindowContainingPoint(point);
}
int TestScreen::GetNumDisplays() const {
diff --git a/ui/aura/window_unittest.cc b/ui/aura/window_unittest.cc
index 16749444..be917dd 100644
--- a/ui/aura/window_unittest.cc
+++ b/ui/aura/window_unittest.cc
@@ -327,7 +327,7 @@ TEST_F(WindowTest, MoveCursorTo) {
scoped_ptr<Window> w1111(
CreateTestWindow(SK_ColorRED, 1111, gfx::Rect(5, 5, 50, 50), w111.get()));
- RootWindow* root = root_window();
+ Window* root = root_window();
root->MoveCursorTo(gfx::Point(10, 10));
EXPECT_EQ("10,10",
gfx::Screen::GetScreenFor(root)->GetCursorScreenPoint().ToString());
@@ -351,7 +351,7 @@ TEST_F(WindowTest, ContainsMouse) {
root_window()));
w->Show();
WindowTestApi w_test_api(w.get());
- RootWindow* root = root_window();
+ Window* root = root_window();
root->MoveCursorTo(gfx::Point(10, 10));
EXPECT_TRUE(w_test_api.ContainsMouse());
root->MoveCursorTo(gfx::Point(9, 10));
@@ -365,7 +365,7 @@ TEST_F(WindowTest, DISABLED_MoveCursorToWithTransformRootWindow) {
#else
TEST_F(WindowTest, MoveCursorToWithTransformRootWindow) {
#endif
- RootWindow* root = root_window();
+ Window* root = root_window();
gfx::Transform transform;
transform.Translate(100.0, 100.0);
transform.Rotate(90.0);
@@ -374,7 +374,7 @@ TEST_F(WindowTest, MoveCursorToWithTransformRootWindow) {
root->MoveCursorTo(gfx::Point(10, 10));
#if !defined(OS_WIN)
gfx::Point mouse_location;
- EXPECT_TRUE(root->QueryMouseLocationForTest(&mouse_location));
+ EXPECT_TRUE(dispatcher()->QueryMouseLocationForTest(&mouse_location));
// TODO(yoshiki): fix this to build on Windows. See crbug.com/133413.OD
EXPECT_EQ("50,120", mouse_location.ToString());
#endif
@@ -438,7 +438,7 @@ TEST_F(WindowTest, MoveCursorToWithComplexTransform) {
scoped_ptr<Window> w1111(
CreateTestWindow(SK_ColorRED, 1111, gfx::Rect(5, 5, 50, 50), w111.get()));
- RootWindow* root = root_window();
+ Window* root = root_window();
// The root window expects transforms that produce integer rects.
gfx::Transform root_transform;
@@ -462,7 +462,7 @@ TEST_F(WindowTest, MoveCursorToWithComplexTransform) {
#if !defined(OS_WIN)
// TODO(yoshiki): fix this to build on Windows. See crbug.com/133413.
gfx::Point mouse_location;
- EXPECT_TRUE(root->QueryMouseLocationForTest(&mouse_location));
+ EXPECT_TRUE(dispatcher()->QueryMouseLocationForTest(&mouse_location));
EXPECT_EQ("169,80", mouse_location.ToString());
#endif
EXPECT_EQ("20,53",
@@ -489,13 +489,13 @@ TEST_F(WindowTest, HitTest) {
ui::TouchEvent pressed(
ui::ET_TOUCH_PRESSED, gfx::Point(50, 50), 0, getTime());
- root_window()->AsRootWindowHostDelegate()->OnHostTouchEvent(&pressed);
+ dispatcher()->AsRootWindowHostDelegate()->OnHostTouchEvent(&pressed);
EXPECT_TRUE(w1.HitTest(gfx::Point(-2, -2)));
EXPECT_TRUE(w1.HitTest(gfx::Point(-5, -5)));
EXPECT_FALSE(w1.HitTest(gfx::Point(-5, -6)));
ui::TouchEvent released(
ui::ET_TOUCH_RELEASED, gfx::Point(50, 50), 0, getTime());
- root_window()->AsRootWindowHostDelegate()->OnHostTouchEvent(&released);
+ dispatcher()->AsRootWindowHostDelegate()->OnHostTouchEvent(&released);
EXPECT_FALSE(w1.HitTest(gfx::Point(-2, -2)));
// TODO(beng): clip Window to parent.
@@ -846,7 +846,7 @@ TEST_F(WindowTest, CaptureTests) {
ui::TouchEvent touchev(
ui::ET_TOUCH_PRESSED, gfx::Point(50, 50), 0, getTime());
- root_window()->AsRootWindowHostDelegate()->OnHostTouchEvent(&touchev);
+ dispatcher()->AsRootWindowHostDelegate()->OnHostTouchEvent(&touchev);
EXPECT_EQ(1, delegate.touch_event_count());
delegate.ResetCounts();
@@ -862,7 +862,7 @@ TEST_F(WindowTest, CaptureTests) {
ui::TouchEvent touchev2(
ui::ET_TOUCH_PRESSED, gfx::Point(250, 250), 1, getTime());
- root_window()->AsRootWindowHostDelegate()->OnHostTouchEvent(&touchev2);
+ dispatcher()->AsRootWindowHostDelegate()->OnHostTouchEvent(&touchev2);
EXPECT_EQ(0, delegate.touch_event_count());
// Removing the capture window from parent should reset the capture window
@@ -885,7 +885,7 @@ TEST_F(WindowTest, TouchCaptureCancelsOtherTouches) {
// Press on w1.
ui::TouchEvent press(
ui::ET_TOUCH_PRESSED, gfx::Point(10, 10), 0, getTime());
- root_window()->AsRootWindowHostDelegate()->OnHostTouchEvent(&press);
+ dispatcher()->AsRootWindowHostDelegate()->OnHostTouchEvent(&press);
// We will get both GESTURE_BEGIN and GESTURE_TAP_DOWN.
EXPECT_EQ(2, delegate1.gesture_event_count());
delegate1.ResetCounts();
@@ -899,7 +899,7 @@ TEST_F(WindowTest, TouchCaptureCancelsOtherTouches) {
// Events now go to w2.
ui::TouchEvent move(ui::ET_TOUCH_MOVED, gfx::Point(10, 20), 0, getTime());
- root_window()->AsRootWindowHostDelegate()->OnHostTouchEvent(&move);
+ dispatcher()->AsRootWindowHostDelegate()->OnHostTouchEvent(&move);
EXPECT_EQ(0, delegate1.gesture_event_count());
EXPECT_EQ(0, delegate1.touch_event_count());
EXPECT_EQ(0, delegate2.gesture_event_count());
@@ -907,14 +907,14 @@ TEST_F(WindowTest, TouchCaptureCancelsOtherTouches) {
ui::TouchEvent release(
ui::ET_TOUCH_RELEASED, gfx::Point(10, 20), 0, getTime());
- root_window()->AsRootWindowHostDelegate()->OnHostTouchEvent(&release);
+ dispatcher()->AsRootWindowHostDelegate()->OnHostTouchEvent(&release);
EXPECT_EQ(0, delegate1.gesture_event_count());
EXPECT_EQ(0, delegate2.gesture_event_count());
// A new press is captured by w2.
ui::TouchEvent press2(
ui::ET_TOUCH_PRESSED, gfx::Point(10, 10), 0, getTime());
- root_window()->AsRootWindowHostDelegate()->OnHostTouchEvent(&press2);
+ dispatcher()->AsRootWindowHostDelegate()->OnHostTouchEvent(&press2);
EXPECT_EQ(0, delegate1.gesture_event_count());
// We will get both GESTURE_BEGIN and GESTURE_TAP_DOWN.
EXPECT_EQ(2, delegate2.gesture_event_count());
@@ -936,7 +936,7 @@ TEST_F(WindowTest, TouchCaptureDoesntCancelCapturedTouches) {
ui::TouchEvent press(
ui::ET_TOUCH_PRESSED, gfx::Point(10, 10), 0, getTime());
- root_window()->AsRootWindowHostDelegate()->OnHostTouchEvent(&press);
+ dispatcher()->AsRootWindowHostDelegate()->OnHostTouchEvent(&press);
// We will get both GESTURE_BEGIN and GESTURE_TAP_DOWN.
EXPECT_EQ(2, delegate.gesture_event_count());
@@ -951,7 +951,7 @@ TEST_F(WindowTest, TouchCaptureDoesntCancelCapturedTouches) {
// On move We will get TOUCH_MOVED, GESTURE_TAP_CANCEL,
// GESTURE_SCROLL_START and GESTURE_SCROLL_UPDATE.
ui::TouchEvent move(ui::ET_TOUCH_MOVED, gfx::Point(10, 20), 0, getTime());
- root_window()->AsRootWindowHostDelegate()->OnHostTouchEvent(&move);
+ dispatcher()->AsRootWindowHostDelegate()->OnHostTouchEvent(&move);
EXPECT_EQ(1, delegate.touch_event_count());
EXPECT_EQ(3, delegate.gesture_event_count());
delegate.ResetCounts();
@@ -964,7 +964,7 @@ TEST_F(WindowTest, TouchCaptureDoesntCancelCapturedTouches) {
// On move we still get TOUCH_MOVED and GESTURE_SCROLL_UPDATE.
ui::TouchEvent move2(ui::ET_TOUCH_MOVED, gfx::Point(10, 30), 0, getTime());
- root_window()->AsRootWindowHostDelegate()->OnHostTouchEvent(&move2);
+ dispatcher()->AsRootWindowHostDelegate()->OnHostTouchEvent(&move2);
EXPECT_EQ(1, delegate.touch_event_count());
EXPECT_EQ(1, delegate.gesture_event_count());
delegate.ResetCounts();
@@ -972,7 +972,7 @@ TEST_F(WindowTest, TouchCaptureDoesntCancelCapturedTouches) {
// And on release we get TOUCH_RELEASED, GESTURE_SCROLL_END, GESTURE_END
ui::TouchEvent release(
ui::ET_TOUCH_RELEASED, gfx::Point(10, 20), 0, getTime());
- root_window()->AsRootWindowHostDelegate()->OnHostTouchEvent(&release);
+ dispatcher()->AsRootWindowHostDelegate()->OnHostTouchEvent(&release);
EXPECT_EQ(1, delegate.touch_event_count());
EXPECT_EQ(2, delegate.gesture_event_count());
}
@@ -985,7 +985,7 @@ TEST_F(WindowTest, TransferCaptureTouchEvents) {
scoped_ptr<Window> w1(CreateTestWindowWithDelegate(
&d1, 0, gfx::Rect(0, 0, 20, 20), root_window()));
ui::TouchEvent p1(ui::ET_TOUCH_PRESSED, gfx::Point(10, 10), 0, getTime());
- root_window()->AsRootWindowHostDelegate()->OnHostTouchEvent(&p1);
+ dispatcher()->AsRootWindowHostDelegate()->OnHostTouchEvent(&p1);
// We will get both GESTURE_BEGIN and GESTURE_TAP_DOWN.
EXPECT_EQ(1, d1.touch_event_count());
EXPECT_EQ(2, d1.gesture_event_count());
@@ -996,7 +996,7 @@ TEST_F(WindowTest, TransferCaptureTouchEvents) {
scoped_ptr<Window> w2(CreateTestWindowWithDelegate(
&d2, 0, gfx::Rect(40, 0, 40, 20), root_window()));
ui::TouchEvent p2(ui::ET_TOUCH_PRESSED, gfx::Point(41, 10), 1, getTime());
- root_window()->AsRootWindowHostDelegate()->OnHostTouchEvent(&p2);
+ dispatcher()->AsRootWindowHostDelegate()->OnHostTouchEvent(&p2);
EXPECT_EQ(0, d1.touch_event_count());
EXPECT_EQ(0, d1.gesture_event_count());
// We will get both GESTURE_BEGIN and GESTURE_TAP_DOWN for new target window.
@@ -1032,7 +1032,7 @@ TEST_F(WindowTest, TransferCaptureTouchEvents) {
// Move touch id originally associated with |w2|. Since capture was transfered
// from 2 to 3 only |w3| should get the event.
ui::TouchEvent m3(ui::ET_TOUCH_MOVED, gfx::Point(110, 105), 1, getTime());
- root_window()->AsRootWindowHostDelegate()->OnHostTouchEvent(&m3);
+ dispatcher()->AsRootWindowHostDelegate()->OnHostTouchEvent(&m3);
EXPECT_EQ(0, d1.touch_event_count());
EXPECT_EQ(0, d1.gesture_event_count());
EXPECT_EQ(0, d2.touch_event_count());
@@ -1055,7 +1055,7 @@ TEST_F(WindowTest, TransferCaptureTouchEvents) {
// And when we move the touch again, |w3| still gets the events.
ui::TouchEvent m4(ui::ET_TOUCH_MOVED, gfx::Point(120, 105), 1, getTime());
- root_window()->AsRootWindowHostDelegate()->OnHostTouchEvent(&m4);
+ dispatcher()->AsRootWindowHostDelegate()->OnHostTouchEvent(&m4);
EXPECT_EQ(0, d1.touch_event_count());
EXPECT_EQ(0, d1.gesture_event_count());
EXPECT_EQ(0, d2.touch_event_count());
@@ -1121,7 +1121,7 @@ TEST_F(WindowTest, ReleaseCaptureOnDestroy) {
window.reset();
// Make sure the root window doesn't reference the window anymore.
- EXPECT_EQ(NULL, root_window()->mouse_pressed_handler());
+ EXPECT_EQ(NULL, dispatcher()->mouse_pressed_handler());
EXPECT_EQ(NULL, aura::client::GetCaptureWindow(root_window()));
}
@@ -1220,7 +1220,7 @@ TEST_F(WindowTest, RootWindowHostExit) {
ui::MouseEvent exit_event(
ui::ET_MOUSE_EXITED, gfx::Point(), gfx::Point(), 0);
- root_window()->AsRootWindowHostDelegate()->OnHostMouseEvent(&exit_event);
+ dispatcher()->AsRootWindowHostDelegate()->OnHostMouseEvent(&exit_event);
EXPECT_FALSE(d1.entered());
EXPECT_TRUE(d1.exited());
}
@@ -1536,7 +1536,7 @@ TEST_F(WindowTest, IgnoreEventsTest) {
// Tests transformation on the root window.
TEST_F(WindowTest, Transform) {
- gfx::Size size = root_window()->GetHostSize();
+ gfx::Size size = dispatcher()->GetHostSize();
EXPECT_EQ(gfx::Rect(size),
gfx::Screen::GetScreenFor(root_window())->GetDisplayNearestPoint(
gfx::Point()).bounds());
@@ -1545,7 +1545,7 @@ TEST_F(WindowTest, Transform) {
gfx::Transform transform;
transform.Translate(size.height(), 0);
transform.Rotate(90.0);
- root_window()->SetTransform(transform);
+ dispatcher()->SetTransform(transform);
// The size should be the transformed size.
gfx::Size transformed_size(size.height(), size.width());
@@ -1558,11 +1558,11 @@ TEST_F(WindowTest, Transform) {
// Host size shouldn't change.
EXPECT_EQ(size.ToString(),
- root_window()->GetHostSize().ToString());
+ dispatcher()->GetHostSize().ToString());
}
TEST_F(WindowTest, TransformGesture) {
- gfx::Size size = root_window()->GetHostSize();
+ gfx::Size size = dispatcher()->GetHostSize();
scoped_ptr<GestureTrackPositionDelegate> delegate(
new GestureTrackPositionDelegate);
@@ -1577,7 +1577,7 @@ TEST_F(WindowTest, TransformGesture) {
ui::TouchEvent press(
ui::ET_TOUCH_PRESSED, gfx::Point(size.height() - 10, 10), 0, getTime());
- root_window()->AsRootWindowHostDelegate()->OnHostTouchEvent(&press);
+ dispatcher()->AsRootWindowHostDelegate()->OnHostTouchEvent(&press);
EXPECT_EQ(gfx::Point(10, 10).ToString(), delegate->position().ToString());
}
@@ -2229,8 +2229,6 @@ TEST_F(WindowTest, StackWindowsWhoseLayersHaveNoDelegate) {
}
TEST_F(WindowTest, StackTransientsWhoseLayersHaveNoDelegate) {
- RootWindow* root = root_window();
-
// Create a window with several transients, then a couple windows on top.
scoped_ptr<Window> window1(CreateTestWindowWithId(1, root_window()));
scoped_ptr<Window> window11(CreateTransientChild(11, window1.get()));
@@ -2239,7 +2237,7 @@ TEST_F(WindowTest, StackTransientsWhoseLayersHaveNoDelegate) {
scoped_ptr<Window> window2(CreateTestWindowWithId(2, root_window()));
scoped_ptr<Window> window3(CreateTestWindowWithId(3, root_window()));
- EXPECT_EQ("1 11 12 13 2 3", ChildWindowIDsAsString(root));
+ EXPECT_EQ("1 11 12 13 2 3", ChildWindowIDsAsString(root_window()));
// Remove the delegates of a couple of transients, as if they are closing
// and animating out.
@@ -2248,14 +2246,14 @@ TEST_F(WindowTest, StackTransientsWhoseLayersHaveNoDelegate) {
// Move window1 to the front. All transients should move with it, and their
// order should be preserved.
- root->StackChildAtTop(window1.get());
+ root_window()->StackChildAtTop(window1.get());
- EXPECT_EQ("2 3 1 11 12 13", ChildWindowIDsAsString(root));
+ EXPECT_EQ("2 3 1 11 12 13", ChildWindowIDsAsString(root_window()));
}
class TestVisibilityClient : public client::VisibilityClient {
public:
- explicit TestVisibilityClient(RootWindow* root_window)
+ explicit TestVisibilityClient(Window* root_window)
: ignore_visibility_changes_(false) {
client::SetVisibilityClient(root_window, this);
}
@@ -2298,7 +2296,7 @@ TEST_F(WindowTest, VisibilityClientIsVisible) {
// Tests mouse events on window change.
TEST_F(WindowTest, MouseEventsOnWindowChange) {
- gfx::Size size = root_window()->GetHostSize();
+ gfx::Size size = dispatcher()->GetHostSize();
EventGenerator generator(root_window());
generator.MoveMouseTo(50, 50);
@@ -2392,7 +2390,7 @@ TEST_F(WindowTest, MouseEventsOnWindowChange) {
class StackingMadrigalLayoutManager : public LayoutManager {
public:
- explicit StackingMadrigalLayoutManager(RootWindow* root_window)
+ explicit StackingMadrigalLayoutManager(Window* root_window)
: root_window_(root_window) {
root_window_->SetLayoutManager(this);
}
@@ -2425,14 +2423,14 @@ class StackingMadrigalLayoutManager : public LayoutManager {
SetChildBoundsDirect(child, requested_bounds);
}
- RootWindow* root_window_;
+ Window* root_window_;
DISALLOW_COPY_AND_ASSIGN(StackingMadrigalLayoutManager);
};
class StackingMadrigalVisibilityClient : public client::VisibilityClient {
public:
- explicit StackingMadrigalVisibilityClient(RootWindow* root_window)
+ explicit StackingMadrigalVisibilityClient(Window* root_window)
: ignored_window_(NULL) {
client::SetVisibilityClient(root_window, this);
}
@@ -2525,7 +2523,7 @@ TEST_F(WindowTest, StackOverClosingTransient) {
scoped_ptr<Window> transient2(CreateTransientChild(21, window2.get()));
// Both windows and layers are stacked in creation order.
- RootWindow* root = root_window();
+ Window* root = root_window();
ASSERT_EQ(4u, root->children().size());
EXPECT_EQ(root->children()[0], window1.get());
EXPECT_EQ(root->children()[1], transient1.get());
diff --git a/ui/keyboard/keyboard_controller_unittest.cc b/ui/keyboard/keyboard_controller_unittest.cc
index 35dbd9e..81de83f 100644
--- a/ui/keyboard/keyboard_controller_unittest.cc
+++ b/ui/keyboard/keyboard_controller_unittest.cc
@@ -29,7 +29,7 @@ namespace {
// used to match the focus manger behaviour in ash and views.
class TestFocusController : public ui::EventHandler {
public:
- explicit TestFocusController(aura::RootWindow* root)
+ explicit TestFocusController(aura::Window* root)
: root_(root) {
root_->AddPreTargetHandler(this);
}
@@ -206,7 +206,7 @@ class KeyboardControllerTest : public testing::Test {
aura_test_helper_->TearDown();
}
- aura::RootWindow* root_window() { return aura_test_helper_->root_window(); }
+ aura::Window* root_window() { return aura_test_helper_->root_window(); }
KeyboardControllerProxy* proxy() { return proxy_; }
KeyboardController* controller() { return controller_.get(); }
diff --git a/ui/keyboard/keyboard_util.cc b/ui/keyboard/keyboard_util.cc
index aebfcf0..96d8385 100644
--- a/ui/keyboard/keyboard_util.cc
+++ b/ui/keyboard/keyboard_util.cc
@@ -123,7 +123,7 @@ bool SendKeyEvent(const std::string type,
// Handling of special printable characters (e.g. accented characters) for
// which there is no key code.
if (event_type == ui::ET_KEY_RELEASED) {
- ui::InputMethod* input_method = dispatcher->GetProperty(
+ ui::InputMethod* input_method = dispatcher->window()->GetProperty(
aura::client::kRootWindowInputMethodKey);
if (!input_method)
return false;
diff --git a/ui/shell/minimal_shell.cc b/ui/shell/minimal_shell.cc
index 3e01ef6..4202fef 100644
--- a/ui/shell/minimal_shell.cc
+++ b/ui/shell/minimal_shell.cc
@@ -20,26 +20,26 @@ MinimalShell::MinimalShell(const gfx::Size& default_window_size) {
aura::RootWindow::CreateParams(
gfx::Rect(default_window_size))));
root_window_->Init();
- aura::client::SetWindowTreeClient(root_window_.get(), this);
+ aura::client::SetWindowTreeClient(root_window_->window(), this);
focus_client_.reset(new aura::test::TestFocusClient);
- aura::client::SetFocusClient(root_window_.get(), focus_client_.get());
+ aura::client::SetFocusClient(root_window_->window(), focus_client_.get());
root_window_event_filter_ = new views::corewm::CompoundEventFilter;
// Pass ownership of the filter to the root_window.
- root_window_->SetEventFilter(root_window_event_filter_);
+ root_window_->window()->SetEventFilter(root_window_event_filter_);
input_method_filter_.reset(new views::corewm::InputMethodEventFilter(
root_window_->GetAcceleratedWidget()));
input_method_filter_->SetInputMethodPropertyInRootWindow(
- root_window_.get());
+ root_window_->window());
root_window_event_filter_->AddHandler(input_method_filter_.get());
activation_client_.reset(
- new aura::client::DefaultActivationClient(root_window_.get()));
+ new aura::client::DefaultActivationClient(root_window_->window()));
capture_client_.reset(
- new aura::client::DefaultCaptureClient(root_window_.get()));
+ new aura::client::DefaultCaptureClient(root_window_->window()));
}
MinimalShell::~MinimalShell() {
@@ -50,7 +50,7 @@ aura::Window* MinimalShell::GetDefaultParent(
aura::Window* context,
aura::Window* window,
const gfx::Rect& bounds) {
- return root_window_.get();
+ return root_window_->window();
}
} // namespace shell
diff --git a/ui/snapshot/snapshot_aura_unittest.cc b/ui/snapshot/snapshot_aura_unittest.cc
index b72629c..da46bcc 100644
--- a/ui/snapshot/snapshot_aura_unittest.cc
+++ b/ui/snapshot/snapshot_aura_unittest.cc
@@ -80,12 +80,13 @@ class SnapshotAuraTest : public testing::Test {
protected:
aura::Window* test_window() { return test_window_.get(); }
- aura::RootWindow* root_window() { return helper_->root_window(); }
+ aura::Window* root_window() { return helper_->root_window(); }
+ aura::WindowEventDispatcher* dispatcher() { return helper_->dispatcher(); }
aura::TestScreen* test_screen() { return helper_->test_screen(); }
void WaitForDraw() {
- root_window()->compositor()->ScheduleDraw();
- ui::DrawWaiterForTest::Wait(root_window()->compositor());
+ dispatcher()->compositor()->ScheduleDraw();
+ ui::DrawWaiterForTest::Wait(dispatcher()->compositor());
}
void SetupTestWindow(const gfx::Rect& window_bounds) {
diff --git a/ui/views/corewm/capture_controller_unittest.cc b/ui/views/corewm/capture_controller_unittest.cc
index edb2410..295ea3d 100644
--- a/ui/views/corewm/capture_controller_unittest.cc
+++ b/ui/views/corewm/capture_controller_unittest.cc
@@ -36,10 +36,10 @@ class CaptureControllerTest : public aura::test::AuraTestBase {
second_root_.reset(new aura::RootWindow(
aura::RootWindow::CreateParams(gfx::Rect(0, 0, 800, 600))));
second_root_->Init();
- second_root_->Show();
+ second_root_->window()->Show();
second_root_->SetHostSize(gfx::Size(800, 600));
second_capture_controller_.reset(
- new corewm::ScopedCaptureClient(second_root_.get()));
+ new corewm::ScopedCaptureClient(second_root_->window()));
#if !defined(OS_CHROMEOS)
desktop_position_client_.reset(new DesktopScreenPositionClient());
@@ -48,7 +48,7 @@ class CaptureControllerTest : public aura::test::AuraTestBase {
second_desktop_position_client_.reset(new DesktopScreenPositionClient());
aura::client::SetScreenPositionClient(
- second_root_.get(),
+ second_root_->window(),
second_desktop_position_client_.get());
#endif
}
@@ -102,17 +102,18 @@ TEST_F(CaptureControllerTest, ResetMouseEventHandlerOnCapture) {
// dispatch further mouse events to |w1|.
ui::MouseEvent mouse_pressed_event(ui::ET_MOUSE_PRESSED, gfx::Point(5, 5),
gfx::Point(5, 5), 0);
- root_window()->AsRootWindowHostDelegate()->OnHostMouseEvent(
+ dispatcher()->AsRootWindowHostDelegate()->OnHostMouseEvent(
&mouse_pressed_event);
- EXPECT_EQ(w1.get(), root_window()->mouse_pressed_handler());
+ EXPECT_EQ(w1.get(), dispatcher()->mouse_pressed_handler());
// Build a window in the second RootWindow.
- scoped_ptr<aura::Window> w2(CreateNormalWindow(2, second_root_.get(), NULL));
+ scoped_ptr<aura::Window> w2(
+ CreateNormalWindow(2, second_root_->window(), NULL));
// The act of having the second window take capture should clear out mouse
// pressed handler in the first RootWindow.
w2->SetCapture();
- EXPECT_EQ(NULL, root_window()->mouse_pressed_handler());
+ EXPECT_EQ(NULL, dispatcher()->mouse_pressed_handler());
}
// Makes sure that when one window gets capture, it forces the release on the
@@ -128,7 +129,8 @@ TEST_F(CaptureControllerTest, ResetOtherWindowCaptureOnCapture) {
// Build a window in the second RootWindow and give it capture. Both capture
// clients should return the same capture window.
- scoped_ptr<aura::Window> w2(CreateNormalWindow(2, second_root_.get(), NULL));
+ scoped_ptr<aura::Window> w2(
+ CreateNormalWindow(2, second_root_->window(), NULL));
w2->SetCapture();
EXPECT_EQ(w2.get(), GetCaptureWindow());
EXPECT_EQ(w2.get(), GetSecondCaptureWindow());
@@ -147,7 +149,8 @@ TEST_F(CaptureControllerTest, TouchTargetResetOnCaptureChange) {
// Build a window in the second RootWindow and give it capture. Both capture
// clients should return the same capture window.
- scoped_ptr<aura::Window> w2(CreateNormalWindow(2, second_root_.get(), NULL));
+ scoped_ptr<aura::Window> w2(
+ CreateNormalWindow(2, second_root_->window(), NULL));
w2->SetCapture();
EXPECT_EQ(w2.get(), GetCaptureWindow());
EXPECT_EQ(w2.get(), GetSecondCaptureWindow());
diff --git a/ui/views/corewm/compound_event_filter_unittest.cc b/ui/views/corewm/compound_event_filter_unittest.cc
index 3141388..2d40b93 100644
--- a/ui/views/corewm/compound_event_filter_unittest.cc
+++ b/ui/views/corewm/compound_event_filter_unittest.cc
@@ -62,36 +62,36 @@ TEST_F(CompoundEventFilterTest, CursorVisibilityChange) {
// Send key event to hide the cursor.
ui::KeyEvent key(ui::ET_KEY_PRESSED, ui::VKEY_A, 0, true);
- root_window()->AsRootWindowHostDelegate()->OnHostKeyEvent(&key);
+ dispatcher()->AsRootWindowHostDelegate()->OnHostKeyEvent(&key);
EXPECT_FALSE(cursor_client.IsCursorVisible());
// Synthesized mouse event should not show the cursor.
ui::MouseEvent enter(ui::ET_MOUSE_ENTERED, gfx::Point(10, 10),
gfx::Point(10, 10), 0);
enter.set_flags(enter.flags() | ui::EF_IS_SYNTHESIZED);
- root_window()->AsRootWindowHostDelegate()->OnHostMouseEvent(&enter);
+ dispatcher()->AsRootWindowHostDelegate()->OnHostMouseEvent(&enter);
EXPECT_FALSE(cursor_client.IsCursorVisible());
ui::MouseEvent move(ui::ET_MOUSE_MOVED, gfx::Point(10, 10),
gfx::Point(10, 10), 0);
move.set_flags(enter.flags() | ui::EF_IS_SYNTHESIZED);
- root_window()->AsRootWindowHostDelegate()->OnHostMouseEvent(&move);
+ dispatcher()->AsRootWindowHostDelegate()->OnHostMouseEvent(&move);
EXPECT_FALSE(cursor_client.IsCursorVisible());
ui::MouseEvent real_move(ui::ET_MOUSE_MOVED, gfx::Point(10, 10),
gfx::Point(10, 10), 0);
- root_window()->AsRootWindowHostDelegate()->OnHostMouseEvent(&real_move);
+ dispatcher()->AsRootWindowHostDelegate()->OnHostMouseEvent(&real_move);
EXPECT_TRUE(cursor_client.IsCursorVisible());
// Send key event to hide the cursor again.
- root_window()->AsRootWindowHostDelegate()->OnHostKeyEvent(&key);
+ dispatcher()->AsRootWindowHostDelegate()->OnHostKeyEvent(&key);
EXPECT_FALSE(cursor_client.IsCursorVisible());
// Mouse synthesized exit event should not show the cursor.
ui::MouseEvent exit(ui::ET_MOUSE_EXITED, gfx::Point(10, 10),
gfx::Point(10, 10), 0);
exit.set_flags(enter.flags() | ui::EF_IS_SYNTHESIZED);
- root_window()->AsRootWindowHostDelegate()->OnHostMouseEvent(&exit);
+ dispatcher()->AsRootWindowHostDelegate()->OnHostMouseEvent(&exit);
EXPECT_FALSE(cursor_client.IsCursorVisible());
}
@@ -108,29 +108,29 @@ TEST_F(CompoundEventFilterTest, TouchHidesCursor) {
ui::MouseEvent mouse0(ui::ET_MOUSE_MOVED, gfx::Point(10, 10),
gfx::Point(10, 10), 0);
- root_window()->AsRootWindowHostDelegate()->OnHostMouseEvent(&mouse0);
+ dispatcher()->AsRootWindowHostDelegate()->OnHostMouseEvent(&mouse0);
EXPECT_TRUE(cursor_client.IsMouseEventsEnabled());
// This press is required for the GestureRecognizer to associate a target
// with kTouchId
ui::TouchEvent press0(
ui::ET_TOUCH_PRESSED, gfx::Point(90, 90), 1, GetTime());
- root_window()->AsRootWindowHostDelegate()->OnHostTouchEvent(&press0);
+ dispatcher()->AsRootWindowHostDelegate()->OnHostTouchEvent(&press0);
EXPECT_FALSE(cursor_client.IsMouseEventsEnabled());
ui::TouchEvent move(ui::ET_TOUCH_MOVED, gfx::Point(10, 10), 1, GetTime());
- root_window()->AsRootWindowHostDelegate()->OnHostTouchEvent(&move);
+ dispatcher()->AsRootWindowHostDelegate()->OnHostTouchEvent(&move);
EXPECT_FALSE(cursor_client.IsMouseEventsEnabled());
ui::TouchEvent release(
ui::ET_TOUCH_RELEASED, gfx::Point(10, 10), 1, GetTime());
- root_window()->AsRootWindowHostDelegate()->OnHostTouchEvent(&release);
+ dispatcher()->AsRootWindowHostDelegate()->OnHostTouchEvent(&release);
EXPECT_FALSE(cursor_client.IsMouseEventsEnabled());
ui::MouseEvent mouse1(ui::ET_MOUSE_MOVED, gfx::Point(10, 10),
gfx::Point(10, 10), 0);
// Move the cursor again. The cursor should be visible.
- root_window()->AsRootWindowHostDelegate()->OnHostMouseEvent(&mouse1);
+ dispatcher()->AsRootWindowHostDelegate()->OnHostMouseEvent(&mouse1);
EXPECT_TRUE(cursor_client.IsMouseEventsEnabled());
// Now activate the window and press on it again.
@@ -138,7 +138,7 @@ TEST_F(CompoundEventFilterTest, TouchHidesCursor) {
ui::ET_TOUCH_PRESSED, gfx::Point(90, 90), 1, GetTime());
aura::client::GetActivationClient(
root_window())->ActivateWindow(window.get());
- root_window()->AsRootWindowHostDelegate()->OnHostTouchEvent(&press1);
+ dispatcher()->AsRootWindowHostDelegate()->OnHostTouchEvent(&press1);
EXPECT_FALSE(cursor_client.IsMouseEventsEnabled());
aura::Env::GetInstance()->RemovePreTargetHandler(compound_filter.get());
}
diff --git a/ui/views/corewm/focus_controller_unittest.cc b/ui/views/corewm/focus_controller_unittest.cc
index 2177271..349f517 100644
--- a/ui/views/corewm/focus_controller_unittest.cc
+++ b/ui/views/corewm/focus_controller_unittest.cc
@@ -80,7 +80,7 @@ class FocusNotificationObserver : public aura::client::ActivationChangeObserver,
class ScopedFocusNotificationObserver : public FocusNotificationObserver {
public:
- ScopedFocusNotificationObserver(aura::RootWindow* root_window)
+ ScopedFocusNotificationObserver(aura::Window* root_window)
: root_window_(root_window) {
aura::client::GetActivationClient(root_window_)->AddObserver(this);
aura::client::GetFocusClient(root_window_)->AddObserver(this);
@@ -91,7 +91,7 @@ class ScopedFocusNotificationObserver : public FocusNotificationObserver {
}
private:
- aura::RootWindow* root_window_;
+ aura::Window* root_window_;
DISALLOW_COPY_AND_ASSIGN(ScopedFocusNotificationObserver);
};
diff --git a/ui/views/corewm/input_method_event_filter_unittest.cc b/ui/views/corewm/input_method_event_filter_unittest.cc
index 76cabfa..5739d0cc 100644
--- a/ui/views/corewm/input_method_event_filter_unittest.cc
+++ b/ui/views/corewm/input_method_event_filter_unittest.cc
@@ -32,7 +32,7 @@ TEST_F(InputMethodEventFilterTest, TestInputMethodProperty) {
root_window()->SetEventFilter(root_filter);
InputMethodEventFilter input_method_event_filter(
- root_window()->GetAcceleratedWidget());
+ dispatcher()->GetAcceleratedWidget());
root_filter->AddHandler(&input_method_event_filter);
// Tests if InputMethodEventFilter adds a window property on its
@@ -51,7 +51,7 @@ TEST_F(InputMethodEventFilterTest, TestInputMethodKeyEventPropagation) {
// Add the InputMethodEventFilter before the TestEventFilter.
InputMethodEventFilter input_method_event_filter(
- root_window()->GetAcceleratedWidget());
+ dispatcher()->GetAcceleratedWidget());
root_filter->AddHandler(&input_method_event_filter);
// Add TestEventFilter to the RootWindow.
diff --git a/ui/views/corewm/tooltip_controller_unittest.cc b/ui/views/corewm/tooltip_controller_unittest.cc
index 1a5db6b..6ebf4b9 100644
--- a/ui/views/corewm/tooltip_controller_unittest.cc
+++ b/ui/views/corewm/tooltip_controller_unittest.cc
@@ -41,7 +41,7 @@ namespace corewm {
namespace test {
namespace {
-views::Widget* CreateWidget(aura::RootWindow* root) {
+views::Widget* CreateWidget(aura::Window* root) {
views::Widget* widget = new views::Widget;
views::Widget::InitParams params;
params.type = views::Widget::InitParams::TYPE_WINDOW_FRAMELESS;
@@ -93,7 +93,7 @@ class TooltipControllerTest : public aura::test::AuraTestBase {
virtual void TearDown() OVERRIDE {
#if defined(OS_CHROMEOS)
root_window()->RemovePreTargetHandler(controller_.get());
- SetTooltipClient(root_window(), NULL);
+ aura::client::SetTooltipClient(root_window(), NULL);
controller_.reset();
#endif
generator_.reset();
diff --git a/ui/views/widget/desktop_aura/desktop_capture_client.cc b/ui/views/widget/desktop_aura/desktop_capture_client.cc
index a6348a9..5a3b0df 100644
--- a/ui/views/widget/desktop_aura/desktop_capture_client.cc
+++ b/ui/views/widget/desktop_aura/desktop_capture_client.cc
@@ -13,7 +13,7 @@ namespace views {
DesktopCaptureClient::CaptureClients*
DesktopCaptureClient::capture_clients_ = NULL;
-DesktopCaptureClient::DesktopCaptureClient(aura::RootWindow* root)
+DesktopCaptureClient::DesktopCaptureClient(aura::Window* root)
: root_(root),
capture_window_(NULL) {
if (!capture_clients_)
@@ -52,7 +52,7 @@ void DesktopCaptureClient::SetCapture(aura::Window* new_capture_window) {
capture_window_ = new_capture_window;
- aura::client::CaptureDelegate* delegate = root_;
+ aura::client::CaptureDelegate* delegate = root_->GetDispatcher();
delegate->UpdateCapture(old_capture_window, new_capture_window);
// Initiate native capture updating.
@@ -67,7 +67,7 @@ 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_;
+ aura::client::CaptureDelegate* delegate = (*i)->root_->GetDispatcher();
delegate->OnOtherRootGotCapture();
}
}
diff --git a/ui/views/widget/desktop_aura/desktop_capture_client.h b/ui/views/widget/desktop_aura/desktop_capture_client.h
index 5f8cecf..9ade3b1 100644
--- a/ui/views/widget/desktop_aura/desktop_capture_client.h
+++ b/ui/views/widget/desktop_aura/desktop_capture_client.h
@@ -22,7 +22,7 @@ namespace views {
// DesktopNativeWidgetAura.
class VIEWS_EXPORT DesktopCaptureClient : public aura::client::CaptureClient {
public:
- explicit DesktopCaptureClient(aura::RootWindow* root);
+ explicit DesktopCaptureClient(aura::Window* root);
virtual ~DesktopCaptureClient();
// Overridden from aura::client::CaptureClient:
@@ -33,7 +33,7 @@ class VIEWS_EXPORT DesktopCaptureClient : public aura::client::CaptureClient {
private:
typedef std::set<DesktopCaptureClient*> CaptureClients;
- aura::RootWindow* root_;
+ aura::Window* root_;
aura::Window* capture_window_;
// Set of DesktopCaptureClients.
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 0a74b98..21b17c19 100644
--- a/ui/views/widget/desktop_aura/desktop_native_widget_aura.cc
+++ b/ui/views/widget/desktop_aura/desktop_native_widget_aura.cc
@@ -147,7 +147,7 @@ class DesktopNativeWidgetAuraWindowTreeClient :
public aura::client::WindowTreeClient {
public:
explicit DesktopNativeWidgetAuraWindowTreeClient(
- aura::RootWindow* root_window)
+ aura::Window* root_window)
: root_window_(root_window) {
aura::client::SetWindowTreeClient(root_window_, this);
}
@@ -176,7 +176,7 @@ class DesktopNativeWidgetAuraWindowTreeClient :
}
private:
- aura::RootWindow* root_window_;
+ aura::Window* root_window_;
DISALLOW_COPY_AND_ASSIGN(DesktopNativeWidgetAuraWindowTreeClient);
};
@@ -230,7 +230,7 @@ void DesktopNativeWidgetAura::OnHostClosed() {
// are left referencing a deleted Window.
{
aura::Window* capture_window = capture_client_->GetCaptureWindow();
- if (capture_window && root_window_->Contains(capture_window))
+ if (capture_window && root_window_->window()->Contains(capture_window))
capture_window->ReleaseCapture();
}
@@ -238,8 +238,8 @@ void DesktopNativeWidgetAura::OnHostClosed() {
// references. Make sure we destroy ShadowController early on.
shadow_controller_.reset();
tooltip_manager_.reset();
- root_window_->RemovePreTargetHandler(tooltip_controller_.get());
- aura::client::SetTooltipClient(root_window_.get(), NULL);
+ root_window_->window()->RemovePreTargetHandler(tooltip_controller_.get());
+ aura::client::SetTooltipClient(root_window_->window(), NULL);
tooltip_controller_.reset();
root_window_event_filter_->RemoveHandler(input_method_event_filter_.get());
@@ -263,30 +263,30 @@ void DesktopNativeWidgetAura::OnDesktopRootWindowHostDestroyed(
aura::RootWindow* root) {
// |root_window_| is still valid, but DesktopRootWindowHost is nearly
// destroyed. Do cleanup here of members DesktopRootWindowHost may also use.
- aura::client::SetFocusClient(root, NULL);
- aura::client::SetActivationClient(root, NULL);
+ aura::client::SetFocusClient(root->window(), NULL);
+ aura::client::SetActivationClient(root->window(), NULL);
focus_client_.reset();
- aura::client::SetDispatcherClient(root, NULL);
+ aura::client::SetDispatcherClient(root->window(), NULL);
dispatcher_client_.reset();
- aura::client::SetCursorClient(root, NULL);
+ aura::client::SetCursorClient(root->window(), NULL);
cursor_client_.reset();
- aura::client::SetScreenPositionClient(root, NULL);
+ aura::client::SetScreenPositionClient(root->window(), NULL);
position_client_.reset();
- aura::client::SetDragDropClient(root, NULL);
+ aura::client::SetDragDropClient(root->window(), NULL);
drag_drop_client_.reset();
- aura::client::SetEventClient(root, NULL);
+ aura::client::SetEventClient(root->window(), NULL);
event_client_.reset();
}
void DesktopNativeWidgetAura::HandleActivationChanged(bool active) {
native_widget_delegate_->OnNativeWidgetActivationChanged(active);
aura::client::ActivationClient* activation_client =
- aura::client::GetActivationClient(root_window_.get());
+ aura::client::GetActivationClient(root_window_->window());
if (!activation_client)
return;
if (active) {
@@ -347,14 +347,14 @@ void DesktopNativeWidgetAura::InitNativeWidget(
root_window_.reset(new aura::RootWindow(rw_params));
root_window_->Init();
- root_window_->AddChild(content_window_container_);
+ root_window_->window()->AddChild(content_window_container_);
// The WindowsModalityController event filter should be at the head of the
// pre target handlers list. This ensures that it handles input events first
// when modal windows are at the top of the Zorder.
if (widget_type_ == Widget::InitParams::TYPE_WINDOW)
window_modality_controller_.reset(
- new views::corewm::WindowModalityController(root_window_.get()));
+ new views::corewm::WindowModalityController(root_window_->window()));
// |root_window_event_filter_| must be created before
// OnRootWindowHostCreated() is invoked.
@@ -365,23 +365,23 @@ void DesktopNativeWidgetAura::InitNativeWidget(
// No event filter for aura::Env. Create CompoundEvnetFilter per RootWindow.
root_window_event_filter_ = new corewm::CompoundEventFilter;
// Pass ownership of the filter to the root_window.
- root_window_->SetEventFilter(root_window_event_filter_);
+ root_window_->window()->SetEventFilter(root_window_event_filter_);
desktop_root_window_host_->OnRootWindowCreated(root_window_.get(), params);
UpdateWindowTransparency();
- capture_client_.reset(new DesktopCaptureClient(root_window_.get()));
+ capture_client_.reset(new DesktopCaptureClient(root_window_->window()));
corewm::FocusController* focus_controller =
new corewm::FocusController(new DesktopFocusRules(content_window_));
focus_client_.reset(focus_controller);
- aura::client::SetFocusClient(root_window_.get(), focus_controller);
- aura::client::SetActivationClient(root_window_.get(), focus_controller);
- root_window_->AddPreTargetHandler(focus_controller);
+ aura::client::SetFocusClient(root_window_->window(), focus_controller);
+ aura::client::SetActivationClient(root_window_->window(), focus_controller);
+ root_window_->window()->AddPreTargetHandler(focus_controller);
dispatcher_client_.reset(new DesktopDispatcherClient);
- aura::client::SetDispatcherClient(root_window_.get(),
+ aura::client::SetDispatcherClient(root_window_->window(),
dispatcher_client_.get());
DesktopNativeCursorManager* desktop_native_cursor_manager =
@@ -392,17 +392,18 @@ void DesktopNativeWidgetAura::InitNativeWidget(
new views::corewm::CursorManager(
scoped_ptr<corewm::NativeCursorManager>(
desktop_native_cursor_manager)));
- aura::client::SetCursorClient(root_window_.get(), cursor_client_.get());
+ aura::client::SetCursorClient(root_window_->window(), cursor_client_.get());
position_client_.reset(new DesktopScreenPositionClient());
- aura::client::SetScreenPositionClient(root_window_.get(),
+ aura::client::SetScreenPositionClient(root_window_->window(),
position_client_.get());
InstallInputMethodEventFilter();
drag_drop_client_ = desktop_root_window_host_->CreateDragDropClient(
desktop_native_cursor_manager);
- aura::client::SetDragDropClient(root_window_.get(), drag_drop_client_.get());
+ aura::client::SetDragDropClient(root_window_->window(),
+ drag_drop_client_.get());
focus_client_->FocusWindow(content_window_);
@@ -411,7 +412,7 @@ void DesktopNativeWidgetAura::InitNativeWidget(
root_window_->AddRootWindowObserver(this);
window_tree_client_.reset(
- new DesktopNativeWidgetAuraWindowTreeClient(root_window_.get()));
+ new DesktopNativeWidgetAuraWindowTreeClient(root_window_->window()));
drop_helper_.reset(new DropHelper(
static_cast<internal::RootView*>(GetWidget()->GetRootView())));
aura::client::SetDragDropDelegate(content_window_, this);
@@ -421,14 +422,16 @@ void DesktopNativeWidgetAura::InitNativeWidget(
tooltip_controller_.reset(
new corewm::TooltipController(
desktop_root_window_host_->CreateTooltip()));
- aura::client::SetTooltipClient(root_window_.get(), tooltip_controller_.get());
+ aura::client::SetTooltipClient(root_window_->window(),
+ tooltip_controller_.get());
root_window_->AddPreTargetHandler(tooltip_controller_.get());
if (params.opacity == Widget::InitParams::TRANSLUCENT_WINDOW) {
visibility_controller_.reset(new views::corewm::VisibilityController);
aura::client::SetVisibilityClient(root_window_.get(),
visibility_controller_.get());
- views::corewm::SetChildWindowVisibilityChangesAnimated(root_window_.get());
+ views::corewm::SetChildWindowVisibilityChangesAnimated(
+ root_window_->window());
views::corewm::SetChildWindowVisibilityChangesAnimated(
content_window_container_);
}
@@ -440,7 +443,7 @@ void DesktopNativeWidgetAura::InitNativeWidget(
}
event_client_.reset(new DesktopEventClient);
- aura::client::SetEventClient(root_window_.get(), event_client_.get());
+ aura::client::SetEventClient(root_window_->window(), event_client_.get());
aura::client::GetFocusClient(content_window_)->FocusWindow(content_window_);
@@ -448,7 +451,7 @@ void DesktopNativeWidgetAura::InitNativeWidget(
shadow_controller_.reset(
new corewm::ShadowController(
- aura::client::GetActivationClient(root_window_.get())));
+ aura::client::GetActivationClient(root_window_->window())));
window_reorderer_.reset(new WindowReorderer(content_window_,
GetWidget()->GetRootView()));
@@ -604,7 +607,7 @@ void DesktopNativeWidgetAura::SetBounds(const gfx::Rect& bounds) {
// We could probably get rid of this and similar logic from
// the DesktopNativeWidgetAura::OnRootWindowHostResized function.
float scale = 1;
- aura::RootWindow* root = root_window_.get();
+ aura::Window* root = root_window_->window();
if (root) {
scale = gfx::Screen::GetScreenFor(root)->
GetDisplayNearestWindow(root).device_scale_factor();
@@ -764,7 +767,7 @@ void DesktopNativeWidgetAura::SchedulePaintInRect(const gfx::Rect& rect) {
void DesktopNativeWidgetAura::SetCursor(gfx::NativeCursor cursor) {
cursor_ = cursor;
aura::client::CursorClient* cursor_client =
- aura::client::GetCursorClient(root_window_.get());
+ aura::client::GetCursorClient(root_window_->window());
if (cursor_client)
cursor_client->SetCursor(cursor);
}
@@ -773,7 +776,7 @@ bool DesktopNativeWidgetAura::IsMouseEventsEnabled() const {
if (!content_window_)
return false;
aura::client::CursorClient* cursor_client =
- aura::client::GetCursorClient(root_window_.get());
+ aura::client::GetCursorClient(root_window_->window());
return cursor_client ? cursor_client->IsMouseEventsEnabled() : true;
}
@@ -1054,7 +1057,7 @@ void DesktopNativeWidgetAura::OnRootWindowHostResized(
if (desktop_root_window_host_->IsAnimatingClosed())
return;
- gfx::Rect new_bounds = gfx::Rect(root->bounds().size());
+ gfx::Rect new_bounds = gfx::Rect(root->window()->bounds().size());
content_window_->SetBounds(new_bounds);
// Can be NULL at start.
if (content_window_container_)
@@ -1084,7 +1087,7 @@ void DesktopNativeWidgetAura::InstallInputMethodEventFilter() {
input_method_event_filter_.reset(
new corewm::InputMethodEventFilter(root_window_->GetAcceleratedWidget()));
input_method_event_filter_->SetInputMethodPropertyInRootWindow(
- root_window_.get());
+ root_window_->window());
root_window_event_filter_->AddHandler(input_method_event_filter_.get());
}
diff --git a/ui/views/widget/desktop_aura/desktop_root_window_host_win.cc b/ui/views/widget/desktop_aura/desktop_root_window_host_win.cc
index e531b66..22ad0f2 100644
--- a/ui/views/widget/desktop_aura/desktop_root_window_host_win.cc
+++ b/ui/views/widget/desktop_aura/desktop_root_window_host_win.cc
@@ -76,7 +76,7 @@ DesktopRootWindowHostWin::~DesktopRootWindowHostWin() {
// static
aura::Window* DesktopRootWindowHostWin::GetContentWindowForHWND(HWND hwnd) {
aura::RootWindow* root = aura::RootWindow::GetForAcceleratedWidget(hwnd);
- return root ? root->GetProperty(kContentWindowForRootWindow) : NULL;
+ return root ? root->window()->GetProperty(kContentWindowForRootWindow) : NULL;
}
// static
@@ -130,8 +130,9 @@ void DesktopRootWindowHostWin::OnRootWindowCreated(
const Widget::InitParams& params) {
root_window_ = root;
- root_window_->SetProperty(kContentWindowForRootWindow, content_window_);
- root_window_->SetProperty(kDesktopRootWindowHostKey, this);
+ root_window_->window()->SetProperty(kContentWindowForRootWindow,
+ content_window_);
+ root_window_->window()->SetProperty(kDesktopRootWindowHostKey, this);
should_animate_window_close_ =
content_window_->type() != aura::client::WINDOW_TYPE_NORMAL &&
@@ -150,7 +151,8 @@ scoped_ptr<corewm::Tooltip> DesktopRootWindowHostWin::CreateTooltip() {
scoped_ptr<aura::client::DragDropClient>
DesktopRootWindowHostWin::CreateDragDropClient(
DesktopNativeCursorManager* cursor_manager) {
- drag_drop_client_ = new DesktopDragDropClientWin(root_window_, GetHWND());
+ drag_drop_client_ = new DesktopDragDropClientWin(root_window_->window(),
+ GetHWND());
return scoped_ptr<aura::client::DragDropClient>(drag_drop_client_).Pass();
}
@@ -464,7 +466,7 @@ void DesktopRootWindowHostWin::SetCursor(gfx::NativeCursor cursor) {
bool DesktopRootWindowHostWin::QueryMouseLocation(gfx::Point* location_return) {
aura::client::CursorClient* cursor_client =
- aura::client::GetCursorClient(root_window_);
+ aura::client::GetCursorClient(root_window_->window());
if (cursor_client && !cursor_client->IsMouseEventsEnabled()) {
*location_return = gfx::Point(0, 0);
return false;
@@ -477,7 +479,7 @@ bool DesktopRootWindowHostWin::QueryMouseLocation(gfx::Point* location_return) {
}
bool DesktopRootWindowHostWin::ConfineCursorToRootWindow() {
- RECT window_rect = root_window_->GetBoundsInScreen().ToRECT();
+ RECT window_rect = root_window_->window()->GetBoundsInScreen().ToRECT();
::ClipCursor(&window_rect);
return true;
}
@@ -796,7 +798,7 @@ void DesktopRootWindowHostWin::HandleTouchEvent(
aura::RootWindow::GetForAcceleratedWidget(GetCapture());
if (root) {
DesktopRootWindowHostWin* target =
- root->GetProperty(kDesktopRootWindowHostKey);
+ root->window()->GetProperty(kDesktopRootWindowHostKey);
if (target && target->HasCapture() && target != this) {
POINT target_location(event.location().ToPOINT());
ClientToScreen(GetHWND(), &target_location);
@@ -885,7 +887,7 @@ HWND DesktopRootWindowHostWin::GetHWND() const {
void DesktopRootWindowHostWin::SetWindowTransparency() {
bool transparent = ShouldUseNativeFrame() && !IsFullscreen();
root_window_->compositor()->SetHostHasTransparentBackground(transparent);
- root_window_->SetTransparent(transparent);
+ root_window_->window()->SetTransparent(transparent);
}
bool DesktopRootWindowHostWin::IsModalWindowActive() const {
@@ -895,8 +897,8 @@ bool DesktopRootWindowHostWin::IsModalWindowActive() const {
return false;
aura::Window::Windows::const_iterator index;
- for (index = root_window_->children().begin();
- index != root_window_->children().end();
+ for (index = root_window_->window()->children().begin();
+ index != root_window_->window()->children().end();
++index) {
if ((*index)->GetProperty(aura::client::kModalKey) !=
ui:: MODAL_TYPE_NONE && (*index)->TargetVisibility())
diff --git a/ui/views/widget/desktop_aura/desktop_root_window_host_x11.cc b/ui/views/widget/desktop_aura/desktop_root_window_host_x11.cc
index cd171cb..af9571b 100644
--- a/ui/views/widget/desktop_aura/desktop_root_window_host_x11.cc
+++ b/ui/views/widget/desktop_aura/desktop_root_window_host_x11.cc
@@ -790,7 +790,7 @@ void DesktopRootWindowHostX11::SetCursor(gfx::NativeCursor cursor) {
bool DesktopRootWindowHostX11::QueryMouseLocation(
gfx::Point* location_return) {
aura::client::CursorClient* cursor_client =
- aura::client::GetCursorClient(GetRootWindow());
+ aura::client::GetCursorClient(GetRootWindow()->window());
if (cursor_client && !cursor_client->IsMouseEventsEnabled()) {
*location_return = gfx::Point(0, 0);
return false;
diff --git a/ui/views/widget/native_widget_aura_unittest.cc b/ui/views/widget/native_widget_aura_unittest.cc
index de63a0b..f0f34c7 100644
--- a/ui/views/widget/native_widget_aura_unittest.cc
+++ b/ui/views/widget/native_widget_aura_unittest.cc
@@ -42,7 +42,7 @@ class NativeWidgetAuraTest : public testing::Test {
aura_test_helper_.reset(new aura::test::AuraTestHelper(&message_loop_));
aura_test_helper_->SetUp();
root_window()->SetBounds(gfx::Rect(0, 0, 640, 480));
- root_window()->SetHostSize(gfx::Size(640, 480));
+ dispatcher()->SetHostSize(gfx::Size(640, 480));
}
virtual void TearDown() OVERRIDE {
message_loop_.RunUntilIdle();
@@ -50,7 +50,8 @@ class NativeWidgetAuraTest : public testing::Test {
}
protected:
- aura::RootWindow* root_window() { return aura_test_helper_->root_window(); }
+ aura::Window* root_window() { return aura_test_helper_->root_window(); }
+ aura::RootWindow* dispatcher() { return aura_test_helper_->dispatcher(); }
private:
base::MessageLoopForUI message_loop_;
@@ -257,7 +258,7 @@ TEST_F(NativeWidgetAuraTest, DontCaptureOnGesture) {
ui::TouchEvent press(ui::ET_TOUCH_PRESSED, gfx::Point(41, 51), 1,
base::TimeDelta());
- root_window()->AsRootWindowHostDelegate()->OnHostTouchEvent(&press);
+ dispatcher()->AsRootWindowHostDelegate()->OnHostTouchEvent(&press);
// Both views should get the press.
EXPECT_TRUE(view->got_gesture_event());
EXPECT_TRUE(child->got_gesture_event());
@@ -270,7 +271,7 @@ TEST_F(NativeWidgetAuraTest, DontCaptureOnGesture) {
// the press.
ui::TouchEvent release(ui::ET_TOUCH_RELEASED, gfx::Point(250, 251), 1,
base::TimeDelta());
- root_window()->AsRootWindowHostDelegate()->OnHostTouchEvent(&release);
+ dispatcher()->AsRootWindowHostDelegate()->OnHostTouchEvent(&release);
EXPECT_TRUE(view->got_gesture_event());
EXPECT_FALSE(child->got_gesture_event());
view->clear_got_gesture_event();
@@ -293,7 +294,7 @@ TEST_F(NativeWidgetAuraTest, ReleaseCaptureOnTouchRelease) {
ui::TouchEvent press(ui::ET_TOUCH_PRESSED, gfx::Point(41, 51), 1,
base::TimeDelta());
- root_window()->AsRootWindowHostDelegate()->OnHostTouchEvent(&press);
+ dispatcher()->AsRootWindowHostDelegate()->OnHostTouchEvent(&press);
EXPECT_TRUE(view->got_gesture_event());
view->clear_got_gesture_event();
// Set the capture.
@@ -303,7 +304,7 @@ TEST_F(NativeWidgetAuraTest, ReleaseCaptureOnTouchRelease) {
// Generate a release, this should trigger releasing capture.
ui::TouchEvent release(ui::ET_TOUCH_RELEASED, gfx::Point(41, 51), 1,
base::TimeDelta());
- root_window()->AsRootWindowHostDelegate()->OnHostTouchEvent(&release);
+ dispatcher()->AsRootWindowHostDelegate()->OnHostTouchEvent(&release);
EXPECT_TRUE(view->got_gesture_event());
view->clear_got_gesture_event();
EXPECT_FALSE(widget->HasCapture());