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 2324 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2335 class AsyncWindowDelegate : public test::TestWindowDelegate { | 2335 class AsyncWindowDelegate : public test::TestWindowDelegate { |
2336 public: | 2336 public: |
2337 AsyncWindowDelegate(WindowEventDispatcher* dispatcher) | 2337 AsyncWindowDelegate(WindowEventDispatcher* dispatcher) |
2338 : dispatcher_(dispatcher) {} | 2338 : dispatcher_(dispatcher) {} |
2339 | 2339 |
2340 void set_window(Window* window) { | 2340 void set_window(Window* window) { |
2341 window_ = window; | 2341 window_ = window; |
2342 } | 2342 } |
2343 private: | 2343 private: |
2344 virtual void OnTouchEvent(ui::TouchEvent* event) override { | 2344 virtual void OnTouchEvent(ui::TouchEvent* event) override { |
2345 // Convert touch event back to root window coordinates. | |
2346 event->ConvertLocationToTarget(window_, window_->GetRootWindow()); | |
2347 dispatcher_->ProcessedTouchEvent(event, window_, ui::ER_UNHANDLED); | |
2348 event->StopPropagation(); | 2345 event->StopPropagation(); |
| 2346 if (dispatcher_->OnProcessingTouchEventAsync(event)) |
| 2347 dispatcher_->ProcessedTouchEvent(event, window_, ui::ER_UNHANDLED); |
2349 } | 2348 } |
2350 | 2349 |
2351 WindowEventDispatcher* dispatcher_; | 2350 WindowEventDispatcher* dispatcher_; |
2352 Window* window_; | 2351 Window* window_; |
2353 | 2352 |
2354 DISALLOW_COPY_AND_ASSIGN(AsyncWindowDelegate); | 2353 DISALLOW_COPY_AND_ASSIGN(AsyncWindowDelegate); |
2355 }; | 2354 }; |
2356 | 2355 |
2357 // Tests that gesture events dispatched through the asynchronous flow have | 2356 // Tests that gesture events dispatched through the asynchronous flow have |
2358 // co-ordinates in the right co-ordinate space. | 2357 // co-ordinates in the right co-ordinate space. |
(...skipping 23 matching lines...) Expand all Loading... |
2382 ASSERT_EQ(1u, recorder.touch_locations().size()); | 2381 ASSERT_EQ(1u, recorder.touch_locations().size()); |
2383 EXPECT_EQ(gfx::Point(kX - kWindowOffset, kY - kWindowOffset).ToString(), | 2382 EXPECT_EQ(gfx::Point(kX - kWindowOffset, kY - kWindowOffset).ToString(), |
2384 recorder.touch_locations()[0].ToString()); | 2383 recorder.touch_locations()[0].ToString()); |
2385 | 2384 |
2386 ASSERT_EQ(2u, recorder.gesture_locations().size()); | 2385 ASSERT_EQ(2u, recorder.gesture_locations().size()); |
2387 EXPECT_EQ(gfx::Point(kX - kWindowOffset, kY - kWindowOffset).ToString(), | 2386 EXPECT_EQ(gfx::Point(kX - kWindowOffset, kY - kWindowOffset).ToString(), |
2388 recorder.gesture_locations()[0].ToString()); | 2387 recorder.gesture_locations()[0].ToString()); |
2389 } | 2388 } |
2390 | 2389 |
2391 } // namespace aura | 2390 } // namespace aura |
OLD | NEW |