[email protected] | 9f4f332 | 2012-01-18 22:29:56 | [diff] [blame] | 1 | // Copyright (c) 2012 The Chromium Authors. All rights reserved. |
license.bot | bf09a50 | 2008-08-24 00:55:55 | [diff] [blame] | 2 | // Use of this source code is governed by a BSD-style license that can be |
| 3 | // found in the LICENSE file. |
initial.commit | 09911bf | 2008-07-26 23:55:29 | [diff] [blame] | 4 | |
[email protected] | 2cff005 | 2011-03-18 16:51:44 | [diff] [blame] | 5 | #ifndef CONTENT_RENDERER_RENDER_WIDGET_H_ |
| 6 | #define CONTENT_RENDERER_RENDER_WIDGET_H_ |
initial.commit | 09911bf | 2008-07-26 23:55:29 | [diff] [blame] | 7 | |
avi | 1023d01 | 2015-12-25 02:39:14 | [diff] [blame] | 8 | #include <stddef.h> |
| 9 | #include <stdint.h> |
| 10 | |
[email protected] | 0e241b4b | 2012-08-18 09:06:27 | [diff] [blame] | 11 | #include <map> |
dcheng | cedca561 | 2016-04-09 01:40:15 | [diff] [blame] | 12 | #include <memory> |
xlai | 180af79 | 2016-08-26 22:07:42 | [diff] [blame] | 13 | #include <queue> |
pwnall | ef66931 | 2017-01-07 01:17:29 | [diff] [blame] | 14 | #include <string> |
| 15 | #include <vector> |
[email protected] | 010ea08a | 2009-10-11 20:21:32 | [diff] [blame] | 16 | |
[email protected] | 586871b | 2014-07-22 17:05:11 | [diff] [blame] | 17 | #include "base/callback.h" |
Fady Samuel | 1ee6fb5c | 2018-02-16 03:27:46 | [diff] [blame] | 18 | #include "base/cancelable_callback.h" |
[email protected] | f3112a5 | 2011-09-30 23:47:49 | [diff] [blame] | 19 | #include "base/compiler_specific.h" |
avi | 1023d01 | 2015-12-25 02:39:14 | [diff] [blame] | 20 | #include "base/macros.h" |
[email protected] | 3b63f8f4 | 2011-03-28 01:54:15 | [diff] [blame] | 21 | #include "base/memory/ref_counted.h" |
wjmaclean | 1d97062 | 2017-01-21 22:28:24 | [diff] [blame] | 22 | #include "base/memory/weak_ptr.h" |
[email protected] | bffc830 | 2014-01-23 20:52:16 | [diff] [blame] | 23 | #include "base/observer_list.h" |
Gabriel Charette | 1452023 | 2018-04-30 23:27:22 | [diff] [blame] | 24 | #include "base/single_thread_task_runner.h" |
[email protected] | abb52216 | 2013-06-28 01:54:16 | [diff] [blame] | 25 | #include "base/time/time.h" |
avi | 1023d01 | 2015-12-25 02:39:14 | [diff] [blame] | 26 | #include "build/build_config.h" |
Sandra Sun | ac5cdd83 | 2017-12-11 03:27:13 | [diff] [blame] | 27 | #include "cc/input/overscroll_behavior.h" |
xidachen | fa0199e7 | 2017-05-11 11:34:26 | [diff] [blame] | 28 | #include "cc/input/touch_action.h" |
danakj | 4b34721 | 2018-07-04 17:55:17 | [diff] [blame] | 29 | #include "cc/trees/layer_tree_settings.h" |
| 30 | #include "cc/trees/managed_memory_policy.h" |
Fady Samuel | 644df1d | 2017-07-13 01:13:02 | [diff] [blame] | 31 | #include "components/viz/common/surfaces/local_surface_id.h" |
Scott Violet | c78fef73 | 2018-03-06 17:42:53 | [diff] [blame] | 32 | #include "content/common/buildflags.h" |
[email protected] | f3112a5 | 2011-09-30 23:47:49 | [diff] [blame] | 33 | #include "content/common/content_export.h" |
[email protected] | c2809346d | 2014-03-20 00:11:03 | [diff] [blame] | 34 | #include "content/common/cursors/webcursor.h" |
paulmeyer | 6ef5a79 | 2016-11-08 20:33:58 | [diff] [blame] | 35 | #include "content/common/drag_event_source_info.h" |
alexmos | 5656749 | 2016-09-13 00:52:46 | [diff] [blame] | 36 | #include "content/common/edit_command.h" |
Dave Tapuska | 1bdf183 | 2017-07-07 18:07:19 | [diff] [blame] | 37 | #include "content/common/widget.mojom.h" |
paulmeyer | 90f6c31d | 2016-11-12 00:17:59 | [diff] [blame] | 38 | #include "content/public/common/drop_data.h" |
ccameron | 2f45153 | 2016-09-07 21:49:27 | [diff] [blame] | 39 | #include "content/public/common/screen_info.h" |
mfomitchev | 2600fd7c | 2016-02-17 20:53:39 | [diff] [blame] | 40 | #include "content/renderer/devtools/render_widget_screen_metrics_emulator_delegate.h" |
danakj | a6c1001 | 2018-07-06 14:25:36 | [diff] [blame] | 41 | #include "content/renderer/gpu/layer_tree_view_delegate.h" |
dtapuska | 9ec1a91 | 2017-04-21 15:18:31 | [diff] [blame] | 42 | #include "content/renderer/input/main_thread_event_queue.h" |
fsamuel | 72464894f | 2015-12-15 06:59:31 | [diff] [blame] | 43 | #include "content/renderer/input/render_widget_input_handler.h" |
| 44 | #include "content/renderer/input/render_widget_input_handler_delegate.h" |
[email protected] | 586871b | 2014-07-22 17:05:11 | [diff] [blame] | 45 | #include "content/renderer/message_delivery_policy.h" |
lfg | bee1e0a | 2016-06-08 21:24:21 | [diff] [blame] | 46 | #include "content/renderer/mouse_lock_dispatcher.h" |
| 47 | #include "content/renderer/render_widget_mouse_lock_dispatcher.h" |
[email protected] | 4f86bdb | 2012-11-10 19:11:19 | [diff] [blame] | 48 | #include "ipc/ipc_listener.h" |
nick | 4df698d8 | 2016-11-11 20:39:23 | [diff] [blame] | 49 | #include "ipc/ipc_message.h" |
[email protected] | 4f86bdb | 2012-11-10 19:11:19 | [diff] [blame] | 50 | #include "ipc/ipc_sender.h" |
Dave Tapuska | 1bdf183 | 2017-07-07 18:07:19 | [diff] [blame] | 51 | #include "mojo/public/cpp/bindings/binding.h" |
Scott Violet | 02e38b9 | 2018-03-27 23:42:14 | [diff] [blame] | 52 | #include "ppapi/buildflags/buildflags.h" |
Dmitry Gozman | 88ca5a99 | 2018-05-18 00:13:33 | [diff] [blame] | 53 | #include "third_party/blink/public/common/manifest/web_display_mode.h" |
Blink Reformat | a30d423 | 2018-04-07 15:31:06 | [diff] [blame] | 54 | #include "third_party/blink/public/platform/web_input_event.h" |
| 55 | #include "third_party/blink/public/platform/web_rect.h" |
| 56 | #include "third_party/blink/public/platform/web_referrer_policy.h" |
| 57 | #include "third_party/blink/public/platform/web_text_input_info.h" |
| 58 | #include "third_party/blink/public/web/web_ime_text_span.h" |
| 59 | #include "third_party/blink/public/web/web_popup_type.h" |
| 60 | #include "third_party/blink/public/web/web_text_direction.h" |
| 61 | #include "third_party/blink/public/web/web_widget.h" |
| 62 | #include "third_party/blink/public/web/web_widget_client.h" |
[email protected] | b256eca | 2013-07-11 10:57:40 | [diff] [blame] | 63 | #include "ui/base/ime/text_input_mode.h" |
[email protected] | ad26ef4 | 2011-06-17 07:59:45 | [diff] [blame] | 64 | #include "ui/base/ime/text_input_type.h" |
[email protected] | a09d53ce | 2014-01-31 00:46:42 | [diff] [blame] | 65 | #include "ui/base/ui_base_types.h" |
tfarina | 93bfa91 | 2014-12-05 14:23:15 | [diff] [blame] | 66 | #include "ui/gfx/geometry/rect.h" |
tfarina | 93bfa91 | 2014-12-05 14:23:15 | [diff] [blame] | 67 | #include "ui/gfx/geometry/vector2d_f.h" |
[email protected] | 08397d5 | 2011-02-05 01:53:38 | [diff] [blame] | 68 | #include "ui/gfx/native_widget_types.h" |
[email protected] | db4fc1e | 2013-09-06 20:01:51 | [diff] [blame] | 69 | #include "ui/gfx/range/range.h" |
[email protected] | d353541f | 2012-05-03 22:45:41 | [diff] [blame] | 70 | #include "ui/surface/transport_dib.h" |
initial.commit | 09911bf | 2008-07-26 23:55:29 | [diff] [blame] | 71 | |
danakj | 870925d | 2016-05-03 20:07:38 | [diff] [blame] | 72 | class GURL; |
| 73 | |
[email protected] | 48495594 | 2010-08-19 16:13:18 | [diff] [blame] | 74 | namespace IPC { |
[email protected] | 586871b | 2014-07-22 17:05:11 | [diff] [blame] | 75 | class SyncMessageFilter; |
[email protected] | 48495594 | 2010-08-19 16:13:18 | [diff] [blame] | 76 | } |
| 77 | |
[email protected] | 180ef24 | 2013-11-07 06:50:46 | [diff] [blame] | 78 | namespace blink { |
skyostil | 529caa29 | 2016-08-10 17:44:51 | [diff] [blame] | 79 | namespace scheduler { |
Yuta Kitamura | 39219b4 | 2018-04-06 10:28:14 | [diff] [blame] | 80 | class WebRenderWidgetSchedulingState; |
skyostil | 529caa29 | 2016-08-10 17:44:51 | [diff] [blame] | 81 | } |
[email protected] | 1919368 | 2014-04-03 15:01:43 | [diff] [blame] | 82 | struct WebDeviceEmulationParams; |
paulmeyer | 6ef5a79 | 2016-11-08 20:33:58 | [diff] [blame] | 83 | class WebDragData; |
lfg | caab514 | 2016-02-26 19:06:52 | [diff] [blame] | 84 | class WebFrameWidget; |
[email protected] | 41d8685 | 2012-11-07 12:23:24 | [diff] [blame] | 85 | class WebGestureEvent; |
ekaramad | 2daaf67 | 2016-11-10 20:29:01 | [diff] [blame] | 86 | class WebInputMethodController; |
kenrb | a719983 | 2015-01-22 23:44:59 | [diff] [blame] | 87 | class WebLocalFrame; |
[email protected] | 6a8ddba5 | 2010-09-05 04:38:06 | [diff] [blame] | 88 | class WebMouseEvent; |
donnd | a070f3c | 2015-01-16 19:54:11 | [diff] [blame] | 89 | struct WebPoint; |
pwnall | ef66931 | 2017-01-07 01:17:29 | [diff] [blame] | 90 | } // namespace blink |
[email protected] | 52647690 | 2011-10-06 20:34:06 | [diff] [blame] | 91 | |
[email protected] | 586871b | 2014-07-22 17:05:11 | [diff] [blame] | 92 | namespace cc { |
[email protected] | 586871b | 2014-07-22 17:05:11 | [diff] [blame] | 93 | class SwapPromise; |
| 94 | } |
[email protected] | ba91a79 | 2013-02-06 09:48:28 | [diff] [blame] | 95 | |
[email protected] | db4fc1e | 2013-09-06 20:01:51 | [diff] [blame] | 96 | namespace gfx { |
danakj | a2c9d0a9 | 2018-07-25 20:01:18 | [diff] [blame^] | 97 | class ColorSpace; |
[email protected] | 4de6d169 | 2011-10-12 08:45:44 | [diff] [blame] | 98 | class Range; |
| 99 | } |
| 100 | |
chongz | a8ba91fc | 2016-08-16 21:39:17 | [diff] [blame] | 101 | namespace ui { |
| 102 | struct DidOverscrollParams; |
| 103 | } |
| 104 | |
[email protected] | e9ff79c | 2012-10-19 21:31:26 | [diff] [blame] | 105 | namespace content { |
Saman Sami | d189e5dfd | 2017-12-20 22:55:31 | [diff] [blame] | 106 | class BrowserPlugin; |
danakj | 6e3bf801 | 2014-12-16 18:27:53 | [diff] [blame] | 107 | class CompositorDependencies; |
[email protected] | b2e4c7013 | 2013-10-03 02:07:51 | [diff] [blame] | 108 | class ExternalPopupMenu; |
[email protected] | 586871b | 2014-07-22 17:05:11 | [diff] [blame] | 109 | class FrameSwapMessageQueue; |
danakj | a2c9d0a9 | 2018-07-25 20:01:18 | [diff] [blame^] | 110 | class IdleUserDetector; |
changwan | f2a707b | 2015-10-30 08:22:16 | [diff] [blame] | 111 | class ImeEventGuard; |
danakj | a6c1001 | 2018-07-06 14:25:36 | [diff] [blame] | 112 | class LayerTreeView; |
dtapuska | 9ec1a91 | 2017-04-21 15:18:31 | [diff] [blame] | 113 | class MainThreadEventQueue; |
ekaramad | 2a46d63 | 2016-07-19 13:33:09 | [diff] [blame] | 114 | class PepperPluginInstanceImpl; |
[email protected] | bffc830 | 2014-01-23 20:52:16 | [diff] [blame] | 115 | class RenderFrameImpl; |
[email protected] | e3244ed | 2014-06-20 20:04:27 | [diff] [blame] | 116 | class RenderFrameProxy; |
nick | f7b3822 | 2016-11-22 21:59:35 | [diff] [blame] | 117 | class RenderViewImpl; |
avi | 40b5be7a | 2016-03-03 21:13:44 | [diff] [blame] | 118 | class RenderWidgetOwnerDelegate; |
mfomitchev | 2600fd7c | 2016-02-17 20:53:39 | [diff] [blame] | 119 | class RenderWidgetScreenMetricsEmulator; |
[email protected] | 5b45ad4 | 2013-10-25 00:42:04 | [diff] [blame] | 120 | class ResizingModeSelector; |
ekaramad | 330ba423 | 2016-09-23 17:57:47 | [diff] [blame] | 121 | class TextInputClientObserver; |
Dave Tapuska | 9db8084 | 2017-07-24 17:24:26 | [diff] [blame] | 122 | class WidgetInputHandlerManager; |
[email protected] | b2e4c7013 | 2013-10-03 02:07:51 | [diff] [blame] | 123 | struct ContextMenuParams; |
Fady Samuel | 799e7219 | 2018-04-25 21:16:57 | [diff] [blame] | 124 | struct VisualProperties; |
[email protected] | e9ff79c | 2012-10-19 21:31:26 | [diff] [blame] | 125 | |
initial.commit | 09911bf | 2008-07-26 23:55:29 | [diff] [blame] | 126 | // RenderWidget provides a communication bridge between a WebWidget and |
| 127 | // a RenderWidgetHost, the latter of which lives in a different process. |
dcheng | d96a27a | 2015-07-24 20:17:32 | [diff] [blame] | 128 | // |
| 129 | // RenderWidget is used to implement: |
| 130 | // - RenderViewImpl (deprecated) |
| 131 | // - Fullscreen mode (RenderWidgetFullScreen) |
| 132 | // - Popup "menus" (like the color chooser and date picker) |
| 133 | // - Widgets for frames (for out-of-process iframe support) |
[email protected] | f3112a5 | 2011-09-30 23:47:49 | [diff] [blame] | 134 | class CONTENT_EXPORT RenderWidget |
[email protected] | c47317e | 2012-06-20 22:35:31 | [diff] [blame] | 135 | : public IPC::Listener, |
| 136 | public IPC::Sender, |
danakj | 9a8a9cf | 2018-07-17 23:52:12 | [diff] [blame] | 137 | public blink::WebWidgetClient, |
Dave Tapuska | 1bdf183 | 2017-07-07 18:07:19 | [diff] [blame] | 138 | public mojom::Widget, |
danakj | a6c1001 | 2018-07-06 14:25:36 | [diff] [blame] | 139 | public LayerTreeViewDelegate, |
fsamuel | 72464894f | 2015-12-15 06:59:31 | [diff] [blame] | 140 | public RenderWidgetInputHandlerDelegate, |
mfomitchev | 2600fd7c | 2016-02-17 20:53:39 | [diff] [blame] | 141 | public RenderWidgetScreenMetricsEmulatorDelegate, |
dtapuska | 9ec1a91 | 2017-04-21 15:18:31 | [diff] [blame] | 142 | public base::RefCounted<RenderWidget>, |
| 143 | public MainThreadEventQueueClient { |
initial.commit | 09911bf | 2008-07-26 23:55:29 | [diff] [blame] | 144 | public: |
danakj | df1ceb7 | 2018-07-18 20:02:25 | [diff] [blame] | 145 | using ShowCallback = |
| 146 | base::OnceCallback<void(RenderWidget* widget_to_show, |
| 147 | blink::WebNavigationPolicy policy, |
| 148 | const gfx::Rect& initial_rect)>; |
| 149 | |
nick | f7b3822 | 2016-11-22 21:59:35 | [diff] [blame] | 150 | // Creates a new RenderWidget for a popup. |opener| is the RenderView that |
| 151 | // this widget lives inside. |
Hajime Hoshi | abb3c8f | 2017-12-04 18:41:39 | [diff] [blame] | 152 | static RenderWidget* CreateForPopup( |
| 153 | RenderViewImpl* opener, |
| 154 | CompositorDependencies* compositor_deps, |
| 155 | blink::WebPopupType popup_type, |
| 156 | const ScreenInfo& screen_info, |
| 157 | scoped_refptr<base::SingleThreadTaskRunner> task_runner); |
initial.commit | 09911bf | 2008-07-26 23:55:29 | [diff] [blame] | 158 | |
kenrb | a719983 | 2015-01-22 23:44:59 | [diff] [blame] | 159 | // Creates a new RenderWidget that will be attached to a RenderFrame. |
nick | 4df698d8 | 2016-11-11 20:39:23 | [diff] [blame] | 160 | static RenderWidget* CreateForFrame(int widget_routing_id, |
kenrb | a719983 | 2015-01-22 23:44:59 | [diff] [blame] | 161 | bool hidden, |
ccameron | 2f45153 | 2016-09-07 21:49:27 | [diff] [blame] | 162 | const ScreenInfo& screen_info, |
kenrb | a719983 | 2015-01-22 23:44:59 | [diff] [blame] | 163 | CompositorDependencies* compositor_deps, |
| 164 | blink::WebLocalFrame* frame); |
| 165 | |
lfg | 1568d11 | 2016-08-30 16:06:29 | [diff] [blame] | 166 | // Used by content_layouttest_support to hook into the creation of |
| 167 | // RenderWidgets. |
nick | 8331f8ad | 2016-11-15 20:42:45 | [diff] [blame] | 168 | using CreateRenderWidgetFunction = RenderWidget* (*)(int32_t, |
| 169 | CompositorDependencies*, |
| 170 | blink::WebPopupType, |
| 171 | const ScreenInfo&, |
| 172 | bool, |
| 173 | bool, |
| 174 | bool); |
lfg | 1568d11 | 2016-08-30 16:06:29 | [diff] [blame] | 175 | using RenderWidgetInitializedCallback = void (*)(RenderWidget*); |
| 176 | static void InstallCreateHook( |
| 177 | CreateRenderWidgetFunction create_render_widget, |
| 178 | RenderWidgetInitializedCallback render_widget_initialized_callback); |
| 179 | |
Albert J. Wong | cb00463 | 2018-07-10 22:58:25 | [diff] [blame] | 180 | // Returns the RenderWidget for the given routing ID. |
| 181 | static RenderWidget* FromRoutingID(int32_t routing_id); |
| 182 | |
dcheng | da9b4bb | 2015-07-20 20:58:08 | [diff] [blame] | 183 | // Closes a RenderWidget that was created by |CreateForFrame|. |
danakj | a2c9d0a9 | 2018-07-25 20:01:18 | [diff] [blame^] | 184 | void CloseForFrame(); |
[email protected] | 48495594 | 2010-08-19 16:13:18 | [diff] [blame] | 185 | |
nick | 8331f8ad | 2016-11-15 20:42:45 | [diff] [blame] | 186 | int32_t routing_id() const { return routing_id_; } |
fsamuel | e8326c74 | 2016-01-12 00:49:39 | [diff] [blame] | 187 | |
danakj | 6e3bf801 | 2014-12-16 18:27:53 | [diff] [blame] | 188 | CompositorDependencies* compositor_deps() const { return compositor_deps_; } |
Ken Buchanan | ed449bb | 2018-02-01 21:02:05 | [diff] [blame] | 189 | |
| 190 | // This can return nullptr while the RenderWidget is closing. |
danakj | a2c9d0a9 | 2018-07-25 20:01:18 | [diff] [blame^] | 191 | blink::WebWidget* GetWebWidget() const; |
ekaramad | 2daaf67 | 2016-11-10 20:29:01 | [diff] [blame] | 192 | |
| 193 | // Returns the current instance of WebInputMethodController which is to be |
| 194 | // used for IME related tasks. This instance corresponds to the one from |
| 195 | // focused frame and can be nullptr. |
| 196 | blink::WebInputMethodController* GetInputMethodController() const; |
| 197 | |
mfomitchev | 2600fd7c | 2016-02-17 20:53:39 | [diff] [blame] | 198 | const gfx::Size& size() const { return size_; } |
Christopher Cameron | 5808937 | 2018-03-08 23:11:13 | [diff] [blame] | 199 | const gfx::Size& compositor_viewport_pixel_size() const { |
Christopher Cameron | aad15a0d | 2018-03-09 03:47:33 | [diff] [blame] | 200 | return compositor_viewport_pixel_size_; |
Christopher Cameron | 5808937 | 2018-03-08 23:11:13 | [diff] [blame] | 201 | } |
mikhail.pozdnyakov | f2c902a | 2015-04-14 08:09:12 | [diff] [blame] | 202 | bool is_fullscreen_granted() const { return is_fullscreen_granted_; } |
mikhail.pozdnyakov | c0e251b | 2015-04-15 06:51:12 | [diff] [blame] | 203 | blink::WebDisplayMode display_mode() const { return display_mode_; } |
[email protected] | 204f1df | 2012-01-04 20:21:13 | [diff] [blame] | 204 | bool is_hidden() const { return is_hidden_; } |
[email protected] | 4ee6462 | 2014-03-21 22:34:15 | [diff] [blame] | 205 | // Temporary for debugging purposes... |
| 206 | bool closing() const { return closing_; } |
pwnall | ef66931 | 2017-01-07 01:17:29 | [diff] [blame] | 207 | bool has_host_context_menu_location() const { |
[email protected] | be1af066 | 2014-07-29 19:55:51 | [diff] [blame] | 208 | return has_host_context_menu_location_; |
| 209 | } |
pwnall | ef66931 | 2017-01-07 01:17:29 | [diff] [blame] | 210 | gfx::Point host_context_menu_location() const { |
[email protected] | be1af066 | 2014-07-29 19:55:51 | [diff] [blame] | 211 | return host_context_menu_location_; |
[email protected] | 4ee6462 | 2014-03-21 22:34:15 | [diff] [blame] | 212 | } |
Ken Buchanan | b2c9e26 | 2018-03-10 16:53:31 | [diff] [blame] | 213 | const gfx::Size& visible_viewport_size() const { |
| 214 | return visible_viewport_size_; |
| 215 | } |
[email protected] | 589621b | 2010-09-23 22:01:07 | [diff] [blame] | 216 | |
avi | 40b5be7a | 2016-03-03 21:13:44 | [diff] [blame] | 217 | void set_owner_delegate(RenderWidgetOwnerDelegate* owner_delegate) { |
| 218 | DCHECK(!owner_delegate_); |
| 219 | owner_delegate_ = owner_delegate; |
| 220 | } |
pwnall | ef66931 | 2017-01-07 01:17:29 | [diff] [blame] | 221 | RenderWidgetOwnerDelegate* owner_delegate() const { return owner_delegate_; } |
avi | 40b5be7a | 2016-03-03 21:13:44 | [diff] [blame] | 222 | |
alexmos | 78c9c0d | 2016-10-14 18:57:03 | [diff] [blame] | 223 | // Sets whether this RenderWidget has been swapped out to be displayed by |
| 224 | // a RenderWidget in a different process. If so, no new IPC messages will be |
| 225 | // sent (only ACKs) and the process is free to exit when there are no other |
| 226 | // active RenderWidgets. |
| 227 | void SetSwappedOut(bool is_swapped_out); |
pwnall | ef66931 | 2017-01-07 01:17:29 | [diff] [blame] | 228 | bool is_swapped_out() const { return is_swapped_out_; } |
alexmos | 78c9c0d | 2016-10-14 18:57:03 | [diff] [blame] | 229 | |
alexmos | 5656749 | 2016-09-13 00:52:46 | [diff] [blame] | 230 | // Manage edit commands to be used for the next keyboard event. |
| 231 | const EditCommands& edit_commands() const { return edit_commands_; } |
| 232 | void SetEditCommandForNextKeyEvent(const std::string& name, |
| 233 | const std::string& value); |
| 234 | void ClearEditCommands(); |
| 235 | |
[email protected] | bffc830 | 2014-01-23 20:52:16 | [diff] [blame] | 236 | // Functions to track out-of-process frames for special notifications. |
[email protected] | e3244ed | 2014-06-20 20:04:27 | [diff] [blame] | 237 | void RegisterRenderFrameProxy(RenderFrameProxy* proxy); |
| 238 | void UnregisterRenderFrameProxy(RenderFrameProxy* proxy); |
[email protected] | bffc830 | 2014-01-23 20:52:16 | [diff] [blame] | 239 | |
[email protected] | de3c5d8 | 2014-05-28 22:12:59 | [diff] [blame] | 240 | // Functions to track all RenderFrame objects associated with this |
| 241 | // RenderWidget. |
| 242 | void RegisterRenderFrame(RenderFrameImpl* frame); |
| 243 | void UnregisterRenderFrame(RenderFrameImpl* frame); |
| 244 | |
Saman Sami | d189e5dfd | 2017-12-20 22:55:31 | [diff] [blame] | 245 | // BrowserPlugins embedded by this RenderWidget register themselves here. |
| 246 | // These plugins need to be notified about changes to ScreenInfo. |
| 247 | void RegisterBrowserPlugin(BrowserPlugin* browser_plugin); |
| 248 | void UnregisterBrowserPlugin(BrowserPlugin* browser_plugin); |
| 249 | |
[email protected] | c47317e | 2012-06-20 22:35:31 | [diff] [blame] | 250 | // IPC::Listener |
dcheng | 6d18e40 | 2014-10-21 12:32:52 | [diff] [blame] | 251 | bool OnMessageReceived(const IPC::Message& msg) override; |
initial.commit | 09911bf | 2008-07-26 23:55:29 | [diff] [blame] | 252 | |
[email protected] | c47317e | 2012-06-20 22:35:31 | [diff] [blame] | 253 | // IPC::Sender |
dcheng | 6d18e40 | 2014-10-21 12:32:52 | [diff] [blame] | 254 | bool Send(IPC::Message* msg) override; |
initial.commit | 09911bf | 2008-07-26 23:55:29 | [diff] [blame] | 255 | |
danakj | a6c1001 | 2018-07-06 14:25:36 | [diff] [blame] | 256 | // LayerTreeViewDelegate |
fsamuel | 78f86e4 | 2016-01-20 04:10:23 | [diff] [blame] | 257 | void ApplyViewportDeltas(const gfx::Vector2dF& inner_delta, |
| 258 | const gfx::Vector2dF& outer_delta, |
| 259 | const gfx::Vector2dF& elastic_overscroll_delta, |
| 260 | float page_scale, |
| 261 | float top_controls_delta) override; |
sahel | 1b47fda7 | 2017-03-28 17:03:07 | [diff] [blame] | 262 | void RecordWheelAndTouchScrollingCount(bool has_scrolled_by_wheel, |
| 263 | bool has_scrolled_by_touch) override; |
Daniel Cheng | 224569ee | 2018-04-25 05:45:06 | [diff] [blame] | 264 | void BeginMainFrame(base::TimeTicks frame_time) override; |
danakj | c7afae5 | 2017-06-20 21:12:41 | [diff] [blame] | 265 | void RequestNewLayerTreeFrameSink( |
danakj | a6c1001 | 2018-07-06 14:25:36 | [diff] [blame] | 266 | LayerTreeFrameSinkCallback callback) override; |
fsamuel | 78f86e4 | 2016-01-20 04:10:23 | [diff] [blame] | 267 | void DidCommitAndDrawCompositorFrame() override; |
| 268 | void DidCommitCompositorFrame() override; |
| 269 | void DidCompletePageScaleAnimation() override; |
danakj | 6c872fc0 | 2016-10-22 04:29:49 | [diff] [blame] | 270 | void DidReceiveCompositorFrameAck() override; |
fsamuel | 78f86e4 | 2016-01-20 04:10:23 | [diff] [blame] | 271 | bool IsClosing() const override; |
danakj | 53eccbc | 2016-03-02 22:51:07 | [diff] [blame] | 272 | void RequestScheduleAnimation() override; |
Eric Seckler | 8af8c0e5 | 2018-01-17 23:45:53 | [diff] [blame] | 273 | void UpdateVisualState(VisualStateUpdate requested_update) override; |
fsamuel | 78f86e4 | 2016-01-20 04:10:23 | [diff] [blame] | 274 | void WillBeginCompositorFrame() override; |
jbroman | 6ccbc7d47 | 2016-07-27 04:45:41 | [diff] [blame] | 275 | std::unique_ptr<cc::SwapPromise> RequestCopyOfOutputForLayoutTest( |
Fady Samuel | dfecb7d | 2017-07-26 11:41:04 | [diff] [blame] | 276 | std::unique_ptr<viz::CopyOutputRequest> request) override; |
fsamuel | 78f86e4 | 2016-01-20 04:10:23 | [diff] [blame] | 277 | |
fsamuel | 72464894f | 2015-12-15 06:59:31 | [diff] [blame] | 278 | // RenderWidgetInputHandlerDelegate |
| 279 | void FocusChangeComplete() override; |
Sandra Sun | ac5cdd83 | 2017-12-11 03:27:13 | [diff] [blame] | 280 | void ObserveGestureEventAndResult( |
| 281 | const blink::WebGestureEvent& gesture_event, |
| 282 | const gfx::Vector2dF& unused_delta, |
| 283 | const cc::OverscrollBehavior& overscroll_behavior, |
| 284 | bool event_processed) override; |
dtapuska | 1827dd2 | 2016-03-11 15:24:59 | [diff] [blame] | 285 | |
fsamuel | 72464894f | 2015-12-15 06:59:31 | [diff] [blame] | 286 | void OnDidHandleKeyEvent() override; |
chongz | a8ba91fc | 2016-08-16 21:39:17 | [diff] [blame] | 287 | void OnDidOverscroll(const ui::DidOverscrollParams& params) override; |
fsamuel | e8326c74 | 2016-01-12 00:49:39 | [diff] [blame] | 288 | void SetInputHandler(RenderWidgetInputHandler* input_handler) override; |
changwan | 75e3b207 | 2017-01-16 02:55:00 | [diff] [blame] | 289 | void ShowVirtualKeyboard() override; |
| 290 | void UpdateTextInputState() override; |
changwan | 62f5729 | 2017-02-17 08:28:25 | [diff] [blame] | 291 | void ClearTextInputState() override; |
fsamuel | 72464894f | 2015-12-15 06:59:31 | [diff] [blame] | 292 | bool WillHandleGestureEvent(const blink::WebGestureEvent& event) override; |
| 293 | bool WillHandleMouseEvent(const blink::WebMouseEvent& event) override; |
| 294 | |
Scott Violet | 1098538e | 2017-10-05 19:23:33 | [diff] [blame] | 295 | // RenderWidgetScreenMetricsEmulatorDelegate |
mfomitchev | 2600fd7c | 2016-02-17 20:53:39 | [diff] [blame] | 296 | void Redraw() override; |
Fady Samuel | 799e7219 | 2018-04-25 21:16:57 | [diff] [blame] | 297 | void SynchronizeVisualProperties( |
| 298 | const VisualProperties& resize_params) override; |
mfomitchev | 2600fd7c | 2016-02-17 20:53:39 | [diff] [blame] | 299 | void SetScreenMetricsEmulationParameters( |
| 300 | bool enabled, |
| 301 | const blink::WebDeviceEmulationParams& params) override; |
| 302 | void SetScreenRects(const gfx::Rect& view_screen_rect, |
| 303 | const gfx::Rect& window_screen_rect) override; |
| 304 | |
[email protected] | 180ef24 | 2013-11-07 06:50:46 | [diff] [blame] | 305 | // blink::WebWidgetClient |
Blink Reformat | 1c4d759e | 2017-04-09 16:34:54 | [diff] [blame] | 306 | blink::WebLayerTreeView* InitializeLayerTreeView() override; |
Chris Harrelson | d7ab99b | 2018-01-24 17:51:36 | [diff] [blame] | 307 | void IntrinsicSizingInfoChanged( |
| 308 | const blink::WebIntrinsicSizingInfo&) override; |
Blink Reformat | 1c4d759e | 2017-04-09 16:34:54 | [diff] [blame] | 309 | void DidMeaningfulLayout(blink::WebMeaningfulLayout layout_type) override; |
| 310 | void DidChangeCursor(const blink::WebCursorInfo&) override; |
aelias | 5971e47d | 2017-06-16 02:39:38 | [diff] [blame] | 311 | void AutoscrollStart(const blink::WebFloatPoint& point) override; |
| 312 | void AutoscrollFling(const blink::WebFloatSize& velocity) override; |
| 313 | void AutoscrollEnd() override; |
Blink Reformat | 1c4d759e | 2017-04-09 16:34:54 | [diff] [blame] | 314 | void CloseWidgetSoon() override; |
| 315 | void Show(blink::WebNavigationPolicy) override; |
| 316 | blink::WebRect WindowRect() override; |
| 317 | blink::WebRect ViewRect() override; |
| 318 | void SetToolTipText(const blink::WebString& text, |
avi | 5c77d21 | 2015-09-25 20:08:25 | [diff] [blame] | 319 | blink::WebTextDirection hint) override; |
Blink Reformat | 1c4d759e | 2017-04-09 16:34:54 | [diff] [blame] | 320 | void SetWindowRect(const blink::WebRect&) override; |
| 321 | blink::WebScreenInfo GetScreenInfo() override; |
| 322 | void DidHandleGestureEvent(const blink::WebGestureEvent& event, |
avi | 5c77d21 | 2015-09-25 20:08:25 | [diff] [blame] | 323 | bool event_cancelled) override; |
Blink Reformat | 1c4d759e | 2017-04-09 16:34:54 | [diff] [blame] | 324 | void DidOverscroll(const blink::WebFloatSize& overscrollDelta, |
bokan | e53a10f | 2016-04-13 23:48:31 | [diff] [blame] | 325 | const blink::WebFloatSize& accumulatedOverscroll, |
avi | 5c77d21 | 2015-09-25 20:08:25 | [diff] [blame] | 326 | const blink::WebFloatPoint& position, |
sunyunjia | bbea8a9 | 2017-08-31 11:18:54 | [diff] [blame] | 327 | const blink::WebFloatSize& velocity, |
danakj | e819b62 | 2018-05-01 20:27:14 | [diff] [blame] | 328 | const cc::OverscrollBehavior& behavior) override; |
Blink Reformat | 1c4d759e | 2017-04-09 16:34:54 | [diff] [blame] | 329 | void ShowVirtualKeyboardOnElementFocus() override; |
| 330 | void ConvertViewportToWindow(blink::WebRect* rect) override; |
| 331 | void ConvertWindowToViewport(blink::WebFloatRect* rect) override; |
| 332 | bool RequestPointerLock() override; |
| 333 | void RequestPointerUnlock() override; |
| 334 | bool IsPointerLocked() override; |
| 335 | void StartDragging(blink::WebReferrerPolicy policy, |
paulmeyer | 6ef5a79 | 2016-11-08 20:33:58 | [diff] [blame] | 336 | const blink::WebDragData& data, |
| 337 | blink::WebDragOperationsMask mask, |
danakj | 0c75ad8 | 2018-07-10 19:50:12 | [diff] [blame] | 338 | const SkBitmap& drag_image, |
| 339 | const blink::WebPoint& image_offset) override; |
[email protected] | 4873c7d | 2009-07-16 06:36:28 | [diff] [blame] | 340 | |
fsamuel | 72464894f | 2015-12-15 06:59:31 | [diff] [blame] | 341 | // Override point to obtain that the current input method state and caret |
| 342 | // position. |
danakj | a2c9d0a9 | 2018-07-25 20:01:18 | [diff] [blame^] | 343 | ui::TextInputType GetTextInputType(); |
fsamuel | 72464894f | 2015-12-15 06:59:31 | [diff] [blame] | 344 | |
danakj | 4b34721 | 2018-07-04 17:55:17 | [diff] [blame] | 345 | // Internal helper that generates the LayerTreeSettings to be given to the |
| 346 | // compositor in StartCompositor(). |
| 347 | static cc::LayerTreeSettings GenerateLayerTreeSettings( |
| 348 | CompositorDependencies* compositor_deps, |
| 349 | bool is_for_subframe, |
| 350 | const gfx::Size& initial_screen_size, |
| 351 | float initial_device_scale_factor); |
| 352 | // Internal helper that generates the ManagedMemoryPolicy to be given to the |
| 353 | // compositor in StartCompositor(). |
| 354 | static cc::ManagedMemoryPolicy GetGpuMemoryPolicy( |
| 355 | const cc::ManagedMemoryPolicy& policy, |
| 356 | const gfx::Size& initial_screen_size, |
| 357 | float initial_device_scale_factor); |
| 358 | |
[email protected] | 7912e82 | 2014-04-16 02:37:03 | [diff] [blame] | 359 | // Begins the compositor's scheduler to start producing frames. |
| 360 | void StartCompositor(); |
| 361 | |
[email protected] | aeeedad | 2014-08-22 18:16:22 | [diff] [blame] | 362 | // Stop compositing. |
enne | f3c5814 | 2014-12-09 21:44:38 | [diff] [blame] | 363 | void WillCloseLayerTreeView(); |
[email protected] | aeeedad | 2014-08-22 18:16:22 | [diff] [blame] | 364 | |
danakj | a6c1001 | 2018-07-06 14:25:36 | [diff] [blame] | 365 | LayerTreeView* layer_tree_view() const { return layer_tree_view_.get(); } |
[email protected] | 24ed043 | 2013-04-24 07:50:31 | [diff] [blame] | 366 | |
Dave Tapuska | 9db8084 | 2017-07-24 17:24:26 | [diff] [blame] | 367 | WidgetInputHandlerManager* widget_input_handler_manager() { |
| 368 | return widget_input_handler_manager_.get(); |
| 369 | } |
| 370 | |
fsamuel | 72464894f | 2015-12-15 06:59:31 | [diff] [blame] | 371 | const RenderWidgetInputHandler& input_handler() const { |
fsamuel | e8326c74 | 2016-01-12 00:49:39 | [diff] [blame] | 372 | return *input_handler_; |
fsamuel | 72464894f | 2015-12-15 06:59:31 | [diff] [blame] | 373 | } |
| 374 | |
[email protected] | 586871b | 2014-07-22 17:05:11 | [diff] [blame] | 375 | // Deliveres |message| together with compositor state change updates. The |
| 376 | // exact behavior depends on |policy|. |
| 377 | // This mechanism is not a drop-in replacement for IPC: messages sent this way |
| 378 | // will not be automatically available to BrowserMessageFilter, for example. |
| 379 | // FIFO ordering is preserved between messages enqueued with the same |
| 380 | // |policy|, the ordering between messages enqueued for different policies is |
| 381 | // undefined. |
| 382 | // |
| 383 | // |msg| message to send, ownership of |msg| is transferred. |
| 384 | // |policy| see the comment on MessageDeliveryPolicy. |
| 385 | void QueueMessage(IPC::Message* msg, MessageDeliveryPolicy policy); |
| 386 | |
changwan | f2a707b | 2015-10-30 08:22:16 | [diff] [blame] | 387 | // Handle start and finish of IME event guard. |
| 388 | void OnImeEventGuardStart(ImeEventGuard* guard); |
| 389 | void OnImeEventGuardFinish(ImeEventGuard* guard); |
[email protected] | 66fca5bc | 2013-05-23 06:58:29 | [diff] [blame] | 390 | |
mfomitchev | 2600fd7c | 2016-02-17 20:53:39 | [diff] [blame] | 391 | void SetPopupOriginAdjustmentsForEmulation( |
| 392 | RenderWidgetScreenMetricsEmulator* emulator); |
[email protected] | b2e4c7013 | 2013-10-03 02:07:51 | [diff] [blame] | 393 | |
[email protected] | 2d6836f4 | 2014-07-02 17:25:31 | [diff] [blame] | 394 | gfx::Rect AdjustValidationMessageAnchor(const gfx::Rect& anchor); |
[email protected] | b2e4c7013 | 2013-10-03 02:07:51 | [diff] [blame] | 395 | |
[email protected] | 7a4e253 | 2013-12-02 21:30:02 | [diff] [blame] | 396 | // Checks if the selection bounds have been changed. If they are changed, |
| 397 | // the new value will be sent to the browser process. |
| 398 | void UpdateSelectionBounds(); |
| 399 | |
danakj | a2c9d0a9 | 2018-07-25 20:01:18 | [diff] [blame^] | 400 | void GetSelectionBounds(gfx::Rect* start, gfx::Rect* end); |
[email protected] | e5e438d6 | 2014-03-27 21:47:16 | [diff] [blame] | 401 | |
[email protected] | a09d53ce | 2014-01-31 00:46:42 | [diff] [blame] | 402 | void OnShowHostContextMenu(ContextMenuParams* params); |
[email protected] | 7a4e253 | 2013-12-02 21:30:02 | [diff] [blame] | 403 | |
[email protected] | 7a4e253 | 2013-12-02 21:30:02 | [diff] [blame] | 404 | // Checks if the composition range or composition character bounds have been |
| 405 | // changed. If they are changed, the new value will be sent to the browser |
yukawa | 5f21c6a | 2014-10-27 17:09:30 | [diff] [blame] | 406 | // process. This method does nothing when the browser process is not able to |
| 407 | // handle composition range and composition character bounds. |
nona | fa29179 | 2016-08-10 02:36:18 | [diff] [blame] | 408 | // If immediate_request is true, render sends the latest composition info to |
| 409 | // the browser even if the composition info is not changed. |
| 410 | void UpdateCompositionInfo(bool immediate_request); |
[email protected] | 7a4e253 | 2013-12-02 21:30:02 | [diff] [blame] | 411 | |
danakj | a2c9d0a9 | 2018-07-25 20:01:18 | [diff] [blame^] | 412 | // Override point to obtain that the current composition character bounds. |
| 413 | // In the case of surrogate pairs, the character is treated as two characters: |
| 414 | // the bounds for first character is actual one, and the bounds for second |
| 415 | // character is zero width rectangle. |
| 416 | void GetCompositionCharacterBounds(std::vector<gfx::Rect>* character_bounds); |
| 417 | |
lfg | b00fcad | 2016-07-14 14:16:33 | [diff] [blame] | 418 | // Called when the Widget has changed size as a result of an auto-resize. |
| 419 | void DidAutoResize(const gfx::Size& new_size); |
| 420 | |
Albert J. Wong | cb00463 | 2018-07-10 22:58:25 | [diff] [blame] | 421 | void DidPresentForceDrawFrame(int snapshot_id, |
| 422 | const gfx::PresentationFeedback& feedback); |
| 423 | |
lfg | e0c2792ec | 2016-05-11 18:52:08 | [diff] [blame] | 424 | // Indicates whether this widget has focus. |
| 425 | bool has_focus() const { return has_focus_; } |
| 426 | |
pwnall | ef66931 | 2017-01-07 01:17:29 | [diff] [blame] | 427 | MouseLockDispatcher* mouse_lock_dispatcher() const { |
lfg | bee1e0a | 2016-06-08 21:24:21 | [diff] [blame] | 428 | return mouse_lock_dispatcher_.get(); |
| 429 | } |
| 430 | |
Fady Samuel | a863f15 | 2018-03-09 16:10:03 | [diff] [blame] | 431 | // Returns the ScreenInfo exposed to Blink. In device emulation, this |
| 432 | // may not match the compositor ScreenInfo. |
| 433 | const ScreenInfo& GetWebScreenInfo() const; |
Christopher Cameron | e9a30c1 | 2018-03-07 08:23:38 | [diff] [blame] | 434 | |
Fady Samuel | a863f15 | 2018-03-09 16:10:03 | [diff] [blame] | 435 | // When emulated, this returns the original (non-emulated) ScreenInfo. |
| 436 | const ScreenInfo& GetOriginalScreenInfo() const; |
lfg | 1f9011c | 2016-08-17 21:18:42 | [diff] [blame] | 437 | |
paulmeyer | 90f6c31d | 2016-11-12 00:17:59 | [diff] [blame] | 438 | // Helper to convert |point| using ConvertWindowToViewport(). |
Ella Ge | 80a52dce | 2017-11-15 18:01:52 | [diff] [blame] | 439 | gfx::PointF ConvertWindowPointToViewport(const gfx::PointF& point); |
paulmeyer | 90f6c31d | 2016-11-12 00:17:59 | [diff] [blame] | 440 | gfx::Point ConvertWindowPointToViewport(const gfx::Point& point); |
kenrb | 5d78b84 | 2017-03-06 21:06:01 | [diff] [blame] | 441 | uint32_t GetContentSourceId(); |
Saman Sami | f773134 | 2018-01-24 22:18:44 | [diff] [blame] | 442 | void DidNavigate(); |
kenrb | 5d78b84 | 2017-03-06 21:06:01 | [diff] [blame] | 443 | |
Fady Samuel | e62be40 | 2018-03-29 03:19:53 | [diff] [blame] | 444 | bool auto_resize_mode() const { return auto_resize_mode_; } |
| 445 | |
Fady Samuel | e62be40 | 2018-03-29 03:19:53 | [diff] [blame] | 446 | const gfx::Size& min_size_for_auto_resize() const { |
| 447 | return min_size_for_auto_resize_; |
| 448 | } |
| 449 | |
| 450 | const gfx::Size& max_size_for_auto_resize() const { |
| 451 | return max_size_for_auto_resize_; |
| 452 | } |
Vladimir Levin | 98d76dad | 2018-04-21 00:21:29 | [diff] [blame] | 453 | |
| 454 | uint32_t capture_sequence_number() const { |
| 455 | return last_capture_sequence_number_; |
| 456 | } |
| 457 | |
dtapuska | 9ec1a91 | 2017-04-21 15:18:31 | [diff] [blame] | 458 | // MainThreadEventQueueClient overrides. |
| 459 | |
| 460 | // Requests a BeginMainFrame callback from the compositor. |
| 461 | void SetNeedsMainFrame() override; |
| 462 | |
Sadrul Habib Chowdhury | 6539b73 | 2018-01-05 21:53:27 | [diff] [blame] | 463 | viz::FrameSinkId GetFrameSinkIdAtPoint(const gfx::Point& point); |
Navid Zolghadr | 0d86e5f | 2017-10-23 18:09:22 | [diff] [blame] | 464 | |
Dave Tapuska | ea83d3bd | 2017-06-13 16:14:55 | [diff] [blame] | 465 | void HandleInputEvent(const blink::WebCoalescedInputEvent& input_event, |
| 466 | const ui::LatencyInfo& latency_info, |
| 467 | HandledEventCallback callback) override; |
Dave Tapuska | 139a72f | 2017-09-06 21:57:03 | [diff] [blame] | 468 | |
| 469 | void SetupWidgetInputHandler(mojom::WidgetInputHandlerRequest request, |
| 470 | mojom::WidgetInputHandlerHostPtr host) override; |
dtapuska | 9ec1a91 | 2017-04-21 15:18:31 | [diff] [blame] | 471 | |
dtapuska | 9d46ef7d | 2017-05-26 19:06:06 | [diff] [blame] | 472 | scoped_refptr<MainThreadEventQueue> GetInputEventQueue(); |
| 473 | |
Albert J. Wong | cb00463 | 2018-07-10 22:58:25 | [diff] [blame] | 474 | void OnSetActive(bool active); |
danakj | a2c9d0a9 | 2018-07-25 20:01:18 | [diff] [blame^] | 475 | void OnSetFocus(bool enable); |
Albert J. Wong | cb00463 | 2018-07-10 22:58:25 | [diff] [blame] | 476 | void OnSetBackgroundOpaque(bool opaque); |
Dave Tapuska | 9db8084 | 2017-07-24 17:24:26 | [diff] [blame] | 477 | void OnMouseCaptureLost(); |
| 478 | void OnCursorVisibilityChange(bool is_visible); |
| 479 | void OnSetEditCommandsForNextKeyEvent(const EditCommands& edit_commands); |
| 480 | void OnImeSetComposition( |
| 481 | const base::string16& text, |
Ryan Landay | 9e42fd74 | 2017-08-12 01:59:11 | [diff] [blame] | 482 | const std::vector<blink::WebImeTextSpan>& ime_text_spans, |
Dave Tapuska | 9db8084 | 2017-07-24 17:24:26 | [diff] [blame] | 483 | const gfx::Range& replacement_range, |
| 484 | int selection_start, |
| 485 | int selection_end); |
Ryan Landay | 9e42fd74 | 2017-08-12 01:59:11 | [diff] [blame] | 486 | void OnImeCommitText(const base::string16& text, |
| 487 | const std::vector<blink::WebImeTextSpan>& ime_text_spans, |
| 488 | const gfx::Range& replacement_range, |
| 489 | int relative_cursor_pos); |
Dave Tapuska | 9db8084 | 2017-07-24 17:24:26 | [diff] [blame] | 490 | void OnImeFinishComposingText(bool keep_selection); |
| 491 | |
danakj | a2c9d0a9 | 2018-07-25 20:01:18 | [diff] [blame^] | 492 | // This does the actual focus change, but is called in more situations than |
| 493 | // just as an IPC message. |
| 494 | void SetFocus(bool enable); |
| 495 | |
Dave Tapuska | 9db8084 | 2017-07-24 17:24:26 | [diff] [blame] | 496 | // Called by the browser process to update text input state. |
| 497 | void OnRequestTextInputStateUpdate(); |
| 498 | |
| 499 | // Called by the browser process to update the cursor and composition |
Dave Tapuska | 04bc5ee9 | 2018-04-17 19:03:31 | [diff] [blame] | 500 | // information by sending WidgetInputHandlerHost::ImeCompositionRangeChanged. |
| 501 | // If |immediate_request| is true, an IPC is sent back with current state. |
Dave Tapuska | 9db8084 | 2017-07-24 17:24:26 | [diff] [blame] | 502 | // When |monitor_update| is true, then RenderWidget will send the updates |
| 503 | // in each compositor frame when there are changes. Outside of compositor |
| 504 | // frame updates, a change in text selection might also lead to an update for |
| 505 | // composition info (when in monitor mode). |
| 506 | void OnRequestCompositionUpdates(bool immediate_request, |
| 507 | bool monitor_updates); |
Dave Tapuska | 485aca9 | 2017-08-08 00:47:58 | [diff] [blame] | 508 | void SetWidgetBinding(mojom::WidgetRequest request); |
Dave Tapuska | 9db8084 | 2017-07-24 17:24:26 | [diff] [blame] | 509 | |
Ken Buchanan | 94c0beb6 | 2018-06-22 19:56:24 | [diff] [blame] | 510 | void SetMouseCapture(bool capture); |
| 511 | |
Takashi SAKAMOTO | 870f626 | 2017-08-22 04:08:27 | [diff] [blame] | 512 | // Time-To-First-Active-Paint(TTFAP) type |
| 513 | enum { |
| 514 | TTFAP_AFTER_PURGED, |
| 515 | TTFAP_5MIN_AFTER_BACKGROUNDED, |
| 516 | }; |
| 517 | |
Fady Samuel | ca9ecb7 | 2018-05-05 05:59:27 | [diff] [blame] | 518 | bool IsSurfaceSynchronizationEnabled() const; |
| 519 | |
danakj | a2c9d0a9 | 2018-07-25 20:01:18 | [diff] [blame^] | 520 | void SetHandlingInputEventForTesting(bool handling_input_event); |
| 521 | void SetDeviceScaleFactorForTesting(float factor); |
| 522 | void SetDeviceColorSpaceForTesting(const gfx::ColorSpace& color_space); |
| 523 | void SetWindowRectSynchronouslyForTesting(const gfx::Rect& new_window_rect); |
| 524 | void EnableAutoResizeForTesting(const gfx::Size& min_size, |
| 525 | const gfx::Size& max_size); |
| 526 | void DisableAutoResizeForTesting(const gfx::Size& new_size); |
| 527 | |
Saman Sami | 50d1e0c | 2018-03-13 20:03:49 | [diff] [blame] | 528 | base::WeakPtr<RenderWidget> AsWeakPtr(); |
| 529 | |
initial.commit | 09911bf | 2008-07-26 23:55:29 | [diff] [blame] | 530 | protected: |
[email protected] | 8085dbc8 | 2008-09-26 22:53:44 | [diff] [blame] | 531 | // Friend RefCounted so that the dtor can be non-public. Using this class |
| 532 | // without ref-counting is an error. |
| 533 | friend class base::RefCounted<RenderWidget>; |
fsamuel | e8326c74 | 2016-01-12 00:49:39 | [diff] [blame] | 534 | |
[email protected] | 7339cd2 | 2010-10-27 00:11:20 | [diff] [blame] | 535 | // For unit tests. |
[email protected] | e9ff79c | 2012-10-19 21:31:26 | [diff] [blame] | 536 | friend class RenderWidgetTest; |
[email protected] | 8085dbc8 | 2008-09-26 22:53:44 | [diff] [blame] | 537 | |
[email protected] | 61e2b3cc | 2012-03-02 16:13:34 | [diff] [blame] | 538 | enum ResizeAck { |
| 539 | SEND_RESIZE_ACK, |
| 540 | NO_RESIZE_ACK, |
| 541 | }; |
| 542 | |
nick | 8331f8ad | 2016-11-15 20:42:45 | [diff] [blame] | 543 | RenderWidget(int32_t widget_routing_id, |
| 544 | CompositorDependencies* compositor_deps, |
dcheng | 35d31c11 | 2015-07-22 00:17:36 | [diff] [blame] | 545 | blink::WebPopupType popup_type, |
ccameron | 2f45153 | 2016-09-07 21:49:27 | [diff] [blame] | 546 | const ScreenInfo& screen_info, |
[email protected] | 1ac10dca | 2013-08-20 20:47:04 | [diff] [blame] | 547 | bool swapped_out, |
[email protected] | 7912e82 | 2014-04-16 02:37:03 | [diff] [blame] | 548 | bool hidden, |
Dave Tapuska | 1bdf183 | 2017-07-07 18:07:19 | [diff] [blame] | 549 | bool never_visible, |
Hajime Hoshi | abb3c8f | 2017-12-04 18:41:39 | [diff] [blame] | 550 | scoped_refptr<base::SingleThreadTaskRunner> task_runner, |
Dave Tapuska | 1bdf183 | 2017-07-07 18:07:19 | [diff] [blame] | 551 | mojom::WidgetRequest widget_request = nullptr); |
[email protected] | ce2b28e | 2012-08-09 15:53:57 | [diff] [blame] | 552 | |
danakj | a2c9d0a9 | 2018-07-25 20:01:18 | [diff] [blame^] | 553 | // Avoid making RenderWidget other than as a refptr. |
dcheng | 6d18e40 | 2014-10-21 12:32:52 | [diff] [blame] | 554 | ~RenderWidget() override; |
initial.commit | 09911bf | 2008-07-26 23:55:29 | [diff] [blame] | 555 | |
lfg | caab514 | 2016-02-26 19:06:52 | [diff] [blame] | 556 | static blink::WebFrameWidget* CreateWebFrameWidget( |
danakj | 9a8a9cf | 2018-07-17 23:52:12 | [diff] [blame] | 557 | blink::WebWidgetClient* widget_client, |
lfg | caab514 | 2016-02-26 19:06:52 | [diff] [blame] | 558 | blink::WebLocalFrame* frame); |
dcheng | da9b4bb | 2015-07-20 20:58:08 | [diff] [blame] | 559 | |
| 560 | // Creates a WebWidget based on the popup type. |
| 561 | static blink::WebWidget* CreateWebWidget(RenderWidget* render_widget); |
| 562 | |
nick | 4df698d8 | 2016-11-11 20:39:23 | [diff] [blame] | 563 | // Called by Create() functions and subclasses to finish initialization. |
nick | f7b3822 | 2016-11-22 21:59:35 | [diff] [blame] | 564 | // |show_callback| will be invoked once WebWidgetClient::show() occurs, and |
| 565 | // should be null if show() won't be triggered for this widget. |
danakj | df1ceb7 | 2018-07-18 20:02:25 | [diff] [blame] | 566 | void Init(ShowCallback show_callback, blink::WebWidget* web_widget); |
[email protected] | 48495594 | 2010-08-19 16:13:18 | [diff] [blame] | 567 | |
danakj | a2c9d0a9 | 2018-07-25 20:01:18 | [diff] [blame^] | 568 | // Idle user detector is optionally set up and destroyed during |
| 569 | // initialization/teardown. |
| 570 | void SetUpIdleUserDetector(); |
| 571 | |
[email protected] | 949b659 | 2014-08-20 13:17:52 | [diff] [blame] | 572 | // Allows the process to exit once the unload handler has finished, if there |
| 573 | // are no other active RenderWidgets. |
| 574 | void WasSwappedOut(); |
| 575 | |
[email protected] | 2533ce1 | 2009-05-09 00:02:24 | [diff] [blame] | 576 | void DoDeferredClose(); |
dgozman | cf9039cd | 2015-04-06 12:01:31 | [diff] [blame] | 577 | void NotifyOnClose(); |
dcheng | da9b4bb | 2015-07-20 20:58:08 | [diff] [blame] | 578 | |
bokan | c63441c | 2016-04-27 15:49:12 | [diff] [blame] | 579 | gfx::Size GetSizeForWebWidget() const; |
danakj | a2c9d0a9 | 2018-07-25 20:01:18 | [diff] [blame^] | 580 | void ResizeWebWidget(); |
bokan | c63441c | 2016-04-27 15:49:12 | [diff] [blame] | 581 | |
Ken Buchanan | ed449bb | 2018-02-01 21:02:05 | [diff] [blame] | 582 | // Close the underlying WebWidget and stop the compositor. |
dcheng | da9b4bb | 2015-07-20 20:58:08 | [diff] [blame] | 583 | virtual void Close(); |
initial.commit | 09911bf | 2008-07-26 23:55:29 | [diff] [blame] | 584 | |
Ken Buchanan | ed449bb | 2018-02-01 21:02:05 | [diff] [blame] | 585 | // Just Close the WebWidget, in cases where the Close() will be deferred. |
| 586 | // It is safe to call this multiple times, which happens in the case of |
| 587 | // frame widgets beings closed, since subsequent calls are ignored. |
| 588 | void CloseWebWidget(); |
| 589 | |
Mitsuru Oshima | 3c07b33 | 2018-02-06 04:56:50 | [diff] [blame] | 590 | // Update the web view's device scale factor. |
| 591 | void UpdateWebViewWithDeviceScaleFactor(); |
| 592 | |
thakis | 18e42641 | 2017-03-15 12:06:37 | [diff] [blame] | 593 | #if BUILDFLAG(USE_EXTERNAL_POPUP_MENU) |
[email protected] | b2e4c7013 | 2013-10-03 02:07:51 | [diff] [blame] | 594 | void SetExternalPopupOriginAdjustmentsForEmulation( |
mfomitchev | 2600fd7c | 2016-02-17 20:53:39 | [diff] [blame] | 595 | ExternalPopupMenu* popup, |
| 596 | RenderWidgetScreenMetricsEmulator* emulator); |
[email protected] | 5390786 | 2014-03-25 15:42:40 | [diff] [blame] | 597 | #endif |
[email protected] | 61e2b3cc | 2012-03-02 16:13:34 | [diff] [blame] | 598 | |
initial.commit | 09911bf | 2008-07-26 23:55:29 | [diff] [blame] | 599 | // RenderWidget IPC message handlers |
nzolghadr | 5d859650 | 2017-01-23 22:59:35 | [diff] [blame] | 600 | void OnHandleInputEvent( |
| 601 | const blink::WebInputEvent* event, |
| 602 | const std::vector<const blink::WebInputEvent*>& coalesced_events, |
| 603 | const ui::LatencyInfo& latency_info, |
| 604 | InputEventDispatchType dispatch_type); |
nasko | c288745f | 2015-05-01 22:54:21 | [diff] [blame] | 605 | void OnClose(); |
[email protected] | fc4404d | 2012-11-07 19:53:30 | [diff] [blame] | 606 | void OnCreatingNewAck(); |
Fady Samuel | 799e7219 | 2018-04-25 21:16:57 | [diff] [blame] | 607 | virtual void OnSynchronizeVisualProperties(const VisualProperties& params); |
dgozman | 9260b0a1 | 2015-03-16 13:45:20 | [diff] [blame] | 608 | void OnEnableDeviceEmulation(const blink::WebDeviceEmulationParams& params); |
| 609 | void OnDisableDeviceEmulation(); |
danakj | a2c9d0a9 | 2018-07-25 20:01:18 | [diff] [blame^] | 610 | void OnWasHidden(); |
| 611 | void OnWasShown(bool needs_repainting, |
| 612 | base::TimeTicks show_request_timestamp); |
avi | 1023d01 | 2015-12-25 02:39:14 | [diff] [blame] | 613 | void OnCreateVideoAck(int32_t video_id); |
| 614 | void OnUpdateVideoAck(int32_t video_id); |
Avi Drissman | 014dec7 | 2018-06-07 02:34:01 | [diff] [blame] | 615 | void OnRequestSetBoundsAck(); |
Albert J. Wong | cb00463 | 2018-07-10 22:58:25 | [diff] [blame] | 616 | void OnForceRedraw(int snapshot_id); |
wjmaclean | ee244e0 | 2017-05-26 21:06:07 | [diff] [blame] | 617 | // Request from browser to show context menu. |
danakj | a2c9d0a9 | 2018-07-25 20:01:18 | [diff] [blame^] | 618 | void OnShowContextMenu(ui::MenuSourceType source_type, |
| 619 | const gfx::Point& location); |
oshima | d527903 | 2015-12-16 18:22:33 | [diff] [blame] | 620 | |
[email protected] | 180ef24 | 2013-11-07 06:50:46 | [diff] [blame] | 621 | void OnSetTextDirection(blink::WebTextDirection direction); |
[email protected] | 872ae5b | 2011-05-26 20:20:50 | [diff] [blame] | 622 | void OnGetFPS(); |
[email protected] | 80ad862 | 2012-11-07 16:33:03 | [diff] [blame] | 623 | void OnUpdateScreenRects(const gfx::Rect& view_screen_rect, |
| 624 | const gfx::Rect& window_screen_rect); |
lfg | db5c4ed | 2016-03-04 23:09:07 | [diff] [blame] | 625 | void OnUpdateWindowScreenRect(const gfx::Rect& window_screen_rect); |
Ken Buchanan | b2c9e26 | 2018-03-10 16:53:31 | [diff] [blame] | 626 | void OnSetViewportIntersection(const gfx::Rect& viewport_intersection, |
| 627 | const gfx::Rect& compositor_visible_rect); |
kenrb | 0432378 | 2017-06-23 01:23:32 | [diff] [blame] | 628 | void OnSetIsInert(bool); |
sunxd | 540a996 | 2018-05-24 22:51:06 | [diff] [blame] | 629 | void OnSetInheritedEffectiveTouchAction(cc::TouchAction touch_action); |
Ken Buchanan | 8a319fb | 2017-11-15 18:37:12 | [diff] [blame] | 630 | void OnUpdateRenderThrottlingStatus(bool is_throttled, |
| 631 | bool subtree_throttled); |
paulmeyer | 90f6c31d | 2016-11-12 00:17:59 | [diff] [blame] | 632 | // Real data that is dragged is not included at DragEnter time. |
| 633 | void OnDragTargetDragEnter( |
| 634 | const std::vector<DropData::Metadata>& drop_meta_data, |
Ella Ge | 80a52dce | 2017-11-15 18:01:52 | [diff] [blame] | 635 | const gfx::PointF& client_pt, |
| 636 | const gfx::PointF& screen_pt, |
paulmeyer | 90f6c31d | 2016-11-12 00:17:59 | [diff] [blame] | 637 | blink::WebDragOperationsMask operations_allowed, |
| 638 | int key_modifiers); |
Ella Ge | 80a52dce | 2017-11-15 18:01:52 | [diff] [blame] | 639 | void OnDragTargetDragOver(const gfx::PointF& client_pt, |
| 640 | const gfx::PointF& screen_pt, |
paulmeyer | 90f6c31d | 2016-11-12 00:17:59 | [diff] [blame] | 641 | blink::WebDragOperationsMask operations_allowed, |
| 642 | int key_modifiers); |
Ella Ge | 80a52dce | 2017-11-15 18:01:52 | [diff] [blame] | 643 | void OnDragTargetDragLeave(const gfx::PointF& client_point, |
| 644 | const gfx::PointF& screen_point); |
paulmeyer | 90f6c31d | 2016-11-12 00:17:59 | [diff] [blame] | 645 | void OnDragTargetDrop(const DropData& drop_data, |
Ella Ge | 80a52dce | 2017-11-15 18:01:52 | [diff] [blame] | 646 | const gfx::PointF& client_pt, |
| 647 | const gfx::PointF& screen_pt, |
paulmeyer | 90f6c31d | 2016-11-12 00:17:59 | [diff] [blame] | 648 | int key_modifiers); |
Ella Ge | 80a52dce | 2017-11-15 18:01:52 | [diff] [blame] | 649 | void OnDragSourceEnded(const gfx::PointF& client_point, |
| 650 | const gfx::PointF& screen_point, |
paulmeyer | 8fc8ea9 | 2016-11-15 05:12:21 | [diff] [blame] | 651 | blink::WebDragOperation drag_operation); |
| 652 | void OnDragSourceSystemDragEnded(); |
lfg | 8d649cc | 2017-04-28 18:04:30 | [diff] [blame] | 653 | void OnOrientationChange(); |
[email protected] | fcdc564 | 2014-05-09 14:32:24 | [diff] [blame] | 654 | |
danakj | a2c9d0a9 | 2018-07-25 20:01:18 | [diff] [blame^] | 655 | // Notify subclasses that we initiated the paint operation. |
lfg | e0c2792ec | 2016-05-11 18:52:08 | [diff] [blame] | 656 | virtual void DidInitiatePaint() {} |
[email protected] | a2f6bc11 | 2009-06-27 16:27:25 | [diff] [blame] | 657 | |
danakj | a2c9d0a9 | 2018-07-25 20:01:18 | [diff] [blame^] | 658 | // Gets the current URL or a placeholder constant for creating 3d contexts and |
| 659 | // attributing them back to a URL. |
[email protected] | ed7defa | 2013-03-12 21:29:59 | [diff] [blame] | 660 | virtual GURL GetURLForGraphicsContext3D(); |
[email protected] | 6522577 | 2011-05-12 21:10:24 | [diff] [blame] | 661 | |
[email protected] | bee16aab | 2009-08-26 15:55:03 | [diff] [blame] | 662 | // Sets the "hidden" state of this widget. All accesses to is_hidden_ should |
| 663 | // use this method so that we can properly inform the RenderThread of our |
| 664 | // state. |
| 665 | void SetHidden(bool hidden); |
| 666 | |
[email protected] | 2b624c56 | 2011-10-27 22:58:26 | [diff] [blame] | 667 | void DidToggleFullscreen(); |
| 668 | |
Ken Buchanan | b2c9e26 | 2018-03-10 16:53:31 | [diff] [blame] | 669 | // Returns a rect that the compositor needs to raster. For a main frame this |
| 670 | // is always the entire viewprot, but for out-of-process iframes this can be |
| 671 | // constrained to limit overdraw. |
| 672 | gfx::Rect ViewportVisibleRect(); |
| 673 | |
[email protected] | 586871b | 2014-07-22 17:05:11 | [diff] [blame] | 674 | // QueueMessage implementation extracted into a static method for easy |
| 675 | // testing. |
dcheng | cedca561 | 2016-04-09 01:40:15 | [diff] [blame] | 676 | static std::unique_ptr<cc::SwapPromise> QueueMessageImpl( |
[email protected] | 586871b | 2014-07-22 17:05:11 | [diff] [blame] | 677 | IPC::Message* msg, |
| 678 | MessageDeliveryPolicy policy, |
| 679 | FrameSwapMessageQueue* frame_swap_message_queue, |
| 680 | scoped_refptr<IPC::SyncMessageFilter> sync_message_filter, |
[email protected] | 586871b | 2014-07-22 17:05:11 | [diff] [blame] | 681 | int source_frame_number); |
| 682 | |
[email protected] | 88dbe32f | 2013-06-20 23:31:36 | [diff] [blame] | 683 | // Returns the range of the text that is being composed or the selection if |
| 684 | // the composition does not exist. |
danakj | a2c9d0a9 | 2018-07-25 20:01:18 | [diff] [blame^] | 685 | void GetCompositionRange(gfx::Range* range); |
[email protected] | 88dbe32f | 2013-06-20 23:31:36 | [diff] [blame] | 686 | |
[email protected] | 58b48a0d | 2012-06-13 07:01:35 | [diff] [blame] | 687 | // Returns true if the composition range or composition character bounds |
| 688 | // should be sent to the browser process. |
| 689 | bool ShouldUpdateCompositionInfo( |
[email protected] | db4fc1e | 2013-09-06 20:01:51 | [diff] [blame] | 690 | const gfx::Range& range, |
[email protected] | 58b48a0d | 2012-06-13 07:01:35 | [diff] [blame] | 691 | const std::vector<gfx::Rect>& bounds); |
| 692 | |
[email protected] | ad26ef4 | 2011-06-17 07:59:45 | [diff] [blame] | 693 | // Override point to obtain that the current input method state about |
| 694 | // composition text. |
danakj | a2c9d0a9 | 2018-07-25 20:01:18 | [diff] [blame^] | 695 | bool CanComposeInline(); |
[email protected] | 56ea1a6 | 2011-05-30 07:05:57 | [diff] [blame] | 696 | |
[email protected] | 2533ce1 | 2009-05-09 00:02:24 | [diff] [blame] | 697 | // Set the pending window rect. |
| 698 | // Because the real render_widget is hosted in another process, there is |
| 699 | // a time period where we may have set a new window rect which has not yet |
| 700 | // been processed by the browser. So we maintain a pending window rect |
| 701 | // size. If JS code sets the WindowRect, and then immediately calls |
| 702 | // GetWindowRect() we'll use this pending window rect as the size. |
[email protected] | 180ef24 | 2013-11-07 06:50:46 | [diff] [blame] | 703 | void SetPendingWindowRect(const blink::WebRect& r); |
[email protected] | 2533ce1 | 2009-05-09 00:02:24 | [diff] [blame] | 704 | |
[email protected] | ce6689f | 2013-03-29 12:52:55 | [diff] [blame] | 705 | // Check whether the WebWidget has any touch event handlers registered. |
Blink Reformat | 1c4d759e | 2017-04-09 16:34:54 | [diff] [blame] | 706 | void HasTouchEventHandlers(bool has_handlers) override; |
[email protected] | ce6689f | 2013-03-29 12:52:55 | [diff] [blame] | 707 | |
Dave Tapuska | dfe486c1 | 2017-06-09 16:53:13 | [diff] [blame] | 708 | // Called to update whether low latency input mode is enabled or not. |
| 709 | void SetNeedsLowLatencyInput(bool) override; |
| 710 | |
Dave Tapuska | bafc2ba3 | 2017-11-28 01:54:37 | [diff] [blame] | 711 | // Requests unbuffered (ie. low latency) input until a pointerup |
| 712 | // event occurs. |
| 713 | void RequestUnbufferedInputEvents() override; |
| 714 | |
[email protected] | 5d0bbdfa9 | 2013-12-10 00:35:51 | [diff] [blame] | 715 | // Tell the browser about the actions permitted for a new touch point. |
xidachen | fa0199e7 | 2017-05-11 11:34:26 | [diff] [blame] | 716 | void SetTouchAction(cc::TouchAction touch_action) override; |
[email protected] | 5d0bbdfa9 | 2013-12-10 00:35:51 | [diff] [blame] | 717 | |
lfg | 43e08e6 | 2016-02-03 18:51:37 | [diff] [blame] | 718 | // Sends an ACK to the browser process during the next compositor frame. |
| 719 | void OnWaitNextFrameForTests(int routing_id); |
| 720 | |
initial.commit | 09911bf | 2008-07-26 23:55:29 | [diff] [blame] | 721 | // Routing ID that allows us to communicate to the parent browser process |
nick | 8331f8ad | 2016-11-15 20:42:45 | [diff] [blame] | 722 | // RenderWidgetHost. |
| 723 | const int32_t routing_id_; |
initial.commit | 09911bf | 2008-07-26 23:55:29 | [diff] [blame] | 724 | |
danakj | 6e3bf801 | 2014-12-16 18:27:53 | [diff] [blame] | 725 | // Dependencies for initializing a compositor, including flags for optional |
| 726 | // features. |
dcheng | 35d31c11 | 2015-07-22 00:17:36 | [diff] [blame] | 727 | CompositorDependencies* const compositor_deps_; |
danakj | 6e3bf801 | 2014-12-16 18:27:53 | [diff] [blame] | 728 | |
lfg | 8ff3391 | 2016-09-13 20:59:21 | [diff] [blame] | 729 | // Use GetWebWidget() instead of using webwidget_internal_ directly. |
[email protected] | c5b3b5e | 2009-02-13 06:41:11 | [diff] [blame] | 730 | // We are responsible for destroying this object via its Close method. |
[email protected] | 4ee6462 | 2014-03-21 22:34:15 | [diff] [blame] | 731 | // May be NULL when the window is closing. |
lfg | 8ff3391 | 2016-09-13 20:59:21 | [diff] [blame] | 732 | blink::WebWidget* webwidget_internal_; |
initial.commit | 09911bf | 2008-07-26 23:55:29 | [diff] [blame] | 733 | |
avi | 40b5be7a | 2016-03-03 21:13:44 | [diff] [blame] | 734 | // The delegate of the owner of this object. |
| 735 | RenderWidgetOwnerDelegate* owner_delegate_; |
| 736 | |
[email protected] | 8926c60 | 2013-01-23 05:32:06 | [diff] [blame] | 737 | // This is lazily constructed and must not outlive webwidget_. |
danakj | a6c1001 | 2018-07-06 14:25:36 | [diff] [blame] | 738 | std::unique_ptr<LayerTreeView> layer_tree_view_; |
[email protected] | 8926c60 | 2013-01-23 05:32:06 | [diff] [blame] | 739 | |
bokan | c007c3a | 2015-02-03 07:15:56 | [diff] [blame] | 740 | // The rect where this view should be initially shown. |
| 741 | gfx::Rect initial_rect_; |
initial.commit | 09911bf | 2008-07-26 23:55:29 | [diff] [blame] | 742 | |
initial.commit | 09911bf | 2008-07-26 23:55:29 | [diff] [blame] | 743 | // We store the current cursor object so we can avoid spamming SetCursor |
| 744 | // messages. |
| 745 | WebCursor current_cursor_; |
[email protected] | 88efb7ec | 2009-07-14 16:32:59 | [diff] [blame] | 746 | |
danakj | a2c9d0a9 | 2018-07-25 20:01:18 | [diff] [blame^] | 747 | base::Optional<float> device_scale_factor_for_testing_; |
| 748 | |
Christopher Cameron | be7ecea | 2018-02-27 00:47:19 | [diff] [blame] | 749 | // The size of the RenderWidget in DIPs. This may differ from |
Christopher Cameron | aad15a0d | 2018-03-09 03:47:33 | [diff] [blame] | 750 | // |compositor_viewport_pixel_size_| in the following (and possibly other) |
| 751 | // cases: * On Android, for top and bottom controls * On OOPIF, due to |
| 752 | // rounding |
initial.commit | 09911bf | 2008-07-26 23:55:29 | [diff] [blame] | 753 | gfx::Size size_; |
| 754 | |
Christopher Cameron | be7ecea | 2018-02-27 00:47:19 | [diff] [blame] | 755 | // The size of the compositor's surface in pixels. |
Christopher Cameron | aad15a0d | 2018-03-09 03:47:33 | [diff] [blame] | 756 | gfx::Size compositor_viewport_pixel_size_; |
[email protected] | 60d47ac | 2013-03-01 23:42:44 | [diff] [blame] | 757 | |
Christopher Cameron | be7ecea | 2018-02-27 00:47:19 | [diff] [blame] | 758 | // The size of the visible viewport in pixels. |
[email protected] | bb6378fe | 2014-04-28 21:19:44 | [diff] [blame] | 759 | gfx::Size visible_viewport_size_; |
| 760 | |
[email protected] | 847a258 | 2013-03-09 02:29:51 | [diff] [blame] | 761 | // Whether the WebWidget is in auto resize mode, which is used for example |
| 762 | // by extension popups. |
| 763 | bool auto_resize_mode_; |
| 764 | |
Fady Samuel | e62be40 | 2018-03-29 03:19:53 | [diff] [blame] | 765 | // The minimum size to use for auto-resize. |
| 766 | gfx::Size min_size_for_auto_resize_; |
| 767 | |
| 768 | // The maximum size to use for auto-resize. |
| 769 | gfx::Size max_size_for_auto_resize_; |
| 770 | |
initial.commit | 09911bf | 2008-07-26 23:55:29 | [diff] [blame] | 771 | // Set to true if we should ignore RenderWidget::Show calls. |
| 772 | bool did_show_; |
| 773 | |
| 774 | // Indicates that we shouldn't bother generated paint events. |
| 775 | bool is_hidden_; |
| 776 | |
[email protected] | 7912e82 | 2014-04-16 02:37:03 | [diff] [blame] | 777 | // Indicates that we are never visible, so never produce graphical output. |
sievers | 71c62dd5 | 2015-10-07 01:44:39 | [diff] [blame] | 778 | const bool compositor_never_visible_; |
[email protected] | 7912e82 | 2014-04-16 02:37:03 | [diff] [blame] | 779 | |
mikhail.pozdnyakov | f2c902a | 2015-04-14 08:09:12 | [diff] [blame] | 780 | // Indicates whether tab-initiated fullscreen was granted. |
| 781 | bool is_fullscreen_granted_; |
[email protected] | ee41e7d2 | 2011-10-14 19:34:09 | [diff] [blame] | 782 | |
mikhail.pozdnyakov | c0e251b | 2015-04-15 06:51:12 | [diff] [blame] | 783 | // Indicates the display mode. |
| 784 | blink::WebDisplayMode display_mode_; |
| 785 | |
changwan | f2a707b | 2015-10-30 08:22:16 | [diff] [blame] | 786 | // It is possible that one ImeEventGuard is nested inside another |
| 787 | // ImeEventGuard. We keep track of the outermost one, and update it as needed. |
| 788 | ImeEventGuard* ime_event_guard_; |
[email protected] | e8f775f | 2013-02-14 21:00:50 | [diff] [blame] | 789 | |
initial.commit | 09911bf | 2008-07-26 23:55:29 | [diff] [blame] | 790 | // True if we have requested this widget be closed. No more messages will |
| 791 | // be sent, except for a Close. |
| 792 | bool closing_; |
| 793 | |
[email protected] | aeeedad | 2014-08-22 18:16:22 | [diff] [blame] | 794 | // True if it is known that the host is in the process of being shut down. |
| 795 | bool host_closing_; |
| 796 | |
[email protected] | 992db4c | 2011-05-12 15:37:15 | [diff] [blame] | 797 | // Whether this RenderWidget is currently swapped out, such that the view is |
| 798 | // being rendered by another process. If all RenderWidgets in a process are |
| 799 | // swapped out, the process can exit. |
| 800 | bool is_swapped_out_; |
| 801 | |
[email protected] | 5b739cb | 2012-08-21 20:35:21 | [diff] [blame] | 802 | // Stores information about the current text input. |
[email protected] | 180ef24 | 2013-11-07 06:50:46 | [diff] [blame] | 803 | blink::WebTextInputInfo text_input_info_; |
[email protected] | 5b739cb | 2012-08-21 20:35:21 | [diff] [blame] | 804 | |
dglazkov | 97b6c2b | 2016-10-25 17:35:55 | [diff] [blame] | 805 | // Stores the current text input type of |webwidget_|. |
| 806 | ui::TextInputType text_input_type_; |
| 807 | |
[email protected] | b256eca | 2013-07-11 10:57:40 | [diff] [blame] | 808 | // Stores the current text input mode of |webwidget_|. |
| 809 | ui::TextInputMode text_input_mode_; |
| 810 | |
shuchen | 82ce8c5 | 2014-10-23 01:55:20 | [diff] [blame] | 811 | // Stores the current text input flags of |webwidget_|. |
| 812 | int text_input_flags_; |
| 813 | |
AJITH KUMAR V | 041c0b0 | 2017-08-08 10:39:20 | [diff] [blame] | 814 | // Indicates whether currently focused input field has next/previous focusable |
| 815 | // form input field. |
| 816 | int next_previous_flags_; |
| 817 | |
[email protected] | 86ba5fcb | 2013-09-04 00:36:53 | [diff] [blame] | 818 | // Stores the current type of composition text rendering of |webwidget_|. |
| 819 | bool can_compose_inline_; |
| 820 | |
[email protected] | e99ef6f | 2011-10-16 01:13:00 | [diff] [blame] | 821 | // Stores the current selection bounds. |
[email protected] | 7c8873e | 2013-02-05 08:03:01 | [diff] [blame] | 822 | gfx::Rect selection_focus_rect_; |
| 823 | gfx::Rect selection_anchor_rect_; |
initial.commit | 09911bf | 2008-07-26 23:55:29 | [diff] [blame] | 824 | |
[email protected] | 58b48a0d | 2012-06-13 07:01:35 | [diff] [blame] | 825 | // Stores the current composition character bounds. |
| 826 | std::vector<gfx::Rect> composition_character_bounds_; |
| 827 | |
| 828 | // Stores the current composition range. |
[email protected] | db4fc1e | 2013-09-06 20:01:51 | [diff] [blame] | 829 | gfx::Range composition_range_; |
[email protected] | 58b48a0d | 2012-06-13 07:01:35 | [diff] [blame] | 830 | |
[email protected] | 3e2b375b | 2010-04-07 17:03:12 | [diff] [blame] | 831 | // The kind of popup this widget represents, NONE if not a popup. |
[email protected] | 180ef24 | 2013-11-07 06:50:46 | [diff] [blame] | 832 | blink::WebPopupType popup_type_; |
[email protected] | 0ebf387 | 2008-11-07 21:35:03 | [diff] [blame] | 833 | |
[email protected] | 80ad862 | 2012-11-07 16:33:03 | [diff] [blame] | 834 | // While we are waiting for the browser to update window sizes, we track the |
| 835 | // pending size temporarily. |
[email protected] | 2533ce1 | 2009-05-09 00:02:24 | [diff] [blame] | 836 | int pending_window_rect_count_; |
lfg | 0140a45 | 2016-07-19 19:15:05 | [diff] [blame] | 837 | gfx::Rect pending_window_rect_; |
[email protected] | 2533ce1 | 2009-05-09 00:02:24 | [diff] [blame] | 838 | |
[email protected] | 80ad862 | 2012-11-07 16:33:03 | [diff] [blame] | 839 | // The screen rects of the view and the window that contains it. |
| 840 | gfx::Rect view_screen_rect_; |
| 841 | gfx::Rect window_screen_rect_; |
| 842 | |
Dave Tapuska | 9db8084 | 2017-07-24 17:24:26 | [diff] [blame] | 843 | scoped_refptr<WidgetInputHandlerManager> widget_input_handler_manager_; |
| 844 | |
dcheng | cedca561 | 2016-04-09 01:40:15 | [diff] [blame] | 845 | std::unique_ptr<RenderWidgetInputHandler> input_handler_; |
[email protected] | 12fbad81 | 2009-09-01 18:21:24 | [diff] [blame] | 846 | |
[email protected] | fd84779 | 2013-10-24 17:12:35 | [diff] [blame] | 847 | // The time spent in input handlers this frame. Used to throttle input acks. |
| 848 | base::TimeDelta total_input_handling_time_this_frame_; |
| 849 | |
[email protected] | 842f1065 | 2012-06-06 01:54:04 | [diff] [blame] | 850 | // Properties of the screen hosting this RenderWidget instance. |
ccameron | 2f45153 | 2016-09-07 21:49:27 | [diff] [blame] | 851 | ScreenInfo screen_info_; |
[email protected] | 842f1065 | 2012-06-06 01:54:04 | [diff] [blame] | 852 | |
nona | fa29179 | 2016-08-10 02:36:18 | [diff] [blame] | 853 | // True if the IME requests updated composition info. |
| 854 | bool monitor_composition_info_; |
| 855 | |
dcheng | cedca561 | 2016-04-09 01:40:15 | [diff] [blame] | 856 | std::unique_ptr<RenderWidgetScreenMetricsEmulator> screen_metrics_emulator_; |
[email protected] | b2e4c7013 | 2013-10-03 02:07:51 | [diff] [blame] | 857 | |
| 858 | // Popups may be displaced when screen metrics emulation is enabled. |
| 859 | // These values are used to properly adjust popup position. |
danakj | 2ef31b8 | 2015-10-21 18:18:02 | [diff] [blame] | 860 | gfx::Point popup_view_origin_for_emulation_; |
| 861 | gfx::Point popup_screen_origin_for_emulation_; |
[email protected] | b2e4c7013 | 2013-10-03 02:07:51 | [diff] [blame] | 862 | float popup_origin_scale_for_emulation_; |
| 863 | |
[email protected] | 586871b | 2014-07-22 17:05:11 | [diff] [blame] | 864 | scoped_refptr<FrameSwapMessageQueue> frame_swap_message_queue_; |
dcheng | cedca561 | 2016-04-09 01:40:15 | [diff] [blame] | 865 | std::unique_ptr<ResizingModeSelector> resizing_mode_selector_; |
[email protected] | 5b45ad4 | 2013-10-25 00:42:04 | [diff] [blame] | 866 | |
[email protected] | e3244ed | 2014-06-20 20:04:27 | [diff] [blame] | 867 | // Lists of RenderFrameProxy objects that need to be notified of |
| 868 | // compositing-related events (e.g. DidCommitCompositorFrame). |
brettw | 236d317 | 2015-06-03 16:31:43 | [diff] [blame] | 869 | base::ObserverList<RenderFrameProxy> render_frame_proxies_; |
[email protected] | bffc830 | 2014-01-23 20:52:16 | [diff] [blame] | 870 | |
[email protected] | de3c5d8 | 2014-05-28 22:12:59 | [diff] [blame] | 871 | // A list of RenderFrames associated with this RenderWidget. Notifications |
| 872 | // are sent to each frame in the list for events such as changing |
| 873 | // visibility state for example. |
brettw | 236d317 | 2015-06-03 16:31:43 | [diff] [blame] | 874 | base::ObserverList<RenderFrameImpl> render_frames_; |
[email protected] | de3c5d8 | 2014-05-28 22:12:59 | [diff] [blame] | 875 | |
Saman Sami | d189e5dfd | 2017-12-20 22:55:31 | [diff] [blame] | 876 | base::ObserverList<BrowserPlugin> browser_plugins_; |
| 877 | |
[email protected] | be1af066 | 2014-07-29 19:55:51 | [diff] [blame] | 878 | bool has_host_context_menu_location_; |
| 879 | gfx::Point host_context_menu_location_; |
[email protected] | a09d53ce | 2014-01-31 00:46:42 | [diff] [blame] | 880 | |
Yuta Kitamura | 39219b4 | 2018-04-06 10:28:14 | [diff] [blame] | 881 | std::unique_ptr<blink::scheduler::WebRenderWidgetSchedulingState> |
alexclarke | 7fa9394 | 2015-10-21 15:37:11 | [diff] [blame] | 882 | render_widget_scheduling_state_; |
| 883 | |
lfg | bee1e0a | 2016-06-08 21:24:21 | [diff] [blame] | 884 | // Mouse Lock dispatcher attached to this view. |
| 885 | std::unique_ptr<RenderWidgetMouseLockDispatcher> mouse_lock_dispatcher_; |
| 886 | |
| 887 | // Wraps the |webwidget_| as a MouseLockDispatcher::LockTarget interface. |
| 888 | std::unique_ptr<MouseLockDispatcher::LockTarget> webwidget_mouse_lock_target_; |
| 889 | |
Fady Samuel | 4255c18 | 2018-05-24 20:42:36 | [diff] [blame] | 890 | viz::LocalSurfaceId local_surface_id_from_parent_; |
Fady Samuel | da839bb | 2018-03-26 17:34:48 | [diff] [blame] | 891 | |
oshima | 50872a7 | 2016-03-04 13:26:18 | [diff] [blame] | 892 | private: |
Ehsan Karamad | 655d7b8a | 2018-01-12 18:38:38 | [diff] [blame] | 893 | // TODO(ekaramad): This method should not be confused with its RenderView |
| 894 | // variant, GetWebFrameWidget(). Currently Cast and AndroidWebview's |
| 895 | // ContentRendererClients are the only users of the public variant. The public |
| 896 | // method will eventually be removed from RenderView and uses of the method |
| 897 | // will obtain WebFrameWidget from WebLocalFrame. |
| 898 | // Returns the WebFrameWidget associated with this RenderWidget if any. |
| 899 | // Returns nullptr if GetWebWidget() returns nullptr or returns a WebWidget |
| 900 | // that is not a WebFrameWidget. A WebFrameWidget only makes sense when there |
| 901 | // a local root associated with it. RenderWidgetFullscreenPepper and a swapped |
| 902 | // out RenderWidgets are amongst the cases where this method returns nullptr. |
| 903 | blink::WebFrameWidget* GetFrameWidget() const; |
| 904 | |
bokan | 841fdc7 | 2016-10-06 00:16:35 | [diff] [blame] | 905 | // Applies/Removes the DevTools device emulation transformation to/from a |
| 906 | // window rect. |
| 907 | void ScreenRectToEmulatedIfNeeded(blink::WebRect* window_rect) const; |
| 908 | void EmulatedToScreenRectIfNeeded(blink::WebRect* window_rect) const; |
| 909 | |
dtapuska | 014ed08 | 2016-11-11 21:58:48 | [diff] [blame] | 910 | bool CreateWidget(int32_t opener_id, |
| 911 | blink::WebPopupType popup_type, |
| 912 | int32_t* routing_id); |
| 913 | |
Christopher Cameron | aad15a0d | 2018-03-09 03:47:33 | [diff] [blame] | 914 | void UpdateSurfaceAndScreenInfo( |
Fady Samuel | 4392abb | 2018-05-10 21:01:21 | [diff] [blame] | 915 | const viz::LocalSurfaceId& new_local_surface_id, |
Christopher Cameron | aad15a0d | 2018-03-09 03:47:33 | [diff] [blame] | 916 | const gfx::Size& new_compositor_viewport_pixel_size, |
| 917 | const ScreenInfo& new_screen_info); |
Christopher Cameron | be7ecea | 2018-02-27 00:47:19 | [diff] [blame] | 918 | |
danakj | a2c9d0a9 | 2018-07-25 20:01:18 | [diff] [blame^] | 919 | // Used to force the size of a window when running layout tests. |
| 920 | void SetWindowRectSynchronously(const gfx::Rect& new_window_rect); |
| 921 | |
Vladimir Levin | 98d76dad | 2018-04-21 00:21:29 | [diff] [blame] | 922 | void UpdateCaptureSequenceNumber(uint32_t capture_sequence_number); |
| 923 | |
dtapuska | 014ed08 | 2016-11-11 21:58:48 | [diff] [blame] | 924 | // A variant of Send but is fatal if it fails. The browser may |
| 925 | // be waiting for this IPC Message and if the send fails the browser will |
| 926 | // be left in a state waiting for something that never comes. And if it |
| 927 | // never comes then it may later determine this is a hung renderer; so |
| 928 | // instead fail right away. |
| 929 | void SendOrCrash(IPC::Message* msg); |
| 930 | |
ekaramad | 5aff194 | 2017-01-06 01:26:35 | [diff] [blame] | 931 | // Determines whether or not RenderWidget should process IME events from the |
| 932 | // browser. It always returns true unless there is no WebFrameWidget to |
| 933 | // handle the event, or there is no page focus. |
| 934 | bool ShouldHandleImeEvents() const; |
| 935 | |
changwan | 75e3b207 | 2017-01-16 02:55:00 | [diff] [blame] | 936 | void UpdateTextInputStateInternal(bool show_virtual_keyboard, |
| 937 | bool reply_to_request); |
| 938 | |
ccameron | 0191299 | 2017-05-23 07:34:03 | [diff] [blame] | 939 | gfx::ColorSpace GetRasterColorSpace() const; |
| 940 | |
Dave Tapuska | ea83d3bd | 2017-06-13 16:14:55 | [diff] [blame] | 941 | void SendInputEventAck(blink::WebInputEvent::Type type, |
| 942 | uint32_t touch_event_id, |
| 943 | InputEventAckState ack_state, |
| 944 | const ui::LatencyInfo& latency_info, |
Dave Tapuska | b28a108 | 2017-08-30 15:37:26 | [diff] [blame] | 945 | std::unique_ptr<ui::DidOverscrollParams>, |
| 946 | base::Optional<cc::TouchAction>); |
Dave Tapuska | ea83d3bd | 2017-06-13 16:14:55 | [diff] [blame] | 947 | |
akaba | 3483d8f | 2018-07-10 21:43:09 | [diff] [blame] | 948 | void UpdateZoom(double zoom_level); |
akaba | c6bd121 | 2018-06-25 20:10:48 | [diff] [blame] | 949 | |
EhsanK | 22d482e | 2017-08-10 17:29:49 | [diff] [blame] | 950 | #if BUILDFLAG(ENABLE_PLUGINS) |
| 951 | // Returns the focused pepper plugin, if any, inside the WebWidget. That is |
| 952 | // the pepper plugin which is focused inside a frame which belongs to the |
| 953 | // local root associated with this RenderWidget. |
| 954 | PepperPluginInstanceImpl* GetFocusedPepperPluginInsideWidget(); |
| 955 | #endif |
Takashi SAKAMOTO | 870f626 | 2017-08-22 04:08:27 | [diff] [blame] | 956 | void RecordTimeToFirstActivePaint(); |
EhsanK | 22d482e | 2017-08-10 17:29:49 | [diff] [blame] | 957 | |
Khushal | 3e96e66 | 2017-10-30 23:16:50 | [diff] [blame] | 958 | // Updates the URL used by the compositor for keying UKM metrics. |
| 959 | // Note that this uses the main frame's URL and only if its available in the |
| 960 | // current process. In the case where it is not available, no metrics will be |
| 961 | // recorded. |
| 962 | void UpdateURLForCompositorUkm(); |
| 963 | |
EhsanK | 955ba58 | 2017-11-30 21:14:40 | [diff] [blame] | 964 | // This method returns the WebLocalFrame which is currently focused and |
| 965 | // belongs to the frame tree associated with this RenderWidget. |
| 966 | blink::WebLocalFrame* GetFocusedWebLocalFrameInWidget() const; |
| 967 | |
lfg | e0c2792ec | 2016-05-11 18:52:08 | [diff] [blame] | 968 | // Indicates whether this widget has focus. |
| 969 | bool has_focus_; |
| 970 | |
Nicolas Pena | 75a35d66 | 2018-04-05 20:13:44 | [diff] [blame] | 971 | // Whether this RenderWidget is for an out-of-process iframe or not. |
| 972 | bool for_oopif_; |
| 973 | |
nick | f7b3822 | 2016-11-22 21:59:35 | [diff] [blame] | 974 | // A callback into the creator/opener of this widget, to be executed when |
danakj | df1ceb7 | 2018-07-18 20:02:25 | [diff] [blame] | 975 | // WebWidgetClient::Show() occurs. |
nick | f7b3822 | 2016-11-22 21:59:35 | [diff] [blame] | 976 | ShowCallback show_callback_; |
| 977 | |
ekaramad | 330ba423 | 2016-09-23 17:57:47 | [diff] [blame] | 978 | #if defined(OS_MACOSX) |
| 979 | // Responds to IPCs from TextInputClientMac regarding getting string at given |
| 980 | // position or range as well as finding character index at a given position. |
| 981 | std::unique_ptr<TextInputClientObserver> text_input_client_observer_; |
| 982 | #endif |
| 983 | |
alexmos | 5656749 | 2016-09-13 00:52:46 | [diff] [blame] | 984 | // Stores edit commands associated to the next key event. |
| 985 | // Will be cleared as soon as the next key event is processed. |
| 986 | EditCommands edit_commands_; |
| 987 | |
paulmeyer | 6ef5a79 | 2016-11-08 20:33:58 | [diff] [blame] | 988 | // This field stores drag/drop related info for the event that is currently |
| 989 | // being handled. If the current event results in starting a drag/drop |
| 990 | // session, this info is sent to the browser along with other drag/drop info. |
| 991 | DragEventSourceInfo possible_drag_event_info_; |
| 992 | |
Takashi SAKAMOTO | 870f626 | 2017-08-22 04:08:27 | [diff] [blame] | 993 | bool first_update_visual_state_after_hidden_; |
tasak | b95dbb50c | 2017-02-08 18:07:50 | [diff] [blame] | 994 | base::TimeTicks was_shown_time_; |
| 995 | |
danakj | a2c9d0a9 | 2018-07-25 20:01:18 | [diff] [blame^] | 996 | // Whether or not Blink's viewport size should be shrunk by the height of the |
| 997 | // URL-bar. |
| 998 | bool browser_controls_shrink_blink_size_ = false; |
| 999 | // The height of the browser top controls. |
| 1000 | float top_controls_height_ = 0.f; |
| 1001 | // The height of the browser bottom controls. |
| 1002 | float bottom_controls_height_ = 0.f; |
| 1003 | |
kenrb | 5d78b84 | 2017-03-06 21:06:01 | [diff] [blame] | 1004 | // This is initialized to zero and is incremented on each non-same-page |
| 1005 | // navigation commit by RenderFrameImpl. At that time it is sent to the |
| 1006 | // compositor so that it can tag compositor frames, and RenderFrameImpl is |
| 1007 | // responsible for sending it to the browser process to be used to match |
| 1008 | // each compositor frame to the most recent page navigation before it was |
| 1009 | // generated. |
| 1010 | // This only applies to main frames, and is not touched for subframe |
| 1011 | // RenderWidgets, where there is no concern around displaying unloaded |
| 1012 | // content. |
| 1013 | // TODO(kenrb, fsamuel): This should be removed when SurfaceIDs can be used |
| 1014 | // to replace it. See https://crbug.com/695579. |
| 1015 | uint32_t current_content_source_id_; |
| 1016 | |
dtapuska | 9ec1a91 | 2017-04-21 15:18:31 | [diff] [blame] | 1017 | scoped_refptr<MainThreadEventQueue> input_event_queue_; |
| 1018 | |
Dave Tapuska | 1bdf183 | 2017-07-07 18:07:19 | [diff] [blame] | 1019 | mojo::Binding<mojom::Widget> widget_binding_; |
Hajime Hoshi | abb3c8f | 2017-12-04 18:41:39 | [diff] [blame] | 1020 | scoped_refptr<base::SingleThreadTaskRunner> task_runner_; |
danakj | a2c9d0a9 | 2018-07-25 20:01:18 | [diff] [blame^] | 1021 | // IdleUserDetector is setup optionally on RenderWidget by its creator, so may |
| 1022 | // be null. |
| 1023 | std::unique_ptr<IdleUserDetector> idle_user_detector_; |
Hajime Hoshi | abb3c8f | 2017-12-04 18:41:39 | [diff] [blame] | 1024 | |
Ken Buchanan | b2c9e26 | 2018-03-10 16:53:31 | [diff] [blame] | 1025 | gfx::Rect compositor_visible_rect_; |
| 1026 | |
W. James MacLean | 662d538 | 2018-03-29 18:33:08 | [diff] [blame] | 1027 | // Different consumers in the browser process makes different assumptions, so |
| 1028 | // must always send the first IPC regardless of value. |
| 1029 | base::Optional<bool> has_touch_handlers_; |
| 1030 | |
Vladimir Levin | 98d76dad | 2018-04-21 00:21:29 | [diff] [blame] | 1031 | uint32_t last_capture_sequence_number_ = 0u; |
| 1032 | |
wjmaclean | 1d97062 | 2017-01-21 22:28:24 | [diff] [blame] | 1033 | base::WeakPtrFactory<RenderWidget> weak_ptr_factory_; |
| 1034 | |
[email protected] | 05d47875 | 2009-04-08 23:38:16 | [diff] [blame] | 1035 | DISALLOW_COPY_AND_ASSIGN(RenderWidget); |
initial.commit | 09911bf | 2008-07-26 23:55:29 | [diff] [blame] | 1036 | }; |
| 1037 | |
[email protected] | e9ff79c | 2012-10-19 21:31:26 | [diff] [blame] | 1038 | } // namespace content |
| 1039 | |
[email protected] | 2cff005 | 2011-03-18 16:51:44 | [diff] [blame] | 1040 | #endif // CONTENT_RENDERER_RENDER_WIDGET_H_ |