| 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 |
| 11 #include <deque> | 11 #include <deque> |
| 12 #include <map> | 12 #include <map> |
| 13 #include <memory> | 13 #include <memory> |
| 14 #include <queue> | 14 #include <queue> |
| 15 | 15 |
| 16 #include "base/callback.h" | 16 #include "base/callback.h" |
| 17 #include "base/compiler_specific.h" | 17 #include "base/compiler_specific.h" |
| 18 #include "base/macros.h" | 18 #include "base/macros.h" |
| 19 #include "base/memory/ref_counted.h" | 19 #include "base/memory/ref_counted.h" |
| 20 #include "base/observer_list.h" | 20 #include "base/observer_list.h" |
| 21 #include "base/time/time.h" | 21 #include "base/time/time.h" |
| 22 #include "build/build_config.h" | 22 #include "build/build_config.h" |
| 23 #include "cc/surfaces/frame_sink_id.h" |
| 23 #include "content/common/content_export.h" | 24 #include "content/common/content_export.h" |
| 24 #include "content/common/cursors/webcursor.h" | 25 #include "content/common/cursors/webcursor.h" |
| 25 #include "content/common/edit_command.h" | 26 #include "content/common/edit_command.h" |
| 26 #include "content/common/input/synthetic_gesture_params.h" | 27 #include "content/common/input/synthetic_gesture_params.h" |
| 27 #include "content/public/common/screen_info.h" | 28 #include "content/public/common/screen_info.h" |
| 28 #include "content/renderer/devtools/render_widget_screen_metrics_emulator_delega
te.h" | 29 #include "content/renderer/devtools/render_widget_screen_metrics_emulator_delega
te.h" |
| 29 #include "content/renderer/gpu/render_widget_compositor_delegate.h" | 30 #include "content/renderer/gpu/render_widget_compositor_delegate.h" |
| 30 #include "content/renderer/input/render_widget_input_handler.h" | 31 #include "content/renderer/input/render_widget_input_handler.h" |
| 31 #include "content/renderer/input/render_widget_input_handler_delegate.h" | 32 #include "content/renderer/input/render_widget_input_handler_delegate.h" |
| 32 #include "content/renderer/message_delivery_policy.h" | 33 #include "content/renderer/message_delivery_policy.h" |
| (...skipping 85 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 118 public RenderWidgetCompositorDelegate, | 119 public RenderWidgetCompositorDelegate, |
| 119 public RenderWidgetInputHandlerDelegate, | 120 public RenderWidgetInputHandlerDelegate, |
| 120 public RenderWidgetScreenMetricsEmulatorDelegate, | 121 public RenderWidgetScreenMetricsEmulatorDelegate, |
| 121 public base::RefCounted<RenderWidget> { | 122 public base::RefCounted<RenderWidget> { |
| 122 public: | 123 public: |
| 123 // Creates a new RenderWidget. The opener_id is the routing ID of the | 124 // Creates a new RenderWidget. The opener_id is the routing ID of the |
| 124 // RenderView that this widget lives inside. | 125 // RenderView that this widget lives inside. |
| 125 static RenderWidget* Create(int32_t opener_id, | 126 static RenderWidget* Create(int32_t opener_id, |
| 126 CompositorDependencies* compositor_deps, | 127 CompositorDependencies* compositor_deps, |
| 127 blink::WebPopupType popup_type, | 128 blink::WebPopupType popup_type, |
| 128 const ScreenInfo& screen_info); | 129 const ScreenInfo& screen_info, |
| 130 const cc::FrameSinkId& frame_sink_id); |
| 129 | 131 |
| 130 // Creates a new RenderWidget that will be attached to a RenderFrame. | 132 // Creates a new RenderWidget that will be attached to a RenderFrame. |
| 131 static RenderWidget* CreateForFrame(int routing_id, | 133 static RenderWidget* CreateForFrame(int routing_id, |
| 132 bool hidden, | 134 bool hidden, |
| 133 const ScreenInfo& screen_info, | 135 const ScreenInfo& screen_info, |
| 134 CompositorDependencies* compositor_deps, | 136 CompositorDependencies* compositor_deps, |
| 135 blink::WebLocalFrame* frame); | 137 blink::WebLocalFrame* frame, |
| 138 const cc::FrameSinkId& frame_sink_id); |
| 136 | 139 |
| 137 // Used by content_layouttest_support to hook into the creation of | 140 // Used by content_layouttest_support to hook into the creation of |
| 138 // RenderWidgets. | 141 // RenderWidgets. |
| 139 using CreateRenderWidgetFunction = | 142 using CreateRenderWidgetFunction = RenderWidget* (*)(CompositorDependencies*, |
| 140 RenderWidget* (*)(CompositorDependencies*, | 143 blink::WebPopupType, |
| 141 blink::WebPopupType, | 144 const ScreenInfo&, |
| 142 const ScreenInfo&, | 145 const cc::FrameSinkId&, |
| 143 bool, | 146 bool, |
| 144 bool, | 147 bool, |
| 145 bool); | 148 bool); |
| 146 using RenderWidgetInitializedCallback = void (*)(RenderWidget*); | 149 using RenderWidgetInitializedCallback = void (*)(RenderWidget*); |
| 147 static void InstallCreateHook( | 150 static void InstallCreateHook( |
| 148 CreateRenderWidgetFunction create_render_widget, | 151 CreateRenderWidgetFunction create_render_widget, |
| 149 RenderWidgetInitializedCallback render_widget_initialized_callback); | 152 RenderWidgetInitializedCallback render_widget_initialized_callback); |
| 150 | 153 |
| 151 // Closes a RenderWidget that was created by |CreateForFrame|. | 154 // Closes a RenderWidget that was created by |CreateForFrame|. |
| 152 // TODO(avi): De-virtualize this once RenderViewImpl has-a RenderWidget. | 155 // TODO(avi): De-virtualize this once RenderViewImpl has-a RenderWidget. |
| 153 // https://crbug.com/545684 | 156 // https://crbug.com/545684 |
| 154 virtual void CloseForFrame(); | 157 virtual void CloseForFrame(); |
| 155 | 158 |
| (...skipping 227 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 383 | 386 |
| 384 // Change the device ICC color profile while running a layout test. | 387 // Change the device ICC color profile while running a layout test. |
| 385 void SetDeviceColorProfileForTesting(const std::vector<char>& color_profile); | 388 void SetDeviceColorProfileForTesting(const std::vector<char>& color_profile); |
| 386 | 389 |
| 387 // Called when the Widget has changed size as a result of an auto-resize. | 390 // Called when the Widget has changed size as a result of an auto-resize. |
| 388 void DidAutoResize(const gfx::Size& new_size); | 391 void DidAutoResize(const gfx::Size& new_size); |
| 389 | 392 |
| 390 // Indicates whether this widget has focus. | 393 // Indicates whether this widget has focus. |
| 391 bool has_focus() const { return has_focus_; } | 394 bool has_focus() const { return has_focus_; } |
| 392 | 395 |
| 396 const cc::FrameSinkId& frame_sink_id() const { return frame_sink_id_; } |
| 397 |
| 393 MouseLockDispatcher* mouse_lock_dispatcher() { | 398 MouseLockDispatcher* mouse_lock_dispatcher() { |
| 394 return mouse_lock_dispatcher_.get(); | 399 return mouse_lock_dispatcher_.get(); |
| 395 } | 400 } |
| 396 | 401 |
| 397 // TODO(ekaramad): The reference to the focused pepper plugin will be removed | 402 // TODO(ekaramad): The reference to the focused pepper plugin will be removed |
| 398 // from RenderWidget. The purpose of having the reference here was to make IME | 403 // from RenderWidget. The purpose of having the reference here was to make IME |
| 399 // work for OOPIF (https://crbug.com/643727). | 404 // work for OOPIF (https://crbug.com/643727). |
| 400 void set_focused_pepper_plugin(PepperPluginInstanceImpl* plugin) { | 405 void set_focused_pepper_plugin(PepperPluginInstanceImpl* plugin) { |
| 401 focused_pepper_plugin_ = plugin; | 406 focused_pepper_plugin_ = plugin; |
| 402 } | 407 } |
| (...skipping 10 matching lines...) Expand all Loading... |
| 413 friend class RenderWidgetTest; | 418 friend class RenderWidgetTest; |
| 414 | 419 |
| 415 enum ResizeAck { | 420 enum ResizeAck { |
| 416 SEND_RESIZE_ACK, | 421 SEND_RESIZE_ACK, |
| 417 NO_RESIZE_ACK, | 422 NO_RESIZE_ACK, |
| 418 }; | 423 }; |
| 419 | 424 |
| 420 RenderWidget(CompositorDependencies* compositor_deps, | 425 RenderWidget(CompositorDependencies* compositor_deps, |
| 421 blink::WebPopupType popup_type, | 426 blink::WebPopupType popup_type, |
| 422 const ScreenInfo& screen_info, | 427 const ScreenInfo& screen_info, |
| 428 const cc::FrameSinkId& frame_sink_id, |
| 423 bool swapped_out, | 429 bool swapped_out, |
| 424 bool hidden, | 430 bool hidden, |
| 425 bool never_visible); | 431 bool never_visible); |
| 426 | 432 |
| 427 ~RenderWidget() override; | 433 ~RenderWidget() override; |
| 428 | 434 |
| 429 static blink::WebFrameWidget* CreateWebFrameWidget( | 435 static blink::WebFrameWidget* CreateWebFrameWidget( |
| 430 RenderWidget* render_widget, | 436 RenderWidget* render_widget, |
| 431 blink::WebLocalFrame* frame); | 437 blink::WebLocalFrame* frame); |
| 432 | 438 |
| (...skipping 311 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 744 // The time spent in input handlers this frame. Used to throttle input acks. | 750 // The time spent in input handlers this frame. Used to throttle input acks. |
| 745 base::TimeDelta total_input_handling_time_this_frame_; | 751 base::TimeDelta total_input_handling_time_this_frame_; |
| 746 | 752 |
| 747 // Properties of the screen hosting this RenderWidget instance. | 753 // Properties of the screen hosting this RenderWidget instance. |
| 748 ScreenInfo screen_info_; | 754 ScreenInfo screen_info_; |
| 749 | 755 |
| 750 // The device scale factor. This value is computed from the DPI entries in | 756 // The device scale factor. This value is computed from the DPI entries in |
| 751 // |screen_info_| on some platforms, and defaults to 1 on other platforms. | 757 // |screen_info_| on some platforms, and defaults to 1 on other platforms. |
| 752 float device_scale_factor_; | 758 float device_scale_factor_; |
| 753 | 759 |
| 760 cc::FrameSinkId frame_sink_id_; |
| 761 |
| 754 // The device color profile on supported platforms. | 762 // The device color profile on supported platforms. |
| 755 std::vector<char> device_color_profile_; | 763 std::vector<char> device_color_profile_; |
| 756 | 764 |
| 757 // State associated with synthetic gestures. Synthetic gestures are processed | 765 // State associated with synthetic gestures. Synthetic gestures are processed |
| 758 // in-order, so a queue is sufficient to identify the correct state for a | 766 // in-order, so a queue is sufficient to identify the correct state for a |
| 759 // completed gesture. | 767 // completed gesture. |
| 760 std::queue<SyntheticGestureCompletionCallback> | 768 std::queue<SyntheticGestureCompletionCallback> |
| 761 pending_synthetic_gesture_callbacks_; | 769 pending_synthetic_gesture_callbacks_; |
| 762 | 770 |
| 763 #if defined(OS_ANDROID) | 771 #if defined(OS_ANDROID) |
| (...skipping 65 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 829 // Stores edit commands associated to the next key event. | 837 // Stores edit commands associated to the next key event. |
| 830 // Will be cleared as soon as the next key event is processed. | 838 // Will be cleared as soon as the next key event is processed. |
| 831 EditCommands edit_commands_; | 839 EditCommands edit_commands_; |
| 832 | 840 |
| 833 DISALLOW_COPY_AND_ASSIGN(RenderWidget); | 841 DISALLOW_COPY_AND_ASSIGN(RenderWidget); |
| 834 }; | 842 }; |
| 835 | 843 |
| 836 } // namespace content | 844 } // namespace content |
| 837 | 845 |
| 838 #endif // CONTENT_RENDERER_RENDER_WIDGET_H_ | 846 #endif // CONTENT_RENDERER_RENDER_WIDGET_H_ |
| OLD | NEW |