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 "content/common/content_export.h" | 23 #include "content/common/content_export.h" |
24 #include "content/common/cursors/webcursor.h" | 24 #include "content/common/cursors/webcursor.h" |
25 #include "content/common/input/synthetic_gesture_params.h" | 25 #include "content/common/input/synthetic_gesture_params.h" |
| 26 #include "content/public/common/screen_info.h" |
26 #include "content/renderer/devtools/render_widget_screen_metrics_emulator_delega
te.h" | 27 #include "content/renderer/devtools/render_widget_screen_metrics_emulator_delega
te.h" |
27 #include "content/renderer/gpu/render_widget_compositor_delegate.h" | 28 #include "content/renderer/gpu/render_widget_compositor_delegate.h" |
28 #include "content/renderer/input/render_widget_input_handler.h" | 29 #include "content/renderer/input/render_widget_input_handler.h" |
29 #include "content/renderer/input/render_widget_input_handler_delegate.h" | 30 #include "content/renderer/input/render_widget_input_handler_delegate.h" |
30 #include "content/renderer/message_delivery_policy.h" | 31 #include "content/renderer/message_delivery_policy.h" |
31 #include "content/renderer/mouse_lock_dispatcher.h" | 32 #include "content/renderer/mouse_lock_dispatcher.h" |
32 #include "content/renderer/render_widget_mouse_lock_dispatcher.h" | 33 #include "content/renderer/render_widget_mouse_lock_dispatcher.h" |
33 #include "ipc/ipc_listener.h" | 34 #include "ipc/ipc_listener.h" |
34 #include "ipc/ipc_sender.h" | 35 #include "ipc/ipc_sender.h" |
35 #include "third_party/WebKit/public/platform/WebDisplayMode.h" | 36 #include "third_party/WebKit/public/platform/WebDisplayMode.h" |
(...skipping 78 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
114 public RenderWidgetCompositorDelegate, | 115 public RenderWidgetCompositorDelegate, |
115 public RenderWidgetInputHandlerDelegate, | 116 public RenderWidgetInputHandlerDelegate, |
116 public RenderWidgetScreenMetricsEmulatorDelegate, | 117 public RenderWidgetScreenMetricsEmulatorDelegate, |
117 public base::RefCounted<RenderWidget> { | 118 public base::RefCounted<RenderWidget> { |
118 public: | 119 public: |
119 // Creates a new RenderWidget. The opener_id is the routing ID of the | 120 // Creates a new RenderWidget. The opener_id is the routing ID of the |
120 // RenderView that this widget lives inside. | 121 // RenderView that this widget lives inside. |
121 static RenderWidget* Create(int32_t opener_id, | 122 static RenderWidget* Create(int32_t opener_id, |
122 CompositorDependencies* compositor_deps, | 123 CompositorDependencies* compositor_deps, |
123 blink::WebPopupType popup_type, | 124 blink::WebPopupType popup_type, |
124 const blink::WebScreenInfo& screen_info); | 125 const ScreenInfo& screen_info); |
125 | 126 |
126 // Creates a new RenderWidget that will be attached to a RenderFrame. | 127 // Creates a new RenderWidget that will be attached to a RenderFrame. |
127 static RenderWidget* CreateForFrame(int routing_id, | 128 static RenderWidget* CreateForFrame(int routing_id, |
128 bool hidden, | 129 bool hidden, |
129 const blink::WebScreenInfo& screen_info, | 130 const ScreenInfo& screen_info, |
130 CompositorDependencies* compositor_deps, | 131 CompositorDependencies* compositor_deps, |
131 blink::WebLocalFrame* frame); | 132 blink::WebLocalFrame* frame); |
132 | 133 |
133 // Used by content_layouttest_support to hook into the creation of | 134 // Used by content_layouttest_support to hook into the creation of |
134 // RenderWidgets. | 135 // RenderWidgets. |
135 using CreateRenderWidgetFunction = | 136 using CreateRenderWidgetFunction = |
136 RenderWidget* (*)(CompositorDependencies*, | 137 RenderWidget* (*)(CompositorDependencies*, |
137 blink::WebPopupType, | 138 blink::WebPopupType, |
138 const blink::WebScreenInfo&, | 139 const ScreenInfo&, |
139 bool, | 140 bool, |
140 bool, | 141 bool, |
141 bool); | 142 bool); |
142 using RenderWidgetInitializedCallback = void (*)(RenderWidget*); | 143 using RenderWidgetInitializedCallback = void (*)(RenderWidget*); |
143 static void InstallCreateHook( | 144 static void InstallCreateHook( |
144 CreateRenderWidgetFunction create_render_widget, | 145 CreateRenderWidgetFunction create_render_widget, |
145 RenderWidgetInitializedCallback render_widget_initialized_callback); | 146 RenderWidgetInitializedCallback render_widget_initialized_callback); |
146 | 147 |
147 // Closes a RenderWidget that was created by |CreateForFrame|. | 148 // Closes a RenderWidget that was created by |CreateForFrame|. |
148 // TODO(avi): De-virtualize this once RenderViewImpl has-a RenderWidget. | 149 // TODO(avi): De-virtualize this once RenderViewImpl has-a RenderWidget. |
(...skipping 20 matching lines...) Expand all Loading... |
169 } | 170 } |
170 | 171 |
171 void set_owner_delegate(RenderWidgetOwnerDelegate* owner_delegate) { | 172 void set_owner_delegate(RenderWidgetOwnerDelegate* owner_delegate) { |
172 DCHECK(!owner_delegate_); | 173 DCHECK(!owner_delegate_); |
173 owner_delegate_ = owner_delegate; | 174 owner_delegate_ = owner_delegate; |
174 } | 175 } |
175 | 176 |
176 RenderWidgetOwnerDelegate* owner_delegate() { return owner_delegate_; } | 177 RenderWidgetOwnerDelegate* owner_delegate() { return owner_delegate_; } |
177 | 178 |
178 // ScreenInfo exposed so it can be passed to subframe RenderWidgets. | 179 // ScreenInfo exposed so it can be passed to subframe RenderWidgets. |
179 blink::WebScreenInfo screen_info() const { return screen_info_; } | 180 ScreenInfo screen_info() const { return screen_info_; } |
180 | 181 |
181 // Functions to track out-of-process frames for special notifications. | 182 // Functions to track out-of-process frames for special notifications. |
182 void RegisterRenderFrameProxy(RenderFrameProxy* proxy); | 183 void RegisterRenderFrameProxy(RenderFrameProxy* proxy); |
183 void UnregisterRenderFrameProxy(RenderFrameProxy* proxy); | 184 void UnregisterRenderFrameProxy(RenderFrameProxy* proxy); |
184 | 185 |
185 // Functions to track all RenderFrame objects associated with this | 186 // Functions to track all RenderFrame objects associated with this |
186 // RenderWidget. | 187 // RenderWidget. |
187 void RegisterRenderFrame(RenderFrameImpl* frame); | 188 void RegisterRenderFrame(RenderFrameImpl* frame); |
188 void UnregisterRenderFrame(RenderFrameImpl* frame); | 189 void UnregisterRenderFrame(RenderFrameImpl* frame); |
189 | 190 |
(...skipping 218 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
408 // For unit tests. | 409 // For unit tests. |
409 friend class RenderWidgetTest; | 410 friend class RenderWidgetTest; |
410 | 411 |
411 enum ResizeAck { | 412 enum ResizeAck { |
412 SEND_RESIZE_ACK, | 413 SEND_RESIZE_ACK, |
413 NO_RESIZE_ACK, | 414 NO_RESIZE_ACK, |
414 }; | 415 }; |
415 | 416 |
416 RenderWidget(CompositorDependencies* compositor_deps, | 417 RenderWidget(CompositorDependencies* compositor_deps, |
417 blink::WebPopupType popup_type, | 418 blink::WebPopupType popup_type, |
418 const blink::WebScreenInfo& screen_info, | 419 const ScreenInfo& screen_info, |
419 bool swapped_out, | 420 bool swapped_out, |
420 bool hidden, | 421 bool hidden, |
421 bool never_visible); | 422 bool never_visible); |
422 | 423 |
423 ~RenderWidget() override; | 424 ~RenderWidget() override; |
424 | 425 |
425 static blink::WebFrameWidget* CreateWebFrameWidget( | 426 static blink::WebFrameWidget* CreateWebFrameWidget( |
426 RenderWidget* render_widget, | 427 RenderWidget* render_widget, |
427 blink::WebLocalFrame* frame); | 428 blink::WebLocalFrame* frame); |
428 | 429 |
(...skipping 300 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
729 // The screen rects of the view and the window that contains it. | 730 // The screen rects of the view and the window that contains it. |
730 gfx::Rect view_screen_rect_; | 731 gfx::Rect view_screen_rect_; |
731 gfx::Rect window_screen_rect_; | 732 gfx::Rect window_screen_rect_; |
732 | 733 |
733 std::unique_ptr<RenderWidgetInputHandler> input_handler_; | 734 std::unique_ptr<RenderWidgetInputHandler> input_handler_; |
734 | 735 |
735 // The time spent in input handlers this frame. Used to throttle input acks. | 736 // The time spent in input handlers this frame. Used to throttle input acks. |
736 base::TimeDelta total_input_handling_time_this_frame_; | 737 base::TimeDelta total_input_handling_time_this_frame_; |
737 | 738 |
738 // Properties of the screen hosting this RenderWidget instance. | 739 // Properties of the screen hosting this RenderWidget instance. |
739 blink::WebScreenInfo screen_info_; | 740 ScreenInfo screen_info_; |
740 | 741 |
741 // The device scale factor. This value is computed from the DPI entries in | 742 // The device scale factor. This value is computed from the DPI entries in |
742 // |screen_info_| on some platforms, and defaults to 1 on other platforms. | 743 // |screen_info_| on some platforms, and defaults to 1 on other platforms. |
743 float device_scale_factor_; | 744 float device_scale_factor_; |
744 | 745 |
745 // The device color profile on supported platforms. | 746 // The device color profile on supported platforms. |
746 std::vector<char> device_color_profile_; | 747 std::vector<char> device_color_profile_; |
747 | 748 |
748 // State associated with synthetic gestures. Synthetic gestures are processed | 749 // State associated with synthetic gestures. Synthetic gestures are processed |
749 // in-order, so a queue is sufficient to identify the correct state for a | 750 // in-order, so a queue is sufficient to identify the correct state for a |
(...skipping 58 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
808 // This reference is set by the RenderFrame and is used to query the IME- | 809 // This reference is set by the RenderFrame and is used to query the IME- |
809 // related state from the plugin to later send to the browser. | 810 // related state from the plugin to later send to the browser. |
810 PepperPluginInstanceImpl* focused_pepper_plugin_; | 811 PepperPluginInstanceImpl* focused_pepper_plugin_; |
811 | 812 |
812 DISALLOW_COPY_AND_ASSIGN(RenderWidget); | 813 DISALLOW_COPY_AND_ASSIGN(RenderWidget); |
813 }; | 814 }; |
814 | 815 |
815 } // namespace content | 816 } // namespace content |
816 | 817 |
817 #endif // CONTENT_RENDERER_RENDER_WIDGET_H_ | 818 #endif // CONTENT_RENDERER_RENDER_WIDGET_H_ |
OLD | NEW |