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 class BlimpInputManager; |
| 16 |
| 17 // This class is created and lives on the compositor thread. |
| 18 class BlimpInputHandlerWrapper : public ui::InputHandlerProxyClient { |
| 19 public: |
| 20 BlimpInputHandlerWrapper( |
| 21 scoped_refptr<base::SingleThreadTaskRunner> main_task_runner, |
| 22 const base::WeakPtr<BlimpInputManager> input_manager_weak_ptr, |
| 23 cc::InputHandler* input_handler); |
| 24 |
| 25 ~BlimpInputHandlerWrapper() override; |
| 26 |
| 27 void HandleWebInputEvent(const blink::WebInputEvent& input_event); |
| 28 |
| 29 private: |
| 30 // InputHandlerProxyClient implementation. |
| 31 void WillShutdown() override; |
| 32 void TransferActiveWheelFlingAnimation( |
| 33 const blink::WebActiveWheelFlingParameters& params) override; |
| 34 blink::WebGestureCurve* CreateFlingAnimationCurve( |
| 35 blink::WebGestureDevice device_source, |
| 36 const blink::WebFloatPoint& velocity, |
| 37 const blink::WebSize& cumulative_scroll) override; |
| 38 void DidOverscroll(const gfx::Vector2dF& accumulated_overscroll, |
| 39 const gfx::Vector2dF& latest_overscroll_delta, |
| 40 const gfx::Vector2dF& current_fling_velocity, |
| 41 const gfx::PointF& causal_event_viewport_point) override; |
| 42 void DidStopFlinging() override; |
| 43 void DidAnimateForInput() override; |
| 44 |
| 45 base::ThreadChecker compositor_thread_checker_; |
| 46 |
| 47 scoped_refptr<base::SingleThreadTaskRunner> main_task_runner_; |
| 48 |
| 49 // Used to queue calls to the BlimpInputManager to be run on the main |
| 50 // thread. This ensures that any tasks queued are abandoned after the |
| 51 // BlimpInputManager is destroyed. |
| 52 base::WeakPtr<BlimpInputManager> input_manager_weak_ptr_; |
| 53 |
| 54 scoped_ptr<ui::InputHandlerProxy> input_handler_proxy_; |
| 55 |
| 56 DISALLOW_COPY_AND_ASSIGN(BlimpInputHandlerWrapper); |
| 57 }; |
| 58 |
| 59 } // namespace blimp |
| 60 |
| 61 #endif // BLIMP_CLIENT_INPUT_BLIMP_INPUT_HANDLER_WRAPPER_H_ |
OLD | NEW |