OLD | NEW |
1 // Copyright 2013 The Chromium Authors. All rights reserved. | 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 | 2 // Use of this source code is governed by a BSD-style license that can be |
3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
4 | 4 |
5 #ifndef CONTENT_RENDERER_INPUT_INPUT_HANDLER_MANAGER_H_ | 5 #ifndef CONTENT_RENDERER_INPUT_INPUT_HANDLER_MANAGER_H_ |
6 #define CONTENT_RENDERER_INPUT_INPUT_HANDLER_MANAGER_H_ | 6 #define CONTENT_RENDERER_INPUT_INPUT_HANDLER_MANAGER_H_ |
7 | 7 |
8 #include "base/containers/scoped_ptr_hash_map.h" | 8 #include "base/containers/scoped_ptr_hash_map.h" |
9 #include "base/memory/ref_counted.h" | 9 #include "base/memory/ref_counted.h" |
10 #include "base/memory/weak_ptr.h" | 10 #include "base/memory/weak_ptr.h" |
11 #include "content/common/content_export.h" | 11 #include "content/common/content_export.h" |
12 #include "content/common/input/input_event_ack_state.h" | 12 #include "content/common/input/input_event_ack_state.h" |
13 #include "content/renderer/render_view_impl.h" | 13 #include "content/renderer/render_view_impl.h" |
| 14 #include "ui/events/blink/input_handler_proxy.h" |
14 | 15 |
15 namespace base { | 16 namespace base { |
16 class SingleThreadTaskRunner; | 17 class SingleThreadTaskRunner; |
17 } | 18 } |
18 | 19 |
19 namespace cc { | 20 namespace cc { |
20 class InputHandler; | 21 class InputHandler; |
21 struct InputHandlerScrollResult; | 22 struct InputHandlerScrollResult; |
22 } | 23 } |
23 | 24 |
(...skipping 48 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
72 const cc::InputHandlerScrollResult& scroll_result); | 73 const cc::InputHandlerScrollResult& scroll_result); |
73 | 74 |
74 void NotifyInputEventHandledOnMainThread(int routing_id, | 75 void NotifyInputEventHandledOnMainThread(int routing_id, |
75 blink::WebInputEvent::Type, | 76 blink::WebInputEvent::Type, |
76 InputEventAckState); | 77 InputEventAckState); |
77 void ProcessRafAlignedInputOnMainThread(int routing_id); | 78 void ProcessRafAlignedInputOnMainThread(int routing_id); |
78 | 79 |
79 // Callback only from the compositor's thread. | 80 // Callback only from the compositor's thread. |
80 void RemoveInputHandler(int routing_id); | 81 void RemoveInputHandler(int routing_id); |
81 | 82 |
| 83 using InputEventAckStateCallback = |
| 84 base::Callback<void(InputEventAckState, |
| 85 ui::ScopedWebInputEvent, |
| 86 const ui::LatencyInfo&, |
| 87 std::unique_ptr<ui::DidOverscrollParams>)>; |
82 // Called from the compositor's thread. | 88 // Called from the compositor's thread. |
83 virtual InputEventAckState HandleInputEvent( | 89 virtual void HandleInputEvent(int routing_id, |
84 int routing_id, | 90 ui::ScopedWebInputEvent input_event, |
85 const blink::WebInputEvent* input_event, | 91 const ui::LatencyInfo& latency_info, |
86 ui::LatencyInfo* latency_info); | 92 const InputEventAckStateCallback& callback); |
87 | 93 |
88 // Called from the compositor's thread. | 94 // Called from the compositor's thread. |
89 void DidOverscroll(int routing_id, const ui::DidOverscrollParams& params); | 95 void DidOverscroll(int routing_id, const ui::DidOverscrollParams& params); |
90 | 96 |
91 // Called from the compositor's thread. | 97 // Called from the compositor's thread. |
92 void DidStartFlinging(int routing_id); | 98 void DidStartFlinging(int routing_id); |
93 void DidStopFlinging(int routing_id); | 99 void DidStopFlinging(int routing_id); |
94 | 100 |
95 // Called from the compositor's thread. | 101 // Called from the compositor's thread. |
96 void DidAnimateForInput(); | 102 void DidAnimateForInput(); |
(...skipping 16 matching lines...) Expand all Loading... |
113 void ObserveWheelEventAndResultOnCompositorThread( | 119 void ObserveWheelEventAndResultOnCompositorThread( |
114 int routing_id, | 120 int routing_id, |
115 const blink::WebMouseWheelEvent& wheel_event, | 121 const blink::WebMouseWheelEvent& wheel_event, |
116 const cc::InputHandlerScrollResult& scroll_result); | 122 const cc::InputHandlerScrollResult& scroll_result); |
117 | 123 |
118 void ObserveGestureEventAndResultOnCompositorThread( | 124 void ObserveGestureEventAndResultOnCompositorThread( |
119 int routing_id, | 125 int routing_id, |
120 const blink::WebGestureEvent& gesture_event, | 126 const blink::WebGestureEvent& gesture_event, |
121 const cc::InputHandlerScrollResult& scroll_result); | 127 const cc::InputHandlerScrollResult& scroll_result); |
122 | 128 |
| 129 void DidHandleInputEventAndOverscroll( |
| 130 const InputEventAckStateCallback& callback, |
| 131 ui::InputHandlerProxy::EventDisposition event_disposition, |
| 132 ui::ScopedWebInputEvent input_event, |
| 133 const ui::LatencyInfo& latency_info, |
| 134 std::unique_ptr<ui::DidOverscrollParams> overscroll_params); |
| 135 |
123 typedef base::ScopedPtrHashMap<int, // routing_id | 136 typedef base::ScopedPtrHashMap<int, // routing_id |
124 std::unique_ptr<InputHandlerWrapper>> | 137 std::unique_ptr<InputHandlerWrapper>> |
125 InputHandlerMap; | 138 InputHandlerMap; |
126 InputHandlerMap input_handlers_; | 139 InputHandlerMap input_handlers_; |
127 | 140 |
128 const scoped_refptr<base::SingleThreadTaskRunner> task_runner_; | 141 const scoped_refptr<base::SingleThreadTaskRunner> task_runner_; |
129 InputHandlerManagerClient* const client_; | 142 InputHandlerManagerClient* const client_; |
130 // May be null. | 143 // May be null. |
131 SynchronousInputHandlerProxyClient* const synchronous_handler_proxy_client_; | 144 SynchronousInputHandlerProxyClient* const synchronous_handler_proxy_client_; |
132 blink::scheduler::RendererScheduler* const renderer_scheduler_; // Not owned. | 145 blink::scheduler::RendererScheduler* const renderer_scheduler_; // Not owned. |
| 146 |
| 147 base::WeakPtrFactory<InputHandlerManager> weak_ptr_factory_; |
133 }; | 148 }; |
134 | 149 |
135 } // namespace content | 150 } // namespace content |
136 | 151 |
137 #endif // CONTENT_RENDERER_INPUT_INPUT_HANDLER_MANAGER_H_ | 152 #endif // CONTENT_RENDERER_INPUT_INPUT_HANDLER_MANAGER_H_ |
OLD | NEW |