blob: 178df2631c6570a0e25c7fd4f9c6e54117b56446 [file] [log] [blame]
[email protected]7a72d452013-12-13 10:01:131// Copyright 2013 The Chromium Authors. All rights reserved.
[email protected]200a9c062013-05-20 04:34:372// Use of this source code is governed by a BSD-style license that can be
3// found in the LICENSE file.
4
[email protected]7a72d452013-12-13 10:01:135#ifndef CONTENT_RENDERER_INPUT_INPUT_HANDLER_WRAPPER_H_
6#define CONTENT_RENDERER_INPUT_INPUT_HANDLER_WRAPPER_H_
[email protected]200a9c062013-05-20 04:34:377
avi1023d012015-12-25 02:39:148#include "base/macros.h"
[email protected]200a9c062013-05-20 04:34:379#include "base/memory/weak_ptr.h"
skyostil2d3b5bd2015-05-27 15:40:5910#include "base/single_thread_task_runner.h"
[email protected]7a72d452013-12-13 10:01:1311#include "content/renderer/input/input_handler_manager.h"
khushalsagar3a8d0562015-11-23 22:50:3612#include "ui/events/blink/input_handler_proxy.h"
13#include "ui/events/blink/input_handler_proxy_client.h"
14
15namespace ui {
16class InputHandlerProxy;
17class InputHandlerProxyClient;
18}
[email protected]200a9c062013-05-20 04:34:3719
20namespace content {
21
22// This class lives on the compositor thread.
khushalsagar3a8d0562015-11-23 22:50:3623class InputHandlerWrapper : public ui::InputHandlerProxyClient {
[email protected]200a9c062013-05-20 04:34:3724 public:
skyostil2d3b5bd2015-05-27 15:40:5925 InputHandlerWrapper(
26 InputHandlerManager* input_handler_manager,
27 int routing_id,
28 const scoped_refptr<base::SingleThreadTaskRunner>& main_task_runner,
29 const base::WeakPtr<cc::InputHandler>& input_handler,
wjmaclean1d970622017-01-21 22:28:2430 const base::WeakPtr<RenderWidget>& render_widget,
dtapuskae7dd21de2016-06-09 13:41:5631 bool enable_smooth_scrolling);
dcheng6d18e402014-10-21 12:32:5232 ~InputHandlerWrapper() override;
[email protected]200a9c062013-05-20 04:34:3733
34 int routing_id() const { return routing_id_; }
khushalsagar3a8d0562015-11-23 22:50:3635 ui::InputHandlerProxy* input_handler_proxy() {
36 return &input_handler_proxy_;
37 }
[email protected]200a9c062013-05-20 04:34:3738
dtapuska3d5624d32016-08-30 04:34:0039 void NeedsMainFrame();
40
[email protected]200a9c062013-05-20 04:34:3741 // InputHandlerProxyClient implementation.
dcheng6d18e402014-10-21 12:32:5242 void WillShutdown() override;
43 void TransferActiveWheelFlingAnimation(
mohan.reddyee0b42a2014-10-08 04:53:1444 const blink::WebActiveWheelFlingParameters& params) override;
dtapuska1bcb284c42016-09-20 22:12:4845 void DispatchNonBlockingEventToMainThread(
jam013b74c82017-02-10 16:36:1046 ui::WebScopedInputEvent event,
dtapuska1bcb284c42016-09-20 22:12:4847 const ui::LatencyInfo& latency_info) override;
altimineb6bd1962017-05-03 14:52:3848 std::unique_ptr<blink::WebGestureCurve> CreateFlingAnimationCurve(
[email protected]8ec812e32014-06-03 21:53:3349 blink::WebGestureDevice deviceSource,
[email protected]180ef242013-11-07 06:50:4650 const blink::WebFloatPoint& velocity,
mohan.reddyee0b42a2014-10-08 04:53:1451 const blink::WebSize& cumulativeScroll) override;
chongz78f276e2016-09-10 01:08:5052 void DidOverscroll(const gfx::Vector2dF& accumulated_overscroll,
53 const gfx::Vector2dF& latest_overscroll_delta,
54 const gfx::Vector2dF& current_fling_velocity,
55 const gfx::PointF& causal_event_viewport_point) override;
dcheng6d18e402014-10-21 12:32:5256 void DidStopFlinging() override;
alexclarke3722366b2014-11-11 09:52:2257 void DidAnimateForInput() override;
sahel42f43cb2017-05-11 17:58:3158 void GenerateScrollBeginAndSendToMainThread(
59 const blink::WebGestureEvent& update_event) override;
[email protected]200a9c062013-05-20 04:34:3760
61 private:
[email protected]200a9c062013-05-20 04:34:3762 InputHandlerManager* input_handler_manager_;
63 int routing_id_;
khushalsagar3a8d0562015-11-23 22:50:3664 ui::InputHandlerProxy input_handler_proxy_;
skyostil2d3b5bd2015-05-27 15:40:5965 scoped_refptr<base::SingleThreadTaskRunner> main_task_runner_;
[email protected]200a9c062013-05-20 04:34:3766
67 // Can only be accessed on the main thread.
wjmaclean1d970622017-01-21 22:28:2468 base::WeakPtr<RenderWidget> render_widget_;
[email protected]200a9c062013-05-20 04:34:3769
70 DISALLOW_COPY_AND_ASSIGN(InputHandlerWrapper);
71};
72
73} // namespace content
74
[email protected]7a72d452013-12-13 10:01:1375#endif // CONTENT_RENDERER_INPUT_INPUT_HANDLER_WRAPPER_H_