blob: 76bcebaed022f37c9f0d1281470aeb683818e08c [file] [log] [blame]
[email protected]9f4f3322012-01-18 22:29:561// Copyright (c) 2012 The Chromium Authors. All rights reserved.
license.botbf09a502008-08-24 00:55:552// Use of this source code is governed by a BSD-style license that can be
3// found in the LICENSE file.
initial.commit09911bf2008-07-26 23:55:294
[email protected]2cff0052011-03-18 16:51:445#ifndef CONTENT_RENDERER_RENDER_WIDGET_H_
6#define CONTENT_RENDERER_RENDER_WIDGET_H_
initial.commit09911bf2008-07-26 23:55:297
avi1023d012015-12-25 02:39:148#include <stddef.h>
9#include <stdint.h>
10
[email protected]aa4117f2011-12-09 22:19:2111#include <deque>
[email protected]0e241b4b2012-08-18 09:06:2712#include <map>
dchengcedca5612016-04-09 01:40:1513#include <memory>
xlai180af792016-08-26 22:07:4214#include <queue>
[email protected]010ea08a2009-10-11 20:21:3215
[email protected]586871b2014-07-22 17:05:1116#include "base/callback.h"
[email protected]f3112a52011-09-30 23:47:4917#include "base/compiler_specific.h"
avi1023d012015-12-25 02:39:1418#include "base/macros.h"
[email protected]3b63f8f42011-03-28 01:54:1519#include "base/memory/ref_counted.h"
[email protected]bffc8302014-01-23 20:52:1620#include "base/observer_list.h"
[email protected]abb522162013-06-28 01:54:1621#include "base/time/time.h"
avi1023d012015-12-25 02:39:1422#include "build/build_config.h"
[email protected]f3112a52011-09-30 23:47:4923#include "content/common/content_export.h"
[email protected]c2809346d2014-03-20 00:11:0324#include "content/common/cursors/webcursor.h"
paulmeyer6ef5a792016-11-08 20:33:5825#include "content/common/drag_event_source_info.h"
alexmos56567492016-09-13 00:52:4626#include "content/common/edit_command.h"
[email protected]9017d7852013-11-21 17:47:3527#include "content/common/input/synthetic_gesture_params.h"
paulmeyer90f6c31d2016-11-12 00:17:5928#include "content/public/common/drop_data.h"
ccameron2f451532016-09-07 21:49:2729#include "content/public/common/screen_info.h"
mfomitchev2600fd7c2016-02-17 20:53:3930#include "content/renderer/devtools/render_widget_screen_metrics_emulator_delegate.h"
fsamuel78f86e42016-01-20 04:10:2331#include "content/renderer/gpu/render_widget_compositor_delegate.h"
fsamuel72464894f2015-12-15 06:59:3132#include "content/renderer/input/render_widget_input_handler.h"
33#include "content/renderer/input/render_widget_input_handler_delegate.h"
[email protected]586871b2014-07-22 17:05:1134#include "content/renderer/message_delivery_policy.h"
lfgbee1e0a2016-06-08 21:24:2135#include "content/renderer/mouse_lock_dispatcher.h"
36#include "content/renderer/render_widget_mouse_lock_dispatcher.h"
[email protected]4f86bdb2012-11-10 19:11:1937#include "ipc/ipc_listener.h"
nick4df698d82016-11-11 20:39:2338#include "ipc/ipc_message.h"
[email protected]4f86bdb2012-11-10 19:11:1939#include "ipc/ipc_sender.h"
mikhail.pozdnyakovc0e251b2015-04-15 06:51:1240#include "third_party/WebKit/public/platform/WebDisplayMode.h"
dtapuska7f4ddc2a2016-10-13 16:09:3241#include "third_party/WebKit/public/platform/WebInputEvent.h"
[email protected]5c30b5e02013-05-30 03:46:0842#include "third_party/WebKit/public/platform/WebRect.h"
paulmeyer6ef5a792016-11-08 20:33:5843#include "third_party/WebKit/public/platform/WebReferrerPolicy.h"
dtapuska7f4ddc2a2016-10-13 16:09:3244#include "third_party/WebKit/public/platform/WebTextInputInfo.h"
[email protected]2255a9332013-06-17 05:12:3145#include "third_party/WebKit/public/web/WebCompositionUnderline.h"
46#include "third_party/WebKit/public/web/WebPopupType.h"
47#include "third_party/WebKit/public/web/WebTextDirection.h"
[email protected]5d0bbdfa92013-12-10 00:35:5148#include "third_party/WebKit/public/web/WebTouchAction.h"
[email protected]0e45bd02013-07-12 20:20:0249#include "third_party/WebKit/public/web/WebWidget.h"
[email protected]2255a9332013-06-17 05:12:3150#include "third_party/WebKit/public/web/WebWidgetClient.h"
[email protected]b256eca2013-07-11 10:57:4051#include "ui/base/ime/text_input_mode.h"
[email protected]ad26ef42011-06-17 07:59:4552#include "ui/base/ime/text_input_type.h"
[email protected]a09d53ce2014-01-31 00:46:4253#include "ui/base/ui_base_types.h"
tfarina93bfa912014-12-05 14:23:1554#include "ui/gfx/geometry/rect.h"
tfarina93bfa912014-12-05 14:23:1555#include "ui/gfx/geometry/vector2d_f.h"
[email protected]08397d52011-02-05 01:53:3856#include "ui/gfx/native_widget_types.h"
[email protected]db4fc1e2013-09-06 20:01:5157#include "ui/gfx/range/range.h"
[email protected]d353541f2012-05-03 22:45:4158#include "ui/surface/transport_dib.h"
initial.commit09911bf2008-07-26 23:55:2959
danakj870925d42016-05-03 20:07:3860class GURL;
61
[email protected]484955942010-08-19 16:13:1862namespace IPC {
[email protected]586871b2014-07-22 17:05:1163class SyncMessageFilter;
[email protected]484955942010-08-19 16:13:1864}
65
[email protected]180ef242013-11-07 06:50:4666namespace blink {
skyostil529caa292016-08-10 17:44:5167namespace scheduler {
68class RenderWidgetSchedulingState;
69}
[email protected]19193682014-04-03 15:01:4370struct WebDeviceEmulationParams;
paulmeyer6ef5a792016-11-08 20:33:5871class WebDragData;
lfgcaab5142016-02-26 19:06:5272class WebFrameWidget;
[email protected]41d86852012-11-07 12:23:2473class WebGestureEvent;
paulmeyer6ef5a792016-11-08 20:33:5874class WebImage;
ekaramad2daaf672016-11-10 20:29:0175class WebInputMethodController;
kenrba7199832015-01-22 23:44:5976class WebLocalFrame;
[email protected]6a8ddba52010-09-05 04:38:0677class WebMouseEvent;
donnda070f3c2015-01-16 19:54:1178class WebNode;
79struct WebPoint;
[email protected]526476902011-10-06 20:34:0680}
81
[email protected]586871b2014-07-22 17:05:1182namespace cc {
danakj1120f4c2016-09-15 02:05:3283class CompositorFrameSink;
[email protected]586871b2014-07-22 17:05:1184class SwapPromise;
85}
[email protected]ba91a792013-02-06 09:48:2886
[email protected]db4fc1e2013-09-06 20:01:5187namespace gfx {
[email protected]4de6d1692011-10-12 08:45:4488class Range;
89}
90
chongza8ba91fc2016-08-16 21:39:1791namespace ui {
92struct DidOverscrollParams;
93}
94
[email protected]e9ff79c2012-10-19 21:31:2695namespace content {
danakj6e3bf8012014-12-16 18:27:5396class CompositorDependencies;
[email protected]b2e4c70132013-10-03 02:07:5197class ExternalPopupMenu;
[email protected]586871b2014-07-22 17:05:1198class FrameSwapMessageQueue;
changwanf2a707b2015-10-30 08:22:1699class ImeEventGuard;
ekaramad2a46d632016-07-19 13:33:09100class PepperPluginInstanceImpl;
[email protected]bffc8302014-01-23 20:52:16101class RenderFrameImpl;
[email protected]e3244ed2014-06-20 20:04:27102class RenderFrameProxy;
nickf7b38222016-11-22 21:59:35103class RenderViewImpl;
[email protected]ba91a792013-02-06 09:48:28104class RenderWidgetCompositor;
avi40b5be7a2016-03-03 21:13:44105class RenderWidgetOwnerDelegate;
mfomitchev2600fd7c2016-02-17 20:53:39106class RenderWidgetScreenMetricsEmulator;
[email protected]5b45ad42013-10-25 00:42:04107class ResizingModeSelector;
ekaramad330ba4232016-09-23 17:57:47108class TextInputClientObserver;
[email protected]b2e4c70132013-10-03 02:07:51109struct ContextMenuParams;
fsamuel664e8b62016-01-20 19:54:01110struct ResizeParams;
[email protected]e9ff79c2012-10-19 21:31:26111
initial.commit09911bf2008-07-26 23:55:29112// RenderWidget provides a communication bridge between a WebWidget and
113// a RenderWidgetHost, the latter of which lives in a different process.
dchengd96a27a2015-07-24 20:17:32114//
115// RenderWidget is used to implement:
116// - RenderViewImpl (deprecated)
117// - Fullscreen mode (RenderWidgetFullScreen)
118// - Popup "menus" (like the color chooser and date picker)
119// - Widgets for frames (for out-of-process iframe support)
[email protected]f3112a52011-09-30 23:47:49120class CONTENT_EXPORT RenderWidget
[email protected]c47317e2012-06-20 22:35:31121 : public IPC::Listener,
122 public IPC::Sender,
[email protected]180ef242013-11-07 06:50:46123 NON_EXPORTED_BASE(virtual public blink::WebWidgetClient),
fsamuel78f86e42016-01-20 04:10:23124 public RenderWidgetCompositorDelegate,
fsamuel72464894f2015-12-15 06:59:31125 public RenderWidgetInputHandlerDelegate,
mfomitchev2600fd7c2016-02-17 20:53:39126 public RenderWidgetScreenMetricsEmulatorDelegate,
[email protected]f3112a52011-09-30 23:47:49127 public base::RefCounted<RenderWidget> {
initial.commit09911bf2008-07-26 23:55:29128 public:
nickf7b38222016-11-22 21:59:35129 // Creates a new RenderWidget for a popup. |opener| is the RenderView that
130 // this widget lives inside.
131 static RenderWidget* CreateForPopup(RenderViewImpl* opener,
132 CompositorDependencies* compositor_deps,
133 blink::WebPopupType popup_type,
134 const ScreenInfo& screen_info);
initial.commit09911bf2008-07-26 23:55:29135
kenrba7199832015-01-22 23:44:59136 // Creates a new RenderWidget that will be attached to a RenderFrame.
nick4df698d82016-11-11 20:39:23137 static RenderWidget* CreateForFrame(int widget_routing_id,
kenrba7199832015-01-22 23:44:59138 bool hidden,
ccameron2f451532016-09-07 21:49:27139 const ScreenInfo& screen_info,
kenrba7199832015-01-22 23:44:59140 CompositorDependencies* compositor_deps,
141 blink::WebLocalFrame* frame);
142
lfg1568d112016-08-30 16:06:29143 // Used by content_layouttest_support to hook into the creation of
144 // RenderWidgets.
nick8331f8ad2016-11-15 20:42:45145 using CreateRenderWidgetFunction = RenderWidget* (*)(int32_t,
146 CompositorDependencies*,
147 blink::WebPopupType,
148 const ScreenInfo&,
149 bool,
150 bool,
151 bool);
lfg1568d112016-08-30 16:06:29152 using RenderWidgetInitializedCallback = void (*)(RenderWidget*);
nickf7b38222016-11-22 21:59:35153 using ShowCallback = base::Callback<void(RenderWidget* widget_to_show,
154 blink::WebNavigationPolicy policy,
155 const gfx::Rect& initial_rect)>;
lfg1568d112016-08-30 16:06:29156 static void InstallCreateHook(
157 CreateRenderWidgetFunction create_render_widget,
158 RenderWidgetInitializedCallback render_widget_initialized_callback);
159
dchengda9b4bb2015-07-20 20:58:08160 // Closes a RenderWidget that was created by |CreateForFrame|.
dcheng3ce04b62015-10-26 23:30:55161 // TODO(avi): De-virtualize this once RenderViewImpl has-a RenderWidget.
162 // https://crbug.com/545684
163 virtual void CloseForFrame();
[email protected]484955942010-08-19 16:13:18164
nick8331f8ad2016-11-15 20:42:45165 int32_t routing_id() const { return routing_id_; }
fsamuele8326c742016-01-12 00:49:39166
danakj6e3bf8012014-12-16 18:27:53167 CompositorDependencies* compositor_deps() const { return compositor_deps_; }
lfg8ff33912016-09-13 20:59:21168 virtual blink::WebWidget* GetWebWidget() const;
ekaramad2daaf672016-11-10 20:29:01169
170 // Returns the current instance of WebInputMethodController which is to be
171 // used for IME related tasks. This instance corresponds to the one from
172 // focused frame and can be nullptr.
173 blink::WebInputMethodController* GetInputMethodController() const;
174
mfomitchev2600fd7c2016-02-17 20:53:39175 const gfx::Size& size() const { return size_; }
mikhail.pozdnyakovf2c902a2015-04-14 08:09:12176 bool is_fullscreen_granted() const { return is_fullscreen_granted_; }
mikhail.pozdnyakovc0e251b2015-04-15 06:51:12177 blink::WebDisplayMode display_mode() const { return display_mode_; }
[email protected]204f1df2012-01-04 20:21:13178 bool is_hidden() const { return is_hidden_; }
[email protected]4ee64622014-03-21 22:34:15179 // Temporary for debugging purposes...
180 bool closing() const { return closing_; }
[email protected]be1af0662014-07-29 19:55:51181 bool has_host_context_menu_location() {
182 return has_host_context_menu_location_;
183 }
184 gfx::Point host_context_menu_location() {
185 return host_context_menu_location_;
[email protected]4ee64622014-03-21 22:34:15186 }
[email protected]589621b2010-09-23 22:01:07187
avi40b5be7a2016-03-03 21:13:44188 void set_owner_delegate(RenderWidgetOwnerDelegate* owner_delegate) {
189 DCHECK(!owner_delegate_);
190 owner_delegate_ = owner_delegate;
191 }
192
193 RenderWidgetOwnerDelegate* owner_delegate() { return owner_delegate_; }
194
kenrba7199832015-01-22 23:44:59195 // ScreenInfo exposed so it can be passed to subframe RenderWidgets.
ccameron2f451532016-09-07 21:49:27196 ScreenInfo screen_info() const { return screen_info_; }
kenrba7199832015-01-22 23:44:59197
alexmos78c9c0d2016-10-14 18:57:03198 // Sets whether this RenderWidget has been swapped out to be displayed by
199 // a RenderWidget in a different process. If so, no new IPC messages will be
200 // sent (only ACKs) and the process is free to exit when there are no other
201 // active RenderWidgets.
202 void SetSwappedOut(bool is_swapped_out);
203
204 bool is_swapped_out() { return is_swapped_out_; }
205
alexmos56567492016-09-13 00:52:46206 // Manage edit commands to be used for the next keyboard event.
207 const EditCommands& edit_commands() const { return edit_commands_; }
208 void SetEditCommandForNextKeyEvent(const std::string& name,
209 const std::string& value);
210 void ClearEditCommands();
211
[email protected]bffc8302014-01-23 20:52:16212 // Functions to track out-of-process frames for special notifications.
[email protected]e3244ed2014-06-20 20:04:27213 void RegisterRenderFrameProxy(RenderFrameProxy* proxy);
214 void UnregisterRenderFrameProxy(RenderFrameProxy* proxy);
[email protected]bffc8302014-01-23 20:52:16215
[email protected]de3c5d82014-05-28 22:12:59216 // Functions to track all RenderFrame objects associated with this
217 // RenderWidget.
218 void RegisterRenderFrame(RenderFrameImpl* frame);
219 void UnregisterRenderFrame(RenderFrameImpl* frame);
220
[email protected]c47317e2012-06-20 22:35:31221 // IPC::Listener
dcheng6d18e402014-10-21 12:32:52222 bool OnMessageReceived(const IPC::Message& msg) override;
initial.commit09911bf2008-07-26 23:55:29223
[email protected]c47317e2012-06-20 22:35:31224 // IPC::Sender
dcheng6d18e402014-10-21 12:32:52225 bool Send(IPC::Message* msg) override;
initial.commit09911bf2008-07-26 23:55:29226
dtapuska3d5624d32016-08-30 04:34:00227 // Requests a BeginMainFrame callback from the compositor.
228 void SetNeedsMainFrame();
229
fsamuel78f86e42016-01-20 04:10:23230 // RenderWidgetCompositorDelegate
231 void ApplyViewportDeltas(const gfx::Vector2dF& inner_delta,
232 const gfx::Vector2dF& outer_delta,
233 const gfx::Vector2dF& elastic_overscroll_delta,
234 float page_scale,
235 float top_controls_delta) override;
236 void BeginMainFrame(double frame_time_sec) override;
danakj1120f4c2016-09-15 02:05:32237 std::unique_ptr<cc::CompositorFrameSink> CreateCompositorFrameSink(
dchengcedca5612016-04-09 01:40:15238 bool fallback) override;
fsamuel78f86e42016-01-20 04:10:23239 void DidCommitAndDrawCompositorFrame() override;
240 void DidCommitCompositorFrame() override;
241 void DidCompletePageScaleAnimation() override;
danakj6c872fc02016-10-22 04:29:49242 void DidReceiveCompositorFrameAck() override;
fsamuel78f86e42016-01-20 04:10:23243 void ForwardCompositorProto(const std::vector<uint8_t>& proto) override;
244 bool IsClosing() const override;
danakj53eccbc2016-03-02 22:51:07245 void RequestScheduleAnimation() override;
fsamuel78f86e42016-01-20 04:10:23246 void UpdateVisualState() override;
247 void WillBeginCompositorFrame() override;
jbroman6ccbc7d472016-07-27 04:45:41248 std::unique_ptr<cc::SwapPromise> RequestCopyOfOutputForLayoutTest(
249 std::unique_ptr<cc::CopyOutputRequest> request) override;
fsamuel78f86e42016-01-20 04:10:23250
fsamuel72464894f2015-12-15 06:59:31251 // RenderWidgetInputHandlerDelegate
252 void FocusChangeComplete() override;
253 bool HasTouchEventHandlersAt(const gfx::Point& point) const override;
dtapuska1827dd22016-03-11 15:24:59254 void ObserveGestureEventAndResult(const blink::WebGestureEvent& gesture_event,
255 const gfx::Vector2dF& unused_delta,
256 bool event_processed) override;
257
fsamuel72464894f2015-12-15 06:59:31258 void OnDidHandleKeyEvent() override;
chongza8ba91fc2016-08-16 21:39:17259 void OnDidOverscroll(const ui::DidOverscrollParams& params) override;
dchengcedca5612016-04-09 01:40:15260 void OnInputEventAck(std::unique_ptr<InputEventAck> input_event_ack) override;
dtapuskab08721e62016-06-29 03:35:07261 void NotifyInputEventHandled(blink::WebInputEvent::Type handled_type,
262 InputEventAckState ack_result) override;
fsamuele8326c742016-01-12 00:49:39263 void SetInputHandler(RenderWidgetInputHandler* input_handler) override;
fsamuel72464894f2015-12-15 06:59:31264 void UpdateTextInputState(ShowIme show_ime,
265 ChangeSource change_source) override;
266 bool WillHandleGestureEvent(const blink::WebGestureEvent& event) override;
267 bool WillHandleMouseEvent(const blink::WebMouseEvent& event) override;
268
mfomitchev2600fd7c2016-02-17 20:53:39269 // RenderWidgetScreenMetricsDelegate
270 void Redraw() override;
271 void Resize(const ResizeParams& resize_params) override;
272 void SetScreenMetricsEmulationParameters(
273 bool enabled,
274 const blink::WebDeviceEmulationParams& params) override;
275 void SetScreenRects(const gfx::Rect& view_screen_rect,
276 const gfx::Rect& window_screen_rect) override;
277
[email protected]180ef242013-11-07 06:50:46278 // blink::WebWidgetClient
avi5c77d212015-09-25 20:08:25279 void initializeLayerTreeView() override;
280 blink::WebLayerTreeView* layerTreeView() override;
dglazkovf0e1d6d2015-10-10 02:13:48281 void didMeaningfulLayout(blink::WebMeaningfulLayout layout_type) override;
avi5c77d212015-09-25 20:08:25282 void didChangeCursor(const blink::WebCursorInfo&) override;
283 void closeWidgetSoon() override;
284 void show(blink::WebNavigationPolicy) override;
285 blink::WebRect windowRect() override;
bokan6b08cd22016-10-05 00:55:21286 blink::WebRect viewRect() override;
avi5c77d212015-09-25 20:08:25287 void setToolTipText(const blink::WebString& text,
288 blink::WebTextDirection hint) override;
289 void setWindowRect(const blink::WebRect&) override;
avi5c77d212015-09-25 20:08:25290 blink::WebScreenInfo screenInfo() override;
avi5c77d212015-09-25 20:08:25291 void resetInputMethod() override;
292 void didHandleGestureEvent(const blink::WebGestureEvent& event,
293 bool event_cancelled) override;
bokane53a10f2016-04-13 23:48:31294 void didOverscroll(const blink::WebFloatSize& overscrollDelta,
295 const blink::WebFloatSize& accumulatedOverscroll,
avi5c77d212015-09-25 20:08:25296 const blink::WebFloatPoint& position,
297 const blink::WebFloatSize& velocity) override;
298 void showImeIfNeeded() override;
oshima581cf3f62015-12-16 20:08:01299 void convertViewportToWindow(blink::WebRect* rect) override;
oshimaa6985b62016-01-27 08:58:30300 void convertWindowToViewport(blink::WebFloatRect* rect) override;
lfgbee1e0a2016-06-08 21:24:21301 bool requestPointerLock() override;
302 void requestPointerUnlock() override;
303 bool isPointerLocked() override;
paulmeyer6ef5a792016-11-08 20:33:58304 void startDragging(blink::WebReferrerPolicy policy,
305 const blink::WebDragData& data,
306 blink::WebDragOperationsMask mask,
307 const blink::WebImage& image,
308 const blink::WebPoint& imageOffset) override;
[email protected]4873c7d2009-07-16 06:36:28309
fsamuel72464894f2015-12-15 06:59:31310 // Override point to obtain that the current input method state and caret
311 // position.
312 virtual ui::TextInputType GetTextInputType();
fsamuel72464894f2015-12-15 06:59:31313
donnda070f3c2015-01-16 19:54:11314#if defined(OS_ANDROID)
315 // Notifies that a tap was not consumed, so showing a UI for the unhandled
316 // tap may be needed.
donnd57e54f52015-02-26 19:03:37317 // Performs various checks on the given WebNode to apply heuristics to
318 // determine if triggering is appropriate.
avi5c77d212015-09-25 20:08:25319 void showUnhandledTapUIIfNeeded(const blink::WebPoint& tapped_position,
320 const blink::WebNode& tapped_node,
321 bool page_changed) override;
donnda070f3c2015-01-16 19:54:11322#endif
323
[email protected]7912e822014-04-16 02:37:03324 // Begins the compositor's scheduler to start producing frames.
325 void StartCompositor();
326
[email protected]aeeedad2014-08-22 18:16:22327 // Stop compositing.
ennef3c58142014-12-09 21:44:38328 void WillCloseLayerTreeView();
[email protected]aeeedad2014-08-22 18:16:22329
[email protected]24ed0432013-04-24 07:50:31330 RenderWidgetCompositor* compositor() const;
331
fsamuel72464894f2015-12-15 06:59:31332 const RenderWidgetInputHandler& input_handler() const {
fsamuele8326c742016-01-12 00:49:39333 return *input_handler_;
fsamuel72464894f2015-12-15 06:59:31334 }
335
336 void SetHandlingInputEventForTesting(bool handling_input_event);
337
[email protected]79fa22e2013-08-23 15:18:12338 // Callback for use with synthetic gestures (e.g. BeginSmoothScroll).
339 typedef base::Callback<void()> SyntheticGestureCompletionCallback;
[email protected]0e241b4b2012-08-18 09:06:27340
[email protected]9017d7852013-11-21 17:47:35341 // Send a synthetic gesture to the browser to be queued to the synthetic
342 // gesture controller.
343 void QueueSyntheticGesture(
dchengcedca5612016-04-09 01:40:15344 std::unique_ptr<SyntheticGestureParams> gesture_params,
[email protected]9017d7852013-11-21 17:47:35345 const SyntheticGestureCompletionCallback& callback);
[email protected]1e1dd182013-09-12 01:51:15346
[email protected]586871b2014-07-22 17:05:11347 // Deliveres |message| together with compositor state change updates. The
348 // exact behavior depends on |policy|.
349 // This mechanism is not a drop-in replacement for IPC: messages sent this way
350 // will not be automatically available to BrowserMessageFilter, for example.
351 // FIFO ordering is preserved between messages enqueued with the same
352 // |policy|, the ordering between messages enqueued for different policies is
353 // undefined.
354 //
355 // |msg| message to send, ownership of |msg| is transferred.
356 // |policy| see the comment on MessageDeliveryPolicy.
357 void QueueMessage(IPC::Message* msg, MessageDeliveryPolicy policy);
358
changwanf2a707b2015-10-30 08:22:16359 // Handle start and finish of IME event guard.
360 void OnImeEventGuardStart(ImeEventGuard* guard);
361 void OnImeEventGuardFinish(ImeEventGuard* guard);
[email protected]66fca5bc2013-05-23 06:58:29362
mfomitchev2600fd7c2016-02-17 20:53:39363 void SetPopupOriginAdjustmentsForEmulation(
364 RenderWidgetScreenMetricsEmulator* emulator);
[email protected]b2e4c70132013-10-03 02:07:51365
[email protected]2d6836f42014-07-02 17:25:31366 gfx::Rect AdjustValidationMessageAnchor(const gfx::Rect& anchor);
[email protected]b2e4c70132013-10-03 02:07:51367
jdduke491a3f0c2015-06-15 23:30:26368 void ScheduleComposite();
[email protected]7d08a9352013-10-15 08:24:56369 void ScheduleCompositeWithForcedRedraw();
370
[email protected]7a4e2532013-12-02 21:30:02371 // Checks if the selection bounds have been changed. If they are changed,
372 // the new value will be sent to the browser process.
373 void UpdateSelectionBounds();
374
[email protected]e5e438d62014-03-27 21:47:16375 virtual void GetSelectionBounds(gfx::Rect* start, gfx::Rect* end);
376
[email protected]a09d53ce2014-01-31 00:46:42377 void OnShowHostContextMenu(ContextMenuParams* params);
[email protected]7a4e2532013-12-02 21:30:02378
[email protected]7a4e2532013-12-02 21:30:02379 // Checks if the composition range or composition character bounds have been
380 // changed. If they are changed, the new value will be sent to the browser
yukawa5f21c6a2014-10-27 17:09:30381 // process. This method does nothing when the browser process is not able to
382 // handle composition range and composition character bounds.
nonafa291792016-08-10 02:36:18383 // If immediate_request is true, render sends the latest composition info to
384 // the browser even if the composition info is not changed.
385 void UpdateCompositionInfo(bool immediate_request);
[email protected]7a4e2532013-12-02 21:30:02386
engedy8d0ed9b2017-01-02 20:05:48387 // Change the device ICC color profile while running a layout test.
388 void SetDeviceColorProfileForTesting(const std::vector<char>& color_profile);
avi40b5be7a2016-03-03 21:13:44389
lfgb00fcad2016-07-14 14:16:33390 // Called when the Widget has changed size as a result of an auto-resize.
391 void DidAutoResize(const gfx::Size& new_size);
392
lfge0c2792ec2016-05-11 18:52:08393 // Indicates whether this widget has focus.
394 bool has_focus() const { return has_focus_; }
395
lfgbee1e0a2016-06-08 21:24:21396 MouseLockDispatcher* mouse_lock_dispatcher() {
397 return mouse_lock_dispatcher_.get();
398 }
399
ekaramad330ba4232016-09-23 17:57:47400 // 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).
ekaramad2a46d632016-07-19 13:33:09403 void set_focused_pepper_plugin(PepperPluginInstanceImpl* plugin) {
404 focused_pepper_plugin_ = plugin;
405 }
406
lfg1f9011c2016-08-17 21:18:42407 // When emulated, this returns original device scale factor.
408 float GetOriginalDeviceScaleFactor() const;
409
paulmeyer90f6c31d2016-11-12 00:17:59410 // Helper to convert |point| using ConvertWindowToViewport().
411 gfx::Point ConvertWindowPointToViewport(const gfx::Point& point);
412
initial.commit09911bf2008-07-26 23:55:29413 protected:
[email protected]8085dbc82008-09-26 22:53:44414 // Friend RefCounted so that the dtor can be non-public. Using this class
415 // without ref-counting is an error.
416 friend class base::RefCounted<RenderWidget>;
fsamuele8326c742016-01-12 00:49:39417
[email protected]7339cd22010-10-27 00:11:20418 // For unit tests.
[email protected]e9ff79c2012-10-19 21:31:26419 friend class RenderWidgetTest;
[email protected]8085dbc82008-09-26 22:53:44420
[email protected]61e2b3cc2012-03-02 16:13:34421 enum ResizeAck {
422 SEND_RESIZE_ACK,
423 NO_RESIZE_ACK,
424 };
425
nick8331f8ad2016-11-15 20:42:45426 RenderWidget(int32_t widget_routing_id,
427 CompositorDependencies* compositor_deps,
dcheng35d31c112015-07-22 00:17:36428 blink::WebPopupType popup_type,
ccameron2f451532016-09-07 21:49:27429 const ScreenInfo& screen_info,
[email protected]1ac10dca2013-08-20 20:47:04430 bool swapped_out,
[email protected]7912e822014-04-16 02:37:03431 bool hidden,
432 bool never_visible);
[email protected]ce2b28e2012-08-09 15:53:57433
dcheng6d18e402014-10-21 12:32:52434 ~RenderWidget() override;
initial.commit09911bf2008-07-26 23:55:29435
lfgcaab5142016-02-26 19:06:52436 static blink::WebFrameWidget* CreateWebFrameWidget(
437 RenderWidget* render_widget,
438 blink::WebLocalFrame* frame);
dchengda9b4bb2015-07-20 20:58:08439
440 // Creates a WebWidget based on the popup type.
441 static blink::WebWidget* CreateWebWidget(RenderWidget* render_widget);
442
nick4df698d82016-11-11 20:39:23443 // Called by Create() functions and subclasses to finish initialization.
nickf7b38222016-11-22 21:59:35444 // |show_callback| will be invoked once WebWidgetClient::show() occurs, and
445 // should be null if show() won't be triggered for this widget.
446 void Init(const ShowCallback& show_callback, blink::WebWidget* web_widget);
[email protected]484955942010-08-19 16:13:18447
[email protected]949b6592014-08-20 13:17:52448 // Allows the process to exit once the unload handler has finished, if there
449 // are no other active RenderWidgets.
450 void WasSwappedOut();
451
[email protected]2533ce12009-05-09 00:02:24452 void DoDeferredClose();
dgozmancf9039cd2015-04-06 12:01:31453 void NotifyOnClose();
dchengda9b4bb2015-07-20 20:58:08454
bokanc63441c2016-04-27 15:49:12455 gfx::Size GetSizeForWebWidget() const;
456 virtual void ResizeWebWidget();
457
dchengda9b4bb2015-07-20 20:58:08458 // Close the underlying WebWidget.
459 virtual void Close();
initial.commit09911bf2008-07-26 23:55:29460
[email protected]92650162013-10-30 03:31:02461 // Used to force the size of a window when running layout tests.
bokanc007c3a2015-02-03 07:15:56462 void SetWindowRectSynchronously(const gfx::Rect& new_window_rect);
haibinluc643d33c2016-06-03 02:22:34463#if defined(USE_EXTERNAL_POPUP_MENU)
[email protected]b2e4c70132013-10-03 02:07:51464 void SetExternalPopupOriginAdjustmentsForEmulation(
mfomitchev2600fd7c2016-02-17 20:53:39465 ExternalPopupMenu* popup,
466 RenderWidgetScreenMetricsEmulator* emulator);
[email protected]53907862014-03-25 15:42:40467#endif
[email protected]61e2b3cc2012-03-02 16:13:34468
initial.commit09911bf2008-07-26 23:55:29469 // RenderWidget IPC message handlers
[email protected]180ef242013-11-07 06:50:46470 void OnHandleInputEvent(const blink::WebInputEvent* event,
dtapuska0bd451a2016-02-18 17:08:10471 const ui::LatencyInfo& latency_info,
472 InputEventDispatchType dispatch_type);
[email protected]34202de2013-05-06 23:36:22473 void OnCursorVisibilityChange(bool is_visible);
[email protected]c084330e02013-04-27 01:08:15474 void OnMouseCaptureLost();
alexmos56567492016-09-13 00:52:46475 void OnSetEditCommandsForNextKeyEvent(const EditCommands& edit_commands);
[email protected]c084330e02013-04-27 01:08:15476 virtual void OnSetFocus(bool enable);
naskoc288745f2015-05-01 22:54:21477 void OnClose();
[email protected]fc4404d2012-11-07 19:53:30478 void OnCreatingNewAck();
fsamuel664e8b62016-01-20 19:54:01479 virtual void OnResize(const ResizeParams& params);
dgozman9260b0a12015-03-16 13:45:20480 void OnEnableDeviceEmulation(const blink::WebDeviceEmulationParams& params);
481 void OnDisableDeviceEmulation();
[email protected]941e4552010-02-01 21:23:43482 virtual void OnWasHidden();
[email protected]3399dd822014-08-09 11:14:24483 virtual void OnWasShown(bool needs_repainting,
484 const ui::LatencyInfo& latency_info);
avi1023d012015-12-25 02:39:14485 void OnCreateVideoAck(int32_t video_id);
486 void OnUpdateVideoAck(int32_t video_id);
[email protected]2533ce12009-05-09 00:02:24487 void OnRequestMoveAck();
[email protected]56ea1a62011-05-30 07:05:57488 virtual void OnImeSetComposition(
[email protected]fcf75d42013-12-03 20:11:26489 const base::string16& text,
[email protected]180ef242013-11-07 06:50:46490 const std::vector<blink::WebCompositionUnderline>& underlines,
chongz7eb752802016-01-27 21:28:07491 const gfx::Range& replacement_range,
[email protected]fa7b1dc2010-06-23 17:53:04492 int selection_start,
493 int selection_end);
aelias87b8f7c2016-09-14 03:19:29494 virtual void OnImeCommitText(const base::string16& text,
495 const gfx::Range& replacement_range,
496 int relative_cursor_pos);
497 virtual void OnImeFinishComposingText(bool keep_selection);
498
oshimad5279032015-12-16 18:22:33499 // Called when the device scale factor is changed, or the layer tree is
500 // initialized.
501 virtual void OnDeviceScaleFactorChanged();
502
[email protected]0bc1f572013-04-17 01:46:31503 void OnRepaint(gfx::Size size_to_paint);
[email protected]79fa22e2013-08-23 15:18:12504 void OnSyntheticGestureCompleted();
[email protected]180ef242013-11-07 06:50:46505 void OnSetTextDirection(blink::WebTextDirection direction);
[email protected]872ae5b2011-05-26 20:20:50506 void OnGetFPS();
[email protected]80ad8622012-11-07 16:33:03507 void OnUpdateScreenRects(const gfx::Rect& view_screen_rect,
508 const gfx::Rect& window_screen_rect);
lfgdb5c4ed2016-03-04 23:09:07509 void OnUpdateWindowScreenRect(const gfx::Rect& window_screen_rect);
dtrainor5ef644e2015-11-19 00:12:47510 void OnHandleCompositorProto(const std::vector<uint8_t>& proto);
paulmeyer90f6c31d2016-11-12 00:17:59511 // Real data that is dragged is not included at DragEnter time.
512 void OnDragTargetDragEnter(
513 const std::vector<DropData::Metadata>& drop_meta_data,
514 const gfx::Point& client_pt,
515 const gfx::Point& screen_pt,
516 blink::WebDragOperationsMask operations_allowed,
517 int key_modifiers);
518 void OnDragTargetDragOver(const gfx::Point& client_pt,
519 const gfx::Point& screen_pt,
520 blink::WebDragOperationsMask operations_allowed,
521 int key_modifiers);
522 void OnDragTargetDragLeave();
523 void OnDragTargetDrop(const DropData& drop_data,
524 const gfx::Point& client_pt,
525 const gfx::Point& screen_pt,
526 int key_modifiers);
paulmeyer8fc8ea92016-11-15 05:12:21527 void OnDragSourceEnded(const gfx::Point& client_point,
528 const gfx::Point& screen_point,
529 blink::WebDragOperation drag_operation);
530 void OnDragSourceSystemDragEnded();
[email protected]0d1ebed12013-08-05 22:01:13531
[email protected]adb362312014-06-28 06:04:24532#if defined(OS_ANDROID)
changwan8c342742016-02-26 00:53:39533 // Called by the browser process to update text input state.
534 void OnRequestTextInputStateUpdate();
[email protected]105dffb42013-02-20 03:46:21535#endif
[email protected]0d1ebed12013-08-05 22:01:13536
nonafa291792016-08-10 02:36:18537 // Called by the browser process to update the cursor and composition
538 // information.
539 void OnRequestCompositionUpdate(bool immediate_request, bool monitor_request);
540
[email protected]847a2582013-03-09 02:29:51541 // Notify the compositor about a change in viewport size. This should be
542 // used only with auto resize mode WebWidgets, as normal WebWidgets should
543 // go through OnResize.
[email protected]97e1bf72013-03-06 14:06:05544 void AutoResizeCompositor();
545
wjmaclean8a795f32016-08-11 23:49:58546 virtual void OnSetDeviceScaleFactor(float device_scale_factor);
engedy8d0ed9b2017-01-02 20:05:48547 bool SetDeviceColorProfile(const std::vector<char>& color_profile);
[email protected]468ac582012-11-20 00:53:19548
[email protected]fcdc5642014-05-09 14:32:24549 virtual void OnOrientationChange();
550
[email protected]29ed96a2012-02-04 18:12:16551 // Override points to notify derived classes that a paint has happened.
[email protected]0704ac32013-10-03 15:24:22552 // DidInitiatePaint happens when that has completed, and subsequent rendering
bmcquade1f070c52016-11-02 17:50:51553 // won't affect the painted content.
lfge0c2792ec2016-05-11 18:52:08554 virtual void DidInitiatePaint() {}
[email protected]a2f6bc112009-06-27 16:27:25555
[email protected]ed7defa2013-03-12 21:29:59556 virtual GURL GetURLForGraphicsContext3D();
[email protected]65225772011-05-12 21:10:24557
[email protected]bee16aab2009-08-26 15:55:03558 // Sets the "hidden" state of this widget. All accesses to is_hidden_ should
559 // use this method so that we can properly inform the RenderThread of our
560 // state.
561 void SetHidden(bool hidden);
562
[email protected]2b624c562011-10-27 22:58:26563 void DidToggleFullscreen();
564
[email protected]674741932009-02-04 23:44:46565 bool next_paint_is_resize_ack() const;
[email protected]674741932009-02-04 23:44:46566 void set_next_paint_is_resize_ack();
[email protected]674741932009-02-04 23:44:46567 void set_next_paint_is_repaint_ack();
[email protected]ec7dc112008-08-06 05:30:12568
[email protected]586871b2014-07-22 17:05:11569 // QueueMessage implementation extracted into a static method for easy
570 // testing.
dchengcedca5612016-04-09 01:40:15571 static std::unique_ptr<cc::SwapPromise> QueueMessageImpl(
[email protected]586871b2014-07-22 17:05:11572 IPC::Message* msg,
573 MessageDeliveryPolicy policy,
574 FrameSwapMessageQueue* frame_swap_message_queue,
575 scoped_refptr<IPC::SyncMessageFilter> sync_message_filter,
[email protected]586871b2014-07-22 17:05:11576 int source_frame_number);
577
[email protected]58b48a0d2012-06-13 07:01:35578 // Override point to obtain that the current composition character bounds.
579 // In the case of surrogate pairs, the character is treated as two characters:
580 // the bounds for first character is actual one, and the bounds for second
581 // character is zero width rectangle.
582 virtual void GetCompositionCharacterBounds(
583 std::vector<gfx::Rect>* character_bounds);
584
[email protected]88dbe32f2013-06-20 23:31:36585 // Returns the range of the text that is being composed or the selection if
586 // the composition does not exist.
[email protected]db4fc1e2013-09-06 20:01:51587 virtual void GetCompositionRange(gfx::Range* range);
[email protected]88dbe32f2013-06-20 23:31:36588
[email protected]58b48a0d2012-06-13 07:01:35589 // Returns true if the composition range or composition character bounds
590 // should be sent to the browser process.
591 bool ShouldUpdateCompositionInfo(
[email protected]db4fc1e2013-09-06 20:01:51592 const gfx::Range& range,
[email protected]58b48a0d2012-06-13 07:01:35593 const std::vector<gfx::Rect>& bounds);
594
[email protected]ad26ef42011-06-17 07:59:45595 // Override point to obtain that the current input method state about
596 // composition text.
597 virtual bool CanComposeInline();
[email protected]56ea1a62011-05-30 07:05:57598
[email protected]2533ce12009-05-09 00:02:24599 // Set the pending window rect.
600 // Because the real render_widget is hosted in another process, there is
601 // a time period where we may have set a new window rect which has not yet
602 // been processed by the browser. So we maintain a pending window rect
603 // size. If JS code sets the WindowRect, and then immediately calls
604 // GetWindowRect() we'll use this pending window rect as the size.
[email protected]180ef242013-11-07 06:50:46605 void SetPendingWindowRect(const blink::WebRect& r);
[email protected]2533ce12009-05-09 00:02:24606
[email protected]ce6689f2013-03-29 12:52:55607 // Check whether the WebWidget has any touch event handlers registered.
avi5c77d212015-09-25 20:08:25608 void hasTouchEventHandlers(bool has_handlers) override;
[email protected]ce6689f2013-03-29 12:52:55609
[email protected]5d0bbdfa92013-12-10 00:35:51610 // Tell the browser about the actions permitted for a new touch point.
avi5c77d212015-09-25 20:08:25611 void setTouchAction(blink::WebTouchAction touch_action) override;
[email protected]5d0bbdfa92013-12-10 00:35:51612
lfg43e08e62016-02-03 18:51:37613 // Sends an ACK to the browser process during the next compositor frame.
614 void OnWaitNextFrameForTests(int routing_id);
615
initial.commit09911bf2008-07-26 23:55:29616 // Routing ID that allows us to communicate to the parent browser process
nick8331f8ad2016-11-15 20:42:45617 // RenderWidgetHost.
618 const int32_t routing_id_;
initial.commit09911bf2008-07-26 23:55:29619
danakj6e3bf8012014-12-16 18:27:53620 // Dependencies for initializing a compositor, including flags for optional
621 // features.
dcheng35d31c112015-07-22 00:17:36622 CompositorDependencies* const compositor_deps_;
danakj6e3bf8012014-12-16 18:27:53623
lfg8ff33912016-09-13 20:59:21624 // Use GetWebWidget() instead of using webwidget_internal_ directly.
[email protected]c5b3b5e2009-02-13 06:41:11625 // We are responsible for destroying this object via its Close method.
[email protected]4ee64622014-03-21 22:34:15626 // May be NULL when the window is closing.
lfg8ff33912016-09-13 20:59:21627 blink::WebWidget* webwidget_internal_;
initial.commit09911bf2008-07-26 23:55:29628
avi40b5be7a2016-03-03 21:13:44629 // The delegate of the owner of this object.
630 RenderWidgetOwnerDelegate* owner_delegate_;
631
[email protected]8926c602013-01-23 05:32:06632 // This is lazily constructed and must not outlive webwidget_.
dchengcedca5612016-04-09 01:40:15633 std::unique_ptr<RenderWidgetCompositor> compositor_;
[email protected]8926c602013-01-23 05:32:06634
bokanc007c3a2015-02-03 07:15:56635 // The rect where this view should be initially shown.
636 gfx::Rect initial_rect_;
initial.commit09911bf2008-07-26 23:55:29637
initial.commit09911bf2008-07-26 23:55:29638 // We store the current cursor object so we can avoid spamming SetCursor
639 // messages.
640 WebCursor current_cursor_;
[email protected]88efb7ec2009-07-14 16:32:59641
initial.commit09911bf2008-07-26 23:55:29642 // The size of the RenderWidget.
643 gfx::Size size_;
644
[email protected]60d47ac2013-03-01 23:42:44645 // The size of the view's backing surface in non-DPI-adjusted pixels.
646 gfx::Size physical_backing_size_;
647
[email protected]bb6378fe2014-04-28 21:19:44648 // The size of the visible viewport in DPI-adjusted pixels.
649 gfx::Size visible_viewport_size_;
650
[email protected]53d3f302009-12-21 04:42:05651 // Flags for the next ViewHostMsg_UpdateRect message.
initial.commit09911bf2008-07-26 23:55:29652 int next_paint_flags_;
653
[email protected]847a2582013-03-09 02:29:51654 // Whether the WebWidget is in auto resize mode, which is used for example
655 // by extension popups.
656 bool auto_resize_mode_;
657
[email protected]ea3ee0a2012-05-15 03:43:09658 // True if we need to send an UpdateRect message to notify the browser about
659 // an already-completed auto-resize.
660 bool need_update_rect_for_auto_resize_;
661
initial.commit09911bf2008-07-26 23:55:29662 // Set to true if we should ignore RenderWidget::Show calls.
663 bool did_show_;
664
665 // Indicates that we shouldn't bother generated paint events.
666 bool is_hidden_;
667
[email protected]7912e822014-04-16 02:37:03668 // Indicates that we are never visible, so never produce graphical output.
sievers71c62dd52015-10-07 01:44:39669 const bool compositor_never_visible_;
[email protected]7912e822014-04-16 02:37:03670
mikhail.pozdnyakovf2c902a2015-04-14 08:09:12671 // Indicates whether tab-initiated fullscreen was granted.
672 bool is_fullscreen_granted_;
[email protected]ee41e7d22011-10-14 19:34:09673
mikhail.pozdnyakovc0e251b2015-04-15 06:51:12674 // Indicates the display mode.
675 blink::WebDisplayMode display_mode_;
676
changwanf2a707b2015-10-30 08:22:16677 // It is possible that one ImeEventGuard is nested inside another
678 // ImeEventGuard. We keep track of the outermost one, and update it as needed.
679 ImeEventGuard* ime_event_guard_;
[email protected]e8f775f2013-02-14 21:00:50680
initial.commit09911bf2008-07-26 23:55:29681 // True if we have requested this widget be closed. No more messages will
682 // be sent, except for a Close.
683 bool closing_;
684
[email protected]aeeedad2014-08-22 18:16:22685 // True if it is known that the host is in the process of being shut down.
686 bool host_closing_;
687
[email protected]992db4c2011-05-12 15:37:15688 // Whether this RenderWidget is currently swapped out, such that the view is
689 // being rendered by another process. If all RenderWidgets in a process are
690 // swapped out, the process can exit.
691 bool is_swapped_out_;
692
simonhong628f9812015-04-27 23:13:20693 // Whether this RenderWidget is for an out-of-process iframe or not.
694 bool for_oopif_;
695
[email protected]5b739cb2012-08-21 20:35:21696 // Stores information about the current text input.
[email protected]180ef242013-11-07 06:50:46697 blink::WebTextInputInfo text_input_info_;
[email protected]5b739cb2012-08-21 20:35:21698
dglazkov97b6c2b2016-10-25 17:35:55699 // Stores the current text input type of |webwidget_|.
700 ui::TextInputType text_input_type_;
701
[email protected]b256eca2013-07-11 10:57:40702 // Stores the current text input mode of |webwidget_|.
703 ui::TextInputMode text_input_mode_;
704
shuchen82ce8c52014-10-23 01:55:20705 // Stores the current text input flags of |webwidget_|.
706 int text_input_flags_;
707
[email protected]86ba5fcb2013-09-04 00:36:53708 // Stores the current type of composition text rendering of |webwidget_|.
709 bool can_compose_inline_;
710
[email protected]e99ef6f2011-10-16 01:13:00711 // Stores the current selection bounds.
[email protected]7c8873e2013-02-05 08:03:01712 gfx::Rect selection_focus_rect_;
713 gfx::Rect selection_anchor_rect_;
initial.commit09911bf2008-07-26 23:55:29714
[email protected]58b48a0d2012-06-13 07:01:35715 // Stores the current composition character bounds.
716 std::vector<gfx::Rect> composition_character_bounds_;
717
718 // Stores the current composition range.
[email protected]db4fc1e2013-09-06 20:01:51719 gfx::Range composition_range_;
[email protected]58b48a0d2012-06-13 07:01:35720
[email protected]3e2b375b2010-04-07 17:03:12721 // The kind of popup this widget represents, NONE if not a popup.
[email protected]180ef242013-11-07 06:50:46722 blink::WebPopupType popup_type_;
[email protected]0ebf3872008-11-07 21:35:03723
[email protected]80ad8622012-11-07 16:33:03724 // While we are waiting for the browser to update window sizes, we track the
725 // pending size temporarily.
[email protected]2533ce12009-05-09 00:02:24726 int pending_window_rect_count_;
lfg0140a452016-07-19 19:15:05727 gfx::Rect pending_window_rect_;
[email protected]2533ce12009-05-09 00:02:24728
[email protected]80ad8622012-11-07 16:33:03729 // The screen rects of the view and the window that contains it.
730 gfx::Rect view_screen_rect_;
731 gfx::Rect window_screen_rect_;
732
dchengcedca5612016-04-09 01:40:15733 std::unique_ptr<RenderWidgetInputHandler> input_handler_;
[email protected]12fbad812009-09-01 18:21:24734
[email protected]fd847792013-10-24 17:12:35735 // The time spent in input handlers this frame. Used to throttle input acks.
736 base::TimeDelta total_input_handling_time_this_frame_;
737
[email protected]842f10652012-06-06 01:54:04738 // Properties of the screen hosting this RenderWidget instance.
ccameron2f451532016-09-07 21:49:27739 ScreenInfo screen_info_;
[email protected]842f10652012-06-06 01:54:04740
[email protected]f1cccb32012-06-06 18:29:59741 // The device scale factor. This value is computed from the DPI entries in
742 // |screen_info_| on some platforms, and defaults to 1 on other platforms.
[email protected]faec7b12012-06-19 14:42:13743 float device_scale_factor_;
[email protected]f1cccb32012-06-06 18:29:59744
engedy8d0ed9b2017-01-02 20:05:48745 // The device color profile on supported platforms.
746 std::vector<char> device_color_profile_;
747
[email protected]9017d7852013-11-21 17:47:35748 // State associated with synthetic gestures. Synthetic gestures are processed
749 // in-order, so a queue is sufficient to identify the correct state for a
750 // completed gesture.
751 std::queue<SyntheticGestureCompletionCallback>
752 pending_synthetic_gesture_callbacks_;
[email protected]0e241b4b2012-08-18 09:06:27753
nonafa291792016-08-10 02:36:18754 // True if the IME requests updated composition info.
755 bool monitor_composition_info_;
756
dchengcedca5612016-04-09 01:40:15757 std::unique_ptr<RenderWidgetScreenMetricsEmulator> screen_metrics_emulator_;
[email protected]b2e4c70132013-10-03 02:07:51758
759 // Popups may be displaced when screen metrics emulation is enabled.
760 // These values are used to properly adjust popup position.
danakj2ef31b82015-10-21 18:18:02761 gfx::Point popup_view_origin_for_emulation_;
762 gfx::Point popup_screen_origin_for_emulation_;
[email protected]b2e4c70132013-10-03 02:07:51763 float popup_origin_scale_for_emulation_;
764
[email protected]586871b2014-07-22 17:05:11765 scoped_refptr<FrameSwapMessageQueue> frame_swap_message_queue_;
dchengcedca5612016-04-09 01:40:15766 std::unique_ptr<ResizingModeSelector> resizing_mode_selector_;
[email protected]5b45ad42013-10-25 00:42:04767
[email protected]e3244ed2014-06-20 20:04:27768 // Lists of RenderFrameProxy objects that need to be notified of
769 // compositing-related events (e.g. DidCommitCompositorFrame).
brettw236d3172015-06-03 16:31:43770 base::ObserverList<RenderFrameProxy> render_frame_proxies_;
[email protected]bffc8302014-01-23 20:52:16771
[email protected]de3c5d82014-05-28 22:12:59772 // A list of RenderFrames associated with this RenderWidget. Notifications
773 // are sent to each frame in the list for events such as changing
774 // visibility state for example.
brettw236d3172015-06-03 16:31:43775 base::ObserverList<RenderFrameImpl> render_frames_;
[email protected]de3c5d82014-05-28 22:12:59776
[email protected]be1af0662014-07-29 19:55:51777 bool has_host_context_menu_location_;
778 gfx::Point host_context_menu_location_;
[email protected]a09d53ce2014-01-31 00:46:42779
skyostil529caa292016-08-10 17:44:51780 std::unique_ptr<blink::scheduler::RenderWidgetSchedulingState>
alexclarke7fa93942015-10-21 15:37:11781 render_widget_scheduling_state_;
782
lfgbee1e0a2016-06-08 21:24:21783 // Mouse Lock dispatcher attached to this view.
784 std::unique_ptr<RenderWidgetMouseLockDispatcher> mouse_lock_dispatcher_;
785
786 // Wraps the |webwidget_| as a MouseLockDispatcher::LockTarget interface.
787 std::unique_ptr<MouseLockDispatcher::LockTarget> webwidget_mouse_lock_target_;
788
oshima50872a72016-03-04 13:26:18789 private:
bokan841fdc72016-10-06 00:16:35790 // Applies/Removes the DevTools device emulation transformation to/from a
791 // window rect.
792 void ScreenRectToEmulatedIfNeeded(blink::WebRect* window_rect) const;
793 void EmulatedToScreenRectIfNeeded(blink::WebRect* window_rect) const;
794
dtapuska014ed082016-11-11 21:58:48795 bool CreateWidget(int32_t opener_id,
796 blink::WebPopupType popup_type,
797 int32_t* routing_id);
798
799 // A variant of Send but is fatal if it fails. The browser may
800 // be waiting for this IPC Message and if the send fails the browser will
801 // be left in a state waiting for something that never comes. And if it
802 // never comes then it may later determine this is a hung renderer; so
803 // instead fail right away.
804 void SendOrCrash(IPC::Message* msg);
805
lfge0c2792ec2016-05-11 18:52:08806 // Indicates whether this widget has focus.
807 bool has_focus_;
808
nickf7b38222016-11-22 21:59:35809 // A callback into the creator/opener of this widget, to be executed when
810 // WebWidgetClient::show() occurs.
811 ShowCallback show_callback_;
812
ekaramad330ba4232016-09-23 17:57:47813#if defined(OS_MACOSX)
814 // Responds to IPCs from TextInputClientMac regarding getting string at given
815 // position or range as well as finding character index at a given position.
816 std::unique_ptr<TextInputClientObserver> text_input_client_observer_;
817#endif
818
ekaramad2a46d632016-07-19 13:33:09819 // This reference is set by the RenderFrame and is used to query the IME-
820 // related state from the plugin to later send to the browser.
821 PepperPluginInstanceImpl* focused_pepper_plugin_;
822
alexmos56567492016-09-13 00:52:46823 // Stores edit commands associated to the next key event.
824 // Will be cleared as soon as the next key event is processed.
825 EditCommands edit_commands_;
826
paulmeyer6ef5a792016-11-08 20:33:58827 // This field stores drag/drop related info for the event that is currently
828 // being handled. If the current event results in starting a drag/drop
829 // session, this info is sent to the browser along with other drag/drop info.
830 DragEventSourceInfo possible_drag_event_info_;
831
[email protected]05d478752009-04-08 23:38:16832 DISALLOW_COPY_AND_ASSIGN(RenderWidget);
initial.commit09911bf2008-07-26 23:55:29833};
834
[email protected]e9ff79c2012-10-19 21:31:26835} // namespace content
836
[email protected]2cff0052011-03-18 16:51:44837#endif // CONTENT_RENDERER_RENDER_WIDGET_H_