Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(122)

Side by Side Diff: content/browser/renderer_host/input/input_router.h

Issue 660663002: Clear pending events upon main frame navigation (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Updates Created 6 years, 1 month ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
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_H_ 5 #ifndef CONTENT_BROWSER_RENDERER_HOST_INPUT_INPUT_ROUTER_H_
6 #define CONTENT_BROWSER_RENDERER_HOST_INPUT_INPUT_ROUTER_H_ 6 #define CONTENT_BROWSER_RENDERER_HOST_INPUT_INPUT_ROUTER_H_
7 7
8 #include "base/basictypes.h" 8 #include "base/basictypes.h"
9 #include "content/browser/renderer_host/event_with_latency_info.h" 9 #include "content/browser/renderer_host/event_with_latency_info.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 "ipc/ipc_listener.h" 12 #include "ipc/ipc_listener.h"
13 #include "third_party/WebKit/public/web/WebInputEvent.h" 13 #include "third_party/WebKit/public/web/WebInputEvent.h"
14 14
15 namespace content { 15 namespace content {
16 16
17 class InputRouterClient; 17 class InputRouterClient;
18 18
19 // The InputRouter allows the embedder to customize how input events are 19 // The InputRouter allows the embedder to customize how input events are
20 // sent to the renderer, and how responses are dispatched to the browser. 20 // sent to the renderer, and how responses are dispatched to the browser.
21 // While the router should respect the relative order in which events are 21 // While the router should respect the relative order in which events are
22 // received, it is free to customize when those events are dispatched. 22 // received, it is free to customize when those events are dispatched.
23 class InputRouter : public IPC::Listener { 23 class InputRouter : public IPC::Listener {
24 public: 24 public:
25 ~InputRouter() override {} 25 ~InputRouter() override {}
26 26
27 // Should be called only in response to |SetNeedsFlush| requests made via
28 // the |InputRouterClient|.
29 virtual void Flush() = 0;
30
31 // Send and take ownership of the the given InputMsg_*. This should be used 27 // Send and take ownership of the the given InputMsg_*. This should be used
32 // only for event types not associated with a WebInputEvent. Returns true on 28 // only for event types not associated with a WebInputEvent. Returns true on
33 // success and false otherwise. 29 // success and false otherwise.
34 virtual bool SendInput(scoped_ptr<IPC::Message> message) = 0; 30 virtual bool SendInput(scoped_ptr<IPC::Message> message) = 0;
35 31
36 // WebInputEvents 32 // WebInputEvents
37 virtual void SendMouseEvent( 33 virtual void SendMouseEvent(
38 const MouseEventWithLatencyInfo& mouse_event) = 0; 34 const MouseEventWithLatencyInfo& mouse_event) = 0;
39 virtual void SendWheelEvent( 35 virtual void SendWheelEvent(
40 const MouseWheelEventWithLatencyInfo& wheel_event) = 0; 36 const MouseWheelEventWithLatencyInfo& wheel_event) = 0;
41 virtual void SendKeyboardEvent( 37 virtual void SendKeyboardEvent(
42 const NativeWebKeyboardEvent& key_event, 38 const NativeWebKeyboardEvent& key_event,
43 const ui::LatencyInfo& latency_info, 39 const ui::LatencyInfo& latency_info,
44 bool is_shortcut) = 0; 40 bool is_shortcut) = 0;
45 virtual void SendGestureEvent( 41 virtual void SendGestureEvent(
46 const GestureEventWithLatencyInfo& gesture_event) = 0; 42 const GestureEventWithLatencyInfo& gesture_event) = 0;
47 virtual void SendTouchEvent( 43 virtual void SendTouchEvent(
48 const TouchEventWithLatencyInfo& touch_event) = 0; 44 const TouchEventWithLatencyInfo& touch_event) = 0;
49 45
46 // Request a notification from the router (through its client) when it becomes
47 // empty after dispatching all current and pending events. Note that this is
48 // not a strict flush marker, as the router will wait until *all* input has
49 // been dispatched, potentially including future input.
50 virtual void RequestFlushedNotification() = 0;
51
50 // Returns the oldest queued or in-flight keyboard event sent to the router. 52 // Returns the oldest queued or in-flight keyboard event sent to the router.
51 virtual const NativeWebKeyboardEvent* GetLastKeyboardEvent() const = 0; 53 virtual const NativeWebKeyboardEvent* GetLastKeyboardEvent() const = 0;
52 54
53 // Returns |true| if the caller should immediately forward touch events to the 55 // Returns |true| if the caller should immediately forward touch events to the
54 // router. When |false|, the caller can forego sending touch events, and 56 // router. When |false|, the caller can forego sending touch events, and
55 // instead consume them directly. 57 // instead consume them directly.
56 virtual bool ShouldForwardTouchEvent() const = 0; 58 virtual bool ShouldForwardTouchEvent() const = 0;
57 59
58 // Allow the router to make more informed input handling decisions based on 60 // Allow the router to make more informed input handling decisions based on
59 // the current view. 61 // the current view.
60 enum ViewFlags { 62 enum ViewFlags {
61 VIEW_FLAGS_NONE = 0, 63 VIEW_FLAGS_NONE = 0,
62 FIXED_PAGE_SCALE = 1 << 0, 64 FIXED_PAGE_SCALE = 1 << 0,
63 MOBILE_VIEWPORT = 1 << 1 65 MOBILE_VIEWPORT = 1 << 1
64 }; 66 };
65 virtual void OnViewUpdated(int view_flags) = 0; 67 virtual void OnViewUpdated(int view_flags) = 0;
66 68
67 virtual bool HasPendingEvents() const = 0; 69 virtual bool HasPendingEvents() const = 0;
68 }; 70 };
69 71
70 } // namespace content 72 } // namespace content
71 73
72 #endif // CONTENT_BROWSER_RENDERER_HOST_INPUT_INPUT_ROUTER_H_ 74 #endif // CONTENT_BROWSER_RENDERER_HOST_INPUT_INPUT_ROUTER_H_
OLDNEW
« no previous file with comments | « content/browser/renderer_host/input/input_ack_handler.h ('k') | content/browser/renderer_host/input/input_router_client.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698