| OLD | NEW |
| 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 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_RENDERER_RENDER_WIDGET_H_ | 5 #ifndef CONTENT_RENDERER_RENDER_WIDGET_H_ |
| 6 #define CONTENT_RENDERER_RENDER_WIDGET_H_ | 6 #define CONTENT_RENDERER_RENDER_WIDGET_H_ |
| 7 | 7 |
| 8 #include <stddef.h> | 8 #include <stddef.h> |
| 9 #include <stdint.h> | 9 #include <stdint.h> |
| 10 | 10 |
| (...skipping 15 matching lines...) Expand all Loading... |
| 26 #include "content/common/content_export.h" | 26 #include "content/common/content_export.h" |
| 27 #include "content/common/cursors/webcursor.h" | 27 #include "content/common/cursors/webcursor.h" |
| 28 #include "content/common/drag_event_source_info.h" | 28 #include "content/common/drag_event_source_info.h" |
| 29 #include "content/common/edit_command.h" | 29 #include "content/common/edit_command.h" |
| 30 #include "content/common/features.h" | 30 #include "content/common/features.h" |
| 31 #include "content/common/input/synthetic_gesture_params.h" | 31 #include "content/common/input/synthetic_gesture_params.h" |
| 32 #include "content/public/common/drop_data.h" | 32 #include "content/public/common/drop_data.h" |
| 33 #include "content/public/common/screen_info.h" | 33 #include "content/public/common/screen_info.h" |
| 34 #include "content/renderer/devtools/render_widget_screen_metrics_emulator_delega
te.h" | 34 #include "content/renderer/devtools/render_widget_screen_metrics_emulator_delega
te.h" |
| 35 #include "content/renderer/gpu/render_widget_compositor_delegate.h" | 35 #include "content/renderer/gpu/render_widget_compositor_delegate.h" |
| 36 #include "content/renderer/input/main_thread_event_queue.h" |
| 36 #include "content/renderer/input/render_widget_input_handler.h" | 37 #include "content/renderer/input/render_widget_input_handler.h" |
| 37 #include "content/renderer/input/render_widget_input_handler_delegate.h" | 38 #include "content/renderer/input/render_widget_input_handler_delegate.h" |
| 38 #include "content/renderer/message_delivery_policy.h" | 39 #include "content/renderer/message_delivery_policy.h" |
| 39 #include "content/renderer/mouse_lock_dispatcher.h" | 40 #include "content/renderer/mouse_lock_dispatcher.h" |
| 40 #include "content/renderer/render_widget_mouse_lock_dispatcher.h" | 41 #include "content/renderer/render_widget_mouse_lock_dispatcher.h" |
| 41 #include "ipc/ipc_listener.h" | 42 #include "ipc/ipc_listener.h" |
| 42 #include "ipc/ipc_message.h" | 43 #include "ipc/ipc_message.h" |
| 43 #include "ipc/ipc_sender.h" | 44 #include "ipc/ipc_sender.h" |
| 44 #include "third_party/WebKit/public/platform/WebDisplayMode.h" | 45 #include "third_party/WebKit/public/platform/WebDisplayMode.h" |
| 45 #include "third_party/WebKit/public/platform/WebInputEvent.h" | 46 #include "third_party/WebKit/public/platform/WebInputEvent.h" |
| (...skipping 48 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 94 | 95 |
| 95 namespace ui { | 96 namespace ui { |
| 96 struct DidOverscrollParams; | 97 struct DidOverscrollParams; |
| 97 } | 98 } |
| 98 | 99 |
| 99 namespace content { | 100 namespace content { |
| 100 class CompositorDependencies; | 101 class CompositorDependencies; |
| 101 class ExternalPopupMenu; | 102 class ExternalPopupMenu; |
| 102 class FrameSwapMessageQueue; | 103 class FrameSwapMessageQueue; |
| 103 class ImeEventGuard; | 104 class ImeEventGuard; |
| 105 class MainThreadEventQueue; |
| 104 class PepperPluginInstanceImpl; | 106 class PepperPluginInstanceImpl; |
| 105 class RenderFrameImpl; | 107 class RenderFrameImpl; |
| 106 class RenderFrameProxy; | 108 class RenderFrameProxy; |
| 107 class RenderViewImpl; | 109 class RenderViewImpl; |
| 108 class RenderWidgetCompositor; | 110 class RenderWidgetCompositor; |
| 109 class RenderWidgetOwnerDelegate; | 111 class RenderWidgetOwnerDelegate; |
| 110 class RenderWidgetScreenMetricsEmulator; | 112 class RenderWidgetScreenMetricsEmulator; |
| 111 class ResizingModeSelector; | 113 class ResizingModeSelector; |
| 112 class TextInputClientObserver; | 114 class TextInputClientObserver; |
| 113 struct ContextMenuParams; | 115 struct ContextMenuParams; |
| 114 struct ResizeParams; | 116 struct ResizeParams; |
| 115 | 117 |
| 116 // RenderWidget provides a communication bridge between a WebWidget and | 118 // RenderWidget provides a communication bridge between a WebWidget and |
| 117 // a RenderWidgetHost, the latter of which lives in a different process. | 119 // a RenderWidgetHost, the latter of which lives in a different process. |
| 118 // | 120 // |
| 119 // RenderWidget is used to implement: | 121 // RenderWidget is used to implement: |
| 120 // - RenderViewImpl (deprecated) | 122 // - RenderViewImpl (deprecated) |
| 121 // - Fullscreen mode (RenderWidgetFullScreen) | 123 // - Fullscreen mode (RenderWidgetFullScreen) |
| 122 // - Popup "menus" (like the color chooser and date picker) | 124 // - Popup "menus" (like the color chooser and date picker) |
| 123 // - Widgets for frames (for out-of-process iframe support) | 125 // - Widgets for frames (for out-of-process iframe support) |
| 124 class CONTENT_EXPORT RenderWidget | 126 class CONTENT_EXPORT RenderWidget |
| 125 : public IPC::Listener, | 127 : public IPC::Listener, |
| 126 public IPC::Sender, | 128 public IPC::Sender, |
| 127 NON_EXPORTED_BASE(virtual public blink::WebWidgetClient), | 129 NON_EXPORTED_BASE(virtual public blink::WebWidgetClient), |
| 128 public RenderWidgetCompositorDelegate, | 130 public RenderWidgetCompositorDelegate, |
| 129 public RenderWidgetInputHandlerDelegate, | 131 public RenderWidgetInputHandlerDelegate, |
| 130 public RenderWidgetScreenMetricsEmulatorDelegate, | 132 public RenderWidgetScreenMetricsEmulatorDelegate, |
| 131 public base::RefCounted<RenderWidget> { | 133 public base::RefCounted<RenderWidget>, |
| 134 public MainThreadEventQueueClient { |
| 132 public: | 135 public: |
| 133 // Creates a new RenderWidget for a popup. |opener| is the RenderView that | 136 // Creates a new RenderWidget for a popup. |opener| is the RenderView that |
| 134 // this widget lives inside. | 137 // this widget lives inside. |
| 135 static RenderWidget* CreateForPopup(RenderViewImpl* opener, | 138 static RenderWidget* CreateForPopup(RenderViewImpl* opener, |
| 136 CompositorDependencies* compositor_deps, | 139 CompositorDependencies* compositor_deps, |
| 137 blink::WebPopupType popup_type, | 140 blink::WebPopupType popup_type, |
| 138 const ScreenInfo& screen_info); | 141 const ScreenInfo& screen_info); |
| 139 | 142 |
| 140 // Creates a new RenderWidget that will be attached to a RenderFrame. | 143 // Creates a new RenderWidget that will be attached to a RenderFrame. |
| 141 static RenderWidget* CreateForFrame(int widget_routing_id, | 144 static RenderWidget* CreateForFrame(int widget_routing_id, |
| (...skipping 79 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 221 // RenderWidget. | 224 // RenderWidget. |
| 222 void RegisterRenderFrame(RenderFrameImpl* frame); | 225 void RegisterRenderFrame(RenderFrameImpl* frame); |
| 223 void UnregisterRenderFrame(RenderFrameImpl* frame); | 226 void UnregisterRenderFrame(RenderFrameImpl* frame); |
| 224 | 227 |
| 225 // IPC::Listener | 228 // IPC::Listener |
| 226 bool OnMessageReceived(const IPC::Message& msg) override; | 229 bool OnMessageReceived(const IPC::Message& msg) override; |
| 227 | 230 |
| 228 // IPC::Sender | 231 // IPC::Sender |
| 229 bool Send(IPC::Message* msg) override; | 232 bool Send(IPC::Message* msg) override; |
| 230 | 233 |
| 231 // Requests a BeginMainFrame callback from the compositor. | |
| 232 void SetNeedsMainFrame(); | |
| 233 | |
| 234 // RenderWidgetCompositorDelegate | 234 // RenderWidgetCompositorDelegate |
| 235 void ApplyViewportDeltas(const gfx::Vector2dF& inner_delta, | 235 void ApplyViewportDeltas(const gfx::Vector2dF& inner_delta, |
| 236 const gfx::Vector2dF& outer_delta, | 236 const gfx::Vector2dF& outer_delta, |
| 237 const gfx::Vector2dF& elastic_overscroll_delta, | 237 const gfx::Vector2dF& elastic_overscroll_delta, |
| 238 float page_scale, | 238 float page_scale, |
| 239 float top_controls_delta) override; | 239 float top_controls_delta) override; |
| 240 void RecordWheelAndTouchScrollingCount(bool has_scrolled_by_wheel, | 240 void RecordWheelAndTouchScrollingCount(bool has_scrolled_by_wheel, |
| 241 bool has_scrolled_by_touch) override; | 241 bool has_scrolled_by_touch) override; |
| 242 void BeginMainFrame(double frame_time_sec) override; | 242 void BeginMainFrame(double frame_time_sec) override; |
| 243 void RequestNewCompositorFrameSink( | 243 void RequestNewCompositorFrameSink( |
| (...skipping 13 matching lines...) Expand all Loading... |
| 257 // RenderWidgetInputHandlerDelegate | 257 // RenderWidgetInputHandlerDelegate |
| 258 void FocusChangeComplete() override; | 258 void FocusChangeComplete() override; |
| 259 bool HasTouchEventHandlersAt(const gfx::Point& point) const override; | 259 bool HasTouchEventHandlersAt(const gfx::Point& point) const override; |
| 260 void ObserveGestureEventAndResult(const blink::WebGestureEvent& gesture_event, | 260 void ObserveGestureEventAndResult(const blink::WebGestureEvent& gesture_event, |
| 261 const gfx::Vector2dF& unused_delta, | 261 const gfx::Vector2dF& unused_delta, |
| 262 bool event_processed) override; | 262 bool event_processed) override; |
| 263 | 263 |
| 264 void OnDidHandleKeyEvent() override; | 264 void OnDidHandleKeyEvent() override; |
| 265 void OnDidOverscroll(const ui::DidOverscrollParams& params) override; | 265 void OnDidOverscroll(const ui::DidOverscrollParams& params) override; |
| 266 void OnInputEventAck(std::unique_ptr<InputEventAck> input_event_ack) override; | 266 void OnInputEventAck(std::unique_ptr<InputEventAck> input_event_ack) override; |
| 267 void NotifyInputEventHandled(blink::WebInputEvent::Type handled_type, | |
| 268 blink::WebInputEventResult result, | |
| 269 InputEventAckState ack_result) override; | |
| 270 void SetInputHandler(RenderWidgetInputHandler* input_handler) override; | 267 void SetInputHandler(RenderWidgetInputHandler* input_handler) override; |
| 271 void ShowVirtualKeyboard() override; | 268 void ShowVirtualKeyboard() override; |
| 272 void UpdateTextInputState() override; | 269 void UpdateTextInputState() override; |
| 273 void ClearTextInputState() override; | 270 void ClearTextInputState() override; |
| 274 bool WillHandleGestureEvent(const blink::WebGestureEvent& event) override; | 271 bool WillHandleGestureEvent(const blink::WebGestureEvent& event) override; |
| 275 bool WillHandleMouseEvent(const blink::WebMouseEvent& event) override; | 272 bool WillHandleMouseEvent(const blink::WebMouseEvent& event) override; |
| 276 | 273 |
| 277 // RenderWidgetScreenMetricsDelegate | 274 // RenderWidgetScreenMetricsDelegate |
| 278 void Redraw() override; | 275 void Redraw() override; |
| 279 void Resize(const ResizeParams& resize_params) override; | 276 void Resize(const ResizeParams& resize_params) override; |
| (...skipping 129 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 409 | 406 |
| 410 // Helper to convert |point| using ConvertWindowToViewport(). | 407 // Helper to convert |point| using ConvertWindowToViewport(). |
| 411 gfx::Point ConvertWindowPointToViewport(const gfx::Point& point); | 408 gfx::Point ConvertWindowPointToViewport(const gfx::Point& point); |
| 412 | 409 |
| 413 virtual void TransferActiveWheelFlingAnimation( | 410 virtual void TransferActiveWheelFlingAnimation( |
| 414 const blink::WebActiveWheelFlingParameters& params) {} | 411 const blink::WebActiveWheelFlingParameters& params) {} |
| 415 | 412 |
| 416 uint32_t GetContentSourceId(); | 413 uint32_t GetContentSourceId(); |
| 417 void IncrementContentSourceId(); | 414 void IncrementContentSourceId(); |
| 418 | 415 |
| 416 // MainThreadEventQueueClient overrides. |
| 417 |
| 418 // Requests a BeginMainFrame callback from the compositor. |
| 419 void SetNeedsMainFrame() override; |
| 420 |
| 421 InputEventAckState HandleInputEvent( |
| 422 const blink::WebCoalescedInputEvent& input_event, |
| 423 const ui::LatencyInfo& latency_info, |
| 424 InputEventDispatchType dispatch_type) override; |
| 425 |
| 426 void SendInputEventAck(blink::WebInputEvent::Type type, |
| 427 InputEventAckState ack_result, |
| 428 uint32_t touch_event_id) override; |
| 429 |
| 419 protected: | 430 protected: |
| 420 // Friend RefCounted so that the dtor can be non-public. Using this class | 431 // Friend RefCounted so that the dtor can be non-public. Using this class |
| 421 // without ref-counting is an error. | 432 // without ref-counting is an error. |
| 422 friend class base::RefCounted<RenderWidget>; | 433 friend class base::RefCounted<RenderWidget>; |
| 423 | 434 |
| 424 // For unit tests. | 435 // For unit tests. |
| 425 friend class RenderWidgetTest; | 436 friend class RenderWidgetTest; |
| 426 | 437 |
| 427 enum ResizeAck { | 438 enum ResizeAck { |
| 428 SEND_RESIZE_ACK, | 439 SEND_RESIZE_ACK, |
| (...skipping 432 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 861 // responsible for sending it to the browser process to be used to match | 872 // responsible for sending it to the browser process to be used to match |
| 862 // each compositor frame to the most recent page navigation before it was | 873 // each compositor frame to the most recent page navigation before it was |
| 863 // generated. | 874 // generated. |
| 864 // This only applies to main frames, and is not touched for subframe | 875 // This only applies to main frames, and is not touched for subframe |
| 865 // RenderWidgets, where there is no concern around displaying unloaded | 876 // RenderWidgets, where there is no concern around displaying unloaded |
| 866 // content. | 877 // content. |
| 867 // TODO(kenrb, fsamuel): This should be removed when SurfaceIDs can be used | 878 // TODO(kenrb, fsamuel): This should be removed when SurfaceIDs can be used |
| 868 // to replace it. See https://crbug.com/695579. | 879 // to replace it. See https://crbug.com/695579. |
| 869 uint32_t current_content_source_id_; | 880 uint32_t current_content_source_id_; |
| 870 | 881 |
| 882 scoped_refptr<MainThreadEventQueue> input_event_queue_; |
| 883 |
| 871 base::WeakPtrFactory<RenderWidget> weak_ptr_factory_; | 884 base::WeakPtrFactory<RenderWidget> weak_ptr_factory_; |
| 872 | 885 |
| 873 DISALLOW_COPY_AND_ASSIGN(RenderWidget); | 886 DISALLOW_COPY_AND_ASSIGN(RenderWidget); |
| 874 }; | 887 }; |
| 875 | 888 |
| 876 } // namespace content | 889 } // namespace content |
| 877 | 890 |
| 878 #endif // CONTENT_RENDERER_RENDER_WIDGET_H_ | 891 #endif // CONTENT_RENDERER_RENDER_WIDGET_H_ |
| OLD | NEW |