| OLD | NEW |
| 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. |
| 2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
| 3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
| 4 | 4 |
| 5 #include "ui/aura/window_event_dispatcher.h" | 5 #include "ui/aura/window_event_dispatcher.h" |
| 6 | 6 |
| 7 #include <vector> | 7 #include <vector> |
| 8 | 8 |
| 9 #include "base/bind.h" | 9 #include "base/bind.h" |
| 10 #include "base/run_loop.h" | 10 #include "base/run_loop.h" |
| (...skipping 2302 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2313 class AsyncWindowDelegate : public test::TestWindowDelegate { | 2313 class AsyncWindowDelegate : public test::TestWindowDelegate { |
| 2314 public: | 2314 public: |
| 2315 AsyncWindowDelegate(WindowEventDispatcher* dispatcher) | 2315 AsyncWindowDelegate(WindowEventDispatcher* dispatcher) |
| 2316 : dispatcher_(dispatcher) {} | 2316 : dispatcher_(dispatcher) {} |
| 2317 | 2317 |
| 2318 void set_window(Window* window) { | 2318 void set_window(Window* window) { |
| 2319 window_ = window; | 2319 window_ = window; |
| 2320 } | 2320 } |
| 2321 private: | 2321 private: |
| 2322 virtual void OnTouchEvent(ui::TouchEvent* event) override { | 2322 virtual void OnTouchEvent(ui::TouchEvent* event) override { |
| 2323 // Convert touch event back to root window coordinates. | |
| 2324 event->ConvertLocationToTarget(window_, window_->GetRootWindow()); | |
| 2325 dispatcher_->ProcessedTouchEvent(event, window_, ui::ER_UNHANDLED); | |
| 2326 event->StopPropagation(); | 2323 event->StopPropagation(); |
| 2324 if (dispatcher_->OnForwardingAsyncTouchEvent(event)) |
| 2325 dispatcher_->ProcessedTouchEvent(event, window_, ui::ER_UNHANDLED); |
| 2327 } | 2326 } |
| 2328 | 2327 |
| 2329 WindowEventDispatcher* dispatcher_; | 2328 WindowEventDispatcher* dispatcher_; |
| 2330 Window* window_; | 2329 Window* window_; |
| 2331 | 2330 |
| 2332 DISALLOW_COPY_AND_ASSIGN(AsyncWindowDelegate); | 2331 DISALLOW_COPY_AND_ASSIGN(AsyncWindowDelegate); |
| 2333 }; | 2332 }; |
| 2334 | 2333 |
| 2335 // Tests that gesture events dispatched through the asynchronous flow have | 2334 // Tests that gesture events dispatched through the asynchronous flow have |
| 2336 // co-ordinates in the right co-ordinate space. | 2335 // co-ordinates in the right co-ordinate space. |
| (...skipping 23 matching lines...) Expand all Loading... |
| 2360 ASSERT_EQ(1u, recorder.touch_locations().size()); | 2359 ASSERT_EQ(1u, recorder.touch_locations().size()); |
| 2361 EXPECT_EQ(gfx::Point(kX - kWindowOffset, kY - kWindowOffset).ToString(), | 2360 EXPECT_EQ(gfx::Point(kX - kWindowOffset, kY - kWindowOffset).ToString(), |
| 2362 recorder.touch_locations()[0].ToString()); | 2361 recorder.touch_locations()[0].ToString()); |
| 2363 | 2362 |
| 2364 ASSERT_EQ(2u, recorder.gesture_locations().size()); | 2363 ASSERT_EQ(2u, recorder.gesture_locations().size()); |
| 2365 EXPECT_EQ(gfx::Point(kX - kWindowOffset, kY - kWindowOffset).ToString(), | 2364 EXPECT_EQ(gfx::Point(kX - kWindowOffset, kY - kWindowOffset).ToString(), |
| 2366 recorder.gesture_locations()[0].ToString()); | 2365 recorder.gesture_locations()[0].ToString()); |
| 2367 } | 2366 } |
| 2368 | 2367 |
| 2369 } // namespace aura | 2368 } // namespace aura |
| OLD | NEW |