[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] | aa4117f | 2011-12-09 22:19:21 | [diff] [blame] | 11 | #include <deque> |
[email protected] | 0e241b4b | 2012-08-18 09:06:27 | [diff] [blame] | 12 | #include <map> |
dcheng | cedca561 | 2016-04-09 01:40:15 | [diff] [blame] | 13 | #include <memory> |
xlai | 180af79 | 2016-08-26 22:07:42 | [diff] [blame] | 14 | #include <queue> |
pwnall | ef66931 | 2017-01-07 01:17:29 | [diff] [blame] | 15 | #include <string> |
| 16 | #include <vector> |
[email protected] | 010ea08a | 2009-10-11 20:21:32 | [diff] [blame] | 17 | |
[email protected] | 586871b | 2014-07-22 17:05:11 | [diff] [blame] | 18 | #include "base/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" |
[email protected] | abb52216 | 2013-06-28 01:54:16 | [diff] [blame] | 24 | #include "base/time/time.h" |
avi | 1023d01 | 2015-12-25 02:39:14 | [diff] [blame] | 25 | #include "build/build_config.h" |
xidachen | fa0199e7 | 2017-05-11 11:34:26 | [diff] [blame] | 26 | #include "cc/input/touch_action.h" |
fsamuel | ca02c4e | 2017-05-09 13:34:14 | [diff] [blame] | 27 | #include "cc/surfaces/local_surface_id.h" |
[email protected] | f3112a5 | 2011-09-30 23:47:49 | [diff] [blame] | 28 | #include "content/common/content_export.h" |
[email protected] | c2809346d | 2014-03-20 00:11:03 | [diff] [blame] | 29 | #include "content/common/cursors/webcursor.h" |
paulmeyer | 6ef5a79 | 2016-11-08 20:33:58 | [diff] [blame] | 30 | #include "content/common/drag_event_source_info.h" |
alexmos | 5656749 | 2016-09-13 00:52:46 | [diff] [blame] | 31 | #include "content/common/edit_command.h" |
thakis | 18e42641 | 2017-03-15 12:06:37 | [diff] [blame] | 32 | #include "content/common/features.h" |
[email protected] | 9017d785 | 2013-11-21 17:47:35 | [diff] [blame] | 33 | #include "content/common/input/synthetic_gesture_params.h" |
paulmeyer | 90f6c31d | 2016-11-12 00:17:59 | [diff] [blame] | 34 | #include "content/public/common/drop_data.h" |
ccameron | 2f45153 | 2016-09-07 21:49:27 | [diff] [blame] | 35 | #include "content/public/common/screen_info.h" |
mfomitchev | 2600fd7c | 2016-02-17 20:53:39 | [diff] [blame] | 36 | #include "content/renderer/devtools/render_widget_screen_metrics_emulator_delegate.h" |
fsamuel | 78f86e4 | 2016-01-20 04:10:23 | [diff] [blame] | 37 | #include "content/renderer/gpu/render_widget_compositor_delegate.h" |
dtapuska | 9ec1a91 | 2017-04-21 15:18:31 | [diff] [blame] | 38 | #include "content/renderer/input/main_thread_event_queue.h" |
fsamuel | 72464894f | 2015-12-15 06:59:31 | [diff] [blame] | 39 | #include "content/renderer/input/render_widget_input_handler.h" |
| 40 | #include "content/renderer/input/render_widget_input_handler_delegate.h" |
[email protected] | 586871b | 2014-07-22 17:05:11 | [diff] [blame] | 41 | #include "content/renderer/message_delivery_policy.h" |
lfg | bee1e0a | 2016-06-08 21:24:21 | [diff] [blame] | 42 | #include "content/renderer/mouse_lock_dispatcher.h" |
| 43 | #include "content/renderer/render_widget_mouse_lock_dispatcher.h" |
[email protected] | 4f86bdb | 2012-11-10 19:11:19 | [diff] [blame] | 44 | #include "ipc/ipc_listener.h" |
nick | 4df698d8 | 2016-11-11 20:39:23 | [diff] [blame] | 45 | #include "ipc/ipc_message.h" |
[email protected] | 4f86bdb | 2012-11-10 19:11:19 | [diff] [blame] | 46 | #include "ipc/ipc_sender.h" |
mikhail.pozdnyakov | c0e251b | 2015-04-15 06:51:12 | [diff] [blame] | 47 | #include "third_party/WebKit/public/platform/WebDisplayMode.h" |
dtapuska | 7f4ddc2a | 2016-10-13 16:09:32 | [diff] [blame] | 48 | #include "third_party/WebKit/public/platform/WebInputEvent.h" |
[email protected] | 5c30b5e0 | 2013-05-30 03:46:08 | [diff] [blame] | 49 | #include "third_party/WebKit/public/platform/WebRect.h" |
paulmeyer | 6ef5a79 | 2016-11-08 20:33:58 | [diff] [blame] | 50 | #include "third_party/WebKit/public/platform/WebReferrerPolicy.h" |
dtapuska | 7f4ddc2a | 2016-10-13 16:09:32 | [diff] [blame] | 51 | #include "third_party/WebKit/public/platform/WebTextInputInfo.h" |
[email protected] | 2255a933 | 2013-06-17 05:12:31 | [diff] [blame] | 52 | #include "third_party/WebKit/public/web/WebCompositionUnderline.h" |
| 53 | #include "third_party/WebKit/public/web/WebPopupType.h" |
| 54 | #include "third_party/WebKit/public/web/WebTextDirection.h" |
[email protected] | 0e45bd0 | 2013-07-12 20:20:02 | [diff] [blame] | 55 | #include "third_party/WebKit/public/web/WebWidget.h" |
[email protected] | 2255a933 | 2013-06-17 05:12:31 | [diff] [blame] | 56 | #include "third_party/WebKit/public/web/WebWidgetClient.h" |
[email protected] | b256eca | 2013-07-11 10:57:40 | [diff] [blame] | 57 | #include "ui/base/ime/text_input_mode.h" |
[email protected] | ad26ef4 | 2011-06-17 07:59:45 | [diff] [blame] | 58 | #include "ui/base/ime/text_input_type.h" |
[email protected] | a09d53ce | 2014-01-31 00:46:42 | [diff] [blame] | 59 | #include "ui/base/ui_base_types.h" |
tfarina | 93bfa91 | 2014-12-05 14:23:15 | [diff] [blame] | 60 | #include "ui/gfx/geometry/rect.h" |
tfarina | 93bfa91 | 2014-12-05 14:23:15 | [diff] [blame] | 61 | #include "ui/gfx/geometry/vector2d_f.h" |
[email protected] | 08397d5 | 2011-02-05 01:53:38 | [diff] [blame] | 62 | #include "ui/gfx/native_widget_types.h" |
[email protected] | db4fc1e | 2013-09-06 20:01:51 | [diff] [blame] | 63 | #include "ui/gfx/range/range.h" |
[email protected] | d353541f | 2012-05-03 22:45:41 | [diff] [blame] | 64 | #include "ui/surface/transport_dib.h" |
initial.commit | 09911bf | 2008-07-26 23:55:29 | [diff] [blame] | 65 | |
danakj | 870925d | 2016-05-03 20:07:38 | [diff] [blame] | 66 | class GURL; |
| 67 | |
[email protected] | 48495594 | 2010-08-19 16:13:18 | [diff] [blame] | 68 | namespace IPC { |
[email protected] | 586871b | 2014-07-22 17:05:11 | [diff] [blame] | 69 | class SyncMessageFilter; |
[email protected] | 48495594 | 2010-08-19 16:13:18 | [diff] [blame] | 70 | } |
| 71 | |
[email protected] | 180ef24 | 2013-11-07 06:50:46 | [diff] [blame] | 72 | namespace blink { |
skyostil | 529caa29 | 2016-08-10 17:44:51 | [diff] [blame] | 73 | namespace scheduler { |
| 74 | class RenderWidgetSchedulingState; |
| 75 | } |
wjmaclean | 1d97062 | 2017-01-21 22:28:24 | [diff] [blame] | 76 | struct WebActiveWheelFlingParameters; |
[email protected] | 1919368 | 2014-04-03 15:01:43 | [diff] [blame] | 77 | struct WebDeviceEmulationParams; |
paulmeyer | 6ef5a79 | 2016-11-08 20:33:58 | [diff] [blame] | 78 | class WebDragData; |
lfg | caab514 | 2016-02-26 19:06:52 | [diff] [blame] | 79 | class WebFrameWidget; |
[email protected] | 41d8685 | 2012-11-07 12:23:24 | [diff] [blame] | 80 | class WebGestureEvent; |
paulmeyer | 6ef5a79 | 2016-11-08 20:33:58 | [diff] [blame] | 81 | class WebImage; |
ekaramad | 2daaf67 | 2016-11-10 20:29:01 | [diff] [blame] | 82 | class WebInputMethodController; |
kenrb | a719983 | 2015-01-22 23:44:59 | [diff] [blame] | 83 | class WebLocalFrame; |
[email protected] | 6a8ddba5 | 2010-09-05 04:38:06 | [diff] [blame] | 84 | class WebMouseEvent; |
donnd | a070f3c | 2015-01-16 19:54:11 | [diff] [blame] | 85 | class WebNode; |
| 86 | struct WebPoint; |
pwnall | ef66931 | 2017-01-07 01:17:29 | [diff] [blame] | 87 | } // namespace blink |
[email protected] | 52647690 | 2011-10-06 20:34:06 | [diff] [blame] | 88 | |
[email protected] | 586871b | 2014-07-22 17:05:11 | [diff] [blame] | 89 | namespace cc { |
[email protected] | 586871b | 2014-07-22 17:05:11 | [diff] [blame] | 90 | class SwapPromise; |
| 91 | } |
[email protected] | ba91a79 | 2013-02-06 09:48:28 | [diff] [blame] | 92 | |
[email protected] | db4fc1e | 2013-09-06 20:01:51 | [diff] [blame] | 93 | namespace gfx { |
[email protected] | 4de6d169 | 2011-10-12 08:45:44 | [diff] [blame] | 94 | class Range; |
| 95 | } |
| 96 | |
chongz | a8ba91fc | 2016-08-16 21:39:17 | [diff] [blame] | 97 | namespace ui { |
| 98 | struct DidOverscrollParams; |
| 99 | } |
| 100 | |
[email protected] | e9ff79c | 2012-10-19 21:31:26 | [diff] [blame] | 101 | namespace content { |
danakj | 6e3bf801 | 2014-12-16 18:27:53 | [diff] [blame] | 102 | class CompositorDependencies; |
[email protected] | b2e4c7013 | 2013-10-03 02:07:51 | [diff] [blame] | 103 | class ExternalPopupMenu; |
[email protected] | 586871b | 2014-07-22 17:05:11 | [diff] [blame] | 104 | class FrameSwapMessageQueue; |
changwan | f2a707b | 2015-10-30 08:22:16 | [diff] [blame] | 105 | class ImeEventGuard; |
dtapuska | 9ec1a91 | 2017-04-21 15:18:31 | [diff] [blame] | 106 | class MainThreadEventQueue; |
ekaramad | 2a46d63 | 2016-07-19 13:33:09 | [diff] [blame] | 107 | class PepperPluginInstanceImpl; |
[email protected] | bffc830 | 2014-01-23 20:52:16 | [diff] [blame] | 108 | class RenderFrameImpl; |
[email protected] | e3244ed | 2014-06-20 20:04:27 | [diff] [blame] | 109 | class RenderFrameProxy; |
nick | f7b3822 | 2016-11-22 21:59:35 | [diff] [blame] | 110 | class RenderViewImpl; |
[email protected] | ba91a79 | 2013-02-06 09:48:28 | [diff] [blame] | 111 | class RenderWidgetCompositor; |
avi | 40b5be7a | 2016-03-03 21:13:44 | [diff] [blame] | 112 | class RenderWidgetOwnerDelegate; |
mfomitchev | 2600fd7c | 2016-02-17 20:53:39 | [diff] [blame] | 113 | class RenderWidgetScreenMetricsEmulator; |
[email protected] | 5b45ad4 | 2013-10-25 00:42:04 | [diff] [blame] | 114 | class ResizingModeSelector; |
ekaramad | 330ba423 | 2016-09-23 17:57:47 | [diff] [blame] | 115 | class TextInputClientObserver; |
[email protected] | b2e4c7013 | 2013-10-03 02:07:51 | [diff] [blame] | 116 | struct ContextMenuParams; |
fsamuel | 664e8b6 | 2016-01-20 19:54:01 | [diff] [blame] | 117 | struct ResizeParams; |
[email protected] | e9ff79c | 2012-10-19 21:31:26 | [diff] [blame] | 118 | |
initial.commit | 09911bf | 2008-07-26 23:55:29 | [diff] [blame] | 119 | // RenderWidget provides a communication bridge between a WebWidget and |
| 120 | // a RenderWidgetHost, the latter of which lives in a different process. |
dcheng | d96a27a | 2015-07-24 20:17:32 | [diff] [blame] | 121 | // |
| 122 | // RenderWidget is used to implement: |
| 123 | // - RenderViewImpl (deprecated) |
| 124 | // - Fullscreen mode (RenderWidgetFullScreen) |
| 125 | // - Popup "menus" (like the color chooser and date picker) |
| 126 | // - Widgets for frames (for out-of-process iframe support) |
[email protected] | f3112a5 | 2011-09-30 23:47:49 | [diff] [blame] | 127 | class CONTENT_EXPORT RenderWidget |
[email protected] | c47317e | 2012-06-20 22:35:31 | [diff] [blame] | 128 | : public IPC::Listener, |
| 129 | public IPC::Sender, |
[email protected] | 180ef24 | 2013-11-07 06:50:46 | [diff] [blame] | 130 | NON_EXPORTED_BASE(virtual public blink::WebWidgetClient), |
fsamuel | 78f86e4 | 2016-01-20 04:10:23 | [diff] [blame] | 131 | public RenderWidgetCompositorDelegate, |
fsamuel | 72464894f | 2015-12-15 06:59:31 | [diff] [blame] | 132 | public RenderWidgetInputHandlerDelegate, |
mfomitchev | 2600fd7c | 2016-02-17 20:53:39 | [diff] [blame] | 133 | public RenderWidgetScreenMetricsEmulatorDelegate, |
dtapuska | 9ec1a91 | 2017-04-21 15:18:31 | [diff] [blame] | 134 | public base::RefCounted<RenderWidget>, |
| 135 | public MainThreadEventQueueClient { |
initial.commit | 09911bf | 2008-07-26 23:55:29 | [diff] [blame] | 136 | public: |
nick | f7b3822 | 2016-11-22 21:59:35 | [diff] [blame] | 137 | // Creates a new RenderWidget for a popup. |opener| is the RenderView that |
| 138 | // this widget lives inside. |
| 139 | static RenderWidget* CreateForPopup(RenderViewImpl* opener, |
| 140 | CompositorDependencies* compositor_deps, |
| 141 | blink::WebPopupType popup_type, |
| 142 | const ScreenInfo& screen_info); |
initial.commit | 09911bf | 2008-07-26 23:55:29 | [diff] [blame] | 143 | |
kenrb | a719983 | 2015-01-22 23:44:59 | [diff] [blame] | 144 | // Creates a new RenderWidget that will be attached to a RenderFrame. |
nick | 4df698d8 | 2016-11-11 20:39:23 | [diff] [blame] | 145 | static RenderWidget* CreateForFrame(int widget_routing_id, |
kenrb | a719983 | 2015-01-22 23:44:59 | [diff] [blame] | 146 | bool hidden, |
ccameron | 2f45153 | 2016-09-07 21:49:27 | [diff] [blame] | 147 | const ScreenInfo& screen_info, |
kenrb | a719983 | 2015-01-22 23:44:59 | [diff] [blame] | 148 | CompositorDependencies* compositor_deps, |
| 149 | blink::WebLocalFrame* frame); |
| 150 | |
lfg | 1568d11 | 2016-08-30 16:06:29 | [diff] [blame] | 151 | // Used by content_layouttest_support to hook into the creation of |
| 152 | // RenderWidgets. |
nick | 8331f8ad | 2016-11-15 20:42:45 | [diff] [blame] | 153 | using CreateRenderWidgetFunction = RenderWidget* (*)(int32_t, |
| 154 | CompositorDependencies*, |
| 155 | blink::WebPopupType, |
| 156 | const ScreenInfo&, |
| 157 | bool, |
| 158 | bool, |
| 159 | bool); |
lfg | 1568d11 | 2016-08-30 16:06:29 | [diff] [blame] | 160 | using RenderWidgetInitializedCallback = void (*)(RenderWidget*); |
nick | f7b3822 | 2016-11-22 21:59:35 | [diff] [blame] | 161 | using ShowCallback = base::Callback<void(RenderWidget* widget_to_show, |
| 162 | blink::WebNavigationPolicy policy, |
| 163 | const gfx::Rect& initial_rect)>; |
lfg | 1568d11 | 2016-08-30 16:06:29 | [diff] [blame] | 164 | static void InstallCreateHook( |
| 165 | CreateRenderWidgetFunction create_render_widget, |
| 166 | RenderWidgetInitializedCallback render_widget_initialized_callback); |
| 167 | |
dcheng | da9b4bb | 2015-07-20 20:58:08 | [diff] [blame] | 168 | // Closes a RenderWidget that was created by |CreateForFrame|. |
dcheng | 3ce04b6 | 2015-10-26 23:30:55 | [diff] [blame] | 169 | // TODO(avi): De-virtualize this once RenderViewImpl has-a RenderWidget. |
| 170 | // https://crbug.com/545684 |
| 171 | virtual void CloseForFrame(); |
[email protected] | 48495594 | 2010-08-19 16:13:18 | [diff] [blame] | 172 | |
nick | 8331f8ad | 2016-11-15 20:42:45 | [diff] [blame] | 173 | int32_t routing_id() const { return routing_id_; } |
fsamuel | e8326c74 | 2016-01-12 00:49:39 | [diff] [blame] | 174 | |
danakj | 6e3bf801 | 2014-12-16 18:27:53 | [diff] [blame] | 175 | CompositorDependencies* compositor_deps() const { return compositor_deps_; } |
lfg | 8ff3391 | 2016-09-13 20:59:21 | [diff] [blame] | 176 | virtual blink::WebWidget* GetWebWidget() const; |
ekaramad | 2daaf67 | 2016-11-10 20:29:01 | [diff] [blame] | 177 | |
| 178 | // Returns the current instance of WebInputMethodController which is to be |
| 179 | // used for IME related tasks. This instance corresponds to the one from |
| 180 | // focused frame and can be nullptr. |
| 181 | blink::WebInputMethodController* GetInputMethodController() const; |
| 182 | |
mfomitchev | 2600fd7c | 2016-02-17 20:53:39 | [diff] [blame] | 183 | const gfx::Size& size() const { return size_; } |
mikhail.pozdnyakov | f2c902a | 2015-04-14 08:09:12 | [diff] [blame] | 184 | bool is_fullscreen_granted() const { return is_fullscreen_granted_; } |
mikhail.pozdnyakov | c0e251b | 2015-04-15 06:51:12 | [diff] [blame] | 185 | blink::WebDisplayMode display_mode() const { return display_mode_; } |
[email protected] | 204f1df | 2012-01-04 20:21:13 | [diff] [blame] | 186 | bool is_hidden() const { return is_hidden_; } |
[email protected] | 4ee6462 | 2014-03-21 22:34:15 | [diff] [blame] | 187 | // Temporary for debugging purposes... |
| 188 | bool closing() const { return closing_; } |
pwnall | ef66931 | 2017-01-07 01:17:29 | [diff] [blame] | 189 | bool has_host_context_menu_location() const { |
[email protected] | be1af066 | 2014-07-29 19:55:51 | [diff] [blame] | 190 | return has_host_context_menu_location_; |
| 191 | } |
pwnall | ef66931 | 2017-01-07 01:17:29 | [diff] [blame] | 192 | gfx::Point host_context_menu_location() const { |
[email protected] | be1af066 | 2014-07-29 19:55:51 | [diff] [blame] | 193 | return host_context_menu_location_; |
[email protected] | 4ee6462 | 2014-03-21 22:34:15 | [diff] [blame] | 194 | } |
[email protected] | 589621b | 2010-09-23 22:01:07 | [diff] [blame] | 195 | |
avi | 40b5be7a | 2016-03-03 21:13:44 | [diff] [blame] | 196 | void set_owner_delegate(RenderWidgetOwnerDelegate* owner_delegate) { |
| 197 | DCHECK(!owner_delegate_); |
| 198 | owner_delegate_ = owner_delegate; |
| 199 | } |
| 200 | |
pwnall | ef66931 | 2017-01-07 01:17:29 | [diff] [blame] | 201 | RenderWidgetOwnerDelegate* owner_delegate() const { return owner_delegate_; } |
avi | 40b5be7a | 2016-03-03 21:13:44 | [diff] [blame] | 202 | |
kenrb | a719983 | 2015-01-22 23:44:59 | [diff] [blame] | 203 | // ScreenInfo exposed so it can be passed to subframe RenderWidgets. |
ccameron | 2f45153 | 2016-09-07 21:49:27 | [diff] [blame] | 204 | ScreenInfo screen_info() const { return screen_info_; } |
kenrb | a719983 | 2015-01-22 23:44:59 | [diff] [blame] | 205 | |
alexmos | 78c9c0d | 2016-10-14 18:57:03 | [diff] [blame] | 206 | // Sets whether this RenderWidget has been swapped out to be displayed by |
| 207 | // a RenderWidget in a different process. If so, no new IPC messages will be |
| 208 | // sent (only ACKs) and the process is free to exit when there are no other |
| 209 | // active RenderWidgets. |
| 210 | void SetSwappedOut(bool is_swapped_out); |
| 211 | |
pwnall | ef66931 | 2017-01-07 01:17:29 | [diff] [blame] | 212 | bool is_swapped_out() const { return is_swapped_out_; } |
alexmos | 78c9c0d | 2016-10-14 18:57:03 | [diff] [blame] | 213 | |
alexmos | 5656749 | 2016-09-13 00:52:46 | [diff] [blame] | 214 | // Manage edit commands to be used for the next keyboard event. |
| 215 | const EditCommands& edit_commands() const { return edit_commands_; } |
| 216 | void SetEditCommandForNextKeyEvent(const std::string& name, |
| 217 | const std::string& value); |
| 218 | void ClearEditCommands(); |
| 219 | |
[email protected] | bffc830 | 2014-01-23 20:52:16 | [diff] [blame] | 220 | // Functions to track out-of-process frames for special notifications. |
[email protected] | e3244ed | 2014-06-20 20:04:27 | [diff] [blame] | 221 | void RegisterRenderFrameProxy(RenderFrameProxy* proxy); |
| 222 | void UnregisterRenderFrameProxy(RenderFrameProxy* proxy); |
[email protected] | bffc830 | 2014-01-23 20:52:16 | [diff] [blame] | 223 | |
[email protected] | de3c5d8 | 2014-05-28 22:12:59 | [diff] [blame] | 224 | // Functions to track all RenderFrame objects associated with this |
| 225 | // RenderWidget. |
| 226 | void RegisterRenderFrame(RenderFrameImpl* frame); |
| 227 | void UnregisterRenderFrame(RenderFrameImpl* frame); |
| 228 | |
[email protected] | c47317e | 2012-06-20 22:35:31 | [diff] [blame] | 229 | // IPC::Listener |
dcheng | 6d18e40 | 2014-10-21 12:32:52 | [diff] [blame] | 230 | bool OnMessageReceived(const IPC::Message& msg) override; |
initial.commit | 09911bf | 2008-07-26 23:55:29 | [diff] [blame] | 231 | |
[email protected] | c47317e | 2012-06-20 22:35:31 | [diff] [blame] | 232 | // IPC::Sender |
dcheng | 6d18e40 | 2014-10-21 12:32:52 | [diff] [blame] | 233 | bool Send(IPC::Message* msg) override; |
initial.commit | 09911bf | 2008-07-26 23:55:29 | [diff] [blame] | 234 | |
fsamuel | 78f86e4 | 2016-01-20 04:10:23 | [diff] [blame] | 235 | // RenderWidgetCompositorDelegate |
| 236 | void ApplyViewportDeltas(const gfx::Vector2dF& inner_delta, |
| 237 | const gfx::Vector2dF& outer_delta, |
| 238 | const gfx::Vector2dF& elastic_overscroll_delta, |
| 239 | float page_scale, |
| 240 | float top_controls_delta) override; |
sahel | 1b47fda7 | 2017-03-28 17:03:07 | [diff] [blame] | 241 | void RecordWheelAndTouchScrollingCount(bool has_scrolled_by_wheel, |
| 242 | bool has_scrolled_by_touch) override; |
fsamuel | 78f86e4 | 2016-01-20 04:10:23 | [diff] [blame] | 243 | void BeginMainFrame(double frame_time_sec) override; |
danakj | c7afae5 | 2017-06-20 21:12:41 | [diff] [blame] | 244 | void RequestNewLayerTreeFrameSink( |
fsamuel | cf3002e | 2017-03-20 23:13:47 | [diff] [blame] | 245 | bool fallback, |
danakj | c7afae5 | 2017-06-20 21:12:41 | [diff] [blame] | 246 | const LayerTreeFrameSinkCallback& callback) override; |
fsamuel | 78f86e4 | 2016-01-20 04:10:23 | [diff] [blame] | 247 | void DidCommitAndDrawCompositorFrame() override; |
| 248 | void DidCommitCompositorFrame() override; |
| 249 | void DidCompletePageScaleAnimation() override; |
danakj | 6c872fc0 | 2016-10-22 04:29:49 | [diff] [blame] | 250 | void DidReceiveCompositorFrameAck() override; |
fsamuel | 78f86e4 | 2016-01-20 04:10:23 | [diff] [blame] | 251 | bool IsClosing() const override; |
danakj | 53eccbc | 2016-03-02 22:51:07 | [diff] [blame] | 252 | void RequestScheduleAnimation() override; |
fsamuel | 78f86e4 | 2016-01-20 04:10:23 | [diff] [blame] | 253 | void UpdateVisualState() override; |
| 254 | void WillBeginCompositorFrame() override; |
jbroman | 6ccbc7d47 | 2016-07-27 04:45:41 | [diff] [blame] | 255 | std::unique_ptr<cc::SwapPromise> RequestCopyOfOutputForLayoutTest( |
| 256 | std::unique_ptr<cc::CopyOutputRequest> request) override; |
fsamuel | 78f86e4 | 2016-01-20 04:10:23 | [diff] [blame] | 257 | |
fsamuel | 72464894f | 2015-12-15 06:59:31 | [diff] [blame] | 258 | // RenderWidgetInputHandlerDelegate |
| 259 | void FocusChangeComplete() override; |
| 260 | bool HasTouchEventHandlersAt(const gfx::Point& point) const override; |
dtapuska | 1827dd2 | 2016-03-11 15:24:59 | [diff] [blame] | 261 | void ObserveGestureEventAndResult(const blink::WebGestureEvent& gesture_event, |
| 262 | const gfx::Vector2dF& unused_delta, |
| 263 | bool event_processed) override; |
| 264 | |
fsamuel | 72464894f | 2015-12-15 06:59:31 | [diff] [blame] | 265 | void OnDidHandleKeyEvent() override; |
chongz | a8ba91fc | 2016-08-16 21:39:17 | [diff] [blame] | 266 | void OnDidOverscroll(const ui::DidOverscrollParams& params) override; |
fsamuel | e8326c74 | 2016-01-12 00:49:39 | [diff] [blame] | 267 | void SetInputHandler(RenderWidgetInputHandler* input_handler) override; |
changwan | 75e3b207 | 2017-01-16 02:55:00 | [diff] [blame] | 268 | void ShowVirtualKeyboard() override; |
| 269 | void UpdateTextInputState() override; |
changwan | 62f5729 | 2017-02-17 08:28:25 | [diff] [blame] | 270 | void ClearTextInputState() override; |
fsamuel | 72464894f | 2015-12-15 06:59:31 | [diff] [blame] | 271 | bool WillHandleGestureEvent(const blink::WebGestureEvent& event) override; |
| 272 | bool WillHandleMouseEvent(const blink::WebMouseEvent& event) override; |
| 273 | |
mfomitchev | 2600fd7c | 2016-02-17 20:53:39 | [diff] [blame] | 274 | // RenderWidgetScreenMetricsDelegate |
| 275 | void Redraw() override; |
| 276 | void Resize(const ResizeParams& resize_params) override; |
| 277 | void SetScreenMetricsEmulationParameters( |
| 278 | bool enabled, |
| 279 | const blink::WebDeviceEmulationParams& params) override; |
| 280 | void SetScreenRects(const gfx::Rect& view_screen_rect, |
| 281 | const gfx::Rect& window_screen_rect) override; |
| 282 | |
[email protected] | 180ef24 | 2013-11-07 06:50:46 | [diff] [blame] | 283 | // blink::WebWidgetClient |
Blink Reformat | 1c4d759e | 2017-04-09 16:34:54 | [diff] [blame] | 284 | blink::WebLayerTreeView* InitializeLayerTreeView() override; |
| 285 | void DidMeaningfulLayout(blink::WebMeaningfulLayout layout_type) override; |
| 286 | void DidChangeCursor(const blink::WebCursorInfo&) override; |
aelias | 5971e47d | 2017-06-16 02:39:38 | [diff] [blame] | 287 | void AutoscrollStart(const blink::WebFloatPoint& point) override; |
| 288 | void AutoscrollFling(const blink::WebFloatSize& velocity) override; |
| 289 | void AutoscrollEnd() override; |
Blink Reformat | 1c4d759e | 2017-04-09 16:34:54 | [diff] [blame] | 290 | void CloseWidgetSoon() override; |
| 291 | void Show(blink::WebNavigationPolicy) override; |
| 292 | blink::WebRect WindowRect() override; |
| 293 | blink::WebRect ViewRect() override; |
| 294 | void SetToolTipText(const blink::WebString& text, |
avi | 5c77d21 | 2015-09-25 20:08:25 | [diff] [blame] | 295 | blink::WebTextDirection hint) override; |
Blink Reformat | 1c4d759e | 2017-04-09 16:34:54 | [diff] [blame] | 296 | void SetWindowRect(const blink::WebRect&) override; |
| 297 | blink::WebScreenInfo GetScreenInfo() override; |
| 298 | void DidHandleGestureEvent(const blink::WebGestureEvent& event, |
avi | 5c77d21 | 2015-09-25 20:08:25 | [diff] [blame] | 299 | bool event_cancelled) override; |
Blink Reformat | 1c4d759e | 2017-04-09 16:34:54 | [diff] [blame] | 300 | void DidOverscroll(const blink::WebFloatSize& overscrollDelta, |
bokan | e53a10f | 2016-04-13 23:48:31 | [diff] [blame] | 301 | const blink::WebFloatSize& accumulatedOverscroll, |
avi | 5c77d21 | 2015-09-25 20:08:25 | [diff] [blame] | 302 | const blink::WebFloatPoint& position, |
| 303 | const blink::WebFloatSize& velocity) override; |
Blink Reformat | 1c4d759e | 2017-04-09 16:34:54 | [diff] [blame] | 304 | void ShowVirtualKeyboardOnElementFocus() override; |
| 305 | void ConvertViewportToWindow(blink::WebRect* rect) override; |
| 306 | void ConvertWindowToViewport(blink::WebFloatRect* rect) override; |
| 307 | bool RequestPointerLock() override; |
| 308 | void RequestPointerUnlock() override; |
| 309 | bool IsPointerLocked() override; |
| 310 | void StartDragging(blink::WebReferrerPolicy policy, |
paulmeyer | 6ef5a79 | 2016-11-08 20:33:58 | [diff] [blame] | 311 | const blink::WebDragData& data, |
| 312 | blink::WebDragOperationsMask mask, |
| 313 | const blink::WebImage& image, |
| 314 | const blink::WebPoint& imageOffset) override; |
[email protected] | 4873c7d | 2009-07-16 06:36:28 | [diff] [blame] | 315 | |
fsamuel | 72464894f | 2015-12-15 06:59:31 | [diff] [blame] | 316 | // Override point to obtain that the current input method state and caret |
| 317 | // position. |
| 318 | virtual ui::TextInputType GetTextInputType(); |
fsamuel | 72464894f | 2015-12-15 06:59:31 | [diff] [blame] | 319 | |
donnd | a070f3c | 2015-01-16 19:54:11 | [diff] [blame] | 320 | #if defined(OS_ANDROID) |
| 321 | // Notifies that a tap was not consumed, so showing a UI for the unhandled |
| 322 | // tap may be needed. |
donnd | 57e54f5 | 2015-02-26 19:03:37 | [diff] [blame] | 323 | // Performs various checks on the given WebNode to apply heuristics to |
| 324 | // determine if triggering is appropriate. |
Blink Reformat | 1c4d759e | 2017-04-09 16:34:54 | [diff] [blame] | 325 | void ShowUnhandledTapUIIfNeeded(const blink::WebPoint& tapped_position, |
avi | 5c77d21 | 2015-09-25 20:08:25 | [diff] [blame] | 326 | const blink::WebNode& tapped_node, |
| 327 | bool page_changed) override; |
donnd | a070f3c | 2015-01-16 19:54:11 | [diff] [blame] | 328 | #endif |
| 329 | |
[email protected] | 7912e82 | 2014-04-16 02:37:03 | [diff] [blame] | 330 | // Begins the compositor's scheduler to start producing frames. |
| 331 | void StartCompositor(); |
| 332 | |
[email protected] | aeeedad | 2014-08-22 18:16:22 | [diff] [blame] | 333 | // Stop compositing. |
enne | f3c5814 | 2014-12-09 21:44:38 | [diff] [blame] | 334 | void WillCloseLayerTreeView(); |
[email protected] | aeeedad | 2014-08-22 18:16:22 | [diff] [blame] | 335 | |
[email protected] | 24ed043 | 2013-04-24 07:50:31 | [diff] [blame] | 336 | RenderWidgetCompositor* compositor() const; |
| 337 | |
fsamuel | 72464894f | 2015-12-15 06:59:31 | [diff] [blame] | 338 | const RenderWidgetInputHandler& input_handler() const { |
fsamuel | e8326c74 | 2016-01-12 00:49:39 | [diff] [blame] | 339 | return *input_handler_; |
fsamuel | 72464894f | 2015-12-15 06:59:31 | [diff] [blame] | 340 | } |
| 341 | |
| 342 | void SetHandlingInputEventForTesting(bool handling_input_event); |
| 343 | |
[email protected] | 79fa22e | 2013-08-23 15:18:12 | [diff] [blame] | 344 | // Callback for use with synthetic gestures (e.g. BeginSmoothScroll). |
| 345 | typedef base::Callback<void()> SyntheticGestureCompletionCallback; |
[email protected] | 0e241b4b | 2012-08-18 09:06:27 | [diff] [blame] | 346 | |
[email protected] | 9017d785 | 2013-11-21 17:47:35 | [diff] [blame] | 347 | // Send a synthetic gesture to the browser to be queued to the synthetic |
| 348 | // gesture controller. |
| 349 | void QueueSyntheticGesture( |
dcheng | cedca561 | 2016-04-09 01:40:15 | [diff] [blame] | 350 | std::unique_ptr<SyntheticGestureParams> gesture_params, |
[email protected] | 9017d785 | 2013-11-21 17:47:35 | [diff] [blame] | 351 | const SyntheticGestureCompletionCallback& callback); |
[email protected] | 1e1dd18 | 2013-09-12 01:51:15 | [diff] [blame] | 352 | |
[email protected] | 586871b | 2014-07-22 17:05:11 | [diff] [blame] | 353 | // Deliveres |message| together with compositor state change updates. The |
| 354 | // exact behavior depends on |policy|. |
| 355 | // This mechanism is not a drop-in replacement for IPC: messages sent this way |
| 356 | // will not be automatically available to BrowserMessageFilter, for example. |
| 357 | // FIFO ordering is preserved between messages enqueued with the same |
| 358 | // |policy|, the ordering between messages enqueued for different policies is |
| 359 | // undefined. |
| 360 | // |
| 361 | // |msg| message to send, ownership of |msg| is transferred. |
| 362 | // |policy| see the comment on MessageDeliveryPolicy. |
| 363 | void QueueMessage(IPC::Message* msg, MessageDeliveryPolicy policy); |
| 364 | |
changwan | f2a707b | 2015-10-30 08:22:16 | [diff] [blame] | 365 | // Handle start and finish of IME event guard. |
| 366 | void OnImeEventGuardStart(ImeEventGuard* guard); |
| 367 | void OnImeEventGuardFinish(ImeEventGuard* guard); |
[email protected] | 66fca5bc | 2013-05-23 06:58:29 | [diff] [blame] | 368 | |
mfomitchev | 2600fd7c | 2016-02-17 20:53:39 | [diff] [blame] | 369 | void SetPopupOriginAdjustmentsForEmulation( |
| 370 | RenderWidgetScreenMetricsEmulator* emulator); |
[email protected] | b2e4c7013 | 2013-10-03 02:07:51 | [diff] [blame] | 371 | |
[email protected] | 2d6836f4 | 2014-07-02 17:25:31 | [diff] [blame] | 372 | gfx::Rect AdjustValidationMessageAnchor(const gfx::Rect& anchor); |
[email protected] | b2e4c7013 | 2013-10-03 02:07:51 | [diff] [blame] | 373 | |
[email protected] | 7a4e253 | 2013-12-02 21:30:02 | [diff] [blame] | 374 | // Checks if the selection bounds have been changed. If they are changed, |
| 375 | // the new value will be sent to the browser process. |
| 376 | void UpdateSelectionBounds(); |
| 377 | |
[email protected] | e5e438d6 | 2014-03-27 21:47:16 | [diff] [blame] | 378 | virtual void GetSelectionBounds(gfx::Rect* start, gfx::Rect* end); |
| 379 | |
[email protected] | a09d53ce | 2014-01-31 00:46:42 | [diff] [blame] | 380 | void OnShowHostContextMenu(ContextMenuParams* params); |
[email protected] | 7a4e253 | 2013-12-02 21:30:02 | [diff] [blame] | 381 | |
[email protected] | 7a4e253 | 2013-12-02 21:30:02 | [diff] [blame] | 382 | // Checks if the composition range or composition character bounds have been |
| 383 | // changed. If they are changed, the new value will be sent to the browser |
yukawa | 5f21c6a | 2014-10-27 17:09:30 | [diff] [blame] | 384 | // process. This method does nothing when the browser process is not able to |
| 385 | // handle composition range and composition character bounds. |
nona | fa29179 | 2016-08-10 02:36:18 | [diff] [blame] | 386 | // If immediate_request is true, render sends the latest composition info to |
| 387 | // the browser even if the composition info is not changed. |
| 388 | void UpdateCompositionInfo(bool immediate_request); |
[email protected] | 7a4e253 | 2013-12-02 21:30:02 | [diff] [blame] | 389 | |
lfg | b00fcad | 2016-07-14 14:16:33 | [diff] [blame] | 390 | // Called when the Widget has changed size as a result of an auto-resize. |
| 391 | void DidAutoResize(const gfx::Size& new_size); |
| 392 | |
lfg | e0c2792ec | 2016-05-11 18:52:08 | [diff] [blame] | 393 | // Indicates whether this widget has focus. |
| 394 | bool has_focus() const { return has_focus_; } |
| 395 | |
pwnall | ef66931 | 2017-01-07 01:17:29 | [diff] [blame] | 396 | MouseLockDispatcher* mouse_lock_dispatcher() const { |
lfg | bee1e0a | 2016-06-08 21:24:21 | [diff] [blame] | 397 | return mouse_lock_dispatcher_.get(); |
| 398 | } |
| 399 | |
ekaramad | 330ba423 | 2016-09-23 17:57:47 | [diff] [blame] | 400 | // TODO(ekaramad): The reference to the focused pepper plugin will be removed |
| 401 | // from RenderWidget. The purpose of having the reference here was to make IME |
| 402 | // work for OOPIF (https://crbug.com/643727). |
ekaramad | 2a46d63 | 2016-07-19 13:33:09 | [diff] [blame] | 403 | void set_focused_pepper_plugin(PepperPluginInstanceImpl* plugin) { |
| 404 | focused_pepper_plugin_ = plugin; |
| 405 | } |
| 406 | |
lfg | 1f9011c | 2016-08-17 21:18:42 | [diff] [blame] | 407 | // When emulated, this returns original device scale factor. |
| 408 | float GetOriginalDeviceScaleFactor() const; |
| 409 | |
paulmeyer | 90f6c31d | 2016-11-12 00:17:59 | [diff] [blame] | 410 | // Helper to convert |point| using ConvertWindowToViewport(). |
| 411 | gfx::Point ConvertWindowPointToViewport(const gfx::Point& point); |
| 412 | |
wjmaclean | 1d97062 | 2017-01-21 22:28:24 | [diff] [blame] | 413 | virtual void TransferActiveWheelFlingAnimation( |
| 414 | const blink::WebActiveWheelFlingParameters& params) {} |
| 415 | |
kenrb | 5d78b84 | 2017-03-06 21:06:01 | [diff] [blame] | 416 | uint32_t GetContentSourceId(); |
| 417 | void IncrementContentSourceId(); |
| 418 | |
dtapuska | 9ec1a91 | 2017-04-21 15:18:31 | [diff] [blame] | 419 | // MainThreadEventQueueClient overrides. |
| 420 | |
| 421 | // Requests a BeginMainFrame callback from the compositor. |
| 422 | void SetNeedsMainFrame() override; |
| 423 | |
Dave Tapuska | ea83d3bd | 2017-06-13 16:14:55 | [diff] [blame] | 424 | void HandleInputEvent(const blink::WebCoalescedInputEvent& input_event, |
| 425 | const ui::LatencyInfo& latency_info, |
| 426 | HandledEventCallback callback) override; |
dtapuska | 9ec1a91 | 2017-04-21 15:18:31 | [diff] [blame] | 427 | |
dtapuska | 9d46ef7d | 2017-05-26 19:06:06 | [diff] [blame] | 428 | scoped_refptr<MainThreadEventQueue> GetInputEventQueue(); |
| 429 | |
initial.commit | 09911bf | 2008-07-26 23:55:29 | [diff] [blame] | 430 | protected: |
[email protected] | 8085dbc8 | 2008-09-26 22:53:44 | [diff] [blame] | 431 | // Friend RefCounted so that the dtor can be non-public. Using this class |
| 432 | // without ref-counting is an error. |
| 433 | friend class base::RefCounted<RenderWidget>; |
fsamuel | e8326c74 | 2016-01-12 00:49:39 | [diff] [blame] | 434 | |
[email protected] | 7339cd2 | 2010-10-27 00:11:20 | [diff] [blame] | 435 | // For unit tests. |
[email protected] | e9ff79c | 2012-10-19 21:31:26 | [diff] [blame] | 436 | friend class RenderWidgetTest; |
[email protected] | 8085dbc8 | 2008-09-26 22:53:44 | [diff] [blame] | 437 | |
[email protected] | 61e2b3cc | 2012-03-02 16:13:34 | [diff] [blame] | 438 | enum ResizeAck { |
| 439 | SEND_RESIZE_ACK, |
| 440 | NO_RESIZE_ACK, |
| 441 | }; |
| 442 | |
nick | 8331f8ad | 2016-11-15 20:42:45 | [diff] [blame] | 443 | RenderWidget(int32_t widget_routing_id, |
| 444 | CompositorDependencies* compositor_deps, |
dcheng | 35d31c11 | 2015-07-22 00:17:36 | [diff] [blame] | 445 | blink::WebPopupType popup_type, |
ccameron | 2f45153 | 2016-09-07 21:49:27 | [diff] [blame] | 446 | const ScreenInfo& screen_info, |
[email protected] | 1ac10dca | 2013-08-20 20:47:04 | [diff] [blame] | 447 | bool swapped_out, |
[email protected] | 7912e82 | 2014-04-16 02:37:03 | [diff] [blame] | 448 | bool hidden, |
| 449 | bool never_visible); |
[email protected] | ce2b28e | 2012-08-09 15:53:57 | [diff] [blame] | 450 | |
dcheng | 6d18e40 | 2014-10-21 12:32:52 | [diff] [blame] | 451 | ~RenderWidget() override; |
initial.commit | 09911bf | 2008-07-26 23:55:29 | [diff] [blame] | 452 | |
lfg | caab514 | 2016-02-26 19:06:52 | [diff] [blame] | 453 | static blink::WebFrameWidget* CreateWebFrameWidget( |
| 454 | RenderWidget* render_widget, |
| 455 | blink::WebLocalFrame* frame); |
dcheng | da9b4bb | 2015-07-20 20:58:08 | [diff] [blame] | 456 | |
| 457 | // Creates a WebWidget based on the popup type. |
| 458 | static blink::WebWidget* CreateWebWidget(RenderWidget* render_widget); |
| 459 | |
nick | 4df698d8 | 2016-11-11 20:39:23 | [diff] [blame] | 460 | // Called by Create() functions and subclasses to finish initialization. |
nick | f7b3822 | 2016-11-22 21:59:35 | [diff] [blame] | 461 | // |show_callback| will be invoked once WebWidgetClient::show() occurs, and |
| 462 | // should be null if show() won't be triggered for this widget. |
| 463 | void Init(const ShowCallback& show_callback, blink::WebWidget* web_widget); |
[email protected] | 48495594 | 2010-08-19 16:13:18 | [diff] [blame] | 464 | |
[email protected] | 949b659 | 2014-08-20 13:17:52 | [diff] [blame] | 465 | // Allows the process to exit once the unload handler has finished, if there |
| 466 | // are no other active RenderWidgets. |
| 467 | void WasSwappedOut(); |
| 468 | |
[email protected] | 2533ce1 | 2009-05-09 00:02:24 | [diff] [blame] | 469 | void DoDeferredClose(); |
dgozman | cf9039cd | 2015-04-06 12:01:31 | [diff] [blame] | 470 | void NotifyOnClose(); |
dcheng | da9b4bb | 2015-07-20 20:58:08 | [diff] [blame] | 471 | |
bokan | c63441c | 2016-04-27 15:49:12 | [diff] [blame] | 472 | gfx::Size GetSizeForWebWidget() const; |
| 473 | virtual void ResizeWebWidget(); |
| 474 | |
dcheng | da9b4bb | 2015-07-20 20:58:08 | [diff] [blame] | 475 | // Close the underlying WebWidget. |
| 476 | virtual void Close(); |
initial.commit | 09911bf | 2008-07-26 23:55:29 | [diff] [blame] | 477 | |
[email protected] | 9265016 | 2013-10-30 03:31:02 | [diff] [blame] | 478 | // Used to force the size of a window when running layout tests. |
bokan | c007c3a | 2015-02-03 07:15:56 | [diff] [blame] | 479 | void SetWindowRectSynchronously(const gfx::Rect& new_window_rect); |
thakis | 18e42641 | 2017-03-15 12:06:37 | [diff] [blame] | 480 | #if BUILDFLAG(USE_EXTERNAL_POPUP_MENU) |
[email protected] | b2e4c7013 | 2013-10-03 02:07:51 | [diff] [blame] | 481 | void SetExternalPopupOriginAdjustmentsForEmulation( |
mfomitchev | 2600fd7c | 2016-02-17 20:53:39 | [diff] [blame] | 482 | ExternalPopupMenu* popup, |
| 483 | RenderWidgetScreenMetricsEmulator* emulator); |
[email protected] | 5390786 | 2014-03-25 15:42:40 | [diff] [blame] | 484 | #endif |
[email protected] | 61e2b3cc | 2012-03-02 16:13:34 | [diff] [blame] | 485 | |
initial.commit | 09911bf | 2008-07-26 23:55:29 | [diff] [blame] | 486 | // RenderWidget IPC message handlers |
nzolghadr | 5d859650 | 2017-01-23 22:59:35 | [diff] [blame] | 487 | void OnHandleInputEvent( |
| 488 | const blink::WebInputEvent* event, |
| 489 | const std::vector<const blink::WebInputEvent*>& coalesced_events, |
| 490 | const ui::LatencyInfo& latency_info, |
| 491 | InputEventDispatchType dispatch_type); |
[email protected] | 34202de | 2013-05-06 23:36:22 | [diff] [blame] | 492 | void OnCursorVisibilityChange(bool is_visible); |
[email protected] | c084330e0 | 2013-04-27 01:08:15 | [diff] [blame] | 493 | void OnMouseCaptureLost(); |
alexmos | 5656749 | 2016-09-13 00:52:46 | [diff] [blame] | 494 | void OnSetEditCommandsForNextKeyEvent(const EditCommands& edit_commands); |
[email protected] | c084330e0 | 2013-04-27 01:08:15 | [diff] [blame] | 495 | virtual void OnSetFocus(bool enable); |
nasko | c288745f | 2015-05-01 22:54:21 | [diff] [blame] | 496 | void OnClose(); |
[email protected] | fc4404d | 2012-11-07 19:53:30 | [diff] [blame] | 497 | void OnCreatingNewAck(); |
fsamuel | 664e8b6 | 2016-01-20 19:54:01 | [diff] [blame] | 498 | virtual void OnResize(const ResizeParams& params); |
dgozman | 9260b0a1 | 2015-03-16 13:45:20 | [diff] [blame] | 499 | void OnEnableDeviceEmulation(const blink::WebDeviceEmulationParams& params); |
| 500 | void OnDisableDeviceEmulation(); |
[email protected] | 941e455 | 2010-02-01 21:23:43 | [diff] [blame] | 501 | virtual void OnWasHidden(); |
[email protected] | 3399dd82 | 2014-08-09 11:14:24 | [diff] [blame] | 502 | virtual void OnWasShown(bool needs_repainting, |
| 503 | const ui::LatencyInfo& latency_info); |
avi | 1023d01 | 2015-12-25 02:39:14 | [diff] [blame] | 504 | void OnCreateVideoAck(int32_t video_id); |
| 505 | void OnUpdateVideoAck(int32_t video_id); |
[email protected] | 2533ce1 | 2009-05-09 00:02:24 | [diff] [blame] | 506 | void OnRequestMoveAck(); |
wjmaclean | ee244e0 | 2017-05-26 21:06:07 | [diff] [blame] | 507 | // Request from browser to show context menu. |
| 508 | virtual void OnShowContextMenu(ui::MenuSourceType source_type, |
| 509 | const gfx::Point& location); |
[email protected] | 56ea1a6 | 2011-05-30 07:05:57 | [diff] [blame] | 510 | virtual void OnImeSetComposition( |
[email protected] | fcf75d4 | 2013-12-03 20:11:26 | [diff] [blame] | 511 | const base::string16& text, |
[email protected] | 180ef24 | 2013-11-07 06:50:46 | [diff] [blame] | 512 | const std::vector<blink::WebCompositionUnderline>& underlines, |
chongz | 7eb75280 | 2016-01-27 21:28:07 | [diff] [blame] | 513 | const gfx::Range& replacement_range, |
[email protected] | fa7b1dc | 2010-06-23 17:53:04 | [diff] [blame] | 514 | int selection_start, |
| 515 | int selection_end); |
rlanday | 7efe230 | 2017-01-11 00:14:28 | [diff] [blame] | 516 | virtual void OnImeCommitText( |
| 517 | const base::string16& text, |
| 518 | const std::vector<blink::WebCompositionUnderline>& underlines, |
| 519 | const gfx::Range& replacement_range, |
| 520 | int relative_cursor_pos); |
aelias | 87b8f7c | 2016-09-14 03:19:29 | [diff] [blame] | 521 | virtual void OnImeFinishComposingText(bool keep_selection); |
| 522 | |
oshima | d527903 | 2015-12-16 18:22:33 | [diff] [blame] | 523 | // Called when the device scale factor is changed, or the layer tree is |
| 524 | // initialized. |
| 525 | virtual void OnDeviceScaleFactorChanged(); |
| 526 | |
[email protected] | 0bc1f57 | 2013-04-17 01:46:31 | [diff] [blame] | 527 | void OnRepaint(gfx::Size size_to_paint); |
[email protected] | 79fa22e | 2013-08-23 15:18:12 | [diff] [blame] | 528 | void OnSyntheticGestureCompleted(); |
[email protected] | 180ef24 | 2013-11-07 06:50:46 | [diff] [blame] | 529 | void OnSetTextDirection(blink::WebTextDirection direction); |
[email protected] | 872ae5b | 2011-05-26 20:20:50 | [diff] [blame] | 530 | void OnGetFPS(); |
[email protected] | 80ad862 | 2012-11-07 16:33:03 | [diff] [blame] | 531 | void OnUpdateScreenRects(const gfx::Rect& view_screen_rect, |
| 532 | const gfx::Rect& window_screen_rect); |
lfg | db5c4ed | 2016-03-04 23:09:07 | [diff] [blame] | 533 | void OnUpdateWindowScreenRect(const gfx::Rect& window_screen_rect); |
kenrb | ea73179 | 2017-01-13 15:10:48 | [diff] [blame] | 534 | void OnSetViewportIntersection(const gfx::Rect& viewport_intersection); |
paulmeyer | 90f6c31d | 2016-11-12 00:17:59 | [diff] [blame] | 535 | // Real data that is dragged is not included at DragEnter time. |
| 536 | void OnDragTargetDragEnter( |
| 537 | const std::vector<DropData::Metadata>& drop_meta_data, |
| 538 | const gfx::Point& client_pt, |
| 539 | const gfx::Point& screen_pt, |
| 540 | blink::WebDragOperationsMask operations_allowed, |
| 541 | int key_modifiers); |
| 542 | void OnDragTargetDragOver(const gfx::Point& client_pt, |
| 543 | const gfx::Point& screen_pt, |
| 544 | blink::WebDragOperationsMask operations_allowed, |
| 545 | int key_modifiers); |
kenrb | 07c27280 | 2017-02-07 23:48:17 | [diff] [blame] | 546 | void OnDragTargetDragLeave(const gfx::Point& client_point, |
| 547 | const gfx::Point& screen_point); |
paulmeyer | 90f6c31d | 2016-11-12 00:17:59 | [diff] [blame] | 548 | void OnDragTargetDrop(const DropData& drop_data, |
| 549 | const gfx::Point& client_pt, |
| 550 | const gfx::Point& screen_pt, |
| 551 | int key_modifiers); |
paulmeyer | 8fc8ea9 | 2016-11-15 05:12:21 | [diff] [blame] | 552 | void OnDragSourceEnded(const gfx::Point& client_point, |
| 553 | const gfx::Point& screen_point, |
| 554 | blink::WebDragOperation drag_operation); |
| 555 | void OnDragSourceSystemDragEnded(); |
[email protected] | 0d1ebed1 | 2013-08-05 22:01:13 | [diff] [blame] | 556 | |
[email protected] | adb36231 | 2014-06-28 06:04:24 | [diff] [blame] | 557 | #if defined(OS_ANDROID) |
changwan | 8c34274 | 2016-02-26 00:53:39 | [diff] [blame] | 558 | // Called by the browser process to update text input state. |
| 559 | void OnRequestTextInputStateUpdate(); |
[email protected] | 105dffb4 | 2013-02-20 03:46:21 | [diff] [blame] | 560 | #endif |
[email protected] | 0d1ebed1 | 2013-08-05 22:01:13 | [diff] [blame] | 561 | |
nona | fa29179 | 2016-08-10 02:36:18 | [diff] [blame] | 562 | // Called by the browser process to update the cursor and composition |
ekaramad | c9b70a7 | 2017-03-23 16:14:23 | [diff] [blame] | 563 | // information by sending InputHostMsg_ImeCompositionRangeChanged. If |
| 564 | // |immediate_request| is true, an IPC is sent back with current state. |
| 565 | // When |monitor_update| is true, then RenderWidget will send the updates |
| 566 | // in each compositor frame when there are changes. Outside of compositor |
| 567 | // frame updates, a change in text selection might also lead to an update for |
| 568 | // composition info (when in monitor mode). |
| 569 | void OnRequestCompositionUpdates(bool immediate_request, |
| 570 | bool monitor_updates); |
nona | fa29179 | 2016-08-10 02:36:18 | [diff] [blame] | 571 | |
[email protected] | 847a258 | 2013-03-09 02:29:51 | [diff] [blame] | 572 | // Notify the compositor about a change in viewport size. This should be |
| 573 | // used only with auto resize mode WebWidgets, as normal WebWidgets should |
| 574 | // go through OnResize. |
[email protected] | 97e1bf7 | 2013-03-06 14:06:05 | [diff] [blame] | 575 | void AutoResizeCompositor(); |
| 576 | |
wjmaclean | 8a795f3 | 2016-08-11 23:49:58 | [diff] [blame] | 577 | virtual void OnSetDeviceScaleFactor(float device_scale_factor); |
[email protected] | 468ac58 | 2012-11-20 00:53:19 | [diff] [blame] | 578 | |
lfg | 8d649cc | 2017-04-28 18:04:30 | [diff] [blame] | 579 | void OnOrientationChange(); |
[email protected] | fcdc564 | 2014-05-09 14:32:24 | [diff] [blame] | 580 | |
[email protected] | 29ed96a | 2012-02-04 18:12:16 | [diff] [blame] | 581 | // Override points to notify derived classes that a paint has happened. |
[email protected] | 0704ac3 | 2013-10-03 15:24:22 | [diff] [blame] | 582 | // DidInitiatePaint happens when that has completed, and subsequent rendering |
bmcquade | 1f070c5 | 2016-11-02 17:50:51 | [diff] [blame] | 583 | // won't affect the painted content. |
lfg | e0c2792ec | 2016-05-11 18:52:08 | [diff] [blame] | 584 | virtual void DidInitiatePaint() {} |
[email protected] | a2f6bc11 | 2009-06-27 16:27:25 | [diff] [blame] | 585 | |
[email protected] | ed7defa | 2013-03-12 21:29:59 | [diff] [blame] | 586 | virtual GURL GetURLForGraphicsContext3D(); |
[email protected] | 6522577 | 2011-05-12 21:10:24 | [diff] [blame] | 587 | |
[email protected] | bee16aab | 2009-08-26 15:55:03 | [diff] [blame] | 588 | // Sets the "hidden" state of this widget. All accesses to is_hidden_ should |
| 589 | // use this method so that we can properly inform the RenderThread of our |
| 590 | // state. |
| 591 | void SetHidden(bool hidden); |
| 592 | |
[email protected] | 2b624c56 | 2011-10-27 22:58:26 | [diff] [blame] | 593 | void DidToggleFullscreen(); |
| 594 | |
[email protected] | 67474193 | 2009-02-04 23:44:46 | [diff] [blame] | 595 | bool next_paint_is_resize_ack() const; |
[email protected] | 67474193 | 2009-02-04 23:44:46 | [diff] [blame] | 596 | void set_next_paint_is_resize_ack(); |
[email protected] | 67474193 | 2009-02-04 23:44:46 | [diff] [blame] | 597 | void set_next_paint_is_repaint_ack(); |
[email protected] | ec7dc11 | 2008-08-06 05:30:12 | [diff] [blame] | 598 | |
[email protected] | 586871b | 2014-07-22 17:05:11 | [diff] [blame] | 599 | // QueueMessage implementation extracted into a static method for easy |
| 600 | // testing. |
dcheng | cedca561 | 2016-04-09 01:40:15 | [diff] [blame] | 601 | static std::unique_ptr<cc::SwapPromise> QueueMessageImpl( |
[email protected] | 586871b | 2014-07-22 17:05:11 | [diff] [blame] | 602 | IPC::Message* msg, |
| 603 | MessageDeliveryPolicy policy, |
| 604 | FrameSwapMessageQueue* frame_swap_message_queue, |
| 605 | scoped_refptr<IPC::SyncMessageFilter> sync_message_filter, |
[email protected] | 586871b | 2014-07-22 17:05:11 | [diff] [blame] | 606 | int source_frame_number); |
| 607 | |
[email protected] | 58b48a0d | 2012-06-13 07:01:35 | [diff] [blame] | 608 | // Override point to obtain that the current composition character bounds. |
| 609 | // In the case of surrogate pairs, the character is treated as two characters: |
| 610 | // the bounds for first character is actual one, and the bounds for second |
| 611 | // character is zero width rectangle. |
| 612 | virtual void GetCompositionCharacterBounds( |
| 613 | std::vector<gfx::Rect>* character_bounds); |
| 614 | |
[email protected] | 88dbe32f | 2013-06-20 23:31:36 | [diff] [blame] | 615 | // Returns the range of the text that is being composed or the selection if |
| 616 | // the composition does not exist. |
[email protected] | db4fc1e | 2013-09-06 20:01:51 | [diff] [blame] | 617 | virtual void GetCompositionRange(gfx::Range* range); |
[email protected] | 88dbe32f | 2013-06-20 23:31:36 | [diff] [blame] | 618 | |
[email protected] | 58b48a0d | 2012-06-13 07:01:35 | [diff] [blame] | 619 | // Returns true if the composition range or composition character bounds |
| 620 | // should be sent to the browser process. |
| 621 | bool ShouldUpdateCompositionInfo( |
[email protected] | db4fc1e | 2013-09-06 20:01:51 | [diff] [blame] | 622 | const gfx::Range& range, |
[email protected] | 58b48a0d | 2012-06-13 07:01:35 | [diff] [blame] | 623 | const std::vector<gfx::Rect>& bounds); |
| 624 | |
[email protected] | ad26ef4 | 2011-06-17 07:59:45 | [diff] [blame] | 625 | // Override point to obtain that the current input method state about |
| 626 | // composition text. |
| 627 | virtual bool CanComposeInline(); |
[email protected] | 56ea1a6 | 2011-05-30 07:05:57 | [diff] [blame] | 628 | |
[email protected] | 2533ce1 | 2009-05-09 00:02:24 | [diff] [blame] | 629 | // Set the pending window rect. |
| 630 | // Because the real render_widget is hosted in another process, there is |
| 631 | // a time period where we may have set a new window rect which has not yet |
| 632 | // been processed by the browser. So we maintain a pending window rect |
| 633 | // size. If JS code sets the WindowRect, and then immediately calls |
| 634 | // GetWindowRect() we'll use this pending window rect as the size. |
[email protected] | 180ef24 | 2013-11-07 06:50:46 | [diff] [blame] | 635 | void SetPendingWindowRect(const blink::WebRect& r); |
[email protected] | 2533ce1 | 2009-05-09 00:02:24 | [diff] [blame] | 636 | |
[email protected] | ce6689f | 2013-03-29 12:52:55 | [diff] [blame] | 637 | // Check whether the WebWidget has any touch event handlers registered. |
Blink Reformat | 1c4d759e | 2017-04-09 16:34:54 | [diff] [blame] | 638 | void HasTouchEventHandlers(bool has_handlers) override; |
[email protected] | ce6689f | 2013-03-29 12:52:55 | [diff] [blame] | 639 | |
Dave Tapuska | dfe486c1 | 2017-06-09 16:53:13 | [diff] [blame] | 640 | // Called to update whether low latency input mode is enabled or not. |
| 641 | void SetNeedsLowLatencyInput(bool) override; |
| 642 | |
[email protected] | 5d0bbdfa9 | 2013-12-10 00:35:51 | [diff] [blame] | 643 | // Tell the browser about the actions permitted for a new touch point. |
xidachen | fa0199e7 | 2017-05-11 11:34:26 | [diff] [blame] | 644 | void SetTouchAction(cc::TouchAction touch_action) override; |
[email protected] | 5d0bbdfa9 | 2013-12-10 00:35:51 | [diff] [blame] | 645 | |
lfg | 43e08e6 | 2016-02-03 18:51:37 | [diff] [blame] | 646 | // Sends an ACK to the browser process during the next compositor frame. |
| 647 | void OnWaitNextFrameForTests(int routing_id); |
| 648 | |
initial.commit | 09911bf | 2008-07-26 23:55:29 | [diff] [blame] | 649 | // Routing ID that allows us to communicate to the parent browser process |
nick | 8331f8ad | 2016-11-15 20:42:45 | [diff] [blame] | 650 | // RenderWidgetHost. |
| 651 | const int32_t routing_id_; |
initial.commit | 09911bf | 2008-07-26 23:55:29 | [diff] [blame] | 652 | |
danakj | 6e3bf801 | 2014-12-16 18:27:53 | [diff] [blame] | 653 | // Dependencies for initializing a compositor, including flags for optional |
| 654 | // features. |
dcheng | 35d31c11 | 2015-07-22 00:17:36 | [diff] [blame] | 655 | CompositorDependencies* const compositor_deps_; |
danakj | 6e3bf801 | 2014-12-16 18:27:53 | [diff] [blame] | 656 | |
lfg | 8ff3391 | 2016-09-13 20:59:21 | [diff] [blame] | 657 | // Use GetWebWidget() instead of using webwidget_internal_ directly. |
[email protected] | c5b3b5e | 2009-02-13 06:41:11 | [diff] [blame] | 658 | // We are responsible for destroying this object via its Close method. |
[email protected] | 4ee6462 | 2014-03-21 22:34:15 | [diff] [blame] | 659 | // May be NULL when the window is closing. |
lfg | 8ff3391 | 2016-09-13 20:59:21 | [diff] [blame] | 660 | blink::WebWidget* webwidget_internal_; |
initial.commit | 09911bf | 2008-07-26 23:55:29 | [diff] [blame] | 661 | |
avi | 40b5be7a | 2016-03-03 21:13:44 | [diff] [blame] | 662 | // The delegate of the owner of this object. |
| 663 | RenderWidgetOwnerDelegate* owner_delegate_; |
| 664 | |
[email protected] | 8926c60 | 2013-01-23 05:32:06 | [diff] [blame] | 665 | // This is lazily constructed and must not outlive webwidget_. |
dcheng | cedca561 | 2016-04-09 01:40:15 | [diff] [blame] | 666 | std::unique_ptr<RenderWidgetCompositor> compositor_; |
[email protected] | 8926c60 | 2013-01-23 05:32:06 | [diff] [blame] | 667 | |
bokan | c007c3a | 2015-02-03 07:15:56 | [diff] [blame] | 668 | // The rect where this view should be initially shown. |
| 669 | gfx::Rect initial_rect_; |
initial.commit | 09911bf | 2008-07-26 23:55:29 | [diff] [blame] | 670 | |
initial.commit | 09911bf | 2008-07-26 23:55:29 | [diff] [blame] | 671 | // We store the current cursor object so we can avoid spamming SetCursor |
| 672 | // messages. |
| 673 | WebCursor current_cursor_; |
[email protected] | 88efb7ec | 2009-07-14 16:32:59 | [diff] [blame] | 674 | |
initial.commit | 09911bf | 2008-07-26 23:55:29 | [diff] [blame] | 675 | // The size of the RenderWidget. |
| 676 | gfx::Size size_; |
| 677 | |
[email protected] | 60d47ac | 2013-03-01 23:42:44 | [diff] [blame] | 678 | // The size of the view's backing surface in non-DPI-adjusted pixels. |
| 679 | gfx::Size physical_backing_size_; |
| 680 | |
[email protected] | bb6378fe | 2014-04-28 21:19:44 | [diff] [blame] | 681 | // The size of the visible viewport in DPI-adjusted pixels. |
| 682 | gfx::Size visible_viewport_size_; |
| 683 | |
[email protected] | 53d3f30 | 2009-12-21 04:42:05 | [diff] [blame] | 684 | // Flags for the next ViewHostMsg_UpdateRect message. |
initial.commit | 09911bf | 2008-07-26 23:55:29 | [diff] [blame] | 685 | int next_paint_flags_; |
| 686 | |
[email protected] | 847a258 | 2013-03-09 02:29:51 | [diff] [blame] | 687 | // Whether the WebWidget is in auto resize mode, which is used for example |
| 688 | // by extension popups. |
| 689 | bool auto_resize_mode_; |
| 690 | |
[email protected] | ea3ee0a | 2012-05-15 03:43:09 | [diff] [blame] | 691 | // True if we need to send an UpdateRect message to notify the browser about |
| 692 | // an already-completed auto-resize. |
| 693 | bool need_update_rect_for_auto_resize_; |
| 694 | |
initial.commit | 09911bf | 2008-07-26 23:55:29 | [diff] [blame] | 695 | // Set to true if we should ignore RenderWidget::Show calls. |
| 696 | bool did_show_; |
| 697 | |
| 698 | // Indicates that we shouldn't bother generated paint events. |
| 699 | bool is_hidden_; |
| 700 | |
[email protected] | 7912e82 | 2014-04-16 02:37:03 | [diff] [blame] | 701 | // Indicates that we are never visible, so never produce graphical output. |
sievers | 71c62dd5 | 2015-10-07 01:44:39 | [diff] [blame] | 702 | const bool compositor_never_visible_; |
[email protected] | 7912e82 | 2014-04-16 02:37:03 | [diff] [blame] | 703 | |
mikhail.pozdnyakov | f2c902a | 2015-04-14 08:09:12 | [diff] [blame] | 704 | // Indicates whether tab-initiated fullscreen was granted. |
| 705 | bool is_fullscreen_granted_; |
[email protected] | ee41e7d2 | 2011-10-14 19:34:09 | [diff] [blame] | 706 | |
mikhail.pozdnyakov | c0e251b | 2015-04-15 06:51:12 | [diff] [blame] | 707 | // Indicates the display mode. |
| 708 | blink::WebDisplayMode display_mode_; |
| 709 | |
changwan | f2a707b | 2015-10-30 08:22:16 | [diff] [blame] | 710 | // It is possible that one ImeEventGuard is nested inside another |
| 711 | // ImeEventGuard. We keep track of the outermost one, and update it as needed. |
| 712 | ImeEventGuard* ime_event_guard_; |
[email protected] | e8f775f | 2013-02-14 21:00:50 | [diff] [blame] | 713 | |
initial.commit | 09911bf | 2008-07-26 23:55:29 | [diff] [blame] | 714 | // True if we have requested this widget be closed. No more messages will |
| 715 | // be sent, except for a Close. |
| 716 | bool closing_; |
| 717 | |
[email protected] | aeeedad | 2014-08-22 18:16:22 | [diff] [blame] | 718 | // True if it is known that the host is in the process of being shut down. |
| 719 | bool host_closing_; |
| 720 | |
[email protected] | 992db4c | 2011-05-12 15:37:15 | [diff] [blame] | 721 | // Whether this RenderWidget is currently swapped out, such that the view is |
| 722 | // being rendered by another process. If all RenderWidgets in a process are |
| 723 | // swapped out, the process can exit. |
| 724 | bool is_swapped_out_; |
| 725 | |
simonhong | 628f981 | 2015-04-27 23:13:20 | [diff] [blame] | 726 | // Whether this RenderWidget is for an out-of-process iframe or not. |
| 727 | bool for_oopif_; |
| 728 | |
[email protected] | 5b739cb | 2012-08-21 20:35:21 | [diff] [blame] | 729 | // Stores information about the current text input. |
[email protected] | 180ef24 | 2013-11-07 06:50:46 | [diff] [blame] | 730 | blink::WebTextInputInfo text_input_info_; |
[email protected] | 5b739cb | 2012-08-21 20:35:21 | [diff] [blame] | 731 | |
dglazkov | 97b6c2b | 2016-10-25 17:35:55 | [diff] [blame] | 732 | // Stores the current text input type of |webwidget_|. |
| 733 | ui::TextInputType text_input_type_; |
| 734 | |
[email protected] | b256eca | 2013-07-11 10:57:40 | [diff] [blame] | 735 | // Stores the current text input mode of |webwidget_|. |
| 736 | ui::TextInputMode text_input_mode_; |
| 737 | |
shuchen | 82ce8c5 | 2014-10-23 01:55:20 | [diff] [blame] | 738 | // Stores the current text input flags of |webwidget_|. |
| 739 | int text_input_flags_; |
| 740 | |
[email protected] | 86ba5fcb | 2013-09-04 00:36:53 | [diff] [blame] | 741 | // Stores the current type of composition text rendering of |webwidget_|. |
| 742 | bool can_compose_inline_; |
| 743 | |
[email protected] | e99ef6f | 2011-10-16 01:13:00 | [diff] [blame] | 744 | // Stores the current selection bounds. |
[email protected] | 7c8873e | 2013-02-05 08:03:01 | [diff] [blame] | 745 | gfx::Rect selection_focus_rect_; |
| 746 | gfx::Rect selection_anchor_rect_; |
initial.commit | 09911bf | 2008-07-26 23:55:29 | [diff] [blame] | 747 | |
[email protected] | 58b48a0d | 2012-06-13 07:01:35 | [diff] [blame] | 748 | // Stores the current composition character bounds. |
| 749 | std::vector<gfx::Rect> composition_character_bounds_; |
| 750 | |
| 751 | // Stores the current composition range. |
[email protected] | db4fc1e | 2013-09-06 20:01:51 | [diff] [blame] | 752 | gfx::Range composition_range_; |
[email protected] | 58b48a0d | 2012-06-13 07:01:35 | [diff] [blame] | 753 | |
[email protected] | 3e2b375b | 2010-04-07 17:03:12 | [diff] [blame] | 754 | // The kind of popup this widget represents, NONE if not a popup. |
[email protected] | 180ef24 | 2013-11-07 06:50:46 | [diff] [blame] | 755 | blink::WebPopupType popup_type_; |
[email protected] | 0ebf387 | 2008-11-07 21:35:03 | [diff] [blame] | 756 | |
[email protected] | 80ad862 | 2012-11-07 16:33:03 | [diff] [blame] | 757 | // While we are waiting for the browser to update window sizes, we track the |
| 758 | // pending size temporarily. |
[email protected] | 2533ce1 | 2009-05-09 00:02:24 | [diff] [blame] | 759 | int pending_window_rect_count_; |
lfg | 0140a45 | 2016-07-19 19:15:05 | [diff] [blame] | 760 | gfx::Rect pending_window_rect_; |
[email protected] | 2533ce1 | 2009-05-09 00:02:24 | [diff] [blame] | 761 | |
[email protected] | 80ad862 | 2012-11-07 16:33:03 | [diff] [blame] | 762 | // The screen rects of the view and the window that contains it. |
| 763 | gfx::Rect view_screen_rect_; |
| 764 | gfx::Rect window_screen_rect_; |
| 765 | |
dcheng | cedca561 | 2016-04-09 01:40:15 | [diff] [blame] | 766 | std::unique_ptr<RenderWidgetInputHandler> input_handler_; |
[email protected] | 12fbad81 | 2009-09-01 18:21:24 | [diff] [blame] | 767 | |
[email protected] | fd84779 | 2013-10-24 17:12:35 | [diff] [blame] | 768 | // The time spent in input handlers this frame. Used to throttle input acks. |
| 769 | base::TimeDelta total_input_handling_time_this_frame_; |
| 770 | |
[email protected] | 842f1065 | 2012-06-06 01:54:04 | [diff] [blame] | 771 | // Properties of the screen hosting this RenderWidget instance. |
ccameron | 2f45153 | 2016-09-07 21:49:27 | [diff] [blame] | 772 | ScreenInfo screen_info_; |
[email protected] | 842f1065 | 2012-06-06 01:54:04 | [diff] [blame] | 773 | |
[email protected] | f1cccb3 | 2012-06-06 18:29:59 | [diff] [blame] | 774 | // The device scale factor. This value is computed from the DPI entries in |
| 775 | // |screen_info_| on some platforms, and defaults to 1 on other platforms. |
[email protected] | faec7b1 | 2012-06-19 14:42:13 | [diff] [blame] | 776 | float device_scale_factor_; |
[email protected] | f1cccb3 | 2012-06-06 18:29:59 | [diff] [blame] | 777 | |
[email protected] | 9017d785 | 2013-11-21 17:47:35 | [diff] [blame] | 778 | // State associated with synthetic gestures. Synthetic gestures are processed |
| 779 | // in-order, so a queue is sufficient to identify the correct state for a |
| 780 | // completed gesture. |
| 781 | std::queue<SyntheticGestureCompletionCallback> |
| 782 | pending_synthetic_gesture_callbacks_; |
[email protected] | 0e241b4b | 2012-08-18 09:06:27 | [diff] [blame] | 783 | |
nona | fa29179 | 2016-08-10 02:36:18 | [diff] [blame] | 784 | // True if the IME requests updated composition info. |
| 785 | bool monitor_composition_info_; |
| 786 | |
dcheng | cedca561 | 2016-04-09 01:40:15 | [diff] [blame] | 787 | std::unique_ptr<RenderWidgetScreenMetricsEmulator> screen_metrics_emulator_; |
[email protected] | b2e4c7013 | 2013-10-03 02:07:51 | [diff] [blame] | 788 | |
| 789 | // Popups may be displaced when screen metrics emulation is enabled. |
| 790 | // These values are used to properly adjust popup position. |
danakj | 2ef31b8 | 2015-10-21 18:18:02 | [diff] [blame] | 791 | gfx::Point popup_view_origin_for_emulation_; |
| 792 | gfx::Point popup_screen_origin_for_emulation_; |
[email protected] | b2e4c7013 | 2013-10-03 02:07:51 | [diff] [blame] | 793 | float popup_origin_scale_for_emulation_; |
| 794 | |
[email protected] | 586871b | 2014-07-22 17:05:11 | [diff] [blame] | 795 | scoped_refptr<FrameSwapMessageQueue> frame_swap_message_queue_; |
dcheng | cedca561 | 2016-04-09 01:40:15 | [diff] [blame] | 796 | std::unique_ptr<ResizingModeSelector> resizing_mode_selector_; |
[email protected] | 5b45ad4 | 2013-10-25 00:42:04 | [diff] [blame] | 797 | |
[email protected] | e3244ed | 2014-06-20 20:04:27 | [diff] [blame] | 798 | // Lists of RenderFrameProxy objects that need to be notified of |
| 799 | // compositing-related events (e.g. DidCommitCompositorFrame). |
brettw | 236d317 | 2015-06-03 16:31:43 | [diff] [blame] | 800 | base::ObserverList<RenderFrameProxy> render_frame_proxies_; |
[email protected] | bffc830 | 2014-01-23 20:52:16 | [diff] [blame] | 801 | |
[email protected] | de3c5d8 | 2014-05-28 22:12:59 | [diff] [blame] | 802 | // A list of RenderFrames associated with this RenderWidget. Notifications |
| 803 | // are sent to each frame in the list for events such as changing |
| 804 | // visibility state for example. |
brettw | 236d317 | 2015-06-03 16:31:43 | [diff] [blame] | 805 | base::ObserverList<RenderFrameImpl> render_frames_; |
[email protected] | de3c5d8 | 2014-05-28 22:12:59 | [diff] [blame] | 806 | |
[email protected] | be1af066 | 2014-07-29 19:55:51 | [diff] [blame] | 807 | bool has_host_context_menu_location_; |
| 808 | gfx::Point host_context_menu_location_; |
[email protected] | a09d53ce | 2014-01-31 00:46:42 | [diff] [blame] | 809 | |
skyostil | 529caa29 | 2016-08-10 17:44:51 | [diff] [blame] | 810 | std::unique_ptr<blink::scheduler::RenderWidgetSchedulingState> |
alexclarke | 7fa9394 | 2015-10-21 15:37:11 | [diff] [blame] | 811 | render_widget_scheduling_state_; |
| 812 | |
lfg | bee1e0a | 2016-06-08 21:24:21 | [diff] [blame] | 813 | // Mouse Lock dispatcher attached to this view. |
| 814 | std::unique_ptr<RenderWidgetMouseLockDispatcher> mouse_lock_dispatcher_; |
| 815 | |
| 816 | // Wraps the |webwidget_| as a MouseLockDispatcher::LockTarget interface. |
| 817 | std::unique_ptr<MouseLockDispatcher::LockTarget> webwidget_mouse_lock_target_; |
| 818 | |
wjmaclean | 1d97062 | 2017-01-21 22:28:24 | [diff] [blame] | 819 | bool has_added_input_handler_; |
| 820 | |
oshima | 50872a7 | 2016-03-04 13:26:18 | [diff] [blame] | 821 | private: |
bokan | 841fdc7 | 2016-10-06 00:16:35 | [diff] [blame] | 822 | // Applies/Removes the DevTools device emulation transformation to/from a |
| 823 | // window rect. |
| 824 | void ScreenRectToEmulatedIfNeeded(blink::WebRect* window_rect) const; |
| 825 | void EmulatedToScreenRectIfNeeded(blink::WebRect* window_rect) const; |
| 826 | |
dtapuska | 014ed08 | 2016-11-11 21:58:48 | [diff] [blame] | 827 | bool CreateWidget(int32_t opener_id, |
| 828 | blink::WebPopupType popup_type, |
| 829 | int32_t* routing_id); |
| 830 | |
| 831 | // A variant of Send but is fatal if it fails. The browser may |
| 832 | // be waiting for this IPC Message and if the send fails the browser will |
| 833 | // be left in a state waiting for something that never comes. And if it |
| 834 | // never comes then it may later determine this is a hung renderer; so |
| 835 | // instead fail right away. |
| 836 | void SendOrCrash(IPC::Message* msg); |
| 837 | |
ekaramad | 5aff194 | 2017-01-06 01:26:35 | [diff] [blame] | 838 | // Determines whether or not RenderWidget should process IME events from the |
| 839 | // browser. It always returns true unless there is no WebFrameWidget to |
| 840 | // handle the event, or there is no page focus. |
| 841 | bool ShouldHandleImeEvents() const; |
| 842 | |
changwan | 75e3b207 | 2017-01-16 02:55:00 | [diff] [blame] | 843 | void UpdateTextInputStateInternal(bool show_virtual_keyboard, |
| 844 | bool reply_to_request); |
| 845 | |
ccameron | 0191299 | 2017-05-23 07:34:03 | [diff] [blame] | 846 | gfx::ColorSpace GetRasterColorSpace() const; |
| 847 | |
Dave Tapuska | ea83d3bd | 2017-06-13 16:14:55 | [diff] [blame] | 848 | void SendInputEventAck(blink::WebInputEvent::Type type, |
| 849 | uint32_t touch_event_id, |
| 850 | InputEventAckState ack_state, |
| 851 | const ui::LatencyInfo& latency_info, |
| 852 | std::unique_ptr<ui::DidOverscrollParams>); |
| 853 | |
lfg | e0c2792ec | 2016-05-11 18:52:08 | [diff] [blame] | 854 | // Indicates whether this widget has focus. |
| 855 | bool has_focus_; |
| 856 | |
nick | f7b3822 | 2016-11-22 21:59:35 | [diff] [blame] | 857 | // A callback into the creator/opener of this widget, to be executed when |
| 858 | // WebWidgetClient::show() occurs. |
| 859 | ShowCallback show_callback_; |
| 860 | |
ekaramad | 330ba423 | 2016-09-23 17:57:47 | [diff] [blame] | 861 | #if defined(OS_MACOSX) |
| 862 | // Responds to IPCs from TextInputClientMac regarding getting string at given |
| 863 | // position or range as well as finding character index at a given position. |
| 864 | std::unique_ptr<TextInputClientObserver> text_input_client_observer_; |
| 865 | #endif |
| 866 | |
ekaramad | 2a46d63 | 2016-07-19 13:33:09 | [diff] [blame] | 867 | // This reference is set by the RenderFrame and is used to query the IME- |
| 868 | // related state from the plugin to later send to the browser. |
| 869 | PepperPluginInstanceImpl* focused_pepper_plugin_; |
| 870 | |
alexmos | 5656749 | 2016-09-13 00:52:46 | [diff] [blame] | 871 | // Stores edit commands associated to the next key event. |
| 872 | // Will be cleared as soon as the next key event is processed. |
| 873 | EditCommands edit_commands_; |
| 874 | |
paulmeyer | 6ef5a79 | 2016-11-08 20:33:58 | [diff] [blame] | 875 | // This field stores drag/drop related info for the event that is currently |
| 876 | // being handled. If the current event results in starting a drag/drop |
| 877 | // session, this info is sent to the browser along with other drag/drop info. |
| 878 | DragEventSourceInfo possible_drag_event_info_; |
| 879 | |
tasak | b95dbb50c | 2017-02-08 18:07:50 | [diff] [blame] | 880 | bool time_to_first_active_paint_recorded_; |
| 881 | base::TimeTicks was_shown_time_; |
| 882 | |
kenrb | 5d78b84 | 2017-03-06 21:06:01 | [diff] [blame] | 883 | // This is initialized to zero and is incremented on each non-same-page |
| 884 | // navigation commit by RenderFrameImpl. At that time it is sent to the |
| 885 | // compositor so that it can tag compositor frames, and RenderFrameImpl is |
| 886 | // responsible for sending it to the browser process to be used to match |
| 887 | // each compositor frame to the most recent page navigation before it was |
| 888 | // generated. |
| 889 | // This only applies to main frames, and is not touched for subframe |
| 890 | // RenderWidgets, where there is no concern around displaying unloaded |
| 891 | // content. |
| 892 | // TODO(kenrb, fsamuel): This should be removed when SurfaceIDs can be used |
| 893 | // to replace it. See https://crbug.com/695579. |
| 894 | uint32_t current_content_source_id_; |
| 895 | |
fsamuel | ca02c4e | 2017-05-09 13:34:14 | [diff] [blame] | 896 | cc::LocalSurfaceId local_surface_id_; |
| 897 | |
dtapuska | 9ec1a91 | 2017-04-21 15:18:31 | [diff] [blame] | 898 | scoped_refptr<MainThreadEventQueue> input_event_queue_; |
| 899 | |
wjmaclean | 1d97062 | 2017-01-21 22:28:24 | [diff] [blame] | 900 | base::WeakPtrFactory<RenderWidget> weak_ptr_factory_; |
| 901 | |
[email protected] | 05d47875 | 2009-04-08 23:38:16 | [diff] [blame] | 902 | DISALLOW_COPY_AND_ASSIGN(RenderWidget); |
initial.commit | 09911bf | 2008-07-26 23:55:29 | [diff] [blame] | 903 | }; |
| 904 | |
[email protected] | e9ff79c | 2012-10-19 21:31:26 | [diff] [blame] | 905 | } // namespace content |
| 906 | |
[email protected] | 2cff005 | 2011-03-18 16:51:44 | [diff] [blame] | 907 | #endif // CONTENT_RENDERER_RENDER_WIDGET_H_ |