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

Side by Side Diff: content/browser/renderer_host/render_widget_host.h

Issue 8885009: Revert r112160 ("Send one WebKeyboardEvent to the RenderWidget at a time.") (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 9 years 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 | Annotate | Revision Log
« no previous file with comments | « no previous file | content/browser/renderer_host/render_widget_host.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2011 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_RENDER_WIDGET_HOST_H_ 5 #ifndef CONTENT_BROWSER_RENDERER_HOST_RENDER_WIDGET_HOST_H_
6 #define CONTENT_BROWSER_RENDERER_HOST_RENDER_WIDGET_HOST_H_ 6 #define CONTENT_BROWSER_RENDERER_HOST_RENDER_WIDGET_HOST_H_
7 #pragma once 7 #pragma once
8 8
9 #include <deque> 9 #include <deque>
10 #include <string> 10 #include <string>
(...skipping 265 matching lines...) Expand 10 before | Expand all | Expand 10 after
276 void StopHangMonitorTimeout(); 276 void StopHangMonitorTimeout();
277 277
278 // Forwards the given message to the renderer. These are called by the view 278 // Forwards the given message to the renderer. These are called by the view
279 // when it has received a message. 279 // when it has received a message.
280 virtual void ForwardMouseEvent(const WebKit::WebMouseEvent& mouse_event); 280 virtual void ForwardMouseEvent(const WebKit::WebMouseEvent& mouse_event);
281 // Called when a mouse click activates the renderer. 281 // Called when a mouse click activates the renderer.
282 virtual void OnMouseActivate(); 282 virtual void OnMouseActivate();
283 void ForwardWheelEvent(const WebKit::WebMouseWheelEvent& wheel_event); 283 void ForwardWheelEvent(const WebKit::WebMouseWheelEvent& wheel_event);
284 void ForwardGestureEvent(const WebKit::WebGestureEvent& gesture_event); 284 void ForwardGestureEvent(const WebKit::WebGestureEvent& gesture_event);
285 virtual void ForwardKeyboardEvent(const NativeWebKeyboardEvent& key_event); 285 virtual void ForwardKeyboardEvent(const NativeWebKeyboardEvent& key_event);
286 virtual void ForwardNextKeyboardEvent();
287 virtual void ForwardTouchEvent(const WebKit::WebTouchEvent& touch_event); 286 virtual void ForwardTouchEvent(const WebKit::WebTouchEvent& touch_event);
288 287
289 288
290 // Update the text direction of the focused input element and notify it to a 289 // Update the text direction of the focused input element and notify it to a
291 // renderer process. 290 // renderer process.
292 // These functions have two usage scenarios: changing the text direction 291 // These functions have two usage scenarios: changing the text direction
293 // from a menu (as Safari does), and; changing the text direction when a user 292 // from a menu (as Safari does), and; changing the text direction when a user
294 // presses a set of keys (as IE and Firefox do). 293 // presses a set of keys (as IE and Firefox do).
295 // 1. Change the text direction from a menu. 294 // 1. Change the text direction from a menu.
296 // In this scenario, we receive a menu event only once and we should update 295 // In this scenario, we receive a menu event only once and we should update
(...skipping 155 matching lines...) Expand 10 before | Expand all | Expand 10 after
452 451
453 #if defined(OS_MACOSX) || defined(UI_COMPOSITOR_IMAGE_TRANSPORT) 452 #if defined(OS_MACOSX) || defined(UI_COMPOSITOR_IMAGE_TRANSPORT)
454 // Called by the view in response to AcceleratedSurfaceBuffersSwapped. 453 // Called by the view in response to AcceleratedSurfaceBuffersSwapped.
455 static void AcknowledgeSwapBuffers(int32 route_id, int gpu_host_id); 454 static void AcknowledgeSwapBuffers(int32 route_id, int gpu_host_id);
456 static void AcknowledgePostSubBuffer(int32 route_id, int gpu_host_id); 455 static void AcknowledgePostSubBuffer(int32 route_id, int gpu_host_id);
457 #endif 456 #endif
458 457
459 protected: 458 protected:
460 // Internal implementation of the public Forward*Event() methods. 459 // Internal implementation of the public Forward*Event() methods.
461 void ForwardInputEvent(const WebKit::WebInputEvent& input_event, 460 void ForwardInputEvent(const WebKit::WebInputEvent& input_event,
462 int event_size); 461 int event_size, bool is_keyboard_shortcut);
463 462
464 // Called when we receive a notification indicating that the renderer 463 // Called when we receive a notification indicating that the renderer
465 // process has gone. This will reset our state so that our state will be 464 // process has gone. This will reset our state so that our state will be
466 // consistent if a new renderer is created. 465 // consistent if a new renderer is created.
467 void RendererExited(base::TerminationStatus status, int exit_code); 466 void RendererExited(base::TerminationStatus status, int exit_code);
468 467
469 // Retrieves an id the renderer can use to refer to its view. 468 // Retrieves an id the renderer can use to refer to its view.
470 // This is used for various IPC messages, including plugins. 469 // This is used for various IPC messages, including plugins.
471 gfx::NativeViewId GetNativeViewId() const; 470 gfx::NativeViewId GetNativeViewId() const;
472 471
(...skipping 280 matching lines...) Expand 10 before | Expand all | Expand 10 after
753 bool in_get_backing_store_; 752 bool in_get_backing_store_;
754 753
755 // Set when we call DidPaintRect/DidScrollRect on the view. 754 // Set when we call DidPaintRect/DidScrollRect on the view.
756 bool view_being_painted_; 755 bool view_being_painted_;
757 756
758 // Used for UMA histogram logging to measure the time for a repaint view 757 // Used for UMA histogram logging to measure the time for a repaint view
759 // operation to finish. 758 // operation to finish.
760 base::TimeTicks repaint_start_time_; 759 base::TimeTicks repaint_start_time_;
761 760
762 // Queue of keyboard events that we need to track. 761 // Queue of keyboard events that we need to track.
763 struct Key { 762 typedef std::deque<NativeWebKeyboardEvent> KeyQueue;
764 Key(const NativeWebKeyboardEvent& event, bool is_shortcut)
765 : event(event), is_shortcut(is_shortcut) {
766 }
767 NativeWebKeyboardEvent event;
768 bool is_shortcut;
769 };
770 typedef std::deque<Key> KeyQueue;
771 763
772 // A queue of keyboard events. We can't trust data from the renderer so we 764 // A queue of keyboard events. We can't trust data from the renderer so we
773 // stuff key events into a queue and pop them out on ACK, feeding our copy 765 // stuff key events into a queue and pop them out on ACK, feeding our copy
774 // back to whatever unhandled handler instead of the returned version. 766 // back to whatever unhandled handler instead of the returned version.
775 KeyQueue key_queue_; 767 KeyQueue key_queue_;
776 768
777 // Set to true if we shouldn't send input events from the render widget. 769 // Set to true if we shouldn't send input events from the render widget.
778 bool ignore_input_events_; 770 bool ignore_input_events_;
779 771
780 // Set when we update the text direction of the selected input element. 772 // Set when we update the text direction of the selected input element.
781 bool text_direction_updated_; 773 bool text_direction_updated_;
782 WebKit::WebTextDirection text_direction_; 774 WebKit::WebTextDirection text_direction_;
783 775
784 // Set when we cancel updating the text direction. 776 // Set when we cancel updating the text direction.
785 // This flag also ignores succeeding update requests until we call 777 // This flag also ignores succeeding update requests until we call
786 // NotifyTextDirection(). 778 // NotifyTextDirection().
787 bool text_direction_canceled_; 779 bool text_direction_canceled_;
788 780
789 // Indicates if the next sequence of Char events should be suppressed or not. 781 // Indicates if the next sequence of Char events should be suppressed or not.
790 // 782 // System may translate a RawKeyDown event into zero or more Char events,
791 // The system may translate a RawKeyDown event into zero or more Char events,
792 // usually we send them to the renderer directly in sequence. However, If a 783 // usually we send them to the renderer directly in sequence. However, If a
793 // RawKeyDown event was not handled by the renderer but was handled by our 784 // RawKeyDown event was not handled by the renderer but was handled by
794 // UnhandledKeyboardEvent() method, e.g. as an accelerator key, then we shall 785 // our UnhandledKeyboardEvent() method, e.g. as an accelerator key, then we
795 // not send the following sequence of Char events, which was generated by 786 // shall not send the following sequence of Char events, which was generated
796 // this RawKeyDown event, to the renderer. Otherwise the renderer may handle 787 // by this RawKeyDown event, to the renderer. Otherwise the renderer may
797 // the Char events and cause unexpected behavior. For example, pressing 788 // handle the Char events and cause unexpected behavior.
798 // alt-2 may let the browser switch to the second tab, but the Char event 789 // For example, pressing alt-2 may let the browser switch to the second tab,
799 // generated by alt-2 may also activate a HTML element if its accesskey 790 // but the Char event generated by alt-2 may also activate a HTML element
800 // happens to be "2", then the user may get confused when switching back to 791 // if its accesskey happens to be "2", then the user may get confused when
801 // the original tab, because the content may already be changed. 792 // switching back to the original tab, because the content may already be
802 // 793 // changed.
803 // If true, suppress_incoming_char_events_ prevents Char events from being 794 bool suppress_next_char_events_;
804 // added to key_queue_.
805 //
806 // If true, suppress_outgoing_char_events_ prevents Char events from being
807 // removed from key_queue_ and forwarded to the renderer.
808 //
809 bool suppress_incoming_char_events_;
810 bool suppress_outgoing_char_events_;
811 795
812 std::vector<gfx::PluginWindowHandle> deferred_plugin_handles_; 796 std::vector<gfx::PluginWindowHandle> deferred_plugin_handles_;
813 797
814 // The last scroll offset of the render widget. 798 // The last scroll offset of the render widget.
815 gfx::Point last_scroll_offset_; 799 gfx::Point last_scroll_offset_;
816 800
817 bool pending_mouse_lock_request_; 801 bool pending_mouse_lock_request_;
818 802
819 base::WeakPtrFactory<RenderWidgetHost> weak_factory_; 803 base::WeakPtrFactory<RenderWidgetHost> weak_factory_;
820 804
821 DISALLOW_COPY_AND_ASSIGN(RenderWidgetHost); 805 DISALLOW_COPY_AND_ASSIGN(RenderWidgetHost);
822 }; 806 };
823 807
824 #endif // CONTENT_BROWSER_RENDERER_HOST_RENDER_WIDGET_HOST_H_ 808 #endif // CONTENT_BROWSER_RENDERER_HOST_RENDER_WIDGET_HOST_H_
OLDNEW
« no previous file with comments | « no previous file | content/browser/renderer_host/render_widget_host.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698