| 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_BROWSER_RENDERER_HOST_INPUT_INPUT_ROUTER_CLIENT_H_ | 5 #ifndef CONTENT_BROWSER_RENDERER_HOST_INPUT_INPUT_ROUTER_CLIENT_H_ |
| 6 #define CONTENT_BROWSER_RENDERER_HOST_INPUT_INPUT_ROUTER_CLIENT_H_ | 6 #define CONTENT_BROWSER_RENDERER_HOST_INPUT_INPUT_ROUTER_CLIENT_H_ |
| 7 | 7 |
| 8 #include "content/browser/renderer_host/event_with_latency_info.h" | 8 #include "content/browser/renderer_host/event_with_latency_info.h" |
| 9 #include "content/common/content_export.h" | 9 #include "content/common/content_export.h" |
| 10 #include "content/common/input/input_event_ack_state.h" | 10 #include "content/common/input/input_event_ack_state.h" |
| 11 #include "content/public/browser/native_web_keyboard_event.h" | 11 #include "content/public/browser/native_web_keyboard_event.h" |
| 12 #include "third_party/WebKit/public/web/WebInputEvent.h" | 12 #include "third_party/WebKit/public/web/WebInputEvent.h" |
| 13 | 13 |
| 14 namespace ui { | 14 namespace ui { |
| 15 struct LatencyInfo; | 15 struct LatencyInfo; |
| 16 } | 16 } |
| 17 | 17 |
| 18 namespace content { | 18 namespace content { |
| 19 | 19 |
| 20 class OverscrollController; | |
| 21 struct DidOverscrollParams; | 20 struct DidOverscrollParams; |
| 22 | 21 |
| 23 class CONTENT_EXPORT InputRouterClient { | 22 class CONTENT_EXPORT InputRouterClient { |
| 24 public: | 23 public: |
| 25 virtual ~InputRouterClient() {} | 24 virtual ~InputRouterClient() {} |
| 26 | 25 |
| 27 // Called just prior to events being sent to the renderer, giving the client | 26 // Called just prior to events being sent to the renderer, giving the client |
| 28 // a chance to perform in-process event filtering. | 27 // a chance to perform in-process event filtering. |
| 29 // The returned disposition will yield the following behavior: | 28 // The returned disposition will yield the following behavior: |
| 30 // * |NOT_CONSUMED| will result in |input_event| being sent as usual. | 29 // * |NOT_CONSUMED| will result in |input_event| being sent as usual. |
| 31 // * |CONSUMED| or |NO_CONSUMER_EXISTS| will trigger the appropriate ack. | 30 // * |CONSUMED| or |NO_CONSUMER_EXISTS| will trigger the appropriate ack. |
| 32 // * |UNKNOWN| will result in |input_event| being dropped. | 31 // * |UNKNOWN| will result in |input_event| being dropped. |
| 33 virtual InputEventAckState FilterInputEvent( | 32 virtual InputEventAckState FilterInputEvent( |
| 34 const blink::WebInputEvent& input_event, | 33 const blink::WebInputEvent& input_event, |
| 35 const ui::LatencyInfo& latency_info) = 0; | 34 const ui::LatencyInfo& latency_info) = 0; |
| 36 | 35 |
| 37 // Called each time a WebInputEvent IPC is sent. | 36 // Called each time a WebInputEvent IPC is sent. |
| 38 virtual void IncrementInFlightEventCount() = 0; | 37 virtual void IncrementInFlightEventCount() = 0; |
| 39 | 38 |
| 40 // Called each time a WebInputEvent ACK IPC is received. | 39 // Called each time a WebInputEvent ACK IPC is received. |
| 41 virtual void DecrementInFlightEventCount() = 0; | 40 virtual void DecrementInFlightEventCount() = 0; |
| 42 | 41 |
| 43 // Called when the renderer notifies that it has touch event handlers. | 42 // Called when the renderer notifies that it has touch event handlers. |
| 44 virtual void OnHasTouchEventHandlers(bool has_handlers) = 0; | 43 virtual void OnHasTouchEventHandlers(bool has_handlers) = 0; |
| 45 | 44 |
| 46 // Returns an optional OverscrollController. If non-NULL, the controller | |
| 47 // will be fed events and event acks by the router, when appropriate. | |
| 48 // TODO(jdduke): crbug.com/306133 - Move the controller to the router. | |
| 49 virtual OverscrollController* GetOverscrollController() const = 0; | |
| 50 | |
| 51 // Certain router implementations require periodic flushing of queued events. | 45 // Certain router implementations require periodic flushing of queued events. |
| 52 // When this method is called, the client should ensure a timely call, either | 46 // When this method is called, the client should ensure a timely call, either |
| 53 // synchronous or asynchronous, of |Flush| on the InputRouter. | 47 // synchronous or asynchronous, of |Flush| on the InputRouter. |
| 54 virtual void SetNeedsFlush() = 0; | 48 virtual void SetNeedsFlush() = 0; |
| 55 | 49 |
| 56 // Called when the router has finished flushing all events queued at the time | 50 // Called when the router has finished flushing all events queued at the time |
| 57 // of the call to Flush. The call will typically be asynchronous with | 51 // of the call to Flush. The call will typically be asynchronous with |
| 58 // respect to the call to |Flush| on the InputRouter. | 52 // respect to the call to |Flush| on the InputRouter. |
| 59 virtual void DidFlush() = 0; | 53 virtual void DidFlush() = 0; |
| 60 | 54 |
| 55 // Called when the router has received an overscroll notification from the |
| 56 // renderer. |
| 61 virtual void DidOverscroll(const DidOverscrollParams& params) = 0; | 57 virtual void DidOverscroll(const DidOverscrollParams& params) = 0; |
| 62 }; | 58 }; |
| 63 | 59 |
| 64 } // namespace content | 60 } // namespace content |
| 65 | 61 |
| 66 #endif // CONTENT_BROWSER_RENDERER_HOST_INPUT_INPUT_ROUTER_CLIENT_H_ | 62 #endif // CONTENT_BROWSER_RENDERER_HOST_INPUT_INPUT_ROUTER_CLIENT_H_ |
| OLD | NEW |