| OLD | NEW |
| 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 Loading... |
| 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(); |
| 286 virtual void ForwardTouchEvent(const WebKit::WebTouchEvent& touch_event); | 287 virtual void ForwardTouchEvent(const WebKit::WebTouchEvent& touch_event); |
| 287 | 288 |
| 288 | 289 |
| 289 // Update the text direction of the focused input element and notify it to a | 290 // Update the text direction of the focused input element and notify it to a |
| 290 // renderer process. | 291 // renderer process. |
| 291 // These functions have two usage scenarios: changing the text direction | 292 // These functions have two usage scenarios: changing the text direction |
| 292 // from a menu (as Safari does), and; changing the text direction when a user | 293 // from a menu (as Safari does), and; changing the text direction when a user |
| 293 // presses a set of keys (as IE and Firefox do). | 294 // presses a set of keys (as IE and Firefox do). |
| 294 // 1. Change the text direction from a menu. | 295 // 1. Change the text direction from a menu. |
| 295 // In this scenario, we receive a menu event only once and we should update | 296 // In this scenario, we receive a menu event only once and we should update |
| (...skipping 147 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 443 | 444 |
| 444 #if defined(OS_MACOSX) || defined(UI_COMPOSITOR_IMAGE_TRANSPORT) | 445 #if defined(OS_MACOSX) || defined(UI_COMPOSITOR_IMAGE_TRANSPORT) |
| 445 // Called by the view in response to AcceleratedSurfaceBuffersSwapped. | 446 // Called by the view in response to AcceleratedSurfaceBuffersSwapped. |
| 446 static void AcknowledgeSwapBuffers(int32 route_id, int gpu_host_id); | 447 static void AcknowledgeSwapBuffers(int32 route_id, int gpu_host_id); |
| 447 static void AcknowledgePostSubBuffer(int32 route_id, int gpu_host_id); | 448 static void AcknowledgePostSubBuffer(int32 route_id, int gpu_host_id); |
| 448 #endif | 449 #endif |
| 449 | 450 |
| 450 protected: | 451 protected: |
| 451 // Internal implementation of the public Forward*Event() methods. | 452 // Internal implementation of the public Forward*Event() methods. |
| 452 void ForwardInputEvent(const WebKit::WebInputEvent& input_event, | 453 void ForwardInputEvent(const WebKit::WebInputEvent& input_event, |
| 453 int event_size, bool is_keyboard_shortcut); | 454 int event_size); |
| 454 | 455 |
| 455 // Called when we receive a notification indicating that the renderer | 456 // Called when we receive a notification indicating that the renderer |
| 456 // process has gone. This will reset our state so that our state will be | 457 // process has gone. This will reset our state so that our state will be |
| 457 // consistent if a new renderer is created. | 458 // consistent if a new renderer is created. |
| 458 void RendererExited(base::TerminationStatus status, int exit_code); | 459 void RendererExited(base::TerminationStatus status, int exit_code); |
| 459 | 460 |
| 460 // Retrieves an id the renderer can use to refer to its view. | 461 // Retrieves an id the renderer can use to refer to its view. |
| 461 // This is used for various IPC messages, including plugins. | 462 // This is used for various IPC messages, including plugins. |
| 462 gfx::NativeViewId GetNativeViewId() const; | 463 gfx::NativeViewId GetNativeViewId() const; |
| 463 | 464 |
| (...skipping 267 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 731 bool in_get_backing_store_; | 732 bool in_get_backing_store_; |
| 732 | 733 |
| 733 // Set when we call DidPaintRect/DidScrollRect on the view. | 734 // Set when we call DidPaintRect/DidScrollRect on the view. |
| 734 bool view_being_painted_; | 735 bool view_being_painted_; |
| 735 | 736 |
| 736 // Used for UMA histogram logging to measure the time for a repaint view | 737 // Used for UMA histogram logging to measure the time for a repaint view |
| 737 // operation to finish. | 738 // operation to finish. |
| 738 base::TimeTicks repaint_start_time_; | 739 base::TimeTicks repaint_start_time_; |
| 739 | 740 |
| 740 // Queue of keyboard events that we need to track. | 741 // Queue of keyboard events that we need to track. |
| 741 typedef std::deque<NativeWebKeyboardEvent> KeyQueue; | 742 struct Key { |
| 743 Key(const NativeWebKeyboardEvent& event, bool is_shortcut) |
| 744 : event(event), is_shortcut(is_shortcut) { |
| 745 } |
| 746 NativeWebKeyboardEvent event; |
| 747 bool is_shortcut; |
| 748 }; |
| 749 typedef std::deque<Key> KeyQueue; |
| 742 | 750 |
| 743 // A queue of keyboard events. We can't trust data from the renderer so we | 751 // A queue of keyboard events. We can't trust data from the renderer so we |
| 744 // stuff key events into a queue and pop them out on ACK, feeding our copy | 752 // stuff key events into a queue and pop them out on ACK, feeding our copy |
| 745 // back to whatever unhandled handler instead of the returned version. | 753 // back to whatever unhandled handler instead of the returned version. |
| 746 KeyQueue key_queue_; | 754 KeyQueue key_queue_; |
| 747 | 755 |
| 748 // Set to true if we shouldn't send input events from the render widget. | 756 // Set to true if we shouldn't send input events from the render widget. |
| 749 bool ignore_input_events_; | 757 bool ignore_input_events_; |
| 750 | 758 |
| 751 // Set when we update the text direction of the selected input element. | 759 // Set when we update the text direction of the selected input element. |
| 752 bool text_direction_updated_; | 760 bool text_direction_updated_; |
| 753 WebKit::WebTextDirection text_direction_; | 761 WebKit::WebTextDirection text_direction_; |
| 754 | 762 |
| 755 // Set when we cancel updating the text direction. | 763 // Set when we cancel updating the text direction. |
| 756 // This flag also ignores succeeding update requests until we call | 764 // This flag also ignores succeeding update requests until we call |
| 757 // NotifyTextDirection(). | 765 // NotifyTextDirection(). |
| 758 bool text_direction_canceled_; | 766 bool text_direction_canceled_; |
| 759 | 767 |
| 760 // Indicates if the next sequence of Char events should be suppressed or not. | 768 // Indicates if the next sequence of Char events should be suppressed or not. |
| 761 // System may translate a RawKeyDown event into zero or more Char events, | 769 // |
| 770 // The system may translate a RawKeyDown event into zero or more Char events, |
| 762 // usually we send them to the renderer directly in sequence. However, If a | 771 // usually we send them to the renderer directly in sequence. However, If a |
| 763 // RawKeyDown event was not handled by the renderer but was handled by | 772 // RawKeyDown event was not handled by the renderer but was handled by our |
| 764 // our UnhandledKeyboardEvent() method, e.g. as an accelerator key, then we | 773 // UnhandledKeyboardEvent() method, e.g. as an accelerator key, then we shall |
| 765 // shall not send the following sequence of Char events, which was generated | 774 // not send the following sequence of Char events, which was generated by |
| 766 // by this RawKeyDown event, to the renderer. Otherwise the renderer may | 775 // this RawKeyDown event, to the renderer. Otherwise the renderer may handle |
| 767 // handle the Char events and cause unexpected behavior. | 776 // the Char events and cause unexpected behavior. For example, pressing |
| 768 // For example, pressing alt-2 may let the browser switch to the second tab, | 777 // alt-2 may let the browser switch to the second tab, but the Char event |
| 769 // but the Char event generated by alt-2 may also activate a HTML element | 778 // generated by alt-2 may also activate a HTML element if its accesskey |
| 770 // if its accesskey happens to be "2", then the user may get confused when | 779 // happens to be "2", then the user may get confused when switching back to |
| 771 // switching back to the original tab, because the content may already be | 780 // the original tab, because the content may already be changed. |
| 772 // changed. | 781 // |
| 773 bool suppress_next_char_events_; | 782 // If true, suppress_incoming_char_events_ prevents Char events from being |
| 783 // added to key_queue_. |
| 784 // |
| 785 // If true, suppress_outgoing_char_events_ prevents Char events from being |
| 786 // removed from key_queue_ and forwarded to the renderer. |
| 787 // |
| 788 bool suppress_incoming_char_events_; |
| 789 bool suppress_outgoing_char_events_; |
| 774 | 790 |
| 775 std::vector<gfx::PluginWindowHandle> deferred_plugin_handles_; | 791 std::vector<gfx::PluginWindowHandle> deferred_plugin_handles_; |
| 776 | 792 |
| 777 // The last scroll offset of the render widget. | 793 // The last scroll offset of the render widget. |
| 778 gfx::Point last_scroll_offset_; | 794 gfx::Point last_scroll_offset_; |
| 779 | 795 |
| 780 bool pending_mouse_lock_request_; | 796 bool pending_mouse_lock_request_; |
| 781 | 797 |
| 782 base::WeakPtrFactory<RenderWidgetHost> weak_factory_; | 798 base::WeakPtrFactory<RenderWidgetHost> weak_factory_; |
| 783 | 799 |
| 784 DISALLOW_COPY_AND_ASSIGN(RenderWidgetHost); | 800 DISALLOW_COPY_AND_ASSIGN(RenderWidgetHost); |
| 785 }; | 801 }; |
| 786 | 802 |
| 787 #endif // CONTENT_BROWSER_RENDERER_HOST_RENDER_WIDGET_HOST_H_ | 803 #endif // CONTENT_BROWSER_RENDERER_HOST_RENDER_WIDGET_HOST_H_ |
| OLD | NEW |