blob: 3cffee421e5433e7848a1606b604642099df93b4 [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>
[email protected]010ea08a2009-10-11 20:21:3214
[email protected]586871b2014-07-22 17:05:1115#include "base/callback.h"
[email protected]f3112a52011-09-30 23:47:4916#include "base/compiler_specific.h"
avi1023d012015-12-25 02:39:1417#include "base/macros.h"
[email protected]3b63f8f42011-03-28 01:54:1518#include "base/memory/ref_counted.h"
[email protected]bffc8302014-01-23 20:52:1619#include "base/observer_list.h"
[email protected]abb522162013-06-28 01:54:1620#include "base/time/time.h"
avi1023d012015-12-25 02:39:1421#include "build/build_config.h"
[email protected]f3112a52011-09-30 23:47:4922#include "content/common/content_export.h"
[email protected]c2809346d2014-03-20 00:11:0323#include "content/common/cursors/webcursor.h"
[email protected]9017d7852013-11-21 17:47:3524#include "content/common/input/synthetic_gesture_params.h"
mfomitchev2600fd7c2016-02-17 20:53:3925#include "content/renderer/devtools/render_widget_screen_metrics_emulator_delegate.h"
fsamuel78f86e42016-01-20 04:10:2326#include "content/renderer/gpu/render_widget_compositor_delegate.h"
fsamuel72464894f2015-12-15 06:59:3127#include "content/renderer/input/render_widget_input_handler.h"
28#include "content/renderer/input/render_widget_input_handler_delegate.h"
[email protected]586871b2014-07-22 17:05:1129#include "content/renderer/message_delivery_policy.h"
[email protected]4f86bdb2012-11-10 19:11:1930#include "ipc/ipc_listener.h"
31#include "ipc/ipc_sender.h"
mikhail.pozdnyakovc0e251b2015-04-15 06:51:1232#include "third_party/WebKit/public/platform/WebDisplayMode.h"
[email protected]5c30b5e02013-05-30 03:46:0833#include "third_party/WebKit/public/platform/WebRect.h"
[email protected]2255a9332013-06-17 05:12:3134#include "third_party/WebKit/public/web/WebCompositionUnderline.h"
[email protected]c27dd4f2014-05-22 18:05:1935#include "third_party/WebKit/public/web/WebInputEvent.h"
[email protected]2255a9332013-06-17 05:12:3136#include "third_party/WebKit/public/web/WebPopupType.h"
37#include "third_party/WebKit/public/web/WebTextDirection.h"
38#include "third_party/WebKit/public/web/WebTextInputInfo.h"
[email protected]5d0bbdfa92013-12-10 00:35:5139#include "third_party/WebKit/public/web/WebTouchAction.h"
[email protected]0e45bd02013-07-12 20:20:0240#include "third_party/WebKit/public/web/WebWidget.h"
[email protected]2255a9332013-06-17 05:12:3141#include "third_party/WebKit/public/web/WebWidgetClient.h"
[email protected]b256eca2013-07-11 10:57:4042#include "ui/base/ime/text_input_mode.h"
[email protected]ad26ef42011-06-17 07:59:4543#include "ui/base/ime/text_input_type.h"
[email protected]a09d53ce2014-01-31 00:46:4244#include "ui/base/ui_base_types.h"
tfarina93bfa912014-12-05 14:23:1545#include "ui/gfx/geometry/rect.h"
tfarina93bfa912014-12-05 14:23:1546#include "ui/gfx/geometry/vector2d_f.h"
[email protected]08397d52011-02-05 01:53:3847#include "ui/gfx/native_widget_types.h"
[email protected]db4fc1e2013-09-06 20:01:5148#include "ui/gfx/range/range.h"
[email protected]d353541f2012-05-03 22:45:4149#include "ui/surface/transport_dib.h"
initial.commit09911bf2008-07-26 23:55:2950
danakj870925d2016-05-03 20:07:3851class GURL;
52
[email protected]484955942010-08-19 16:13:1853namespace IPC {
54class SyncMessage;
[email protected]586871b2014-07-22 17:05:1155class SyncMessageFilter;
[email protected]484955942010-08-19 16:13:1856}
57
[email protected]180ef242013-11-07 06:50:4658namespace blink {
[email protected]19193682014-04-03 15:01:4359struct WebDeviceEmulationParams;
lfgcaab5142016-02-26 19:06:5260class WebFrameWidget;
[email protected]41d86852012-11-07 12:23:2461class WebGestureEvent;
kenrba7199832015-01-22 23:44:5962class WebLocalFrame;
[email protected]6a8ddba52010-09-05 04:38:0663class WebMouseEvent;
donnda070f3c2015-01-16 19:54:1164class WebNode;
65struct WebPoint;
[email protected]526476902011-10-06 20:34:0666}
67
[email protected]586871b2014-07-22 17:05:1168namespace cc {
69class OutputSurface;
70class SwapPromise;
71}
[email protected]ba91a792013-02-06 09:48:2872
[email protected]db4fc1e2013-09-06 20:01:5173namespace gfx {
[email protected]4de6d1692011-10-12 08:45:4474class Range;
75}
76
alexclarke7fa93942015-10-21 15:37:1177namespace scheduler {
78class RenderWidgetSchedulingState;
79}
80
[email protected]e9ff79c2012-10-19 21:31:2681namespace content {
danakj6e3bf8012014-12-16 18:27:5382class CompositorDependencies;
[email protected]b2e4c70132013-10-03 02:07:5183class ExternalPopupMenu;
[email protected]586871b2014-07-22 17:05:1184class FrameSwapMessageQueue;
changwanf2a707b2015-10-30 08:22:1685class ImeEventGuard;
[email protected]bffc8302014-01-23 20:52:1686class RenderFrameImpl;
[email protected]e3244ed2014-06-20 20:04:2787class RenderFrameProxy;
[email protected]ba91a792013-02-06 09:48:2888class RenderWidgetCompositor;
avi40b5be7a2016-03-03 21:13:4489class RenderWidgetOwnerDelegate;
mfomitchev2600fd7c2016-02-17 20:53:3990class RenderWidgetScreenMetricsEmulator;
[email protected]5b45ad42013-10-25 00:42:0491class ResizingModeSelector;
[email protected]b2e4c70132013-10-03 02:07:5192struct ContextMenuParams;
jddukec05612b2015-06-25 23:13:1893struct DidOverscrollParams;
fsamuel664e8b62016-01-20 19:54:0194struct ResizeParams;
[email protected]e9ff79c2012-10-19 21:31:2695
initial.commit09911bf2008-07-26 23:55:2996// RenderWidget provides a communication bridge between a WebWidget and
97// a RenderWidgetHost, the latter of which lives in a different process.
dchengd96a27a2015-07-24 20:17:3298//
99// RenderWidget is used to implement:
100// - RenderViewImpl (deprecated)
101// - Fullscreen mode (RenderWidgetFullScreen)
102// - Popup "menus" (like the color chooser and date picker)
103// - Widgets for frames (for out-of-process iframe support)
[email protected]f3112a52011-09-30 23:47:49104class CONTENT_EXPORT RenderWidget
[email protected]c47317e2012-06-20 22:35:31105 : public IPC::Listener,
106 public IPC::Sender,
[email protected]180ef242013-11-07 06:50:46107 NON_EXPORTED_BASE(virtual public blink::WebWidgetClient),
fsamuel78f86e42016-01-20 04:10:23108 public RenderWidgetCompositorDelegate,
fsamuel72464894f2015-12-15 06:59:31109 public RenderWidgetInputHandlerDelegate,
mfomitchev2600fd7c2016-02-17 20:53:39110 public RenderWidgetScreenMetricsEmulatorDelegate,
[email protected]f3112a52011-09-30 23:47:49111 public base::RefCounted<RenderWidget> {
initial.commit09911bf2008-07-26 23:55:29112 public:
113 // Creates a new RenderWidget. The opener_id is the routing ID of the
[email protected]380244092011-10-07 17:26:27114 // RenderView that this widget lives inside.
avi1023d012015-12-25 02:39:14115 static RenderWidget* Create(int32_t opener_id,
danakj6e3bf8012014-12-16 18:27:53116 CompositorDependencies* compositor_deps,
[email protected]180ef242013-11-07 06:50:46117 blink::WebPopupType popup_type,
118 const blink::WebScreenInfo& screen_info);
initial.commit09911bf2008-07-26 23:55:29119
kenrba7199832015-01-22 23:44:59120 // Creates a new RenderWidget that will be attached to a RenderFrame.
121 static RenderWidget* CreateForFrame(int routing_id,
kenrba7199832015-01-22 23:44:59122 bool hidden,
123 const blink::WebScreenInfo& screen_info,
124 CompositorDependencies* compositor_deps,
125 blink::WebLocalFrame* frame);
126
dchengda9b4bb2015-07-20 20:58:08127 // Closes a RenderWidget that was created by |CreateForFrame|.
dcheng3ce04b62015-10-26 23:30:55128 // TODO(avi): De-virtualize this once RenderViewImpl has-a RenderWidget.
129 // https://crbug.com/545684
130 virtual void CloseForFrame();
[email protected]484955942010-08-19 16:13:18131
avi1023d012015-12-25 02:39:14132 int32_t routing_id() const { return routing_id_; }
fsamuele8326c742016-01-12 00:49:39133 void SetRoutingID(int32_t routing_id);
134
danakj6e3bf8012014-12-16 18:27:53135 CompositorDependencies* compositor_deps() const { return compositor_deps_; }
[email protected]180ef242013-11-07 06:50:46136 blink::WebWidget* webwidget() const { return webwidget_; }
mfomitchev2600fd7c2016-02-17 20:53:39137 const gfx::Size& size() const { return size_; }
mikhail.pozdnyakovf2c902a2015-04-14 08:09:12138 bool is_fullscreen_granted() const { return is_fullscreen_granted_; }
mikhail.pozdnyakovc0e251b2015-04-15 06:51:12139 blink::WebDisplayMode display_mode() const { return display_mode_; }
[email protected]204f1df2012-01-04 20:21:13140 bool is_hidden() const { return is_hidden_; }
[email protected]4ee64622014-03-21 22:34:15141 // Temporary for debugging purposes...
142 bool closing() const { return closing_; }
143 bool is_swapped_out() { return is_swapped_out_; }
[email protected]be1af0662014-07-29 19:55:51144 bool has_host_context_menu_location() {
145 return has_host_context_menu_location_;
146 }
147 gfx::Point host_context_menu_location() {
148 return host_context_menu_location_;
[email protected]4ee64622014-03-21 22:34:15149 }
[email protected]589621b2010-09-23 22:01:07150
avi40b5be7a2016-03-03 21:13:44151 void set_owner_delegate(RenderWidgetOwnerDelegate* owner_delegate) {
152 DCHECK(!owner_delegate_);
153 owner_delegate_ = owner_delegate;
154 }
155
156 RenderWidgetOwnerDelegate* owner_delegate() { return owner_delegate_; }
157
kenrba7199832015-01-22 23:44:59158 // ScreenInfo exposed so it can be passed to subframe RenderWidgets.
159 blink::WebScreenInfo screen_info() const { return screen_info_; }
160
[email protected]bffc8302014-01-23 20:52:16161 // Functions to track out-of-process frames for special notifications.
[email protected]e3244ed2014-06-20 20:04:27162 void RegisterRenderFrameProxy(RenderFrameProxy* proxy);
163 void UnregisterRenderFrameProxy(RenderFrameProxy* proxy);
[email protected]bffc8302014-01-23 20:52:16164
[email protected]de3c5d82014-05-28 22:12:59165 // Functions to track all RenderFrame objects associated with this
166 // RenderWidget.
167 void RegisterRenderFrame(RenderFrameImpl* frame);
168 void UnregisterRenderFrame(RenderFrameImpl* frame);
169
[email protected]a017938b2014-05-27 21:17:17170#if defined(VIDEO_HOLE)
171 void RegisterVideoHoleFrame(RenderFrameImpl* frame);
172 void UnregisterVideoHoleFrame(RenderFrameImpl* frame);
173#endif // defined(VIDEO_HOLE)
174
[email protected]c47317e2012-06-20 22:35:31175 // IPC::Listener
dcheng6d18e402014-10-21 12:32:52176 bool OnMessageReceived(const IPC::Message& msg) override;
initial.commit09911bf2008-07-26 23:55:29177
[email protected]c47317e2012-06-20 22:35:31178 // IPC::Sender
dcheng6d18e402014-10-21 12:32:52179 bool Send(IPC::Message* msg) override;
initial.commit09911bf2008-07-26 23:55:29180
fsamuel78f86e42016-01-20 04:10:23181 // RenderWidgetCompositorDelegate
182 void ApplyViewportDeltas(const gfx::Vector2dF& inner_delta,
183 const gfx::Vector2dF& outer_delta,
184 const gfx::Vector2dF& elastic_overscroll_delta,
185 float page_scale,
186 float top_controls_delta) override;
187 void BeginMainFrame(double frame_time_sec) override;
dchengcedca5612016-04-09 01:40:15188 std::unique_ptr<cc::OutputSurface> CreateOutputSurface(
189 bool fallback) override;
190 std::unique_ptr<cc::BeginFrameSource> CreateExternalBeginFrameSource()
191 override;
fsamuel78f86e42016-01-20 04:10:23192 void DidCommitAndDrawCompositorFrame() override;
193 void DidCommitCompositorFrame() override;
194 void DidCompletePageScaleAnimation() override;
195 void DidCompleteSwapBuffers() override;
fsamuel78f86e42016-01-20 04:10:23196 void ForwardCompositorProto(const std::vector<uint8_t>& proto) override;
197 bool IsClosing() const override;
198 void OnSwapBuffersAborted() override;
199 void OnSwapBuffersComplete() override;
200 void OnSwapBuffersPosted() override;
danakj53eccbc2016-03-02 22:51:07201 void RequestScheduleAnimation() override;
fsamuel78f86e42016-01-20 04:10:23202 void UpdateVisualState() override;
203 void WillBeginCompositorFrame() override;
vmpstrd6dce2602016-05-18 20:19:04204 void ReportFixedRasterScaleUseCounters(
205 bool has_blurry_content,
206 bool has_potential_performance_regression) override;
fsamuel78f86e42016-01-20 04:10:23207
fsamuel72464894f2015-12-15 06:59:31208 // RenderWidgetInputHandlerDelegate
209 void FocusChangeComplete() override;
210 bool HasTouchEventHandlersAt(const gfx::Point& point) const override;
211 void ObserveWheelEventAndResult(const blink::WebMouseWheelEvent& wheel_event,
212 const gfx::Vector2dF& wheel_unused_delta,
213 bool event_processed) override;
dtapuska1827dd22016-03-11 15:24:59214 void ObserveGestureEventAndResult(const blink::WebGestureEvent& gesture_event,
215 const gfx::Vector2dF& unused_delta,
216 bool event_processed) override;
217
fsamuel72464894f2015-12-15 06:59:31218 void OnDidHandleKeyEvent() override;
219 void OnDidOverscroll(const DidOverscrollParams& params) override;
dchengcedca5612016-04-09 01:40:15220 void OnInputEventAck(std::unique_ptr<InputEventAck> input_event_ack) override;
dtapuska46616922016-03-17 22:52:01221 void NotifyInputEventHandled(
dtapuska0bd451a2016-02-18 17:08:10222 blink::WebInputEvent::Type handled_type) override;
fsamuele8326c742016-01-12 00:49:39223 void SetInputHandler(RenderWidgetInputHandler* input_handler) override;
fsamuel72464894f2015-12-15 06:59:31224 void UpdateTextInputState(ShowIme show_ime,
225 ChangeSource change_source) override;
226 bool WillHandleGestureEvent(const blink::WebGestureEvent& event) override;
227 bool WillHandleMouseEvent(const blink::WebMouseEvent& event) override;
228
mfomitchev2600fd7c2016-02-17 20:53:39229 // RenderWidgetScreenMetricsDelegate
230 void Redraw() override;
231 void Resize(const ResizeParams& resize_params) override;
232 void SetScreenMetricsEmulationParameters(
233 bool enabled,
234 const blink::WebDeviceEmulationParams& params) override;
235 void SetScreenRects(const gfx::Rect& view_screen_rect,
236 const gfx::Rect& window_screen_rect) override;
237
[email protected]180ef242013-11-07 06:50:46238 // blink::WebWidgetClient
avi5c77d212015-09-25 20:08:25239 void didAutoResize(const blink::WebSize& new_size) override;
240 void initializeLayerTreeView() override;
241 blink::WebLayerTreeView* layerTreeView() override;
dglazkovf0e1d6d2015-10-10 02:13:48242 void didMeaningfulLayout(blink::WebMeaningfulLayout layout_type) override;
avi5c77d212015-09-25 20:08:25243 void didFocus() override;
avi5c77d212015-09-25 20:08:25244 void didChangeCursor(const blink::WebCursorInfo&) override;
245 void closeWidgetSoon() override;
246 void show(blink::WebNavigationPolicy) override;
247 blink::WebRect windowRect() override;
248 void setToolTipText(const blink::WebString& text,
249 blink::WebTextDirection hint) override;
250 void setWindowRect(const blink::WebRect&) override;
251 blink::WebRect windowResizerRect() override;
252 blink::WebRect rootWindowRect() override;
253 blink::WebScreenInfo screenInfo() override;
avi5c77d212015-09-25 20:08:25254 void resetInputMethod() override;
255 void didHandleGestureEvent(const blink::WebGestureEvent& event,
256 bool event_cancelled) override;
bokane53a10f2016-04-13 23:48:31257 void didOverscroll(const blink::WebFloatSize& overscrollDelta,
258 const blink::WebFloatSize& accumulatedOverscroll,
avi5c77d212015-09-25 20:08:25259 const blink::WebFloatPoint& position,
260 const blink::WebFloatSize& velocity) override;
261 void showImeIfNeeded() override;
oshima581cf3f62015-12-16 20:08:01262 void convertViewportToWindow(blink::WebRect* rect) override;
oshimaa6985b62016-01-27 08:58:30263 void convertWindowToViewport(blink::WebFloatRect* rect) override;
[email protected]4873c7d2009-07-16 06:36:28264
fsamuel72464894f2015-12-15 06:59:31265 // Override point to obtain that the current input method state and caret
266 // position.
267 virtual ui::TextInputType GetTextInputType();
268 virtual ui::TextInputType WebKitToUiTextInputType(
269 blink::WebTextInputType type);
270
donnda070f3c2015-01-16 19:54:11271#if defined(OS_ANDROID)
272 // Notifies that a tap was not consumed, so showing a UI for the unhandled
273 // tap may be needed.
donnd57e54f52015-02-26 19:03:37274 // Performs various checks on the given WebNode to apply heuristics to
275 // determine if triggering is appropriate.
avi5c77d212015-09-25 20:08:25276 void showUnhandledTapUIIfNeeded(const blink::WebPoint& tapped_position,
277 const blink::WebNode& tapped_node,
278 bool page_changed) override;
donnda070f3c2015-01-16 19:54:11279#endif
280
[email protected]7912e822014-04-16 02:37:03281 // Begins the compositor's scheduler to start producing frames.
282 void StartCompositor();
283
[email protected]aeeedad2014-08-22 18:16:22284 // Stop compositing.
ennef3c58142014-12-09 21:44:38285 void WillCloseLayerTreeView();
[email protected]aeeedad2014-08-22 18:16:22286
[email protected]24ed0432013-04-24 07:50:31287 RenderWidgetCompositor* compositor() const;
288
fsamuel72464894f2015-12-15 06:59:31289 const RenderWidgetInputHandler& input_handler() const {
fsamuele8326c742016-01-12 00:49:39290 return *input_handler_;
fsamuel72464894f2015-12-15 06:59:31291 }
292
293 void SetHandlingInputEventForTesting(bool handling_input_event);
294
295 // When paused in debugger, we send ack for mouse event early. This ensures
296 // that we continue receiving mouse moves and pass them to debugger. Returns
297 // whether we are paused in mouse move event and have sent the ack.
298 bool SendAckForMouseMoveFromDebugger();
299
300 // When resumed from pause in debugger while handling mouse move,
301 // we should not send an extra ack (see SendAckForMouseMoveFromDebugger).
302 void IgnoreAckForMouseMoveFromDebugger();
303
[email protected]79fa22e2013-08-23 15:18:12304 // Callback for use with synthetic gestures (e.g. BeginSmoothScroll).
305 typedef base::Callback<void()> SyntheticGestureCompletionCallback;
[email protected]0e241b4b2012-08-18 09:06:27306
[email protected]9017d7852013-11-21 17:47:35307 // Send a synthetic gesture to the browser to be queued to the synthetic
308 // gesture controller.
309 void QueueSyntheticGesture(
dchengcedca5612016-04-09 01:40:15310 std::unique_ptr<SyntheticGestureParams> gesture_params,
[email protected]9017d7852013-11-21 17:47:35311 const SyntheticGestureCompletionCallback& callback);
[email protected]1e1dd182013-09-12 01:51:15312
[email protected]586871b2014-07-22 17:05:11313 // Deliveres |message| together with compositor state change updates. The
314 // exact behavior depends on |policy|.
315 // This mechanism is not a drop-in replacement for IPC: messages sent this way
316 // will not be automatically available to BrowserMessageFilter, for example.
317 // FIFO ordering is preserved between messages enqueued with the same
318 // |policy|, the ordering between messages enqueued for different policies is
319 // undefined.
320 //
321 // |msg| message to send, ownership of |msg| is transferred.
322 // |policy| see the comment on MessageDeliveryPolicy.
323 void QueueMessage(IPC::Message* msg, MessageDeliveryPolicy policy);
324
changwan8c342742016-02-26 00:53:39325 // Check whether IME thread is being used or not.
326 bool IsUsingImeThread();
327
changwanf2a707b2015-10-30 08:22:16328 // Handle start and finish of IME event guard.
329 void OnImeEventGuardStart(ImeEventGuard* guard);
330 void OnImeEventGuardFinish(ImeEventGuard* guard);
[email protected]66fca5bc2013-05-23 06:58:29331
[email protected]4ee64622014-03-21 22:34:15332 // Returns whether we currently should handle an IME event.
333 bool ShouldHandleImeEvent();
334
mfomitchev2600fd7c2016-02-17 20:53:39335 void SetPopupOriginAdjustmentsForEmulation(
336 RenderWidgetScreenMetricsEmulator* emulator);
[email protected]b2e4c70132013-10-03 02:07:51337
[email protected]2d6836f42014-07-02 17:25:31338 gfx::Rect AdjustValidationMessageAnchor(const gfx::Rect& anchor);
[email protected]b2e4c70132013-10-03 02:07:51339
jdduke491a3f0c2015-06-15 23:30:26340
341 void ScheduleComposite();
[email protected]7d08a9352013-10-15 08:24:56342 void ScheduleCompositeWithForcedRedraw();
343
[email protected]7a4e2532013-12-02 21:30:02344 // Checks if the selection bounds have been changed. If they are changed,
345 // the new value will be sent to the browser process.
346 void UpdateSelectionBounds();
347
dtrainor5ef644e2015-11-19 00:12:47348 // Called by the compositor to forward a proto that represents serialized
349 // compositor state.
dtrainor5ef644e2015-11-19 00:12:47350
[email protected]e5e438d62014-03-27 21:47:16351 virtual void GetSelectionBounds(gfx::Rect* start, gfx::Rect* end);
352
[email protected]a09d53ce2014-01-31 00:46:42353 void OnShowHostContextMenu(ContextMenuParams* params);
[email protected]7a4e2532013-12-02 21:30:02354
[email protected]7a4e2532013-12-02 21:30:02355 // Checks if the composition range or composition character bounds have been
356 // changed. If they are changed, the new value will be sent to the browser
yukawa5f21c6a2014-10-27 17:09:30357 // process. This method does nothing when the browser process is not able to
358 // handle composition range and composition character bounds.
[email protected]7a4e2532013-12-02 21:30:02359 void UpdateCompositionInfo(bool should_update_range);
[email protected]7a4e2532013-12-02 21:30:02360
avi40b5be7a2016-03-03 21:13:44361 // Change the device ICC color profile while running a layout test.
362 void SetDeviceColorProfileForTesting(const std::vector<char>& color_profile);
363 void ResetDeviceColorProfileForTesting();
364
lfge0c2792ec2016-05-11 18:52:08365 // Indicates whether this widget has focus.
366 bool has_focus() const { return has_focus_; }
367
initial.commit09911bf2008-07-26 23:55:29368 protected:
[email protected]8085dbc82008-09-26 22:53:44369 // Friend RefCounted so that the dtor can be non-public. Using this class
370 // without ref-counting is an error.
371 friend class base::RefCounted<RenderWidget>;
fsamuele8326c742016-01-12 00:49:39372
[email protected]7339cd22010-10-27 00:11:20373 // For unit tests.
[email protected]e9ff79c2012-10-19 21:31:26374 friend class RenderWidgetTest;
[email protected]8085dbc82008-09-26 22:53:44375
[email protected]61e2b3cc2012-03-02 16:13:34376 enum ResizeAck {
377 SEND_RESIZE_ACK,
378 NO_RESIZE_ACK,
379 };
380
dcheng35d31c112015-07-22 00:17:36381 RenderWidget(CompositorDependencies* compositor_deps,
382 blink::WebPopupType popup_type,
[email protected]180ef242013-11-07 06:50:46383 const blink::WebScreenInfo& screen_info,
[email protected]1ac10dca2013-08-20 20:47:04384 bool swapped_out,
[email protected]7912e822014-04-16 02:37:03385 bool hidden,
386 bool never_visible);
[email protected]ce2b28e2012-08-09 15:53:57387
dcheng6d18e402014-10-21 12:32:52388 ~RenderWidget() override;
initial.commit09911bf2008-07-26 23:55:29389
lfgcaab5142016-02-26 19:06:52390 static blink::WebFrameWidget* CreateWebFrameWidget(
391 RenderWidget* render_widget,
392 blink::WebLocalFrame* frame);
dchengda9b4bb2015-07-20 20:58:08393
394 // Creates a WebWidget based on the popup type.
395 static blink::WebWidget* CreateWebWidget(RenderWidget* render_widget);
396
pimanc4af3072015-10-02 03:45:59397 // Initializes this view with the given opener.
avi1023d012015-12-25 02:39:14398 bool Init(int32_t opener_id);
initial.commit09911bf2008-07-26 23:55:29399
[email protected]484955942010-08-19 16:13:18400 // Called by Init and subclasses to perform initialization.
avi1023d012015-12-25 02:39:14401 bool DoInit(int32_t opener_id,
[email protected]180ef242013-11-07 06:50:46402 blink::WebWidget* web_widget,
[email protected]484955942010-08-19 16:13:18403 IPC::SyncMessage* create_widget_message);
404
[email protected]992db4c2011-05-12 15:37:15405 // Sets whether this RenderWidget has been swapped out to be displayed by
406 // a RenderWidget in a different process. If so, no new IPC messages will be
407 // sent (only ACKs) and the process is free to exit when there are no other
408 // active RenderWidgets.
409 void SetSwappedOut(bool is_swapped_out);
410
[email protected]949b6592014-08-20 13:17:52411 // Allows the process to exit once the unload handler has finished, if there
412 // are no other active RenderWidgets.
413 void WasSwappedOut();
414
[email protected]2533ce12009-05-09 00:02:24415 void DoDeferredClose();
dgozmancf9039cd2015-04-06 12:01:31416 void NotifyOnClose();
dchengda9b4bb2015-07-20 20:58:08417
bokanc63441c2016-04-27 15:49:12418 gfx::Size GetSizeForWebWidget() const;
419 virtual void ResizeWebWidget();
420
dchengda9b4bb2015-07-20 20:58:08421 // Close the underlying WebWidget.
422 virtual void Close();
initial.commit09911bf2008-07-26 23:55:29423
[email protected]92650162013-10-30 03:31:02424 // Used to force the size of a window when running layout tests.
bokanc007c3a2015-02-03 07:15:56425 void SetWindowRectSynchronously(const gfx::Rect& new_window_rect);
haibinluc643d33c2016-06-03 02:22:34426#if defined(USE_EXTERNAL_POPUP_MENU)
[email protected]b2e4c70132013-10-03 02:07:51427 void SetExternalPopupOriginAdjustmentsForEmulation(
mfomitchev2600fd7c2016-02-17 20:53:39428 ExternalPopupMenu* popup,
429 RenderWidgetScreenMetricsEmulator* emulator);
[email protected]53907862014-03-25 15:42:40430#endif
[email protected]61e2b3cc2012-03-02 16:13:34431
initial.commit09911bf2008-07-26 23:55:29432 // RenderWidget IPC message handlers
[email protected]180ef242013-11-07 06:50:46433 void OnHandleInputEvent(const blink::WebInputEvent* event,
dtapuska0bd451a2016-02-18 17:08:10434 const ui::LatencyInfo& latency_info,
435 InputEventDispatchType dispatch_type);
[email protected]34202de2013-05-06 23:36:22436 void OnCursorVisibilityChange(bool is_visible);
[email protected]c084330e02013-04-27 01:08:15437 void OnMouseCaptureLost();
438 virtual void OnSetFocus(bool enable);
naskoc288745f2015-05-01 22:54:21439 void OnClose();
[email protected]fc4404d2012-11-07 19:53:30440 void OnCreatingNewAck();
fsamuel664e8b62016-01-20 19:54:01441 virtual void OnResize(const ResizeParams& params);
dgozman9260b0a12015-03-16 13:45:20442 void OnEnableDeviceEmulation(const blink::WebDeviceEmulationParams& params);
443 void OnDisableDeviceEmulation();
noel89949e62014-09-30 01:12:41444 void OnColorProfile(const std::vector<char>& color_profile);
[email protected]b5913d72012-02-07 22:26:54445 void OnChangeResizeRect(const gfx::Rect& resizer_rect);
[email protected]941e4552010-02-01 21:23:43446 virtual void OnWasHidden();
[email protected]3399dd822014-08-09 11:14:24447 virtual void OnWasShown(bool needs_repainting,
448 const ui::LatencyInfo& latency_info);
avi1023d012015-12-25 02:39:14449 void OnCreateVideoAck(int32_t video_id);
450 void OnUpdateVideoAck(int32_t video_id);
[email protected]2533ce12009-05-09 00:02:24451 void OnRequestMoveAck();
[email protected]56ea1a62011-05-30 07:05:57452 virtual void OnImeSetComposition(
[email protected]fcf75d42013-12-03 20:11:26453 const base::string16& text,
[email protected]180ef242013-11-07 06:50:46454 const std::vector<blink::WebCompositionUnderline>& underlines,
chongz7eb752802016-01-27 21:28:07455 const gfx::Range& replacement_range,
[email protected]fa7b1dc2010-06-23 17:53:04456 int selection_start,
457 int selection_end);
[email protected]fcf75d42013-12-03 20:11:26458 virtual void OnImeConfirmComposition(const base::string16& text,
[email protected]db4fc1e2013-09-06 20:01:51459 const gfx::Range& replacement_range,
[email protected]0e45bd02013-07-12 20:20:02460 bool keep_selection);
oshimad5279032015-12-16 18:22:33461 // Called when the device scale factor is changed, or the layer tree is
462 // initialized.
463 virtual void OnDeviceScaleFactorChanged();
464
[email protected]0bc1f572013-04-17 01:46:31465 void OnRepaint(gfx::Size size_to_paint);
[email protected]79fa22e2013-08-23 15:18:12466 void OnSyntheticGestureCompleted();
[email protected]180ef242013-11-07 06:50:46467 void OnSetTextDirection(blink::WebTextDirection direction);
[email protected]872ae5b2011-05-26 20:20:50468 void OnGetFPS();
[email protected]80ad8622012-11-07 16:33:03469 void OnUpdateScreenRects(const gfx::Rect& view_screen_rect,
470 const gfx::Rect& window_screen_rect);
lfgdb5c4ed2016-03-04 23:09:07471 void OnUpdateWindowScreenRect(const gfx::Rect& window_screen_rect);
[email protected]2384b6c2013-02-28 23:58:51472 void OnShowImeIfNeeded();
kenrbb4e2a3b2015-05-14 15:05:05473 void OnSetSurfaceIdNamespace(uint32_t surface_id_namespace);
dtrainor5ef644e2015-11-19 00:12:47474 void OnHandleCompositorProto(const std::vector<uint8_t>& proto);
[email protected]0d1ebed12013-08-05 22:01:13475
[email protected]adb362312014-06-28 06:04:24476#if defined(OS_ANDROID)
changwan3a841162015-08-11 02:53:37477 // Called when we send IME event that expects an ACK.
478 void OnImeEventSentForAck(const blink::WebTextInputInfo& info);
[email protected]0d1ebed12013-08-05 22:01:13479
480 // Called by the browser process for every required IME acknowledgement.
481 void OnImeEventAck();
changwan8c342742016-02-26 00:53:39482
483 // Called by the browser process to update text input state.
484 void OnRequestTextInputStateUpdate();
[email protected]105dffb42013-02-20 03:46:21485#endif
[email protected]0d1ebed12013-08-05 22:01:13486
[email protected]847a2582013-03-09 02:29:51487 // Notify the compositor about a change in viewport size. This should be
488 // used only with auto resize mode WebWidgets, as normal WebWidgets should
489 // go through OnResize.
[email protected]97e1bf72013-03-06 14:06:05490 void AutoResizeCompositor();
491
[email protected]468ac582012-11-20 00:53:19492 virtual void SetDeviceScaleFactor(float device_scale_factor);
avi40b5be7a2016-03-03 21:13:44493 bool SetDeviceColorProfile(const std::vector<char>& color_profile);
[email protected]468ac582012-11-20 00:53:19494
[email protected]fcdc5642014-05-09 14:32:24495 virtual void OnOrientationChange();
496
[email protected]29ed96a2012-02-04 18:12:16497 // Override points to notify derived classes that a paint has happened.
[email protected]0704ac32013-10-03 15:24:22498 // DidInitiatePaint happens when that has completed, and subsequent rendering
499 // won't affect the painted content. DidFlushPaint happens once we've received
500 // the ACK that the screen has been updated. For a given paint operation,
501 // these overrides will always be called in the order DidInitiatePaint,
502 // DidFlushPaint.
lfge0c2792ec2016-05-11 18:52:08503 virtual void DidInitiatePaint() {}
avib9dbd972016-03-08 18:19:32504 virtual void DidFlushPaint();
[email protected]a2f6bc112009-06-27 16:27:25505
[email protected]ed7defa2013-03-12 21:29:59506 virtual GURL GetURLForGraphicsContext3D();
[email protected]65225772011-05-12 21:10:24507
[email protected]bee16aab2009-08-26 15:55:03508 // Sets the "hidden" state of this widget. All accesses to is_hidden_ should
509 // use this method so that we can properly inform the RenderThread of our
510 // state.
511 void SetHidden(bool hidden);
512
[email protected]2b624c562011-10-27 22:58:26513 void DidToggleFullscreen();
514
[email protected]674741932009-02-04 23:44:46515 bool next_paint_is_resize_ack() const;
[email protected]674741932009-02-04 23:44:46516 void set_next_paint_is_resize_ack();
[email protected]674741932009-02-04 23:44:46517 void set_next_paint_is_repaint_ack();
[email protected]ec7dc112008-08-06 05:30:12518
[email protected]586871b2014-07-22 17:05:11519 // QueueMessage implementation extracted into a static method for easy
520 // testing.
dchengcedca5612016-04-09 01:40:15521 static std::unique_ptr<cc::SwapPromise> QueueMessageImpl(
[email protected]586871b2014-07-22 17:05:11522 IPC::Message* msg,
523 MessageDeliveryPolicy policy,
524 FrameSwapMessageQueue* frame_swap_message_queue,
525 scoped_refptr<IPC::SyncMessageFilter> sync_message_filter,
[email protected]586871b2014-07-22 17:05:11526 int source_frame_number);
527
[email protected]58b48a0d2012-06-13 07:01:35528 // Override point to obtain that the current composition character bounds.
529 // In the case of surrogate pairs, the character is treated as two characters:
530 // the bounds for first character is actual one, and the bounds for second
531 // character is zero width rectangle.
532 virtual void GetCompositionCharacterBounds(
533 std::vector<gfx::Rect>* character_bounds);
534
[email protected]88dbe32f2013-06-20 23:31:36535 // Returns the range of the text that is being composed or the selection if
536 // the composition does not exist.
[email protected]db4fc1e2013-09-06 20:01:51537 virtual void GetCompositionRange(gfx::Range* range);
[email protected]88dbe32f2013-06-20 23:31:36538
[email protected]58b48a0d2012-06-13 07:01:35539 // Returns true if the composition range or composition character bounds
540 // should be sent to the browser process.
541 bool ShouldUpdateCompositionInfo(
[email protected]db4fc1e2013-09-06 20:01:51542 const gfx::Range& range,
[email protected]58b48a0d2012-06-13 07:01:35543 const std::vector<gfx::Rect>& bounds);
544
[email protected]ad26ef42011-06-17 07:59:45545 // Override point to obtain that the current input method state about
546 // composition text.
547 virtual bool CanComposeInline();
[email protected]56ea1a62011-05-30 07:05:57548
[email protected]2533ce12009-05-09 00:02:24549 // Set the pending window rect.
550 // Because the real render_widget is hosted in another process, there is
551 // a time period where we may have set a new window rect which has not yet
552 // been processed by the browser. So we maintain a pending window rect
553 // size. If JS code sets the WindowRect, and then immediately calls
554 // GetWindowRect() we'll use this pending window rect as the size.
[email protected]180ef242013-11-07 06:50:46555 void SetPendingWindowRect(const blink::WebRect& r);
[email protected]2533ce12009-05-09 00:02:24556
[email protected]ce6689f2013-03-29 12:52:55557 // Check whether the WebWidget has any touch event handlers registered.
avi5c77d212015-09-25 20:08:25558 void hasTouchEventHandlers(bool has_handlers) override;
[email protected]ce6689f2013-03-29 12:52:55559
[email protected]5d0bbdfa92013-12-10 00:35:51560 // Tell the browser about the actions permitted for a new touch point.
avi5c77d212015-09-25 20:08:25561 void setTouchAction(blink::WebTouchAction touch_action) override;
[email protected]5d0bbdfa92013-12-10 00:35:51562
[email protected]90f24152014-04-09 12:41:36563 // Called when value of focused text field gets dirty, e.g. value is modified
564 // by script, not by user input.
avi5c77d212015-09-25 20:08:25565 void didUpdateTextOfFocusedElementByNonUserInput() override;
[email protected]90f24152014-04-09 12:41:36566
lfg43e08e62016-02-03 18:51:37567 // Sends an ACK to the browser process during the next compositor frame.
568 void OnWaitNextFrameForTests(int routing_id);
569
initial.commit09911bf2008-07-26 23:55:29570 // Routing ID that allows us to communicate to the parent browser process
571 // RenderWidgetHost. When MSG_ROUTING_NONE, no messages may be sent.
avi1023d012015-12-25 02:39:14572 int32_t routing_id_;
initial.commit09911bf2008-07-26 23:55:29573
danakj6e3bf8012014-12-16 18:27:53574 // Dependencies for initializing a compositor, including flags for optional
575 // features.
dcheng35d31c112015-07-22 00:17:36576 CompositorDependencies* const compositor_deps_;
danakj6e3bf8012014-12-16 18:27:53577
[email protected]c5b3b5e2009-02-13 06:41:11578 // We are responsible for destroying this object via its Close method.
[email protected]4ee64622014-03-21 22:34:15579 // May be NULL when the window is closing.
[email protected]180ef242013-11-07 06:50:46580 blink::WebWidget* webwidget_;
initial.commit09911bf2008-07-26 23:55:29581
avi40b5be7a2016-03-03 21:13:44582 // The delegate of the owner of this object.
583 RenderWidgetOwnerDelegate* owner_delegate_;
584
[email protected]8926c602013-01-23 05:32:06585 // This is lazily constructed and must not outlive webwidget_.
dchengcedca5612016-04-09 01:40:15586 std::unique_ptr<RenderWidgetCompositor> compositor_;
[email protected]8926c602013-01-23 05:32:06587
initial.commit09911bf2008-07-26 23:55:29588 // Set to the ID of the view that initiated creating this view, if any. When
589 // the view was initiated by the browser (the common case), this will be
590 // MSG_ROUTING_NONE. This is used in determining ownership when opening
591 // child tabs. See RenderWidget::createWebViewWithRequest.
592 //
593 // This ID may refer to an invalid view if that view is closed before this
594 // view is.
avi1023d012015-12-25 02:39:14595 int32_t opener_id_;
initial.commit09911bf2008-07-26 23:55:29596
bokanc007c3a2015-02-03 07:15:56597 // The rect where this view should be initially shown.
598 gfx::Rect initial_rect_;
initial.commit09911bf2008-07-26 23:55:29599
initial.commit09911bf2008-07-26 23:55:29600 // We store the current cursor object so we can avoid spamming SetCursor
601 // messages.
602 WebCursor current_cursor_;
[email protected]88efb7ec2009-07-14 16:32:59603
initial.commit09911bf2008-07-26 23:55:29604 // The size of the RenderWidget.
605 gfx::Size size_;
606
[email protected]60d47ac2013-03-01 23:42:44607 // The size of the view's backing surface in non-DPI-adjusted pixels.
608 gfx::Size physical_backing_size_;
609
[email protected]bb6378fe2014-04-28 21:19:44610 // The size of the visible viewport in DPI-adjusted pixels.
611 gfx::Size visible_viewport_size_;
612
[email protected]f21c613a2009-02-12 14:46:17613 // The area that must be reserved for drawing the resize corner.
614 gfx::Rect resizer_rect_;
615
[email protected]53d3f302009-12-21 04:42:05616 // Flags for the next ViewHostMsg_UpdateRect message.
initial.commit09911bf2008-07-26 23:55:29617 int next_paint_flags_;
618
[email protected]847a2582013-03-09 02:29:51619 // Whether the WebWidget is in auto resize mode, which is used for example
620 // by extension popups.
621 bool auto_resize_mode_;
622
[email protected]ea3ee0a2012-05-15 03:43:09623 // True if we need to send an UpdateRect message to notify the browser about
624 // an already-completed auto-resize.
625 bool need_update_rect_for_auto_resize_;
626
initial.commit09911bf2008-07-26 23:55:29627 // Set to true if we should ignore RenderWidget::Show calls.
628 bool did_show_;
629
630 // Indicates that we shouldn't bother generated paint events.
631 bool is_hidden_;
632
[email protected]7912e822014-04-16 02:37:03633 // Indicates that we are never visible, so never produce graphical output.
sievers71c62dd52015-10-07 01:44:39634 const bool compositor_never_visible_;
[email protected]7912e822014-04-16 02:37:03635
mikhail.pozdnyakovf2c902a2015-04-14 08:09:12636 // Indicates whether tab-initiated fullscreen was granted.
637 bool is_fullscreen_granted_;
[email protected]ee41e7d22011-10-14 19:34:09638
mikhail.pozdnyakovc0e251b2015-04-15 06:51:12639 // Indicates the display mode.
640 blink::WebDisplayMode display_mode_;
641
changwanf2a707b2015-10-30 08:22:16642 // It is possible that one ImeEventGuard is nested inside another
643 // ImeEventGuard. We keep track of the outermost one, and update it as needed.
644 ImeEventGuard* ime_event_guard_;
[email protected]e8f775f2013-02-14 21:00:50645
initial.commit09911bf2008-07-26 23:55:29646 // True if we have requested this widget be closed. No more messages will
647 // be sent, except for a Close.
648 bool closing_;
649
[email protected]aeeedad2014-08-22 18:16:22650 // True if it is known that the host is in the process of being shut down.
651 bool host_closing_;
652
[email protected]992db4c2011-05-12 15:37:15653 // Whether this RenderWidget is currently swapped out, such that the view is
654 // being rendered by another process. If all RenderWidgets in a process are
655 // swapped out, the process can exit.
656 bool is_swapped_out_;
657
simonhong628f9812015-04-27 23:13:20658 // Whether this RenderWidget is for an out-of-process iframe or not.
659 bool for_oopif_;
660
[email protected]5b739cb2012-08-21 20:35:21661 // Stores information about the current text input.
[email protected]180ef242013-11-07 06:50:46662 blink::WebTextInputInfo text_input_info_;
[email protected]5b739cb2012-08-21 20:35:21663
[email protected]fa7b1dc2010-06-23 17:53:04664 // Stores the current text input type of |webwidget_|.
[email protected]ad26ef42011-06-17 07:59:45665 ui::TextInputType text_input_type_;
666
[email protected]b256eca2013-07-11 10:57:40667 // Stores the current text input mode of |webwidget_|.
668 ui::TextInputMode text_input_mode_;
669
shuchen82ce8c52014-10-23 01:55:20670 // Stores the current text input flags of |webwidget_|.
671 int text_input_flags_;
672
[email protected]86ba5fcb2013-09-04 00:36:53673 // Stores the current type of composition text rendering of |webwidget_|.
674 bool can_compose_inline_;
675
[email protected]e99ef6f2011-10-16 01:13:00676 // Stores the current selection bounds.
[email protected]7c8873e2013-02-05 08:03:01677 gfx::Rect selection_focus_rect_;
678 gfx::Rect selection_anchor_rect_;
initial.commit09911bf2008-07-26 23:55:29679
[email protected]58b48a0d2012-06-13 07:01:35680 // Stores the current composition character bounds.
681 std::vector<gfx::Rect> composition_character_bounds_;
682
683 // Stores the current composition range.
[email protected]db4fc1e2013-09-06 20:01:51684 gfx::Range composition_range_;
[email protected]58b48a0d2012-06-13 07:01:35685
[email protected]3e2b375b2010-04-07 17:03:12686 // The kind of popup this widget represents, NONE if not a popup.
[email protected]180ef242013-11-07 06:50:46687 blink::WebPopupType popup_type_;
[email protected]0ebf3872008-11-07 21:35:03688
[email protected]80ad8622012-11-07 16:33:03689 // While we are waiting for the browser to update window sizes, we track the
690 // pending size temporarily.
[email protected]2533ce12009-05-09 00:02:24691 int pending_window_rect_count_;
[email protected]180ef242013-11-07 06:50:46692 blink::WebRect pending_window_rect_;
[email protected]2533ce12009-05-09 00:02:24693
[email protected]80ad8622012-11-07 16:33:03694 // The screen rects of the view and the window that contains it.
695 gfx::Rect view_screen_rect_;
696 gfx::Rect window_screen_rect_;
697
dchengcedca5612016-04-09 01:40:15698 std::unique_ptr<RenderWidgetInputHandler> input_handler_;
[email protected]12fbad812009-09-01 18:21:24699
[email protected]fd847792013-10-24 17:12:35700 // The time spent in input handlers this frame. Used to throttle input acks.
701 base::TimeDelta total_input_handling_time_this_frame_;
702
[email protected]842f10652012-06-06 01:54:04703 // Properties of the screen hosting this RenderWidget instance.
[email protected]180ef242013-11-07 06:50:46704 blink::WebScreenInfo screen_info_;
[email protected]842f10652012-06-06 01:54:04705
[email protected]f1cccb32012-06-06 18:29:59706 // The device scale factor. This value is computed from the DPI entries in
707 // |screen_info_| on some platforms, and defaults to 1 on other platforms.
[email protected]faec7b12012-06-19 14:42:13708 float device_scale_factor_;
[email protected]f1cccb32012-06-06 18:29:59709
[email protected]28ed6b32014-06-08 02:16:27710 // The device color profile on supported platforms.
711 std::vector<char> device_color_profile_;
712
[email protected]9017d7852013-11-21 17:47:35713 // State associated with synthetic gestures. Synthetic gestures are processed
714 // in-order, so a queue is sufficient to identify the correct state for a
715 // completed gesture.
716 std::queue<SyntheticGestureCompletionCallback>
717 pending_synthetic_gesture_callbacks_;
[email protected]0e241b4b2012-08-18 09:06:27718
avi1023d012015-12-25 02:39:14719 uint32_t next_output_surface_id_;
[email protected]53b4cc12013-07-18 23:02:30720
[email protected]0d1ebed12013-08-05 22:01:13721#if defined(OS_ANDROID)
[email protected]90f24152014-04-09 12:41:36722 // Indicates value in the focused text field is in dirty state, i.e. modified
723 // by script etc., not by user input.
724 bool text_field_is_dirty_;
725
changwan3a841162015-08-11 02:53:37726 // Stores the history of text input infos from the last ACK'ed one from the
727 // current one. The size is the number of pending ACKs plus one, since we
728 // intentionally keep the last ack'd value to know what the browser is
729 // currently aware of.
730 std::deque<blink::WebTextInputInfo> text_input_info_history_;
[email protected]0d1ebed12013-08-05 22:01:13731#endif
732
dchengcedca5612016-04-09 01:40:15733 std::unique_ptr<RenderWidgetScreenMetricsEmulator> screen_metrics_emulator_;
[email protected]b2e4c70132013-10-03 02:07:51734
735 // Popups may be displaced when screen metrics emulation is enabled.
736 // These values are used to properly adjust popup position.
danakj2ef31b82015-10-21 18:18:02737 gfx::Point popup_view_origin_for_emulation_;
738 gfx::Point popup_screen_origin_for_emulation_;
[email protected]b2e4c70132013-10-03 02:07:51739 float popup_origin_scale_for_emulation_;
740
[email protected]586871b2014-07-22 17:05:11741 scoped_refptr<FrameSwapMessageQueue> frame_swap_message_queue_;
dchengcedca5612016-04-09 01:40:15742 std::unique_ptr<ResizingModeSelector> resizing_mode_selector_;
[email protected]5b45ad42013-10-25 00:42:04743
[email protected]e3244ed2014-06-20 20:04:27744 // Lists of RenderFrameProxy objects that need to be notified of
745 // compositing-related events (e.g. DidCommitCompositorFrame).
brettw236d3172015-06-03 16:31:43746 base::ObserverList<RenderFrameProxy> render_frame_proxies_;
[email protected]a017938b2014-05-27 21:17:17747#if defined(VIDEO_HOLE)
brettw236d3172015-06-03 16:31:43748 base::ObserverList<RenderFrameImpl> video_hole_frames_;
[email protected]a017938b2014-05-27 21:17:17749#endif // defined(VIDEO_HOLE)
[email protected]bffc8302014-01-23 20:52:16750
[email protected]de3c5d82014-05-28 22:12:59751 // A list of RenderFrames associated with this RenderWidget. Notifications
752 // are sent to each frame in the list for events such as changing
753 // visibility state for example.
brettw236d3172015-06-03 16:31:43754 base::ObserverList<RenderFrameImpl> render_frames_;
[email protected]de3c5d82014-05-28 22:12:59755
[email protected]be1af0662014-07-29 19:55:51756 bool has_host_context_menu_location_;
757 gfx::Point host_context_menu_location_;
[email protected]a09d53ce2014-01-31 00:46:42758
dchengcedca5612016-04-09 01:40:15759 std::unique_ptr<scheduler::RenderWidgetSchedulingState>
alexclarke7fa93942015-10-21 15:37:11760 render_widget_scheduling_state_;
761
oshima50872a72016-03-04 13:26:18762 private:
763 // When emulated, this returns original device scale factor.
764 float GetOriginalDeviceScaleFactor() const;
765
lfge0c2792ec2016-05-11 18:52:08766 // Indicates whether this widget has focus.
767 bool has_focus_;
768
[email protected]05d478752009-04-08 23:38:16769 DISALLOW_COPY_AND_ASSIGN(RenderWidget);
initial.commit09911bf2008-07-26 23:55:29770};
771
[email protected]e9ff79c2012-10-19 21:31:26772} // namespace content
773
[email protected]2cff0052011-03-18 16:51:44774#endif // CONTENT_RENDERER_RENDER_WIDGET_H_