Home | History | Annotate | Download | only in input
      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.
      4 
      5 #include "content/renderer/input/input_handler_wrapper.h"
      6 
      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"
     11 
     12 namespace content {
     13 
     14 InputHandlerWrapper::InputHandlerWrapper(
     15     InputHandlerManager* input_handler_manager,
     16     int routing_id,
     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()),
     23       main_loop_(main_loop),
     24       render_view_impl_(render_view_impl) {
     25   DCHECK(input_handler);
     26   input_handler_proxy_.SetClient(this);
     27 }
     28 
     29 InputHandlerWrapper::~InputHandlerWrapper() {
     30   input_handler_proxy_.SetClient(NULL);
     31 }
     32 
     33 void InputHandlerWrapper::TransferActiveWheelFlingAnimation(
     34     const blink::WebActiveWheelFlingParameters& params) {
     35   main_loop_->PostTask(
     36       FROM_HERE,
     37       base::Bind(&RenderViewImpl::TransferActiveWheelFlingAnimation,
     38                  render_view_impl_,
     39                  params));
     40 }
     41 
     42 void InputHandlerWrapper::WillShutdown() {
     43   input_handler_manager_->RemoveInputHandler(routing_id_);
     44 }
     45 
     46 blink::WebGestureCurve* InputHandlerWrapper::CreateFlingAnimationCurve(
     47     int deviceSource,
     48     const blink::WebFloatPoint& velocity,
     49     const blink::WebSize& cumulative_scroll) {
     50   return blink::Platform::current()->createFlingAnimationCurve(
     51       deviceSource, velocity, cumulative_scroll);
     52 }
     53 
     54 void InputHandlerWrapper::DidOverscroll(const cc::DidOverscrollParams& params) {
     55   input_handler_manager_->DidOverscroll(routing_id_, params);
     56 }
     57 
     58 }  // namespace content
     59