| 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" |
| (...skipping 64 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 75 void NotifyInputEventHandledOnMainThread(int routing_id, | 75 void NotifyInputEventHandledOnMainThread(int routing_id, |
| 76 blink::WebInputEvent::Type, | 76 blink::WebInputEvent::Type, |
| 77 InputEventAckState); | 77 InputEventAckState); |
| 78 void ProcessRafAlignedInputOnMainThread(int routing_id); | 78 void ProcessRafAlignedInputOnMainThread(int routing_id); |
| 79 | 79 |
| 80 // Callback only from the compositor's thread. | 80 // Callback only from the compositor's thread. |
| 81 void RemoveInputHandler(int routing_id); | 81 void RemoveInputHandler(int routing_id); |
| 82 | 82 |
| 83 using InputEventAckStateCallback = | 83 using InputEventAckStateCallback = |
| 84 base::Callback<void(InputEventAckState, | 84 base::Callback<void(InputEventAckState, |
| 85 ui::ScopedWebInputEvent, | 85 blink::ScopedCoalescedWebInputEvent, |
| 86 const ui::LatencyInfo&, | 86 const ui::LatencyInfo&, |
| 87 std::unique_ptr<ui::DidOverscrollParams>)>; | 87 std::unique_ptr<ui::DidOverscrollParams>)>; |
| 88 // Called from the compositor's thread. | 88 // Called from the compositor's thread. |
| 89 virtual void HandleInputEvent(int routing_id, | 89 virtual void HandleInputEvent(int routing_id, |
| 90 ui::ScopedWebInputEvent input_event, | 90 blink::ScopedCoalescedWebInputEvent input_event, |
| 91 const ui::LatencyInfo& latency_info, | 91 const ui::LatencyInfo& latency_info, |
| 92 const InputEventAckStateCallback& callback); | 92 const InputEventAckStateCallback& callback); |
| 93 | 93 |
| 94 // Called from the compositor's thread. | 94 // Called from the compositor's thread. |
| 95 void DidOverscroll(int routing_id, const ui::DidOverscrollParams& params); | 95 void DidOverscroll(int routing_id, const ui::DidOverscrollParams& params); |
| 96 | 96 |
| 97 // Called from the compositor's thread. | 97 // Called from the compositor's thread. |
| 98 void DidStopFlinging(int routing_id); | 98 void DidStopFlinging(int routing_id); |
| 99 | 99 |
| 100 // Called from the compositor's thread. | 100 // Called from the compositor's thread. |
| 101 void DidAnimateForInput(); | 101 void DidAnimateForInput(); |
| 102 | 102 |
| 103 // Called from the compositor's thread. | 103 // Called from the compositor's thread. |
| 104 void NeedsMainFrame(int routing_id); | 104 void NeedsMainFrame(int routing_id); |
| 105 | 105 |
| 106 // Called from the compositor's thread. | 106 // Called from the compositor's thread. |
| 107 void DispatchNonBlockingEventToMainThread( | 107 void DispatchNonBlockingEventToMainThread( |
| 108 int routing_id, | 108 int routing_id, |
| 109 ui::ScopedWebInputEvent event, | 109 blink::ScopedCoalescedWebInputEvent event, |
| 110 const ui::LatencyInfo& latency_info); | 110 const ui::LatencyInfo& latency_info); |
| 111 | 111 |
| 112 private: | 112 private: |
| 113 // Called from the compositor's thread. | 113 // Called from the compositor's thread. |
| 114 void AddInputHandlerOnCompositorThread( | 114 void AddInputHandlerOnCompositorThread( |
| 115 int routing_id, | 115 int routing_id, |
| 116 const scoped_refptr<base::SingleThreadTaskRunner>& main_task_runner, | 116 const scoped_refptr<base::SingleThreadTaskRunner>& main_task_runner, |
| 117 const base::WeakPtr<cc::InputHandler>& input_handler, | 117 const base::WeakPtr<cc::InputHandler>& input_handler, |
| 118 const base::WeakPtr<RenderViewImpl>& render_view_impl, | 118 const base::WeakPtr<RenderViewImpl>& render_view_impl, |
| 119 bool enable_smooth_scrolling); | 119 bool enable_smooth_scrolling); |
| 120 | 120 |
| 121 void RegisterRoutingIDOnCompositorThread(int routing_id); | 121 void RegisterRoutingIDOnCompositorThread(int routing_id); |
| 122 void UnregisterRoutingIDOnCompositorThread(int routing_id); | 122 void UnregisterRoutingIDOnCompositorThread(int routing_id); |
| 123 | 123 |
| 124 void ObserveWheelEventAndResultOnCompositorThread( | 124 void ObserveWheelEventAndResultOnCompositorThread( |
| 125 int routing_id, | 125 int routing_id, |
| 126 const blink::WebMouseWheelEvent& wheel_event, | 126 const blink::WebMouseWheelEvent& wheel_event, |
| 127 const cc::InputHandlerScrollResult& scroll_result); | 127 const cc::InputHandlerScrollResult& scroll_result); |
| 128 | 128 |
| 129 void ObserveGestureEventAndResultOnCompositorThread( | 129 void ObserveGestureEventAndResultOnCompositorThread( |
| 130 int routing_id, | 130 int routing_id, |
| 131 const blink::WebGestureEvent& gesture_event, | 131 const blink::WebGestureEvent& gesture_event, |
| 132 const cc::InputHandlerScrollResult& scroll_result); | 132 const cc::InputHandlerScrollResult& scroll_result); |
| 133 | 133 |
| 134 void DidHandleInputEventAndOverscroll( | 134 void DidHandleInputEventAndOverscroll( |
| 135 const InputEventAckStateCallback& callback, | 135 const InputEventAckStateCallback& callback, |
| 136 ui::InputHandlerProxy::EventDisposition event_disposition, | 136 ui::InputHandlerProxy::EventDisposition event_disposition, |
| 137 ui::ScopedWebInputEvent input_event, | 137 blink::ScopedCoalescedWebInputEvent input_event, |
| 138 const ui::LatencyInfo& latency_info, | 138 const ui::LatencyInfo& latency_info, |
| 139 std::unique_ptr<ui::DidOverscrollParams> overscroll_params); | 139 std::unique_ptr<ui::DidOverscrollParams> overscroll_params); |
| 140 | 140 |
| 141 typedef base::ScopedPtrHashMap<int, // routing_id | 141 typedef base::ScopedPtrHashMap<int, // routing_id |
| 142 std::unique_ptr<InputHandlerWrapper>> | 142 std::unique_ptr<InputHandlerWrapper>> |
| 143 InputHandlerMap; | 143 InputHandlerMap; |
| 144 InputHandlerMap input_handlers_; | 144 InputHandlerMap input_handlers_; |
| 145 | 145 |
| 146 const scoped_refptr<base::SingleThreadTaskRunner> task_runner_; | 146 const scoped_refptr<base::SingleThreadTaskRunner> task_runner_; |
| 147 InputHandlerManagerClient* const client_; | 147 InputHandlerManagerClient* const client_; |
| 148 // May be null. | 148 // May be null. |
| 149 SynchronousInputHandlerProxyClient* const synchronous_handler_proxy_client_; | 149 SynchronousInputHandlerProxyClient* const synchronous_handler_proxy_client_; |
| 150 blink::scheduler::RendererScheduler* const renderer_scheduler_; // Not owned. | 150 blink::scheduler::RendererScheduler* const renderer_scheduler_; // Not owned. |
| 151 | 151 |
| 152 base::WeakPtrFactory<InputHandlerManager> weak_ptr_factory_; | 152 base::WeakPtrFactory<InputHandlerManager> weak_ptr_factory_; |
| 153 }; | 153 }; |
| 154 | 154 |
| 155 } // namespace content | 155 } // namespace content |
| 156 | 156 |
| 157 #endif // CONTENT_RENDERER_INPUT_INPUT_HANDLER_MANAGER_H_ | 157 #endif // CONTENT_RENDERER_INPUT_INPUT_HANDLER_MANAGER_H_ |
| OLD | NEW |