Upstream version 7.36.149.0
[platform/framework/web/crosswalk.git] / src / content / renderer / input / input_handler_wrapper.h
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 #ifndef CONTENT_RENDERER_INPUT_INPUT_HANDLER_WRAPPER_H_
6 #define CONTENT_RENDERER_INPUT_INPUT_HANDLER_WRAPPER_H_
7
8 #include "base/memory/weak_ptr.h"
9 #include "content/renderer/input/input_handler_manager.h"
10 #include "content/renderer/input/input_handler_proxy.h"
11 #include "content/renderer/input/input_handler_proxy_client.h"
12
13 namespace content {
14
15 // This class lives on the compositor thread.
16 class InputHandlerWrapper : public InputHandlerProxyClient {
17  public:
18   InputHandlerWrapper(InputHandlerManager* input_handler_manager,
19                       int routing_id,
20                       const scoped_refptr<base::MessageLoopProxy>& main_loop,
21                       const base::WeakPtr<cc::InputHandler>& input_handler,
22                       const base::WeakPtr<RenderViewImpl>& render_view_impl);
23   virtual ~InputHandlerWrapper();
24
25   int routing_id() const { return routing_id_; }
26   InputHandlerProxy* input_handler_proxy() { return &input_handler_proxy_; }
27
28   // InputHandlerProxyClient implementation.
29   virtual void WillShutdown() OVERRIDE;
30   virtual void TransferActiveWheelFlingAnimation(
31       const blink::WebActiveWheelFlingParameters& params) OVERRIDE;
32   virtual blink::WebGestureCurve* CreateFlingAnimationCurve(
33       int deviceSource,
34       const blink::WebFloatPoint& velocity,
35       const blink::WebSize& cumulativeScroll) OVERRIDE;
36   virtual void DidOverscroll(const DidOverscrollParams& params) OVERRIDE;
37   virtual void DidStopFlinging() OVERRIDE;
38
39  private:
40   InputHandlerManager* input_handler_manager_;
41   int routing_id_;
42   InputHandlerProxy input_handler_proxy_;
43   scoped_refptr<base::MessageLoopProxy> main_loop_;
44
45   // Can only be accessed on the main thread.
46   base::WeakPtr<RenderViewImpl> render_view_impl_;
47
48   DISALLOW_COPY_AND_ASSIGN(InputHandlerWrapper);
49 };
50
51 }  // namespace content
52
53 #endif  // CONTENT_RENDERER_INPUT_INPUT_HANDLER_WRAPPER_H_