1 // Copyright 2013 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.
5 #include "content/renderer/input/input_handler_wrapper.h"
7 #include "base/message_loop/message_loop_proxy.h"
8 #include "content/renderer/input/input_event_filter.h"
9 #include "content/renderer/input/input_handler_manager.h"
10 #include "third_party/WebKit/public/platform/Platform.h"
14 InputHandlerWrapper::InputHandlerWrapper(
15 InputHandlerManager
* input_handler_manager
,
17 const scoped_refptr
<base::MessageLoopProxy
>& main_loop
,
18 const base::WeakPtr
<cc::InputHandler
>& input_handler
,
19 const base::WeakPtr
<RenderViewImpl
>& render_view_impl
)
20 : input_handler_manager_(input_handler_manager
),
21 routing_id_(routing_id
),
22 input_handler_proxy_(input_handler
.get(), this),
23 main_loop_(main_loop
),
24 render_view_impl_(render_view_impl
) {
25 DCHECK(input_handler
);
28 InputHandlerWrapper::~InputHandlerWrapper() {
31 void InputHandlerWrapper::TransferActiveWheelFlingAnimation(
32 const blink::WebActiveWheelFlingParameters
& params
) {
35 base::Bind(&RenderViewImpl::TransferActiveWheelFlingAnimation
,
40 void InputHandlerWrapper::WillShutdown() {
41 input_handler_manager_
->RemoveInputHandler(routing_id_
);
44 blink::WebGestureCurve
* InputHandlerWrapper::CreateFlingAnimationCurve(
45 blink::WebGestureDevice deviceSource
,
46 const blink::WebFloatPoint
& velocity
,
47 const blink::WebSize
& cumulative_scroll
) {
48 return blink::Platform::current()->createFlingAnimationCurve(
49 deviceSource
, velocity
, cumulative_scroll
);
52 void InputHandlerWrapper::DidOverscroll(const DidOverscrollParams
& params
) {
53 input_handler_manager_
->DidOverscroll(routing_id_
, params
);
56 void InputHandlerWrapper::DidStopFlinging() {
57 input_handler_manager_
->DidStopFlinging(routing_id_
);
60 void InputHandlerWrapper::DidReceiveInputEvent(
61 const blink::WebInputEvent
& web_input_event
) {
62 input_handler_manager_
->DidReceiveInputEvent(web_input_event
);
65 void InputHandlerWrapper::DidAnimateForInput() {
66 input_handler_manager_
->DidAnimateForInput();
69 } // namespace content