Index: content/browser/renderer_host/render_widget_host.h |
=================================================================== |
--- content/browser/renderer_host/render_widget_host.h (revision 111709) |
+++ content/browser/renderer_host/render_widget_host.h (working copy) |
@@ -283,6 +283,7 @@ |
void ForwardWheelEvent(const WebKit::WebMouseWheelEvent& wheel_event); |
void ForwardGestureEvent(const WebKit::WebGestureEvent& gesture_event); |
virtual void ForwardKeyboardEvent(const NativeWebKeyboardEvent& key_event); |
+ virtual void ForwardNextKeyboardEvent(); |
virtual void ForwardTouchEvent(const WebKit::WebTouchEvent& touch_event); |
@@ -450,7 +451,7 @@ |
protected: |
// Internal implementation of the public Forward*Event() methods. |
void ForwardInputEvent(const WebKit::WebInputEvent& input_event, |
- int event_size, bool is_keyboard_shortcut); |
+ int event_size); |
// Called when we receive a notification indicating that the renderer |
// process has gone. This will reset our state so that our state will be |
@@ -738,7 +739,14 @@ |
base::TimeTicks repaint_start_time_; |
// Queue of keyboard events that we need to track. |
- typedef std::deque<NativeWebKeyboardEvent> KeyQueue; |
+ struct Key { |
+ Key(const NativeWebKeyboardEvent& event, bool is_shortcut) |
+ : event(event), is_shortcut(is_shortcut) { |
+ } |
+ NativeWebKeyboardEvent event; |
+ bool is_shortcut; |
+ }; |
+ typedef std::deque<Key> KeyQueue; |
// A queue of keyboard events. We can't trust data from the renderer so we |
// stuff key events into a queue and pop them out on ACK, feeding our copy |
@@ -758,19 +766,27 @@ |
bool text_direction_canceled_; |
// Indicates if the next sequence of Char events should be suppressed or not. |
- // System may translate a RawKeyDown event into zero or more Char events, |
+ // |
+ // The system may translate a RawKeyDown event into zero or more Char events, |
// usually we send them to the renderer directly in sequence. However, If a |
- // RawKeyDown event was not handled by the renderer but was handled by |
- // our UnhandledKeyboardEvent() method, e.g. as an accelerator key, then we |
- // shall not send the following sequence of Char events, which was generated |
- // by this RawKeyDown event, to the renderer. Otherwise the renderer may |
- // handle the Char events and cause unexpected behavior. |
- // For example, pressing alt-2 may let the browser switch to the second tab, |
- // but the Char event generated by alt-2 may also activate a HTML element |
- // if its accesskey happens to be "2", then the user may get confused when |
- // switching back to the original tab, because the content may already be |
- // changed. |
- bool suppress_next_char_events_; |
+ // RawKeyDown event was not handled by the renderer but was handled by our |
+ // UnhandledKeyboardEvent() method, e.g. as an accelerator key, then we shall |
+ // not send the following sequence of Char events, which was generated by |
+ // this RawKeyDown event, to the renderer. Otherwise the renderer may handle |
+ // the Char events and cause unexpected behavior. For example, pressing |
+ // alt-2 may let the browser switch to the second tab, but the Char event |
+ // generated by alt-2 may also activate a HTML element if its accesskey |
+ // happens to be "2", then the user may get confused when switching back to |
+ // the original tab, because the content may already be changed. |
+ // |
+ // If true, suppress_incoming_char_events_ prevents Char events from being |
+ // added to key_queue_. |
+ // |
+ // If true, suppress_outgoing_char_events_ prevents Char events from being |
+ // removed from key_queue_ and forwarded to the renderer. |
+ // |
+ bool suppress_incoming_char_events_; |
+ bool suppress_outgoing_char_events_; |
std::vector<gfx::PluginWindowHandle> deferred_plugin_handles_; |