blob: 9448836193ee61f095605ef36bdb7512ca0c7137 [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"
[email protected]9017d7852013-11-21 17:47:3525#include "content/common/input/synthetic_gesture_params.h"
mfomitchev2600fd7c2016-02-17 20:53:3926#include "content/renderer/devtools/render_widget_screen_metrics_emulator_delegate.h"
fsamuel78f86e42016-01-20 04:10:2327#include "content/renderer/gpu/render_widget_compositor_delegate.h"
fsamuel72464894f2015-12-15 06:59:3128#include "content/renderer/input/render_widget_input_handler.h"
29#include "content/renderer/input/render_widget_input_handler_delegate.h"
[email protected]586871b2014-07-22 17:05:1130#include "content/renderer/message_delivery_policy.h"
lfgbee1e0a2016-06-08 21:24:2131#include "content/renderer/mouse_lock_dispatcher.h"
32#include "content/renderer/render_widget_mouse_lock_dispatcher.h"
[email protected]4f86bdb2012-11-10 19:11:1933#include "ipc/ipc_listener.h"
34#include "ipc/ipc_sender.h"
mikhail.pozdnyakovc0e251b2015-04-15 06:51:1235#include "third_party/WebKit/public/platform/WebDisplayMode.h"
[email protected]5c30b5e02013-05-30 03:46:0836#include "third_party/WebKit/public/platform/WebRect.h"
[email protected]2255a9332013-06-17 05:12:3137#include "third_party/WebKit/public/web/WebCompositionUnderline.h"
[email protected]c27dd4f2014-05-22 18:05:1938#include "third_party/WebKit/public/web/WebInputEvent.h"
[email protected]2255a9332013-06-17 05:12:3139#include "third_party/WebKit/public/web/WebPopupType.h"
40#include "third_party/WebKit/public/web/WebTextDirection.h"
41#include "third_party/WebKit/public/web/WebTextInputInfo.h"
[email protected]5d0bbdfa92013-12-10 00:35:5142#include "third_party/WebKit/public/web/WebTouchAction.h"
[email protected]0e45bd02013-07-12 20:20:0243#include "third_party/WebKit/public/web/WebWidget.h"
[email protected]2255a9332013-06-17 05:12:3144#include "third_party/WebKit/public/web/WebWidgetClient.h"
[email protected]b256eca2013-07-11 10:57:4045#include "ui/base/ime/text_input_mode.h"
[email protected]ad26ef42011-06-17 07:59:4546#include "ui/base/ime/text_input_type.h"
[email protected]a09d53ce2014-01-31 00:46:4247#include "ui/base/ui_base_types.h"
tfarina93bfa912014-12-05 14:23:1548#include "ui/gfx/geometry/rect.h"
tfarina93bfa912014-12-05 14:23:1549#include "ui/gfx/geometry/vector2d_f.h"
[email protected]08397d52011-02-05 01:53:3850#include "ui/gfx/native_widget_types.h"
[email protected]db4fc1e2013-09-06 20:01:5151#include "ui/gfx/range/range.h"
[email protected]d353541f2012-05-03 22:45:4152#include "ui/surface/transport_dib.h"
initial.commit09911bf2008-07-26 23:55:2953
danakj870925d42016-05-03 20:07:3854class GURL;
55
[email protected]484955942010-08-19 16:13:1856namespace IPC {
57class SyncMessage;
[email protected]586871b2014-07-22 17:05:1158class SyncMessageFilter;
[email protected]484955942010-08-19 16:13:1859}
60
[email protected]180ef242013-11-07 06:50:4661namespace blink {
skyostil529caa292016-08-10 17:44:5162namespace scheduler {
63class RenderWidgetSchedulingState;
64}
[email protected]19193682014-04-03 15:01:4365struct WebDeviceEmulationParams;
lfgcaab5142016-02-26 19:06:5266class WebFrameWidget;
[email protected]41d86852012-11-07 12:23:2467class WebGestureEvent;
kenrba7199832015-01-22 23:44:5968class WebLocalFrame;
[email protected]6a8ddba52010-09-05 04:38:0669class WebMouseEvent;
donnda070f3c2015-01-16 19:54:1170class WebNode;
71struct WebPoint;
[email protected]526476902011-10-06 20:34:0672}
73
[email protected]586871b2014-07-22 17:05:1174namespace cc {
75class OutputSurface;
76class SwapPromise;
77}
[email protected]ba91a792013-02-06 09:48:2878
[email protected]db4fc1e2013-09-06 20:01:5179namespace gfx {
[email protected]4de6d1692011-10-12 08:45:4480class Range;
81}
82
chongza8ba91fc2016-08-16 21:39:1783namespace ui {
84struct DidOverscrollParams;
85}
86
[email protected]e9ff79c2012-10-19 21:31:2687namespace content {
danakj6e3bf8012014-12-16 18:27:5388class CompositorDependencies;
[email protected]b2e4c70132013-10-03 02:07:5189class ExternalPopupMenu;
[email protected]586871b2014-07-22 17:05:1190class FrameSwapMessageQueue;
changwanf2a707b2015-10-30 08:22:1691class ImeEventGuard;
ekaramad2a46d632016-07-19 13:33:0992class PepperPluginInstanceImpl;
[email protected]bffc8302014-01-23 20:52:1693class RenderFrameImpl;
[email protected]e3244ed2014-06-20 20:04:2794class RenderFrameProxy;
[email protected]ba91a792013-02-06 09:48:2895class RenderWidgetCompositor;
avi40b5be7a2016-03-03 21:13:4496class RenderWidgetOwnerDelegate;
mfomitchev2600fd7c2016-02-17 20:53:3997class RenderWidgetScreenMetricsEmulator;
[email protected]5b45ad42013-10-25 00:42:0498class ResizingModeSelector;
[email protected]b2e4c70132013-10-03 02:07:5199struct ContextMenuParams;
fsamuel664e8b62016-01-20 19:54:01100struct ResizeParams;
[email protected]e9ff79c2012-10-19 21:31:26101
initial.commit09911bf2008-07-26 23:55:29102// RenderWidget provides a communication bridge between a WebWidget and
103// a RenderWidgetHost, the latter of which lives in a different process.
dchengd96a27a2015-07-24 20:17:32104//
105// RenderWidget is used to implement:
106// - RenderViewImpl (deprecated)
107// - Fullscreen mode (RenderWidgetFullScreen)
108// - Popup "menus" (like the color chooser and date picker)
109// - Widgets for frames (for out-of-process iframe support)
[email protected]f3112a52011-09-30 23:47:49110class CONTENT_EXPORT RenderWidget
[email protected]c47317e2012-06-20 22:35:31111 : public IPC::Listener,
112 public IPC::Sender,
[email protected]180ef242013-11-07 06:50:46113 NON_EXPORTED_BASE(virtual public blink::WebWidgetClient),
fsamuel78f86e42016-01-20 04:10:23114 public RenderWidgetCompositorDelegate,
fsamuel72464894f2015-12-15 06:59:31115 public RenderWidgetInputHandlerDelegate,
mfomitchev2600fd7c2016-02-17 20:53:39116 public RenderWidgetScreenMetricsEmulatorDelegate,
[email protected]f3112a52011-09-30 23:47:49117 public base::RefCounted<RenderWidget> {
initial.commit09911bf2008-07-26 23:55:29118 public:
119 // Creates a new RenderWidget. The opener_id is the routing ID of the
[email protected]380244092011-10-07 17:26:27120 // RenderView that this widget lives inside.
avi1023d012015-12-25 02:39:14121 static RenderWidget* Create(int32_t opener_id,
danakj6e3bf8012014-12-16 18:27:53122 CompositorDependencies* compositor_deps,
[email protected]180ef242013-11-07 06:50:46123 blink::WebPopupType popup_type,
124 const blink::WebScreenInfo& screen_info);
initial.commit09911bf2008-07-26 23:55:29125
kenrba7199832015-01-22 23:44:59126 // Creates a new RenderWidget that will be attached to a RenderFrame.
127 static RenderWidget* CreateForFrame(int routing_id,
kenrba7199832015-01-22 23:44:59128 bool hidden,
129 const blink::WebScreenInfo& screen_info,
130 CompositorDependencies* compositor_deps,
131 blink::WebLocalFrame* frame);
132
lfg1568d112016-08-30 16:06:29133 // Used by content_layouttest_support to hook into the creation of
134 // RenderWidgets.
135 using CreateRenderWidgetFunction =
136 RenderWidget* (*)(CompositorDependencies*,
137 blink::WebPopupType,
138 const blink::WebScreenInfo&,
139 bool,
140 bool,
141 bool);
142 using RenderWidgetInitializedCallback = void (*)(RenderWidget*);
143 static void InstallCreateHook(
144 CreateRenderWidgetFunction create_render_widget,
145 RenderWidgetInitializedCallback render_widget_initialized_callback);
146
dchengda9b4bb2015-07-20 20:58:08147 // Closes a RenderWidget that was created by |CreateForFrame|.
dcheng3ce04b62015-10-26 23:30:55148 // TODO(avi): De-virtualize this once RenderViewImpl has-a RenderWidget.
149 // https://crbug.com/545684
150 virtual void CloseForFrame();
[email protected]484955942010-08-19 16:13:18151
avi1023d012015-12-25 02:39:14152 int32_t routing_id() const { return routing_id_; }
fsamuele8326c742016-01-12 00:49:39153 void SetRoutingID(int32_t routing_id);
154
danakj6e3bf8012014-12-16 18:27:53155 CompositorDependencies* compositor_deps() const { return compositor_deps_; }
[email protected]180ef242013-11-07 06:50:46156 blink::WebWidget* webwidget() const { return webwidget_; }
mfomitchev2600fd7c2016-02-17 20:53:39157 const gfx::Size& size() const { return size_; }
mikhail.pozdnyakovf2c902a2015-04-14 08:09:12158 bool is_fullscreen_granted() const { return is_fullscreen_granted_; }
mikhail.pozdnyakovc0e251b2015-04-15 06:51:12159 blink::WebDisplayMode display_mode() const { return display_mode_; }
[email protected]204f1df2012-01-04 20:21:13160 bool is_hidden() const { return is_hidden_; }
[email protected]4ee64622014-03-21 22:34:15161 // Temporary for debugging purposes...
162 bool closing() const { return closing_; }
163 bool is_swapped_out() { return is_swapped_out_; }
[email protected]be1af0662014-07-29 19:55:51164 bool has_host_context_menu_location() {
165 return has_host_context_menu_location_;
166 }
167 gfx::Point host_context_menu_location() {
168 return host_context_menu_location_;
[email protected]4ee64622014-03-21 22:34:15169 }
[email protected]589621b2010-09-23 22:01:07170
avi40b5be7a2016-03-03 21:13:44171 void set_owner_delegate(RenderWidgetOwnerDelegate* owner_delegate) {
172 DCHECK(!owner_delegate_);
173 owner_delegate_ = owner_delegate;
174 }
175
176 RenderWidgetOwnerDelegate* owner_delegate() { return owner_delegate_; }
177
kenrba7199832015-01-22 23:44:59178 // ScreenInfo exposed so it can be passed to subframe RenderWidgets.
179 blink::WebScreenInfo screen_info() const { return screen_info_; }
180
[email protected]bffc8302014-01-23 20:52:16181 // Functions to track out-of-process frames for special notifications.
[email protected]e3244ed2014-06-20 20:04:27182 void RegisterRenderFrameProxy(RenderFrameProxy* proxy);
183 void UnregisterRenderFrameProxy(RenderFrameProxy* proxy);
[email protected]bffc8302014-01-23 20:52:16184
[email protected]de3c5d82014-05-28 22:12:59185 // Functions to track all RenderFrame objects associated with this
186 // RenderWidget.
187 void RegisterRenderFrame(RenderFrameImpl* frame);
188 void UnregisterRenderFrame(RenderFrameImpl* frame);
189
[email protected]a017938b2014-05-27 21:17:17190#if defined(VIDEO_HOLE)
191 void RegisterVideoHoleFrame(RenderFrameImpl* frame);
192 void UnregisterVideoHoleFrame(RenderFrameImpl* frame);
193#endif // defined(VIDEO_HOLE)
194
[email protected]c47317e2012-06-20 22:35:31195 // IPC::Listener
dcheng6d18e402014-10-21 12:32:52196 bool OnMessageReceived(const IPC::Message& msg) override;
initial.commit09911bf2008-07-26 23:55:29197
[email protected]c47317e2012-06-20 22:35:31198 // IPC::Sender
dcheng6d18e402014-10-21 12:32:52199 bool Send(IPC::Message* msg) override;
initial.commit09911bf2008-07-26 23:55:29200
dtapuska3d5624d32016-08-30 04:34:00201 // Requests a BeginMainFrame callback from the compositor.
202 void SetNeedsMainFrame();
203
fsamuel78f86e42016-01-20 04:10:23204 // RenderWidgetCompositorDelegate
205 void ApplyViewportDeltas(const gfx::Vector2dF& inner_delta,
206 const gfx::Vector2dF& outer_delta,
207 const gfx::Vector2dF& elastic_overscroll_delta,
208 float page_scale,
209 float top_controls_delta) override;
210 void BeginMainFrame(double frame_time_sec) override;
dchengcedca5612016-04-09 01:40:15211 std::unique_ptr<cc::OutputSurface> CreateOutputSurface(
212 bool fallback) override;
213 std::unique_ptr<cc::BeginFrameSource> CreateExternalBeginFrameSource()
214 override;
fsamuel78f86e42016-01-20 04:10:23215 void DidCommitAndDrawCompositorFrame() override;
216 void DidCommitCompositorFrame() override;
217 void DidCompletePageScaleAnimation() override;
218 void DidCompleteSwapBuffers() override;
fsamuel78f86e42016-01-20 04:10:23219 void ForwardCompositorProto(const std::vector<uint8_t>& proto) override;
220 bool IsClosing() const override;
221 void OnSwapBuffersAborted() override;
222 void OnSwapBuffersComplete() override;
223 void OnSwapBuffersPosted() override;
danakj53eccbc2016-03-02 22:51:07224 void RequestScheduleAnimation() override;
fsamuel78f86e42016-01-20 04:10:23225 void UpdateVisualState() override;
226 void WillBeginCompositorFrame() override;
jbroman6ccbc7d472016-07-27 04:45:41227 std::unique_ptr<cc::SwapPromise> RequestCopyOfOutputForLayoutTest(
228 std::unique_ptr<cc::CopyOutputRequest> request) override;
fsamuel78f86e42016-01-20 04:10:23229
fsamuel72464894f2015-12-15 06:59:31230 // RenderWidgetInputHandlerDelegate
231 void FocusChangeComplete() override;
232 bool HasTouchEventHandlersAt(const gfx::Point& point) const override;
dtapuska1827dd22016-03-11 15:24:59233 void ObserveGestureEventAndResult(const blink::WebGestureEvent& gesture_event,
234 const gfx::Vector2dF& unused_delta,
235 bool event_processed) override;
236
fsamuel72464894f2015-12-15 06:59:31237 void OnDidHandleKeyEvent() override;
chongza8ba91fc2016-08-16 21:39:17238 void OnDidOverscroll(const ui::DidOverscrollParams& params) override;
dchengcedca5612016-04-09 01:40:15239 void OnInputEventAck(std::unique_ptr<InputEventAck> input_event_ack) override;
dtapuskab08721e62016-06-29 03:35:07240 void NotifyInputEventHandled(blink::WebInputEvent::Type handled_type,
241 InputEventAckState ack_result) override;
fsamuele8326c742016-01-12 00:49:39242 void SetInputHandler(RenderWidgetInputHandler* input_handler) override;
fsamuel72464894f2015-12-15 06:59:31243 void UpdateTextInputState(ShowIme show_ime,
244 ChangeSource change_source) override;
245 bool WillHandleGestureEvent(const blink::WebGestureEvent& event) override;
246 bool WillHandleMouseEvent(const blink::WebMouseEvent& event) override;
247
mfomitchev2600fd7c2016-02-17 20:53:39248 // RenderWidgetScreenMetricsDelegate
249 void Redraw() override;
250 void Resize(const ResizeParams& resize_params) override;
251 void SetScreenMetricsEmulationParameters(
252 bool enabled,
253 const blink::WebDeviceEmulationParams& params) override;
254 void SetScreenRects(const gfx::Rect& view_screen_rect,
255 const gfx::Rect& window_screen_rect) override;
256
[email protected]180ef242013-11-07 06:50:46257 // blink::WebWidgetClient
avi5c77d212015-09-25 20:08:25258 void initializeLayerTreeView() override;
259 blink::WebLayerTreeView* layerTreeView() override;
dglazkovf0e1d6d2015-10-10 02:13:48260 void didMeaningfulLayout(blink::WebMeaningfulLayout layout_type) override;
avi5c77d212015-09-25 20:08:25261 void didChangeCursor(const blink::WebCursorInfo&) override;
262 void closeWidgetSoon() override;
263 void show(blink::WebNavigationPolicy) override;
264 blink::WebRect windowRect() override;
265 void setToolTipText(const blink::WebString& text,
266 blink::WebTextDirection hint) override;
267 void setWindowRect(const blink::WebRect&) override;
268 blink::WebRect windowResizerRect() override;
avi5c77d212015-09-25 20:08:25269 blink::WebScreenInfo screenInfo() override;
avi5c77d212015-09-25 20:08:25270 void resetInputMethod() override;
271 void didHandleGestureEvent(const blink::WebGestureEvent& event,
272 bool event_cancelled) override;
bokane53a10f2016-04-13 23:48:31273 void didOverscroll(const blink::WebFloatSize& overscrollDelta,
274 const blink::WebFloatSize& accumulatedOverscroll,
avi5c77d212015-09-25 20:08:25275 const blink::WebFloatPoint& position,
276 const blink::WebFloatSize& velocity) override;
277 void showImeIfNeeded() override;
oshima581cf3f62015-12-16 20:08:01278 void convertViewportToWindow(blink::WebRect* rect) override;
oshimaa6985b62016-01-27 08:58:30279 void convertWindowToViewport(blink::WebFloatRect* rect) override;
lfgbee1e0a2016-06-08 21:24:21280 bool requestPointerLock() override;
281 void requestPointerUnlock() override;
282 bool isPointerLocked() override;
[email protected]4873c7d2009-07-16 06:36:28283
fsamuel72464894f2015-12-15 06:59:31284 // Override point to obtain that the current input method state and caret
285 // position.
286 virtual ui::TextInputType GetTextInputType();
287 virtual ui::TextInputType WebKitToUiTextInputType(
288 blink::WebTextInputType type);
289
donnda070f3c2015-01-16 19:54:11290#if defined(OS_ANDROID)
291 // Notifies that a tap was not consumed, so showing a UI for the unhandled
292 // tap may be needed.
donnd57e54f52015-02-26 19:03:37293 // Performs various checks on the given WebNode to apply heuristics to
294 // determine if triggering is appropriate.
avi5c77d212015-09-25 20:08:25295 void showUnhandledTapUIIfNeeded(const blink::WebPoint& tapped_position,
296 const blink::WebNode& tapped_node,
297 bool page_changed) override;
donnda070f3c2015-01-16 19:54:11298#endif
299
[email protected]7912e822014-04-16 02:37:03300 // Begins the compositor's scheduler to start producing frames.
301 void StartCompositor();
302
[email protected]aeeedad2014-08-22 18:16:22303 // Stop compositing.
ennef3c58142014-12-09 21:44:38304 void WillCloseLayerTreeView();
[email protected]aeeedad2014-08-22 18:16:22305
[email protected]24ed0432013-04-24 07:50:31306 RenderWidgetCompositor* compositor() const;
307
fsamuel72464894f2015-12-15 06:59:31308 const RenderWidgetInputHandler& input_handler() const {
fsamuele8326c742016-01-12 00:49:39309 return *input_handler_;
fsamuel72464894f2015-12-15 06:59:31310 }
311
312 void SetHandlingInputEventForTesting(bool handling_input_event);
313
314 // When paused in debugger, we send ack for mouse event early. This ensures
315 // that we continue receiving mouse moves and pass them to debugger. Returns
316 // whether we are paused in mouse move event and have sent the ack.
317 bool SendAckForMouseMoveFromDebugger();
318
319 // When resumed from pause in debugger while handling mouse move,
320 // we should not send an extra ack (see SendAckForMouseMoveFromDebugger).
321 void IgnoreAckForMouseMoveFromDebugger();
322
[email protected]79fa22e2013-08-23 15:18:12323 // Callback for use with synthetic gestures (e.g. BeginSmoothScroll).
324 typedef base::Callback<void()> SyntheticGestureCompletionCallback;
[email protected]0e241b4b2012-08-18 09:06:27325
[email protected]9017d7852013-11-21 17:47:35326 // Send a synthetic gesture to the browser to be queued to the synthetic
327 // gesture controller.
328 void QueueSyntheticGesture(
dchengcedca5612016-04-09 01:40:15329 std::unique_ptr<SyntheticGestureParams> gesture_params,
[email protected]9017d7852013-11-21 17:47:35330 const SyntheticGestureCompletionCallback& callback);
[email protected]1e1dd182013-09-12 01:51:15331
[email protected]586871b2014-07-22 17:05:11332 // Deliveres |message| together with compositor state change updates. The
333 // exact behavior depends on |policy|.
334 // This mechanism is not a drop-in replacement for IPC: messages sent this way
335 // will not be automatically available to BrowserMessageFilter, for example.
336 // FIFO ordering is preserved between messages enqueued with the same
337 // |policy|, the ordering between messages enqueued for different policies is
338 // undefined.
339 //
340 // |msg| message to send, ownership of |msg| is transferred.
341 // |policy| see the comment on MessageDeliveryPolicy.
342 void QueueMessage(IPC::Message* msg, MessageDeliveryPolicy policy);
343
changwan8c342742016-02-26 00:53:39344 // Check whether IME thread is being used or not.
345 bool IsUsingImeThread();
346
changwanf2a707b2015-10-30 08:22:16347 // Handle start and finish of IME event guard.
348 void OnImeEventGuardStart(ImeEventGuard* guard);
349 void OnImeEventGuardFinish(ImeEventGuard* guard);
[email protected]66fca5bc2013-05-23 06:58:29350
[email protected]4ee64622014-03-21 22:34:15351 // Returns whether we currently should handle an IME event.
352 bool ShouldHandleImeEvent();
353
mfomitchev2600fd7c2016-02-17 20:53:39354 void SetPopupOriginAdjustmentsForEmulation(
355 RenderWidgetScreenMetricsEmulator* emulator);
[email protected]b2e4c70132013-10-03 02:07:51356
[email protected]2d6836f42014-07-02 17:25:31357 gfx::Rect AdjustValidationMessageAnchor(const gfx::Rect& anchor);
[email protected]b2e4c70132013-10-03 02:07:51358
jdduke491a3f0c2015-06-15 23:30:26359
360 void ScheduleComposite();
[email protected]7d08a9352013-10-15 08:24:56361 void ScheduleCompositeWithForcedRedraw();
362
[email protected]7a4e2532013-12-02 21:30:02363 // Checks if the selection bounds have been changed. If they are changed,
364 // the new value will be sent to the browser process.
365 void UpdateSelectionBounds();
366
[email protected]e5e438d62014-03-27 21:47:16367 virtual void GetSelectionBounds(gfx::Rect* start, gfx::Rect* end);
368
[email protected]a09d53ce2014-01-31 00:46:42369 void OnShowHostContextMenu(ContextMenuParams* params);
[email protected]7a4e2532013-12-02 21:30:02370
[email protected]7a4e2532013-12-02 21:30:02371 // Checks if the composition range or composition character bounds have been
372 // changed. If they are changed, the new value will be sent to the browser
yukawa5f21c6a2014-10-27 17:09:30373 // process. This method does nothing when the browser process is not able to
374 // handle composition range and composition character bounds.
nonafa291792016-08-10 02:36:18375 // If immediate_request is true, render sends the latest composition info to
376 // the browser even if the composition info is not changed.
377 void UpdateCompositionInfo(bool immediate_request);
[email protected]7a4e2532013-12-02 21:30:02378
avi40b5be7a2016-03-03 21:13:44379 // Change the device ICC color profile while running a layout test.
380 void SetDeviceColorProfileForTesting(const std::vector<char>& color_profile);
avi40b5be7a2016-03-03 21:13:44381
lfgb00fcad2016-07-14 14:16:33382 // Called when the Widget has changed size as a result of an auto-resize.
383 void DidAutoResize(const gfx::Size& new_size);
384
lfg0140a452016-07-19 19:15:05385 // Called to get the position of the root window containing the widget in
386 // screen coordinates.
387 gfx::Rect RootWindowRect();
388
lfge0c2792ec2016-05-11 18:52:08389 // Indicates whether this widget has focus.
390 bool has_focus() const { return has_focus_; }
391
lfgbee1e0a2016-06-08 21:24:21392 MouseLockDispatcher* mouse_lock_dispatcher() {
393 return mouse_lock_dispatcher_.get();
394 }
395
ekaramad2a46d632016-07-19 13:33:09396 void set_focused_pepper_plugin(PepperPluginInstanceImpl* plugin) {
397 focused_pepper_plugin_ = plugin;
398 }
399
lfg1f9011c2016-08-17 21:18:42400 // When emulated, this returns original device scale factor.
401 float GetOriginalDeviceScaleFactor() const;
402
initial.commit09911bf2008-07-26 23:55:29403 protected:
[email protected]8085dbc82008-09-26 22:53:44404 // Friend RefCounted so that the dtor can be non-public. Using this class
405 // without ref-counting is an error.
406 friend class base::RefCounted<RenderWidget>;
fsamuele8326c742016-01-12 00:49:39407
[email protected]7339cd22010-10-27 00:11:20408 // For unit tests.
[email protected]e9ff79c2012-10-19 21:31:26409 friend class RenderWidgetTest;
[email protected]8085dbc82008-09-26 22:53:44410
[email protected]61e2b3cc2012-03-02 16:13:34411 enum ResizeAck {
412 SEND_RESIZE_ACK,
413 NO_RESIZE_ACK,
414 };
415
dcheng35d31c112015-07-22 00:17:36416 RenderWidget(CompositorDependencies* compositor_deps,
417 blink::WebPopupType popup_type,
[email protected]180ef242013-11-07 06:50:46418 const blink::WebScreenInfo& screen_info,
[email protected]1ac10dca2013-08-20 20:47:04419 bool swapped_out,
[email protected]7912e822014-04-16 02:37:03420 bool hidden,
421 bool never_visible);
[email protected]ce2b28e2012-08-09 15:53:57422
dcheng6d18e402014-10-21 12:32:52423 ~RenderWidget() override;
initial.commit09911bf2008-07-26 23:55:29424
lfgcaab5142016-02-26 19:06:52425 static blink::WebFrameWidget* CreateWebFrameWidget(
426 RenderWidget* render_widget,
427 blink::WebLocalFrame* frame);
dchengda9b4bb2015-07-20 20:58:08428
429 // Creates a WebWidget based on the popup type.
430 static blink::WebWidget* CreateWebWidget(RenderWidget* render_widget);
431
pimanc4af3072015-10-02 03:45:59432 // Initializes this view with the given opener.
avi1023d012015-12-25 02:39:14433 bool Init(int32_t opener_id);
initial.commit09911bf2008-07-26 23:55:29434
[email protected]484955942010-08-19 16:13:18435 // Called by Init and subclasses to perform initialization.
avi1023d012015-12-25 02:39:14436 bool DoInit(int32_t opener_id,
[email protected]180ef242013-11-07 06:50:46437 blink::WebWidget* web_widget,
[email protected]484955942010-08-19 16:13:18438 IPC::SyncMessage* create_widget_message);
439
[email protected]992db4c2011-05-12 15:37:15440 // Sets whether this RenderWidget has been swapped out to be displayed by
441 // a RenderWidget in a different process. If so, no new IPC messages will be
442 // sent (only ACKs) and the process is free to exit when there are no other
443 // active RenderWidgets.
444 void SetSwappedOut(bool is_swapped_out);
445
[email protected]949b6592014-08-20 13:17:52446 // Allows the process to exit once the unload handler has finished, if there
447 // are no other active RenderWidgets.
448 void WasSwappedOut();
449
[email protected]2533ce12009-05-09 00:02:24450 void DoDeferredClose();
dgozmancf9039cd2015-04-06 12:01:31451 void NotifyOnClose();
dchengda9b4bb2015-07-20 20:58:08452
bokanc63441c2016-04-27 15:49:12453 gfx::Size GetSizeForWebWidget() const;
454 virtual void ResizeWebWidget();
455
dchengda9b4bb2015-07-20 20:58:08456 // Close the underlying WebWidget.
457 virtual void Close();
initial.commit09911bf2008-07-26 23:55:29458
[email protected]92650162013-10-30 03:31:02459 // Used to force the size of a window when running layout tests.
bokanc007c3a2015-02-03 07:15:56460 void SetWindowRectSynchronously(const gfx::Rect& new_window_rect);
haibinluc643d33c2016-06-03 02:22:34461#if defined(USE_EXTERNAL_POPUP_MENU)
[email protected]b2e4c70132013-10-03 02:07:51462 void SetExternalPopupOriginAdjustmentsForEmulation(
mfomitchev2600fd7c2016-02-17 20:53:39463 ExternalPopupMenu* popup,
464 RenderWidgetScreenMetricsEmulator* emulator);
[email protected]53907862014-03-25 15:42:40465#endif
[email protected]61e2b3cc2012-03-02 16:13:34466
initial.commit09911bf2008-07-26 23:55:29467 // RenderWidget IPC message handlers
[email protected]180ef242013-11-07 06:50:46468 void OnHandleInputEvent(const blink::WebInputEvent* event,
dtapuska0bd451a2016-02-18 17:08:10469 const ui::LatencyInfo& latency_info,
470 InputEventDispatchType dispatch_type);
[email protected]34202de2013-05-06 23:36:22471 void OnCursorVisibilityChange(bool is_visible);
[email protected]c084330e02013-04-27 01:08:15472 void OnMouseCaptureLost();
473 virtual void OnSetFocus(bool enable);
naskoc288745f2015-05-01 22:54:21474 void OnClose();
[email protected]fc4404d2012-11-07 19:53:30475 void OnCreatingNewAck();
fsamuel664e8b62016-01-20 19:54:01476 virtual void OnResize(const ResizeParams& params);
dgozman9260b0a12015-03-16 13:45:20477 void OnEnableDeviceEmulation(const blink::WebDeviceEmulationParams& params);
478 void OnDisableDeviceEmulation();
[email protected]b5913d72012-02-07 22:26:54479 void OnChangeResizeRect(const gfx::Rect& resizer_rect);
[email protected]941e4552010-02-01 21:23:43480 virtual void OnWasHidden();
[email protected]3399dd822014-08-09 11:14:24481 virtual void OnWasShown(bool needs_repainting,
482 const ui::LatencyInfo& latency_info);
avi1023d012015-12-25 02:39:14483 void OnCreateVideoAck(int32_t video_id);
484 void OnUpdateVideoAck(int32_t video_id);
[email protected]2533ce12009-05-09 00:02:24485 void OnRequestMoveAck();
[email protected]56ea1a62011-05-30 07:05:57486 virtual void OnImeSetComposition(
[email protected]fcf75d42013-12-03 20:11:26487 const base::string16& text,
[email protected]180ef242013-11-07 06:50:46488 const std::vector<blink::WebCompositionUnderline>& underlines,
chongz7eb752802016-01-27 21:28:07489 const gfx::Range& replacement_range,
[email protected]fa7b1dc2010-06-23 17:53:04490 int selection_start,
491 int selection_end);
[email protected]fcf75d42013-12-03 20:11:26492 virtual void OnImeConfirmComposition(const base::string16& text,
[email protected]db4fc1e2013-09-06 20:01:51493 const gfx::Range& replacement_range,
[email protected]0e45bd02013-07-12 20:20:02494 bool keep_selection);
oshimad5279032015-12-16 18:22:33495 // Called when the device scale factor is changed, or the layer tree is
496 // initialized.
497 virtual void OnDeviceScaleFactorChanged();
498
[email protected]0bc1f572013-04-17 01:46:31499 void OnRepaint(gfx::Size size_to_paint);
[email protected]79fa22e2013-08-23 15:18:12500 void OnSyntheticGestureCompleted();
[email protected]180ef242013-11-07 06:50:46501 void OnSetTextDirection(blink::WebTextDirection direction);
[email protected]872ae5b2011-05-26 20:20:50502 void OnGetFPS();
[email protected]80ad8622012-11-07 16:33:03503 void OnUpdateScreenRects(const gfx::Rect& view_screen_rect,
504 const gfx::Rect& window_screen_rect);
lfgdb5c4ed2016-03-04 23:09:07505 void OnUpdateWindowScreenRect(const gfx::Rect& window_screen_rect);
[email protected]2384b6c2013-02-28 23:58:51506 void OnShowImeIfNeeded();
fsamuel278664272016-07-13 04:06:59507 void OnSetSurfaceClientId(uint32_t surface_id_namespace);
dtrainor5ef644e2015-11-19 00:12:47508 void OnHandleCompositorProto(const std::vector<uint8_t>& proto);
[email protected]0d1ebed12013-08-05 22:01:13509
[email protected]adb362312014-06-28 06:04:24510#if defined(OS_ANDROID)
changwan3a841162015-08-11 02:53:37511 // Called when we send IME event that expects an ACK.
512 void OnImeEventSentForAck(const blink::WebTextInputInfo& info);
[email protected]0d1ebed12013-08-05 22:01:13513
514 // Called by the browser process for every required IME acknowledgement.
515 void OnImeEventAck();
changwan8c342742016-02-26 00:53:39516
517 // Called by the browser process to update text input state.
518 void OnRequestTextInputStateUpdate();
[email protected]105dffb42013-02-20 03:46:21519#endif
[email protected]0d1ebed12013-08-05 22:01:13520
nonafa291792016-08-10 02:36:18521 // Called by the browser process to update the cursor and composition
522 // information.
523 void OnRequestCompositionUpdate(bool immediate_request, bool monitor_request);
524
[email protected]847a2582013-03-09 02:29:51525 // Notify the compositor about a change in viewport size. This should be
526 // used only with auto resize mode WebWidgets, as normal WebWidgets should
527 // go through OnResize.
[email protected]97e1bf72013-03-06 14:06:05528 void AutoResizeCompositor();
529
wjmaclean8a795f32016-08-11 23:49:58530 virtual void OnSetDeviceScaleFactor(float device_scale_factor);
avi40b5be7a2016-03-03 21:13:44531 bool SetDeviceColorProfile(const std::vector<char>& color_profile);
[email protected]468ac582012-11-20 00:53:19532
[email protected]fcdc5642014-05-09 14:32:24533 virtual void OnOrientationChange();
534
[email protected]29ed96a2012-02-04 18:12:16535 // Override points to notify derived classes that a paint has happened.
[email protected]0704ac32013-10-03 15:24:22536 // DidInitiatePaint happens when that has completed, and subsequent rendering
537 // won't affect the painted content. DidFlushPaint happens once we've received
538 // the ACK that the screen has been updated. For a given paint operation,
539 // these overrides will always be called in the order DidInitiatePaint,
540 // DidFlushPaint.
lfge0c2792ec2016-05-11 18:52:08541 virtual void DidInitiatePaint() {}
avib9dbd972016-03-08 18:19:32542 virtual void DidFlushPaint();
[email protected]a2f6bc112009-06-27 16:27:25543
[email protected]ed7defa2013-03-12 21:29:59544 virtual GURL GetURLForGraphicsContext3D();
[email protected]65225772011-05-12 21:10:24545
[email protected]bee16aab2009-08-26 15:55:03546 // Sets the "hidden" state of this widget. All accesses to is_hidden_ should
547 // use this method so that we can properly inform the RenderThread of our
548 // state.
549 void SetHidden(bool hidden);
550
[email protected]2b624c562011-10-27 22:58:26551 void DidToggleFullscreen();
552
[email protected]674741932009-02-04 23:44:46553 bool next_paint_is_resize_ack() const;
[email protected]674741932009-02-04 23:44:46554 void set_next_paint_is_resize_ack();
[email protected]674741932009-02-04 23:44:46555 void set_next_paint_is_repaint_ack();
[email protected]ec7dc112008-08-06 05:30:12556
[email protected]586871b2014-07-22 17:05:11557 // QueueMessage implementation extracted into a static method for easy
558 // testing.
dchengcedca5612016-04-09 01:40:15559 static std::unique_ptr<cc::SwapPromise> QueueMessageImpl(
[email protected]586871b2014-07-22 17:05:11560 IPC::Message* msg,
561 MessageDeliveryPolicy policy,
562 FrameSwapMessageQueue* frame_swap_message_queue,
563 scoped_refptr<IPC::SyncMessageFilter> sync_message_filter,
[email protected]586871b2014-07-22 17:05:11564 int source_frame_number);
565
[email protected]58b48a0d2012-06-13 07:01:35566 // Override point to obtain that the current composition character bounds.
567 // In the case of surrogate pairs, the character is treated as two characters:
568 // the bounds for first character is actual one, and the bounds for second
569 // character is zero width rectangle.
570 virtual void GetCompositionCharacterBounds(
571 std::vector<gfx::Rect>* character_bounds);
572
[email protected]88dbe32f2013-06-20 23:31:36573 // Returns the range of the text that is being composed or the selection if
574 // the composition does not exist.
[email protected]db4fc1e2013-09-06 20:01:51575 virtual void GetCompositionRange(gfx::Range* range);
[email protected]88dbe32f2013-06-20 23:31:36576
[email protected]58b48a0d2012-06-13 07:01:35577 // Returns true if the composition range or composition character bounds
578 // should be sent to the browser process.
579 bool ShouldUpdateCompositionInfo(
[email protected]db4fc1e2013-09-06 20:01:51580 const gfx::Range& range,
[email protected]58b48a0d2012-06-13 07:01:35581 const std::vector<gfx::Rect>& bounds);
582
[email protected]ad26ef42011-06-17 07:59:45583 // Override point to obtain that the current input method state about
584 // composition text.
585 virtual bool CanComposeInline();
[email protected]56ea1a62011-05-30 07:05:57586
[email protected]2533ce12009-05-09 00:02:24587 // Set the pending window rect.
588 // Because the real render_widget is hosted in another process, there is
589 // a time period where we may have set a new window rect which has not yet
590 // been processed by the browser. So we maintain a pending window rect
591 // size. If JS code sets the WindowRect, and then immediately calls
592 // GetWindowRect() we'll use this pending window rect as the size.
[email protected]180ef242013-11-07 06:50:46593 void SetPendingWindowRect(const blink::WebRect& r);
[email protected]2533ce12009-05-09 00:02:24594
[email protected]ce6689f2013-03-29 12:52:55595 // Check whether the WebWidget has any touch event handlers registered.
avi5c77d212015-09-25 20:08:25596 void hasTouchEventHandlers(bool has_handlers) override;
[email protected]ce6689f2013-03-29 12:52:55597
[email protected]5d0bbdfa92013-12-10 00:35:51598 // Tell the browser about the actions permitted for a new touch point.
avi5c77d212015-09-25 20:08:25599 void setTouchAction(blink::WebTouchAction touch_action) override;
[email protected]5d0bbdfa92013-12-10 00:35:51600
[email protected]90f24152014-04-09 12:41:36601 // Called when value of focused text field gets dirty, e.g. value is modified
602 // by script, not by user input.
avi5c77d212015-09-25 20:08:25603 void didUpdateTextOfFocusedElementByNonUserInput() override;
[email protected]90f24152014-04-09 12:41:36604
lfg43e08e62016-02-03 18:51:37605 // Sends an ACK to the browser process during the next compositor frame.
606 void OnWaitNextFrameForTests(int routing_id);
607
initial.commit09911bf2008-07-26 23:55:29608 // Routing ID that allows us to communicate to the parent browser process
609 // RenderWidgetHost. When MSG_ROUTING_NONE, no messages may be sent.
avi1023d012015-12-25 02:39:14610 int32_t routing_id_;
initial.commit09911bf2008-07-26 23:55:29611
danakj6e3bf8012014-12-16 18:27:53612 // Dependencies for initializing a compositor, including flags for optional
613 // features.
dcheng35d31c112015-07-22 00:17:36614 CompositorDependencies* const compositor_deps_;
danakj6e3bf8012014-12-16 18:27:53615
[email protected]c5b3b5e2009-02-13 06:41:11616 // We are responsible for destroying this object via its Close method.
[email protected]4ee64622014-03-21 22:34:15617 // May be NULL when the window is closing.
[email protected]180ef242013-11-07 06:50:46618 blink::WebWidget* webwidget_;
initial.commit09911bf2008-07-26 23:55:29619
avi40b5be7a2016-03-03 21:13:44620 // The delegate of the owner of this object.
621 RenderWidgetOwnerDelegate* owner_delegate_;
622
[email protected]8926c602013-01-23 05:32:06623 // This is lazily constructed and must not outlive webwidget_.
dchengcedca5612016-04-09 01:40:15624 std::unique_ptr<RenderWidgetCompositor> compositor_;
[email protected]8926c602013-01-23 05:32:06625
initial.commit09911bf2008-07-26 23:55:29626 // Set to the ID of the view that initiated creating this view, if any. When
627 // the view was initiated by the browser (the common case), this will be
628 // MSG_ROUTING_NONE. This is used in determining ownership when opening
629 // child tabs. See RenderWidget::createWebViewWithRequest.
630 //
631 // This ID may refer to an invalid view if that view is closed before this
632 // view is.
avi1023d012015-12-25 02:39:14633 int32_t opener_id_;
initial.commit09911bf2008-07-26 23:55:29634
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]f21c613a2009-02-12 14:46:17651 // The area that must be reserved for drawing the resize corner.
652 gfx::Rect resizer_rect_;
653
[email protected]53d3f302009-12-21 04:42:05654 // Flags for the next ViewHostMsg_UpdateRect message.
initial.commit09911bf2008-07-26 23:55:29655 int next_paint_flags_;
656
[email protected]847a2582013-03-09 02:29:51657 // Whether the WebWidget is in auto resize mode, which is used for example
658 // by extension popups.
659 bool auto_resize_mode_;
660
[email protected]ea3ee0a2012-05-15 03:43:09661 // True if we need to send an UpdateRect message to notify the browser about
662 // an already-completed auto-resize.
663 bool need_update_rect_for_auto_resize_;
664
initial.commit09911bf2008-07-26 23:55:29665 // Set to true if we should ignore RenderWidget::Show calls.
666 bool did_show_;
667
668 // Indicates that we shouldn't bother generated paint events.
669 bool is_hidden_;
670
[email protected]7912e822014-04-16 02:37:03671 // Indicates that we are never visible, so never produce graphical output.
sievers71c62dd52015-10-07 01:44:39672 const bool compositor_never_visible_;
[email protected]7912e822014-04-16 02:37:03673
mikhail.pozdnyakovf2c902a2015-04-14 08:09:12674 // Indicates whether tab-initiated fullscreen was granted.
675 bool is_fullscreen_granted_;
[email protected]ee41e7d22011-10-14 19:34:09676
mikhail.pozdnyakovc0e251b2015-04-15 06:51:12677 // Indicates the display mode.
678 blink::WebDisplayMode display_mode_;
679
changwanf2a707b2015-10-30 08:22:16680 // It is possible that one ImeEventGuard is nested inside another
681 // ImeEventGuard. We keep track of the outermost one, and update it as needed.
682 ImeEventGuard* ime_event_guard_;
[email protected]e8f775f2013-02-14 21:00:50683
initial.commit09911bf2008-07-26 23:55:29684 // True if we have requested this widget be closed. No more messages will
685 // be sent, except for a Close.
686 bool closing_;
687
[email protected]aeeedad2014-08-22 18:16:22688 // True if it is known that the host is in the process of being shut down.
689 bool host_closing_;
690
[email protected]992db4c2011-05-12 15:37:15691 // Whether this RenderWidget is currently swapped out, such that the view is
692 // being rendered by another process. If all RenderWidgets in a process are
693 // swapped out, the process can exit.
694 bool is_swapped_out_;
695
simonhong628f9812015-04-27 23:13:20696 // Whether this RenderWidget is for an out-of-process iframe or not.
697 bool for_oopif_;
698
[email protected]5b739cb2012-08-21 20:35:21699 // Stores information about the current text input.
[email protected]180ef242013-11-07 06:50:46700 blink::WebTextInputInfo text_input_info_;
[email protected]5b739cb2012-08-21 20:35:21701
[email protected]fa7b1dc2010-06-23 17:53:04702 // Stores the current text input type of |webwidget_|.
[email protected]ad26ef42011-06-17 07:59:45703 ui::TextInputType text_input_type_;
704
[email protected]b256eca2013-07-11 10:57:40705 // Stores the current text input mode of |webwidget_|.
706 ui::TextInputMode text_input_mode_;
707
shuchen82ce8c52014-10-23 01:55:20708 // Stores the current text input flags of |webwidget_|.
709 int text_input_flags_;
710
[email protected]86ba5fcb2013-09-04 00:36:53711 // Stores the current type of composition text rendering of |webwidget_|.
712 bool can_compose_inline_;
713
[email protected]e99ef6f2011-10-16 01:13:00714 // Stores the current selection bounds.
[email protected]7c8873e2013-02-05 08:03:01715 gfx::Rect selection_focus_rect_;
716 gfx::Rect selection_anchor_rect_;
initial.commit09911bf2008-07-26 23:55:29717
[email protected]58b48a0d2012-06-13 07:01:35718 // Stores the current composition character bounds.
719 std::vector<gfx::Rect> composition_character_bounds_;
720
721 // Stores the current composition range.
[email protected]db4fc1e2013-09-06 20:01:51722 gfx::Range composition_range_;
[email protected]58b48a0d2012-06-13 07:01:35723
[email protected]3e2b375b2010-04-07 17:03:12724 // The kind of popup this widget represents, NONE if not a popup.
[email protected]180ef242013-11-07 06:50:46725 blink::WebPopupType popup_type_;
[email protected]0ebf3872008-11-07 21:35:03726
[email protected]80ad8622012-11-07 16:33:03727 // While we are waiting for the browser to update window sizes, we track the
728 // pending size temporarily.
[email protected]2533ce12009-05-09 00:02:24729 int pending_window_rect_count_;
lfg0140a452016-07-19 19:15:05730 gfx::Rect pending_window_rect_;
[email protected]2533ce12009-05-09 00:02:24731
[email protected]80ad8622012-11-07 16:33:03732 // The screen rects of the view and the window that contains it.
733 gfx::Rect view_screen_rect_;
734 gfx::Rect window_screen_rect_;
735
dchengcedca5612016-04-09 01:40:15736 std::unique_ptr<RenderWidgetInputHandler> input_handler_;
[email protected]12fbad812009-09-01 18:21:24737
[email protected]fd847792013-10-24 17:12:35738 // The time spent in input handlers this frame. Used to throttle input acks.
739 base::TimeDelta total_input_handling_time_this_frame_;
740
[email protected]842f10652012-06-06 01:54:04741 // Properties of the screen hosting this RenderWidget instance.
[email protected]180ef242013-11-07 06:50:46742 blink::WebScreenInfo screen_info_;
[email protected]842f10652012-06-06 01:54:04743
[email protected]f1cccb32012-06-06 18:29:59744 // The device scale factor. This value is computed from the DPI entries in
745 // |screen_info_| on some platforms, and defaults to 1 on other platforms.
[email protected]faec7b12012-06-19 14:42:13746 float device_scale_factor_;
[email protected]f1cccb32012-06-06 18:29:59747
[email protected]28ed6b32014-06-08 02:16:27748 // The device color profile on supported platforms.
749 std::vector<char> device_color_profile_;
750
[email protected]9017d7852013-11-21 17:47:35751 // State associated with synthetic gestures. Synthetic gestures are processed
752 // in-order, so a queue is sufficient to identify the correct state for a
753 // completed gesture.
754 std::queue<SyntheticGestureCompletionCallback>
755 pending_synthetic_gesture_callbacks_;
[email protected]0e241b4b2012-08-18 09:06:27756
[email protected]0d1ebed12013-08-05 22:01:13757#if defined(OS_ANDROID)
[email protected]90f24152014-04-09 12:41:36758 // Indicates value in the focused text field is in dirty state, i.e. modified
759 // by script etc., not by user input.
760 bool text_field_is_dirty_;
761
changwan3a841162015-08-11 02:53:37762 // Stores the history of text input infos from the last ACK'ed one from the
763 // current one. The size is the number of pending ACKs plus one, since we
764 // intentionally keep the last ack'd value to know what the browser is
765 // currently aware of.
766 std::deque<blink::WebTextInputInfo> text_input_info_history_;
[email protected]0d1ebed12013-08-05 22:01:13767#endif
768
nonafa291792016-08-10 02:36:18769 // True if the IME requests updated composition info.
770 bool monitor_composition_info_;
771
dchengcedca5612016-04-09 01:40:15772 std::unique_ptr<RenderWidgetScreenMetricsEmulator> screen_metrics_emulator_;
[email protected]b2e4c70132013-10-03 02:07:51773
774 // Popups may be displaced when screen metrics emulation is enabled.
775 // These values are used to properly adjust popup position.
danakj2ef31b82015-10-21 18:18:02776 gfx::Point popup_view_origin_for_emulation_;
777 gfx::Point popup_screen_origin_for_emulation_;
[email protected]b2e4c70132013-10-03 02:07:51778 float popup_origin_scale_for_emulation_;
779
[email protected]586871b2014-07-22 17:05:11780 scoped_refptr<FrameSwapMessageQueue> frame_swap_message_queue_;
dchengcedca5612016-04-09 01:40:15781 std::unique_ptr<ResizingModeSelector> resizing_mode_selector_;
[email protected]5b45ad42013-10-25 00:42:04782
[email protected]e3244ed2014-06-20 20:04:27783 // Lists of RenderFrameProxy objects that need to be notified of
784 // compositing-related events (e.g. DidCommitCompositorFrame).
brettw236d3172015-06-03 16:31:43785 base::ObserverList<RenderFrameProxy> render_frame_proxies_;
[email protected]a017938b2014-05-27 21:17:17786#if defined(VIDEO_HOLE)
brettw236d3172015-06-03 16:31:43787 base::ObserverList<RenderFrameImpl> video_hole_frames_;
[email protected]a017938b2014-05-27 21:17:17788#endif // defined(VIDEO_HOLE)
[email protected]bffc8302014-01-23 20:52:16789
[email protected]de3c5d82014-05-28 22:12:59790 // A list of RenderFrames associated with this RenderWidget. Notifications
791 // are sent to each frame in the list for events such as changing
792 // visibility state for example.
brettw236d3172015-06-03 16:31:43793 base::ObserverList<RenderFrameImpl> render_frames_;
[email protected]de3c5d82014-05-28 22:12:59794
[email protected]be1af0662014-07-29 19:55:51795 bool has_host_context_menu_location_;
796 gfx::Point host_context_menu_location_;
[email protected]a09d53ce2014-01-31 00:46:42797
skyostil529caa292016-08-10 17:44:51798 std::unique_ptr<blink::scheduler::RenderWidgetSchedulingState>
alexclarke7fa93942015-10-21 15:37:11799 render_widget_scheduling_state_;
800
lfgbee1e0a2016-06-08 21:24:21801 // Mouse Lock dispatcher attached to this view.
802 std::unique_ptr<RenderWidgetMouseLockDispatcher> mouse_lock_dispatcher_;
803
804 // Wraps the |webwidget_| as a MouseLockDispatcher::LockTarget interface.
805 std::unique_ptr<MouseLockDispatcher::LockTarget> webwidget_mouse_lock_target_;
806
oshima50872a72016-03-04 13:26:18807 private:
lfge0c2792ec2016-05-11 18:52:08808 // Indicates whether this widget has focus.
809 bool has_focus_;
810
ekaramad2a46d632016-07-19 13:33:09811 // This reference is set by the RenderFrame and is used to query the IME-
812 // related state from the plugin to later send to the browser.
813 PepperPluginInstanceImpl* focused_pepper_plugin_;
814
[email protected]05d478752009-04-08 23:38:16815 DISALLOW_COPY_AND_ASSIGN(RenderWidget);
initial.commit09911bf2008-07-26 23:55:29816};
817
[email protected]e9ff79c2012-10-19 21:31:26818} // namespace content
819
[email protected]2cff0052011-03-18 16:51:44820#endif // CONTENT_RENDERER_RENDER_WIDGET_H_