OLD | NEW |
| (Empty) |
1 // Copyright 2011 The Chromium Authors. All rights reserved. | |
2 // Use of this source code is governed by a BSD-style license that can be | |
3 // found in the LICENSE file. | |
4 | |
5 #ifndef BLIMP_CLIENT_INPUT_BLIMP_INPUT_HANDLER_WRAPPER_H_ | |
6 #define BLIMP_CLIENT_INPUT_BLIMP_INPUT_HANDLER_WRAPPER_H_ | |
7 | |
8 #include "base/macros.h" | |
9 #include "base/single_thread_task_runner.h" | |
10 #include "base/threading/thread_checker.h" | |
11 #include "ui/events/blink/input_handler_proxy.h" | |
12 #include "ui/events/blink/input_handler_proxy_client.h" | |
13 | |
14 namespace blimp { | |
15 namespace client { | |
16 | |
17 class BlimpInputManager; | |
18 | |
19 // The BlimpInputHandlerWrapper isolates all input handling processing done on | |
20 // the compositor thread from the BlimpInputManager. It takes web input events | |
21 // from the BlimpInputManager and sends them to the ui::InputHandlerProxy. | |
22 // The class is created and lives on the compositor thread. | |
23 class BlimpInputHandlerWrapper : public ui::InputHandlerProxyClient { | |
24 public: | |
25 BlimpInputHandlerWrapper( | |
26 scoped_refptr<base::SingleThreadTaskRunner> main_task_runner, | |
27 const base::WeakPtr<BlimpInputManager> input_manager_weak_ptr, | |
28 cc::InputHandler* input_handler); | |
29 | |
30 ~BlimpInputHandlerWrapper() override; | |
31 | |
32 // Called by the BlimpInputManager to process a web input event. This will | |
33 // call BlimpInputManager::HandleWebInputEvent with the result on the main | |
34 // thread. | |
35 void HandleWebInputEvent(scoped_ptr<blink::WebInputEvent> input_event); | |
36 | |
37 private: | |
38 // InputHandlerProxyClient implementation. | |
39 void WillShutdown() override; | |
40 void TransferActiveWheelFlingAnimation( | |
41 const blink::WebActiveWheelFlingParameters& params) override; | |
42 blink::WebGestureCurve* CreateFlingAnimationCurve( | |
43 blink::WebGestureDevice device_source, | |
44 const blink::WebFloatPoint& velocity, | |
45 const blink::WebSize& cumulative_scroll) override; | |
46 void DidOverscroll(const gfx::Vector2dF& accumulated_overscroll, | |
47 const gfx::Vector2dF& latest_overscroll_delta, | |
48 const gfx::Vector2dF& current_fling_velocity, | |
49 const gfx::PointF& causal_event_viewport_point) override; | |
50 void DidStopFlinging() override; | |
51 void DidAnimateForInput() override; | |
52 | |
53 base::ThreadChecker compositor_thread_checker_; | |
54 | |
55 scoped_refptr<base::SingleThreadTaskRunner> main_task_runner_; | |
56 | |
57 // Used to queue calls to the BlimpInputManager to be run on the main | |
58 // thread. This ensures that any tasks queued are abandoned after the | |
59 // BlimpInputManager is destroyed. | |
60 base::WeakPtr<BlimpInputManager> input_manager_weak_ptr_; | |
61 | |
62 scoped_ptr<ui::InputHandlerProxy> input_handler_proxy_; | |
63 | |
64 DISALLOW_COPY_AND_ASSIGN(BlimpInputHandlerWrapper); | |
65 }; | |
66 | |
67 } // namespace client | |
68 } // namespace blimp | |
69 | |
70 #endif // BLIMP_CLIENT_INPUT_BLIMP_INPUT_HANDLER_WRAPPER_H_ | |
OLD | NEW |