| 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_CLIENT_H_ | 5 #ifndef CONTENT_RENDERER_INPUT_INPUT_HANDLER_MANAGER_CLIENT_H_ |
| 6 #define CONTENT_RENDERER_INPUT_INPUT_HANDLER_MANAGER_CLIENT_H_ | 6 #define CONTENT_RENDERER_INPUT_INPUT_HANDLER_MANAGER_CLIENT_H_ |
| 7 | 7 |
| 8 #include "base/callback.h" | 8 #include "base/callback.h" |
| 9 #include "base/callback_forward.h" | 9 #include "base/callback_forward.h" |
| 10 #include "base/macros.h" | 10 #include "base/macros.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 "third_party/WebKit/public/web/WebInputEvent.h" | 13 #include "third_party/WebKit/public/web/WebInputEvent.h" |
| 14 #include "ui/events/blink/scoped_web_input_event.h" |
| 14 #include "ui/gfx/geometry/vector2d_f.h" | 15 #include "ui/gfx/geometry/vector2d_f.h" |
| 15 | 16 |
| 16 namespace ui { | |
| 17 class LatencyInfo; | |
| 18 struct DidOverscrollParams; | |
| 19 } | |
| 20 | |
| 21 namespace cc { | 17 namespace cc { |
| 22 class InputHandler; | 18 class InputHandler; |
| 23 } | 19 } |
| 24 | 20 |
| 25 namespace ui { | 21 namespace ui { |
| 22 class LatencyInfo; |
| 26 class SynchronousInputHandlerProxy; | 23 class SynchronousInputHandlerProxy; |
| 24 struct DidOverscrollParams; |
| 27 } | 25 } |
| 28 | 26 |
| 29 namespace content { | 27 namespace content { |
| 30 | 28 |
| 31 class CONTENT_EXPORT InputHandlerManagerClient { | 29 class CONTENT_EXPORT InputHandlerManagerClient { |
| 32 public: | 30 public: |
| 33 virtual ~InputHandlerManagerClient() {} | 31 virtual ~InputHandlerManagerClient() {} |
| 34 | 32 |
| 33 using InputEventAckStateCallback = |
| 34 base::Callback<void(InputEventAckState, |
| 35 ui::ScopedWebInputEvent, |
| 36 const ui::LatencyInfo&, |
| 37 std::unique_ptr<ui::DidOverscrollParams>)>; |
| 35 // The Manager will supply a |handler| when bound to the client. This is valid | 38 // The Manager will supply a |handler| when bound to the client. This is valid |
| 36 // until the manager shuts down, at which point it supplies a null |handler|. | 39 // until the manager shuts down, at which point it supplies a null |handler|. |
| 37 // The client should only makes calls to |handler| on the compositor thread. | 40 // The client should only makes calls to |handler| on the compositor thread. |
| 38 typedef base::Callback< | 41 using Handler = |
| 39 InputEventAckState(int /*routing_id*/, | 42 base::Callback<void(int /*routing_id*/, |
| 40 const blink::WebInputEvent*, | 43 ui::ScopedWebInputEvent, |
| 41 ui::LatencyInfo* latency_info)> Handler; | 44 const ui::LatencyInfo& latency_info, |
| 45 const InputEventAckStateCallback& callback)>; |
| 42 | 46 |
| 43 // Called from the main thread. | 47 // Called from the main thread. |
| 44 virtual void SetBoundHandler(const Handler& handler) = 0; | 48 virtual void SetBoundHandler(const Handler& handler) = 0; |
| 45 virtual void NotifyInputEventHandled(int routing_id, | 49 virtual void NotifyInputEventHandled(int routing_id, |
| 46 blink::WebInputEvent::Type type, | 50 blink::WebInputEvent::Type type, |
| 47 InputEventAckState ack_result) = 0; | 51 InputEventAckState ack_result) = 0; |
| 48 | 52 |
| 49 // Called from the compositor thread. | 53 // Called from the compositor thread. |
| 50 virtual void RegisterRoutingID(int routing_id) = 0; | 54 virtual void RegisterRoutingID(int routing_id) = 0; |
| 51 virtual void UnregisterRoutingID(int routing_id) = 0; | 55 virtual void UnregisterRoutingID(int routing_id) = 0; |
| 52 virtual void DidOverscroll(int routing_id, | 56 virtual void DidOverscroll(int routing_id, |
| 53 const ui::DidOverscrollParams& params) = 0; | 57 const ui::DidOverscrollParams& params, |
| 58 bool bundle_ack_with_triggering_event) = 0; |
| 54 virtual void DidStartFlinging(int routing_id) = 0; | 59 virtual void DidStartFlinging(int routing_id) = 0; |
| 55 virtual void DidStopFlinging(int routing_id) = 0; | 60 virtual void DidStopFlinging(int routing_id) = 0; |
| 56 | 61 |
| 57 protected: | 62 protected: |
| 58 InputHandlerManagerClient() {} | 63 InputHandlerManagerClient() {} |
| 59 | 64 |
| 60 private: | 65 private: |
| 61 DISALLOW_COPY_AND_ASSIGN(InputHandlerManagerClient); | 66 DISALLOW_COPY_AND_ASSIGN(InputHandlerManagerClient); |
| 62 }; | 67 }; |
| 63 | 68 |
| 64 class CONTENT_EXPORT SynchronousInputHandlerProxyClient { | 69 class CONTENT_EXPORT SynchronousInputHandlerProxyClient { |
| 65 public: | 70 public: |
| 66 virtual ~SynchronousInputHandlerProxyClient() {} | 71 virtual ~SynchronousInputHandlerProxyClient() {} |
| 67 | 72 |
| 68 virtual void DidAddSynchronousHandlerProxy( | 73 virtual void DidAddSynchronousHandlerProxy( |
| 69 int routing_id, | 74 int routing_id, |
| 70 ui::SynchronousInputHandlerProxy* synchronous_handler) = 0; | 75 ui::SynchronousInputHandlerProxy* synchronous_handler) = 0; |
| 71 virtual void DidRemoveSynchronousHandlerProxy(int routing_id) = 0; | 76 virtual void DidRemoveSynchronousHandlerProxy(int routing_id) = 0; |
| 72 | 77 |
| 73 protected: | 78 protected: |
| 74 SynchronousInputHandlerProxyClient() {} | 79 SynchronousInputHandlerProxyClient() {} |
| 75 | 80 |
| 76 private: | 81 private: |
| 77 DISALLOW_COPY_AND_ASSIGN(SynchronousInputHandlerProxyClient); | 82 DISALLOW_COPY_AND_ASSIGN(SynchronousInputHandlerProxyClient); |
| 78 }; | 83 }; |
| 79 | 84 |
| 80 } // namespace content | 85 } // namespace content |
| 81 | 86 |
| 82 #endif // CONTENT_RENDERER_INPUT_INPUT_HANDLER_MANAGER_CLIENT_H_ | 87 #endif // CONTENT_RENDERER_INPUT_INPUT_HANDLER_MANAGER_CLIENT_H_ |
| OLD | NEW |