1ca12bfac764ba476d6cd062bf1dde12cc64c3f40Ben Murdoch// Copyright 2013 The Chromium Authors. All rights reserved. 2ca12bfac764ba476d6cd062bf1dde12cc64c3f40Ben Murdoch// Use of this source code is governed by a BSD-style license that can be 3ca12bfac764ba476d6cd062bf1dde12cc64c3f40Ben Murdoch// found in the LICENSE file. 4ca12bfac764ba476d6cd062bf1dde12cc64c3f40Ben Murdoch 5ca12bfac764ba476d6cd062bf1dde12cc64c3f40Ben Murdoch#ifndef CONTENT_BROWSER_RENDERER_HOST_INPUT_INPUT_ROUTER_CLIENT_H_ 6ca12bfac764ba476d6cd062bf1dde12cc64c3f40Ben Murdoch#define CONTENT_BROWSER_RENDERER_HOST_INPUT_INPUT_ROUTER_CLIENT_H_ 7ca12bfac764ba476d6cd062bf1dde12cc64c3f40Ben Murdoch 8010d83a9304c5a91596085d917d248abff47903aTorne (Richard Coles)#include "content/browser/renderer_host/event_with_latency_info.h" 9ca12bfac764ba476d6cd062bf1dde12cc64c3f40Ben Murdoch#include "content/common/content_export.h" 10010d83a9304c5a91596085d917d248abff47903aTorne (Richard Coles)#include "content/common/input/input_event_ack_state.h" 11ca12bfac764ba476d6cd062bf1dde12cc64c3f40Ben Murdoch#include "content/public/browser/native_web_keyboard_event.h" 12ca12bfac764ba476d6cd062bf1dde12cc64c3f40Ben Murdoch#include "third_party/WebKit/public/web/WebInputEvent.h" 13ca12bfac764ba476d6cd062bf1dde12cc64c3f40Ben Murdoch 14ca12bfac764ba476d6cd062bf1dde12cc64c3f40Ben Murdochnamespace ui { 15ca12bfac764ba476d6cd062bf1dde12cc64c3f40Ben Murdochstruct LatencyInfo; 16ca12bfac764ba476d6cd062bf1dde12cc64c3f40Ben Murdoch} 17ca12bfac764ba476d6cd062bf1dde12cc64c3f40Ben Murdoch 18ca12bfac764ba476d6cd062bf1dde12cc64c3f40Ben Murdochnamespace content { 19ca12bfac764ba476d6cd062bf1dde12cc64c3f40Ben Murdoch 20cedac228d2dd51db4b79ea1e72c7f249408ee061Torne (Richard Coles)struct DidOverscrollParams; 214e180b6a0b4720a9b8e9e959a882386f690f08ffTorne (Richard Coles) 22ca12bfac764ba476d6cd062bf1dde12cc64c3f40Ben Murdochclass CONTENT_EXPORT InputRouterClient { 23ca12bfac764ba476d6cd062bf1dde12cc64c3f40Ben Murdoch public: 24ca12bfac764ba476d6cd062bf1dde12cc64c3f40Ben Murdoch virtual ~InputRouterClient() {} 25ca12bfac764ba476d6cd062bf1dde12cc64c3f40Ben Murdoch 26ca12bfac764ba476d6cd062bf1dde12cc64c3f40Ben Murdoch // Called just prior to events being sent to the renderer, giving the client 27ca12bfac764ba476d6cd062bf1dde12cc64c3f40Ben Murdoch // a chance to perform in-process event filtering. 28ca12bfac764ba476d6cd062bf1dde12cc64c3f40Ben Murdoch // The returned disposition will yield the following behavior: 29ca12bfac764ba476d6cd062bf1dde12cc64c3f40Ben Murdoch // * |NOT_CONSUMED| will result in |input_event| being sent as usual. 30ca12bfac764ba476d6cd062bf1dde12cc64c3f40Ben Murdoch // * |CONSUMED| or |NO_CONSUMER_EXISTS| will trigger the appropriate ack. 31ca12bfac764ba476d6cd062bf1dde12cc64c3f40Ben Murdoch // * |UNKNOWN| will result in |input_event| being dropped. 32ca12bfac764ba476d6cd062bf1dde12cc64c3f40Ben Murdoch virtual InputEventAckState FilterInputEvent( 33f2477e01787aa58f445919b809d89e252beef54fTorne (Richard Coles) const blink::WebInputEvent& input_event, 34ca12bfac764ba476d6cd062bf1dde12cc64c3f40Ben Murdoch const ui::LatencyInfo& latency_info) = 0; 35ca12bfac764ba476d6cd062bf1dde12cc64c3f40Ben Murdoch 36ca12bfac764ba476d6cd062bf1dde12cc64c3f40Ben Murdoch // Called each time a WebInputEvent IPC is sent. 37ca12bfac764ba476d6cd062bf1dde12cc64c3f40Ben Murdoch virtual void IncrementInFlightEventCount() = 0; 38ca12bfac764ba476d6cd062bf1dde12cc64c3f40Ben Murdoch 39ca12bfac764ba476d6cd062bf1dde12cc64c3f40Ben Murdoch // Called each time a WebInputEvent ACK IPC is received. 40ca12bfac764ba476d6cd062bf1dde12cc64c3f40Ben Murdoch virtual void DecrementInFlightEventCount() = 0; 41ca12bfac764ba476d6cd062bf1dde12cc64c3f40Ben Murdoch 42ca12bfac764ba476d6cd062bf1dde12cc64c3f40Ben Murdoch // Called when the renderer notifies that it has touch event handlers. 43ca12bfac764ba476d6cd062bf1dde12cc64c3f40Ben Murdoch virtual void OnHasTouchEventHandlers(bool has_handlers) = 0; 44ca12bfac764ba476d6cd062bf1dde12cc64c3f40Ben Murdoch 4558537e28ecd584eab876aee8be7156509866d23aTorne (Richard Coles) // Certain router implementations require periodic flushing of queued events. 4658537e28ecd584eab876aee8be7156509866d23aTorne (Richard Coles) // When this method is called, the client should ensure a timely call, either 4758537e28ecd584eab876aee8be7156509866d23aTorne (Richard Coles) // synchronous or asynchronous, of |Flush| on the InputRouter. 4858537e28ecd584eab876aee8be7156509866d23aTorne (Richard Coles) virtual void SetNeedsFlush() = 0; 4958537e28ecd584eab876aee8be7156509866d23aTorne (Richard Coles) 5058537e28ecd584eab876aee8be7156509866d23aTorne (Richard Coles) // Called when the router has finished flushing all events queued at the time 5158537e28ecd584eab876aee8be7156509866d23aTorne (Richard Coles) // of the call to Flush. The call will typically be asynchronous with 5258537e28ecd584eab876aee8be7156509866d23aTorne (Richard Coles) // respect to the call to |Flush| on the InputRouter. 5358537e28ecd584eab876aee8be7156509866d23aTorne (Richard Coles) virtual void DidFlush() = 0; 54cedac228d2dd51db4b79ea1e72c7f249408ee061Torne (Richard Coles) 5546d4c2bc3267f3f028f39e7e311b0f89aba2e4fdTorne (Richard Coles) // Called when the router has received an overscroll notification from the 5646d4c2bc3267f3f028f39e7e311b0f89aba2e4fdTorne (Richard Coles) // renderer. 57cedac228d2dd51db4b79ea1e72c7f249408ee061Torne (Richard Coles) virtual void DidOverscroll(const DidOverscrollParams& params) = 0; 58ca12bfac764ba476d6cd062bf1dde12cc64c3f40Ben Murdoch}; 59ca12bfac764ba476d6cd062bf1dde12cc64c3f40Ben Murdoch 60ca12bfac764ba476d6cd062bf1dde12cc64c3f40Ben Murdoch} // namespace content 61ca12bfac764ba476d6cd062bf1dde12cc64c3f40Ben Murdoch 62ca12bfac764ba476d6cd062bf1dde12cc64c3f40Ben Murdoch#endif // CONTENT_BROWSER_RENDERER_HOST_INPUT_INPUT_ROUTER_CLIENT_H_ 63