Chromium Code Reviews| 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/input/input_handler_manager_client.h" | |
| 13 #include "content/renderer/render_view_impl.h" | 14 #include "content/renderer/render_view_impl.h" |
| 15 #include "ui/events/blink/input_handler_proxy.h" | |
| 14 | 16 |
| 15 namespace base { | 17 namespace base { |
| 16 class SingleThreadTaskRunner; | 18 class SingleThreadTaskRunner; |
| 17 } | 19 } |
| 18 | 20 |
| 19 namespace cc { | 21 namespace cc { |
| 20 class InputHandler; | 22 class InputHandler; |
| 21 struct InputHandlerScrollResult; | 23 struct InputHandlerScrollResult; |
| 22 } | 24 } |
| 23 | 25 |
| 24 namespace blink { | 26 namespace blink { |
| 25 class WebInputEvent; | 27 class WebInputEvent; |
| 26 class WebMouseWheelEvent; | 28 class WebMouseWheelEvent; |
| 27 } | 29 } |
| 28 | 30 |
| 29 namespace blink { | 31 namespace blink { |
| 30 namespace scheduler { | 32 namespace scheduler { |
| 31 class RendererScheduler; | 33 class RendererScheduler; |
| 32 } | 34 } |
| 33 } | 35 } |
| 34 | 36 |
| 35 namespace ui { | 37 namespace ui { |
| 36 struct DidOverscrollParams; | 38 struct DidOverscrollParams; |
| 37 } | 39 } |
| 38 | 40 |
| 39 namespace content { | 41 namespace content { |
| 40 | 42 |
| 41 class InputHandlerWrapper; | 43 class InputHandlerWrapper; |
| 42 class SynchronousInputHandlerProxyClient; | 44 class SynchronousInputHandlerProxyClient; |
| 43 class InputHandlerManagerClient; | |
| 44 struct DidOverscrollParams; | |
| 45 | 45 |
| 46 // InputHandlerManager class manages InputHandlerProxy instances for | 46 // InputHandlerManager class manages InputHandlerProxy instances for |
| 47 // the WebViews in this renderer. | 47 // the WebViews in this renderer. |
| 48 class CONTENT_EXPORT InputHandlerManager { | 48 class CONTENT_EXPORT InputHandlerManager { |
| 49 public: | 49 public: |
| 50 // |task_runner| is the SingleThreadTaskRunner of the compositor thread. The | 50 // |task_runner| is the SingleThreadTaskRunner of the compositor thread. The |
| 51 // underlying MessageLoop and supplied |client| and the |renderer_scheduler| | 51 // underlying MessageLoop and supplied |client| and the |renderer_scheduler| |
| 52 // must outlive this object. The RendererScheduler needs to know when input | 52 // must outlive this object. The RendererScheduler needs to know when input |
| 53 // events and fling animations occur, which is why it's passed in here. | 53 // events and fling animations occur, which is why it's passed in here. |
| 54 InputHandlerManager( | 54 InputHandlerManager( |
| (...skipping 17 matching lines...) Expand all Loading... | |
| 72 const blink::WebGestureEvent& gesture_event, | 72 const blink::WebGestureEvent& gesture_event, |
| 73 const cc::InputHandlerScrollResult& scroll_result); | 73 const cc::InputHandlerScrollResult& scroll_result); |
| 74 | 74 |
| 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 | 78 |
| 79 // Callback only from the compositor's thread. | 79 // Callback only from the compositor's thread. |
| 80 void RemoveInputHandler(int routing_id); | 80 void RemoveInputHandler(int routing_id); |
| 81 | 81 |
| 82 using InputEventAckStateCallback = | |
| 83 InputHandlerManagerClient::InputEventAckStateCallback; | |
| 82 // Called from the compositor's thread. | 84 // Called from the compositor's thread. |
| 83 virtual InputEventAckState HandleInputEvent( | 85 virtual void HandleInputEvent(int routing_id, |
| 84 int routing_id, | 86 ui::ScopedWebInputEvent input_event, |
| 85 const blink::WebInputEvent* input_event, | 87 const ui::LatencyInfo& latency_info, |
| 86 ui::LatencyInfo* latency_info); | 88 const InputEventAckStateCallback& callback); |
| 87 | 89 |
| 88 // Called from the compositor's thread. | 90 // Called from the compositor's thread. |
| 89 void DidOverscroll(int routing_id, const ui::DidOverscrollParams& params); | 91 void DidOverscroll(int routing_id, |
|
dtapuska
2016/08/23 19:34:10
I find this DidOverscroll vs DidHandleInputEvent c
chongz
2016/08/23 23:40:33
I've also updated the design doc (@chromium) which
| |
| 92 const ui::DidOverscrollParams& params, | |
| 93 bool bundle_ack_with_triggering_event); | |
| 90 | 94 |
| 91 // Called from the compositor's thread. | 95 // Called from the compositor's thread. |
| 92 void DidStartFlinging(int routing_id); | 96 void DidStartFlinging(int routing_id); |
| 93 void DidStopFlinging(int routing_id); | 97 void DidStopFlinging(int routing_id); |
| 94 | 98 |
| 95 // Called from the compositor's thread. | 99 // Called from the compositor's thread. |
| 96 void DidAnimateForInput(); | 100 void DidAnimateForInput(); |
| 97 | 101 |
| 98 private: | 102 private: |
| 99 // Called from the compositor's thread. | 103 // Called from the compositor's thread. |
| (...skipping 10 matching lines...) Expand all Loading... | |
| 110 void ObserveWheelEventAndResultOnCompositorThread( | 114 void ObserveWheelEventAndResultOnCompositorThread( |
| 111 int routing_id, | 115 int routing_id, |
| 112 const blink::WebMouseWheelEvent& wheel_event, | 116 const blink::WebMouseWheelEvent& wheel_event, |
| 113 const cc::InputHandlerScrollResult& scroll_result); | 117 const cc::InputHandlerScrollResult& scroll_result); |
| 114 | 118 |
| 115 void ObserveGestureEventAndResultOnCompositorThread( | 119 void ObserveGestureEventAndResultOnCompositorThread( |
| 116 int routing_id, | 120 int routing_id, |
| 117 const blink::WebGestureEvent& gesture_event, | 121 const blink::WebGestureEvent& gesture_event, |
| 118 const cc::InputHandlerScrollResult& scroll_result); | 122 const cc::InputHandlerScrollResult& scroll_result); |
| 119 | 123 |
| 124 using EventDisposition = ui::InputHandlerProxy::EventDisposition; | |
| 125 void DidHandleInputEvent( | |
| 126 const InputEventAckStateCallback& callback, | |
| 127 EventDisposition event_disposition, | |
| 128 ui::ScopedWebInputEvent input_event, | |
| 129 const ui::LatencyInfo& latency_info, | |
| 130 std::unique_ptr<ui::DidOverscrollParams> overscroll_params); | |
| 131 | |
| 120 typedef base::ScopedPtrHashMap<int, // routing_id | 132 typedef base::ScopedPtrHashMap<int, // routing_id |
| 121 std::unique_ptr<InputHandlerWrapper>> | 133 std::unique_ptr<InputHandlerWrapper>> |
| 122 InputHandlerMap; | 134 InputHandlerMap; |
| 123 InputHandlerMap input_handlers_; | 135 InputHandlerMap input_handlers_; |
| 124 | 136 |
| 125 const scoped_refptr<base::SingleThreadTaskRunner> task_runner_; | 137 const scoped_refptr<base::SingleThreadTaskRunner> task_runner_; |
| 126 InputHandlerManagerClient* const client_; | 138 InputHandlerManagerClient* const client_; |
| 127 // May be null. | 139 // May be null. |
| 128 SynchronousInputHandlerProxyClient* const synchronous_handler_proxy_client_; | 140 SynchronousInputHandlerProxyClient* const synchronous_handler_proxy_client_; |
| 129 blink::scheduler::RendererScheduler* const renderer_scheduler_; // Not owned. | 141 blink::scheduler::RendererScheduler* const renderer_scheduler_; // Not owned. |
| 130 }; | 142 }; |
| 131 | 143 |
| 132 } // namespace content | 144 } // namespace content |
| 133 | 145 |
| 134 #endif // CONTENT_RENDERER_INPUT_INPUT_HANDLER_MANAGER_H_ | 146 #endif // CONTENT_RENDERER_INPUT_INPUT_HANDLER_MANAGER_H_ |
| OLD | NEW |