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