blob: a22fec6d3dc9692b67f7fe6b7725a068c9089402 [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>
pwnallef669312017-01-07 01:17:2915#include <string>
16#include <vector>
[email protected]010ea08a2009-10-11 20:21:3217
[email protected]586871b2014-07-22 17:05:1118#include "base/callback.h"
[email protected]f3112a52011-09-30 23:47:4919#include "base/compiler_specific.h"
avi1023d012015-12-25 02:39:1420#include "base/macros.h"
[email protected]3b63f8f42011-03-28 01:54:1521#include "base/memory/ref_counted.h"
wjmaclean1d970622017-01-21 22:28:2422#include "base/memory/weak_ptr.h"
[email protected]bffc8302014-01-23 20:52:1623#include "base/observer_list.h"
[email protected]abb522162013-06-28 01:54:1624#include "base/time/time.h"
avi1023d012015-12-25 02:39:1425#include "build/build_config.h"
[email protected]f3112a52011-09-30 23:47:4926#include "content/common/content_export.h"
[email protected]c2809346d2014-03-20 00:11:0327#include "content/common/cursors/webcursor.h"
paulmeyer6ef5a792016-11-08 20:33:5828#include "content/common/drag_event_source_info.h"
alexmos56567492016-09-13 00:52:4629#include "content/common/edit_command.h"
[email protected]9017d7852013-11-21 17:47:3530#include "content/common/input/synthetic_gesture_params.h"
paulmeyer90f6c31d2016-11-12 00:17:5931#include "content/public/common/drop_data.h"
ccameron2f451532016-09-07 21:49:2732#include "content/public/common/screen_info.h"
mfomitchev2600fd7c2016-02-17 20:53:3933#include "content/renderer/devtools/render_widget_screen_metrics_emulator_delegate.h"
fsamuel78f86e42016-01-20 04:10:2334#include "content/renderer/gpu/render_widget_compositor_delegate.h"
fsamuel72464894f2015-12-15 06:59:3135#include "content/renderer/input/render_widget_input_handler.h"
36#include "content/renderer/input/render_widget_input_handler_delegate.h"
[email protected]586871b2014-07-22 17:05:1137#include "content/renderer/message_delivery_policy.h"
lfgbee1e0a2016-06-08 21:24:2138#include "content/renderer/mouse_lock_dispatcher.h"
39#include "content/renderer/render_widget_mouse_lock_dispatcher.h"
[email protected]4f86bdb2012-11-10 19:11:1940#include "ipc/ipc_listener.h"
nick4df698d82016-11-11 20:39:2341#include "ipc/ipc_message.h"
[email protected]4f86bdb2012-11-10 19:11:1942#include "ipc/ipc_sender.h"
mikhail.pozdnyakovc0e251b2015-04-15 06:51:1243#include "third_party/WebKit/public/platform/WebDisplayMode.h"
dtapuska7f4ddc2a2016-10-13 16:09:3244#include "third_party/WebKit/public/platform/WebInputEvent.h"
[email protected]5c30b5e02013-05-30 03:46:0845#include "third_party/WebKit/public/platform/WebRect.h"
paulmeyer6ef5a792016-11-08 20:33:5846#include "third_party/WebKit/public/platform/WebReferrerPolicy.h"
dtapuska7f4ddc2a2016-10-13 16:09:3247#include "third_party/WebKit/public/platform/WebTextInputInfo.h"
[email protected]2255a9332013-06-17 05:12:3148#include "third_party/WebKit/public/web/WebCompositionUnderline.h"
49#include "third_party/WebKit/public/web/WebPopupType.h"
50#include "third_party/WebKit/public/web/WebTextDirection.h"
[email protected]5d0bbdfa92013-12-10 00:35:5151#include "third_party/WebKit/public/web/WebTouchAction.h"
[email protected]0e45bd02013-07-12 20:20:0252#include "third_party/WebKit/public/web/WebWidget.h"
[email protected]2255a9332013-06-17 05:12:3153#include "third_party/WebKit/public/web/WebWidgetClient.h"
[email protected]b256eca2013-07-11 10:57:4054#include "ui/base/ime/text_input_mode.h"
[email protected]ad26ef42011-06-17 07:59:4555#include "ui/base/ime/text_input_type.h"
[email protected]a09d53ce2014-01-31 00:46:4256#include "ui/base/ui_base_types.h"
tfarina93bfa912014-12-05 14:23:1557#include "ui/gfx/geometry/rect.h"
tfarina93bfa912014-12-05 14:23:1558#include "ui/gfx/geometry/vector2d_f.h"
[email protected]08397d52011-02-05 01:53:3859#include "ui/gfx/native_widget_types.h"
[email protected]db4fc1e2013-09-06 20:01:5160#include "ui/gfx/range/range.h"
[email protected]d353541f2012-05-03 22:45:4161#include "ui/surface/transport_dib.h"
initial.commit09911bf2008-07-26 23:55:2962
danakj870925d2016-05-03 20:07:3863class GURL;
64
[email protected]484955942010-08-19 16:13:1865namespace IPC {
[email protected]586871b2014-07-22 17:05:1166class SyncMessageFilter;
[email protected]484955942010-08-19 16:13:1867}
68
[email protected]180ef242013-11-07 06:50:4669namespace blink {
skyostil529caa292016-08-10 17:44:5170namespace scheduler {
71class RenderWidgetSchedulingState;
72}
wjmaclean1d970622017-01-21 22:28:2473struct WebActiveWheelFlingParameters;
[email protected]19193682014-04-03 15:01:4374struct WebDeviceEmulationParams;
paulmeyer6ef5a792016-11-08 20:33:5875class WebDragData;
lfgcaab5142016-02-26 19:06:5276class WebFrameWidget;
[email protected]41d86852012-11-07 12:23:2477class WebGestureEvent;
paulmeyer6ef5a792016-11-08 20:33:5878class WebImage;
ekaramad2daaf672016-11-10 20:29:0179class WebInputMethodController;
kenrba7199832015-01-22 23:44:5980class WebLocalFrame;
[email protected]6a8ddba52010-09-05 04:38:0681class WebMouseEvent;
donnda070f3c2015-01-16 19:54:1182class WebNode;
83struct WebPoint;
pwnallef669312017-01-07 01:17:2984} // namespace blink
[email protected]526476902011-10-06 20:34:0685
[email protected]586871b2014-07-22 17:05:1186namespace cc {
danakj1120f4c2016-09-15 02:05:3287class CompositorFrameSink;
[email protected]586871b2014-07-22 17:05:1188class SwapPromise;
89}
[email protected]ba91a792013-02-06 09:48:2890
[email protected]db4fc1e2013-09-06 20:01:5191namespace gfx {
[email protected]4de6d1692011-10-12 08:45:4492class Range;
93}
94
chongza8ba91fc2016-08-16 21:39:1795namespace ui {
96struct DidOverscrollParams;
97}
98
[email protected]e9ff79c2012-10-19 21:31:2699namespace content {
danakj6e3bf8012014-12-16 18:27:53100class CompositorDependencies;
[email protected]b2e4c70132013-10-03 02:07:51101class ExternalPopupMenu;
[email protected]586871b2014-07-22 17:05:11102class FrameSwapMessageQueue;
changwanf2a707b2015-10-30 08:22:16103class ImeEventGuard;
ekaramad2a46d632016-07-19 13:33:09104class PepperPluginInstanceImpl;
[email protected]bffc8302014-01-23 20:52:16105class RenderFrameImpl;
[email protected]e3244ed2014-06-20 20:04:27106class RenderFrameProxy;
nickf7b38222016-11-22 21:59:35107class RenderViewImpl;
[email protected]ba91a792013-02-06 09:48:28108class RenderWidgetCompositor;
avi40b5be7a2016-03-03 21:13:44109class RenderWidgetOwnerDelegate;
mfomitchev2600fd7c2016-02-17 20:53:39110class RenderWidgetScreenMetricsEmulator;
[email protected]5b45ad42013-10-25 00:42:04111class ResizingModeSelector;
ekaramad330ba4232016-09-23 17:57:47112class TextInputClientObserver;
[email protected]b2e4c70132013-10-03 02:07:51113struct ContextMenuParams;
fsamuel664e8b62016-01-20 19:54:01114struct ResizeParams;
[email protected]e9ff79c2012-10-19 21:31:26115
initial.commit09911bf2008-07-26 23:55:29116// RenderWidget provides a communication bridge between a WebWidget and
117// a RenderWidgetHost, the latter of which lives in a different process.
dchengd96a27a2015-07-24 20:17:32118//
119// RenderWidget is used to implement:
120// - RenderViewImpl (deprecated)
121// - Fullscreen mode (RenderWidgetFullScreen)
122// - Popup "menus" (like the color chooser and date picker)
123// - Widgets for frames (for out-of-process iframe support)
[email protected]f3112a52011-09-30 23:47:49124class CONTENT_EXPORT RenderWidget
[email protected]c47317e2012-06-20 22:35:31125 : public IPC::Listener,
126 public IPC::Sender,
[email protected]180ef242013-11-07 06:50:46127 NON_EXPORTED_BASE(virtual public blink::WebWidgetClient),
fsamuel78f86e42016-01-20 04:10:23128 public RenderWidgetCompositorDelegate,
fsamuel72464894f2015-12-15 06:59:31129 public RenderWidgetInputHandlerDelegate,
mfomitchev2600fd7c2016-02-17 20:53:39130 public RenderWidgetScreenMetricsEmulatorDelegate,
[email protected]f3112a52011-09-30 23:47:49131 public base::RefCounted<RenderWidget> {
initial.commit09911bf2008-07-26 23:55:29132 public:
nickf7b38222016-11-22 21:59:35133 // Creates a new RenderWidget for a popup. |opener| is the RenderView that
134 // this widget lives inside.
135 static RenderWidget* CreateForPopup(RenderViewImpl* opener,
136 CompositorDependencies* compositor_deps,
137 blink::WebPopupType popup_type,
138 const ScreenInfo& screen_info);
initial.commit09911bf2008-07-26 23:55:29139
kenrba7199832015-01-22 23:44:59140 // Creates a new RenderWidget that will be attached to a RenderFrame.
nick4df698d82016-11-11 20:39:23141 static RenderWidget* CreateForFrame(int widget_routing_id,
kenrba7199832015-01-22 23:44:59142 bool hidden,
ccameron2f451532016-09-07 21:49:27143 const ScreenInfo& screen_info,
kenrba7199832015-01-22 23:44:59144 CompositorDependencies* compositor_deps,
145 blink::WebLocalFrame* frame);
146
lfg1568d112016-08-30 16:06:29147 // Used by content_layouttest_support to hook into the creation of
148 // RenderWidgets.
nick8331f8ad2016-11-15 20:42:45149 using CreateRenderWidgetFunction = RenderWidget* (*)(int32_t,
150 CompositorDependencies*,
151 blink::WebPopupType,
152 const ScreenInfo&,
153 bool,
154 bool,
155 bool);
lfg1568d112016-08-30 16:06:29156 using RenderWidgetInitializedCallback = void (*)(RenderWidget*);
nickf7b38222016-11-22 21:59:35157 using ShowCallback = base::Callback<void(RenderWidget* widget_to_show,
158 blink::WebNavigationPolicy policy,
159 const gfx::Rect& initial_rect)>;
lfg1568d112016-08-30 16:06:29160 static void InstallCreateHook(
161 CreateRenderWidgetFunction create_render_widget,
162 RenderWidgetInitializedCallback render_widget_initialized_callback);
163
dchengda9b4bb2015-07-20 20:58:08164 // Closes a RenderWidget that was created by |CreateForFrame|.
dcheng3ce04b62015-10-26 23:30:55165 // TODO(avi): De-virtualize this once RenderViewImpl has-a RenderWidget.
166 // https://crbug.com/545684
167 virtual void CloseForFrame();
[email protected]484955942010-08-19 16:13:18168
nick8331f8ad2016-11-15 20:42:45169 int32_t routing_id() const { return routing_id_; }
fsamuele8326c742016-01-12 00:49:39170
danakj6e3bf8012014-12-16 18:27:53171 CompositorDependencies* compositor_deps() const { return compositor_deps_; }
lfg8ff33912016-09-13 20:59:21172 virtual blink::WebWidget* GetWebWidget() const;
ekaramad2daaf672016-11-10 20:29:01173
174 // Returns the current instance of WebInputMethodController which is to be
175 // used for IME related tasks. This instance corresponds to the one from
176 // focused frame and can be nullptr.
177 blink::WebInputMethodController* GetInputMethodController() const;
178
mfomitchev2600fd7c2016-02-17 20:53:39179 const gfx::Size& size() const { return size_; }
mikhail.pozdnyakovf2c902a2015-04-14 08:09:12180 bool is_fullscreen_granted() const { return is_fullscreen_granted_; }
mikhail.pozdnyakovc0e251b2015-04-15 06:51:12181 blink::WebDisplayMode display_mode() const { return display_mode_; }
[email protected]204f1df2012-01-04 20:21:13182 bool is_hidden() const { return is_hidden_; }
[email protected]4ee64622014-03-21 22:34:15183 // Temporary for debugging purposes...
184 bool closing() const { return closing_; }
pwnallef669312017-01-07 01:17:29185 bool has_host_context_menu_location() const {
[email protected]be1af0662014-07-29 19:55:51186 return has_host_context_menu_location_;
187 }
pwnallef669312017-01-07 01:17:29188 gfx::Point host_context_menu_location() const {
[email protected]be1af0662014-07-29 19:55:51189 return host_context_menu_location_;
[email protected]4ee64622014-03-21 22:34:15190 }
[email protected]589621b2010-09-23 22:01:07191
avi40b5be7a2016-03-03 21:13:44192 void set_owner_delegate(RenderWidgetOwnerDelegate* owner_delegate) {
193 DCHECK(!owner_delegate_);
194 owner_delegate_ = owner_delegate;
195 }
196
pwnallef669312017-01-07 01:17:29197 RenderWidgetOwnerDelegate* owner_delegate() const { return owner_delegate_; }
avi40b5be7a2016-03-03 21:13:44198
kenrba7199832015-01-22 23:44:59199 // ScreenInfo exposed so it can be passed to subframe RenderWidgets.
ccameron2f451532016-09-07 21:49:27200 ScreenInfo screen_info() const { return screen_info_; }
kenrba7199832015-01-22 23:44:59201
alexmos78c9c0d2016-10-14 18:57:03202 // Sets whether this RenderWidget has been swapped out to be displayed by
203 // a RenderWidget in a different process. If so, no new IPC messages will be
204 // sent (only ACKs) and the process is free to exit when there are no other
205 // active RenderWidgets.
206 void SetSwappedOut(bool is_swapped_out);
207
pwnallef669312017-01-07 01:17:29208 bool is_swapped_out() const { return is_swapped_out_; }
alexmos78c9c0d2016-10-14 18:57:03209
alexmos56567492016-09-13 00:52:46210 // Manage edit commands to be used for the next keyboard event.
211 const EditCommands& edit_commands() const { return edit_commands_; }
212 void SetEditCommandForNextKeyEvent(const std::string& name,
213 const std::string& value);
214 void ClearEditCommands();
215
[email protected]bffc8302014-01-23 20:52:16216 // Functions to track out-of-process frames for special notifications.
[email protected]e3244ed2014-06-20 20:04:27217 void RegisterRenderFrameProxy(RenderFrameProxy* proxy);
218 void UnregisterRenderFrameProxy(RenderFrameProxy* proxy);
[email protected]bffc8302014-01-23 20:52:16219
[email protected]de3c5d82014-05-28 22:12:59220 // Functions to track all RenderFrame objects associated with this
221 // RenderWidget.
222 void RegisterRenderFrame(RenderFrameImpl* frame);
223 void UnregisterRenderFrame(RenderFrameImpl* frame);
224
[email protected]c47317e2012-06-20 22:35:31225 // IPC::Listener
dcheng6d18e402014-10-21 12:32:52226 bool OnMessageReceived(const IPC::Message& msg) override;
initial.commit09911bf2008-07-26 23:55:29227
[email protected]c47317e2012-06-20 22:35:31228 // IPC::Sender
dcheng6d18e402014-10-21 12:32:52229 bool Send(IPC::Message* msg) override;
initial.commit09911bf2008-07-26 23:55:29230
dtapuska3d5624d32016-08-30 04:34:00231 // Requests a BeginMainFrame callback from the compositor.
232 void SetNeedsMainFrame();
233
fsamuel78f86e42016-01-20 04:10:23234 // RenderWidgetCompositorDelegate
235 void ApplyViewportDeltas(const gfx::Vector2dF& inner_delta,
236 const gfx::Vector2dF& outer_delta,
237 const gfx::Vector2dF& elastic_overscroll_delta,
238 float page_scale,
239 float top_controls_delta) override;
240 void BeginMainFrame(double frame_time_sec) override;
danakj1120f4c2016-09-15 02:05:32241 std::unique_ptr<cc::CompositorFrameSink> CreateCompositorFrameSink(
samansd5db2502017-01-13 23:18:27242 const cc::FrameSinkId& frame_sink_id,
dchengcedca5612016-04-09 01:40:15243 bool fallback) override;
fsamuel78f86e42016-01-20 04:10:23244 void DidCommitAndDrawCompositorFrame() override;
245 void DidCommitCompositorFrame() override;
246 void DidCompletePageScaleAnimation() override;
danakj6c872fc02016-10-22 04:29:49247 void DidReceiveCompositorFrameAck() override;
fsamuel78f86e42016-01-20 04:10:23248 bool IsClosing() const override;
danakj53eccbc2016-03-02 22:51:07249 void RequestScheduleAnimation() override;
fsamuel78f86e42016-01-20 04:10:23250 void UpdateVisualState() override;
251 void WillBeginCompositorFrame() override;
jbroman6ccbc7d472016-07-27 04:45:41252 std::unique_ptr<cc::SwapPromise> RequestCopyOfOutputForLayoutTest(
253 std::unique_ptr<cc::CopyOutputRequest> request) override;
fsamuel78f86e42016-01-20 04:10:23254
fsamuel72464894f2015-12-15 06:59:31255 // RenderWidgetInputHandlerDelegate
256 void FocusChangeComplete() override;
257 bool HasTouchEventHandlersAt(const gfx::Point& point) const override;
dtapuska1827dd22016-03-11 15:24:59258 void ObserveGestureEventAndResult(const blink::WebGestureEvent& gesture_event,
259 const gfx::Vector2dF& unused_delta,
260 bool event_processed) override;
261
fsamuel72464894f2015-12-15 06:59:31262 void OnDidHandleKeyEvent() override;
chongza8ba91fc2016-08-16 21:39:17263 void OnDidOverscroll(const ui::DidOverscrollParams& params) override;
dchengcedca5612016-04-09 01:40:15264 void OnInputEventAck(std::unique_ptr<InputEventAck> input_event_ack) override;
dtapuskab08721e62016-06-29 03:35:07265 void NotifyInputEventHandled(blink::WebInputEvent::Type handled_type,
skyostilcff62882017-01-28 13:18:04266 blink::WebInputEventResult result,
dtapuskab08721e62016-06-29 03:35:07267 InputEventAckState ack_result) override;
fsamuele8326c742016-01-12 00:49:39268 void SetInputHandler(RenderWidgetInputHandler* input_handler) override;
changwan75e3b2072017-01-16 02:55:00269 void ShowVirtualKeyboard() override;
270 void UpdateTextInputState() override;
fsamuel72464894f2015-12-15 06:59:31271 bool WillHandleGestureEvent(const blink::WebGestureEvent& event) override;
272 bool WillHandleMouseEvent(const blink::WebMouseEvent& event) override;
273
mfomitchev2600fd7c2016-02-17 20:53:39274 // RenderWidgetScreenMetricsDelegate
275 void Redraw() override;
276 void Resize(const ResizeParams& resize_params) override;
277 void SetScreenMetricsEmulationParameters(
278 bool enabled,
279 const blink::WebDeviceEmulationParams& params) override;
280 void SetScreenRects(const gfx::Rect& view_screen_rect,
281 const gfx::Rect& window_screen_rect) override;
282
[email protected]180ef242013-11-07 06:50:46283 // blink::WebWidgetClient
loyso50b51c22017-01-10 07:18:37284 blink::WebLayerTreeView* initializeLayerTreeView() override;
dglazkovf0e1d6d2015-10-10 02:13:48285 void didMeaningfulLayout(blink::WebMeaningfulLayout layout_type) override;
avi5c77d212015-09-25 20:08:25286 void didChangeCursor(const blink::WebCursorInfo&) override;
287 void closeWidgetSoon() override;
288 void show(blink::WebNavigationPolicy) override;
289 blink::WebRect windowRect() override;
bokan6b08cd22016-10-05 00:55:21290 blink::WebRect viewRect() override;
avi5c77d212015-09-25 20:08:25291 void setToolTipText(const blink::WebString& text,
292 blink::WebTextDirection hint) override;
293 void setWindowRect(const blink::WebRect&) override;
avi5c77d212015-09-25 20:08:25294 blink::WebScreenInfo screenInfo() override;
avi5c77d212015-09-25 20:08:25295 void resetInputMethod() override;
296 void didHandleGestureEvent(const blink::WebGestureEvent& event,
297 bool event_cancelled) override;
bokane53a10f2016-04-13 23:48:31298 void didOverscroll(const blink::WebFloatSize& overscrollDelta,
299 const blink::WebFloatSize& accumulatedOverscroll,
avi5c77d212015-09-25 20:08:25300 const blink::WebFloatPoint& position,
301 const blink::WebFloatSize& velocity) override;
lukasza86f05da2017-01-24 21:23:26302 void showVirtualKeyboardOnElementFocus() override;
oshima581cf3f62015-12-16 20:08:01303 void convertViewportToWindow(blink::WebRect* rect) override;
oshimaa6985b62016-01-27 08:58:30304 void convertWindowToViewport(blink::WebFloatRect* rect) override;
lfgbee1e0a2016-06-08 21:24:21305 bool requestPointerLock() override;
306 void requestPointerUnlock() override;
307 bool isPointerLocked() override;
paulmeyer6ef5a792016-11-08 20:33:58308 void startDragging(blink::WebReferrerPolicy policy,
309 const blink::WebDragData& data,
310 blink::WebDragOperationsMask mask,
311 const blink::WebImage& image,
312 const blink::WebPoint& imageOffset) override;
[email protected]4873c7d2009-07-16 06:36:28313
fsamuel72464894f2015-12-15 06:59:31314 // Override point to obtain that the current input method state and caret
315 // position.
316 virtual ui::TextInputType GetTextInputType();
fsamuel72464894f2015-12-15 06:59:31317
donnda070f3c2015-01-16 19:54:11318#if defined(OS_ANDROID)
319 // Notifies that a tap was not consumed, so showing a UI for the unhandled
320 // tap may be needed.
donnd57e54f52015-02-26 19:03:37321 // Performs various checks on the given WebNode to apply heuristics to
322 // determine if triggering is appropriate.
avi5c77d212015-09-25 20:08:25323 void showUnhandledTapUIIfNeeded(const blink::WebPoint& tapped_position,
324 const blink::WebNode& tapped_node,
325 bool page_changed) override;
donnda070f3c2015-01-16 19:54:11326#endif
327
[email protected]7912e822014-04-16 02:37:03328 // Begins the compositor's scheduler to start producing frames.
329 void StartCompositor();
330
[email protected]aeeedad2014-08-22 18:16:22331 // Stop compositing.
ennef3c58142014-12-09 21:44:38332 void WillCloseLayerTreeView();
[email protected]aeeedad2014-08-22 18:16:22333
[email protected]24ed0432013-04-24 07:50:31334 RenderWidgetCompositor* compositor() const;
335
fsamuel72464894f2015-12-15 06:59:31336 const RenderWidgetInputHandler& input_handler() const {
fsamuele8326c742016-01-12 00:49:39337 return *input_handler_;
fsamuel72464894f2015-12-15 06:59:31338 }
339
340 void SetHandlingInputEventForTesting(bool handling_input_event);
341
[email protected]79fa22e2013-08-23 15:18:12342 // Callback for use with synthetic gestures (e.g. BeginSmoothScroll).
343 typedef base::Callback<void()> SyntheticGestureCompletionCallback;
[email protected]0e241b4b2012-08-18 09:06:27344
[email protected]9017d7852013-11-21 17:47:35345 // Send a synthetic gesture to the browser to be queued to the synthetic
346 // gesture controller.
347 void QueueSyntheticGesture(
dchengcedca5612016-04-09 01:40:15348 std::unique_ptr<SyntheticGestureParams> gesture_params,
[email protected]9017d7852013-11-21 17:47:35349 const SyntheticGestureCompletionCallback& callback);
[email protected]1e1dd182013-09-12 01:51:15350
[email protected]586871b2014-07-22 17:05:11351 // Deliveres |message| together with compositor state change updates. The
352 // exact behavior depends on |policy|.
353 // This mechanism is not a drop-in replacement for IPC: messages sent this way
354 // will not be automatically available to BrowserMessageFilter, for example.
355 // FIFO ordering is preserved between messages enqueued with the same
356 // |policy|, the ordering between messages enqueued for different policies is
357 // undefined.
358 //
359 // |msg| message to send, ownership of |msg| is transferred.
360 // |policy| see the comment on MessageDeliveryPolicy.
361 void QueueMessage(IPC::Message* msg, MessageDeliveryPolicy policy);
362
changwanf2a707b2015-10-30 08:22:16363 // Handle start and finish of IME event guard.
364 void OnImeEventGuardStart(ImeEventGuard* guard);
365 void OnImeEventGuardFinish(ImeEventGuard* guard);
[email protected]66fca5bc2013-05-23 06:58:29366
mfomitchev2600fd7c2016-02-17 20:53:39367 void SetPopupOriginAdjustmentsForEmulation(
368 RenderWidgetScreenMetricsEmulator* emulator);
[email protected]b2e4c70132013-10-03 02:07:51369
[email protected]2d6836f42014-07-02 17:25:31370 gfx::Rect AdjustValidationMessageAnchor(const gfx::Rect& anchor);
[email protected]b2e4c70132013-10-03 02:07:51371
jdduke491a3f0c2015-06-15 23:30:26372 void ScheduleComposite();
[email protected]7d08a9352013-10-15 08:24:56373 void ScheduleCompositeWithForcedRedraw();
374
[email protected]7a4e2532013-12-02 21:30:02375 // Checks if the selection bounds have been changed. If they are changed,
376 // the new value will be sent to the browser process.
377 void UpdateSelectionBounds();
378
[email protected]e5e438d62014-03-27 21:47:16379 virtual void GetSelectionBounds(gfx::Rect* start, gfx::Rect* end);
380
[email protected]a09d53ce2014-01-31 00:46:42381 void OnShowHostContextMenu(ContextMenuParams* params);
[email protected]7a4e2532013-12-02 21:30:02382
[email protected]7a4e2532013-12-02 21:30:02383 // Checks if the composition range or composition character bounds have been
384 // changed. If they are changed, the new value will be sent to the browser
yukawa5f21c6a2014-10-27 17:09:30385 // process. This method does nothing when the browser process is not able to
386 // handle composition range and composition character bounds.
nonafa291792016-08-10 02:36:18387 // If immediate_request is true, render sends the latest composition info to
388 // the browser even if the composition info is not changed.
389 void UpdateCompositionInfo(bool immediate_request);
[email protected]7a4e2532013-12-02 21:30:02390
lfgb00fcad2016-07-14 14:16:33391 // Called when the Widget has changed size as a result of an auto-resize.
392 void DidAutoResize(const gfx::Size& new_size);
393
lfge0c2792ec2016-05-11 18:52:08394 // Indicates whether this widget has focus.
395 bool has_focus() const { return has_focus_; }
396
pwnallef669312017-01-07 01:17:29397 MouseLockDispatcher* mouse_lock_dispatcher() const {
lfgbee1e0a2016-06-08 21:24:21398 return mouse_lock_dispatcher_.get();
399 }
400
ekaramad330ba4232016-09-23 17:57:47401 // TODO(ekaramad): The reference to the focused pepper plugin will be removed
402 // from RenderWidget. The purpose of having the reference here was to make IME
403 // work for OOPIF (https://crbug.com/643727).
ekaramad2a46d632016-07-19 13:33:09404 void set_focused_pepper_plugin(PepperPluginInstanceImpl* plugin) {
405 focused_pepper_plugin_ = plugin;
406 }
407
lfg1f9011c2016-08-17 21:18:42408 // When emulated, this returns original device scale factor.
409 float GetOriginalDeviceScaleFactor() const;
410
paulmeyer90f6c31d2016-11-12 00:17:59411 // Helper to convert |point| using ConvertWindowToViewport().
412 gfx::Point ConvertWindowPointToViewport(const gfx::Point& point);
413
wjmaclean1d970622017-01-21 22:28:24414 virtual void TransferActiveWheelFlingAnimation(
415 const blink::WebActiveWheelFlingParameters& params) {}
416
initial.commit09911bf2008-07-26 23:55:29417 protected:
[email protected]8085dbc82008-09-26 22:53:44418 // Friend RefCounted so that the dtor can be non-public. Using this class
419 // without ref-counting is an error.
420 friend class base::RefCounted<RenderWidget>;
fsamuele8326c742016-01-12 00:49:39421
[email protected]7339cd22010-10-27 00:11:20422 // For unit tests.
[email protected]e9ff79c2012-10-19 21:31:26423 friend class RenderWidgetTest;
[email protected]8085dbc82008-09-26 22:53:44424
[email protected]61e2b3cc2012-03-02 16:13:34425 enum ResizeAck {
426 SEND_RESIZE_ACK,
427 NO_RESIZE_ACK,
428 };
429
nick8331f8ad2016-11-15 20:42:45430 RenderWidget(int32_t widget_routing_id,
431 CompositorDependencies* compositor_deps,
dcheng35d31c112015-07-22 00:17:36432 blink::WebPopupType popup_type,
ccameron2f451532016-09-07 21:49:27433 const ScreenInfo& screen_info,
[email protected]1ac10dca2013-08-20 20:47:04434 bool swapped_out,
[email protected]7912e822014-04-16 02:37:03435 bool hidden,
436 bool never_visible);
[email protected]ce2b28e2012-08-09 15:53:57437
dcheng6d18e402014-10-21 12:32:52438 ~RenderWidget() override;
initial.commit09911bf2008-07-26 23:55:29439
lfgcaab5142016-02-26 19:06:52440 static blink::WebFrameWidget* CreateWebFrameWidget(
441 RenderWidget* render_widget,
442 blink::WebLocalFrame* frame);
dchengda9b4bb2015-07-20 20:58:08443
444 // Creates a WebWidget based on the popup type.
445 static blink::WebWidget* CreateWebWidget(RenderWidget* render_widget);
446
nick4df698d82016-11-11 20:39:23447 // Called by Create() functions and subclasses to finish initialization.
nickf7b38222016-11-22 21:59:35448 // |show_callback| will be invoked once WebWidgetClient::show() occurs, and
449 // should be null if show() won't be triggered for this widget.
450 void Init(const ShowCallback& show_callback, blink::WebWidget* web_widget);
[email protected]484955942010-08-19 16:13:18451
[email protected]949b6592014-08-20 13:17:52452 // Allows the process to exit once the unload handler has finished, if there
453 // are no other active RenderWidgets.
454 void WasSwappedOut();
455
[email protected]2533ce12009-05-09 00:02:24456 void DoDeferredClose();
dgozmancf9039cd2015-04-06 12:01:31457 void NotifyOnClose();
dchengda9b4bb2015-07-20 20:58:08458
bokanc63441c2016-04-27 15:49:12459 gfx::Size GetSizeForWebWidget() const;
460 virtual void ResizeWebWidget();
461
dchengda9b4bb2015-07-20 20:58:08462 // Close the underlying WebWidget.
463 virtual void Close();
initial.commit09911bf2008-07-26 23:55:29464
[email protected]92650162013-10-30 03:31:02465 // Used to force the size of a window when running layout tests.
bokanc007c3a2015-02-03 07:15:56466 void SetWindowRectSynchronously(const gfx::Rect& new_window_rect);
haibinluc643d33c2016-06-03 02:22:34467#if defined(USE_EXTERNAL_POPUP_MENU)
[email protected]b2e4c70132013-10-03 02:07:51468 void SetExternalPopupOriginAdjustmentsForEmulation(
mfomitchev2600fd7c2016-02-17 20:53:39469 ExternalPopupMenu* popup,
470 RenderWidgetScreenMetricsEmulator* emulator);
[email protected]53907862014-03-25 15:42:40471#endif
[email protected]61e2b3cc2012-03-02 16:13:34472
initial.commit09911bf2008-07-26 23:55:29473 // RenderWidget IPC message handlers
nzolghadr5d8596502017-01-23 22:59:35474 void OnHandleInputEvent(
475 const blink::WebInputEvent* event,
476 const std::vector<const blink::WebInputEvent*>& coalesced_events,
477 const ui::LatencyInfo& latency_info,
478 InputEventDispatchType dispatch_type);
[email protected]34202de2013-05-06 23:36:22479 void OnCursorVisibilityChange(bool is_visible);
[email protected]c084330e02013-04-27 01:08:15480 void OnMouseCaptureLost();
alexmos56567492016-09-13 00:52:46481 void OnSetEditCommandsForNextKeyEvent(const EditCommands& edit_commands);
[email protected]c084330e02013-04-27 01:08:15482 virtual void OnSetFocus(bool enable);
naskoc288745f2015-05-01 22:54:21483 void OnClose();
[email protected]fc4404d2012-11-07 19:53:30484 void OnCreatingNewAck();
fsamuel664e8b62016-01-20 19:54:01485 virtual void OnResize(const ResizeParams& params);
dgozman9260b0a12015-03-16 13:45:20486 void OnEnableDeviceEmulation(const blink::WebDeviceEmulationParams& params);
487 void OnDisableDeviceEmulation();
[email protected]941e4552010-02-01 21:23:43488 virtual void OnWasHidden();
[email protected]3399dd822014-08-09 11:14:24489 virtual void OnWasShown(bool needs_repainting,
490 const ui::LatencyInfo& latency_info);
avi1023d012015-12-25 02:39:14491 void OnCreateVideoAck(int32_t video_id);
492 void OnUpdateVideoAck(int32_t video_id);
[email protected]2533ce12009-05-09 00:02:24493 void OnRequestMoveAck();
[email protected]56ea1a62011-05-30 07:05:57494 virtual void OnImeSetComposition(
[email protected]fcf75d42013-12-03 20:11:26495 const base::string16& text,
[email protected]180ef242013-11-07 06:50:46496 const std::vector<blink::WebCompositionUnderline>& underlines,
chongz7eb752802016-01-27 21:28:07497 const gfx::Range& replacement_range,
[email protected]fa7b1dc2010-06-23 17:53:04498 int selection_start,
499 int selection_end);
rlanday7efe2302017-01-11 00:14:28500 virtual void OnImeCommitText(
501 const base::string16& text,
502 const std::vector<blink::WebCompositionUnderline>& underlines,
503 const gfx::Range& replacement_range,
504 int relative_cursor_pos);
aelias87b8f7c2016-09-14 03:19:29505 virtual void OnImeFinishComposingText(bool keep_selection);
506
oshimad5279032015-12-16 18:22:33507 // Called when the device scale factor is changed, or the layer tree is
508 // initialized.
509 virtual void OnDeviceScaleFactorChanged();
510
[email protected]0bc1f572013-04-17 01:46:31511 void OnRepaint(gfx::Size size_to_paint);
[email protected]79fa22e2013-08-23 15:18:12512 void OnSyntheticGestureCompleted();
[email protected]180ef242013-11-07 06:50:46513 void OnSetTextDirection(blink::WebTextDirection direction);
[email protected]872ae5b2011-05-26 20:20:50514 void OnGetFPS();
[email protected]80ad8622012-11-07 16:33:03515 void OnUpdateScreenRects(const gfx::Rect& view_screen_rect,
516 const gfx::Rect& window_screen_rect);
lfgdb5c4ed2016-03-04 23:09:07517 void OnUpdateWindowScreenRect(const gfx::Rect& window_screen_rect);
kenrbea731792017-01-13 15:10:48518 void OnSetViewportIntersection(const gfx::Rect& viewport_intersection);
paulmeyer90f6c31d2016-11-12 00:17:59519 // Real data that is dragged is not included at DragEnter time.
520 void OnDragTargetDragEnter(
521 const std::vector<DropData::Metadata>& drop_meta_data,
522 const gfx::Point& client_pt,
523 const gfx::Point& screen_pt,
524 blink::WebDragOperationsMask operations_allowed,
525 int key_modifiers);
526 void OnDragTargetDragOver(const gfx::Point& client_pt,
527 const gfx::Point& screen_pt,
528 blink::WebDragOperationsMask operations_allowed,
529 int key_modifiers);
kenrb07c272802017-02-07 23:48:17530 void OnDragTargetDragLeave(const gfx::Point& client_point,
531 const gfx::Point& screen_point);
paulmeyer90f6c31d2016-11-12 00:17:59532 void OnDragTargetDrop(const DropData& drop_data,
533 const gfx::Point& client_pt,
534 const gfx::Point& screen_pt,
535 int key_modifiers);
paulmeyer8fc8ea92016-11-15 05:12:21536 void OnDragSourceEnded(const gfx::Point& client_point,
537 const gfx::Point& screen_point,
538 blink::WebDragOperation drag_operation);
539 void OnDragSourceSystemDragEnded();
[email protected]0d1ebed12013-08-05 22:01:13540
[email protected]adb362312014-06-28 06:04:24541#if defined(OS_ANDROID)
changwan8c342742016-02-26 00:53:39542 // Called by the browser process to update text input state.
543 void OnRequestTextInputStateUpdate();
[email protected]105dffb42013-02-20 03:46:21544#endif
[email protected]0d1ebed12013-08-05 22:01:13545
nonafa291792016-08-10 02:36:18546 // Called by the browser process to update the cursor and composition
547 // information.
548 void OnRequestCompositionUpdate(bool immediate_request, bool monitor_request);
549
[email protected]847a2582013-03-09 02:29:51550 // Notify the compositor about a change in viewport size. This should be
551 // used only with auto resize mode WebWidgets, as normal WebWidgets should
552 // go through OnResize.
[email protected]97e1bf72013-03-06 14:06:05553 void AutoResizeCompositor();
554
wjmaclean8a795f32016-08-11 23:49:58555 virtual void OnSetDeviceScaleFactor(float device_scale_factor);
[email protected]468ac582012-11-20 00:53:19556
[email protected]fcdc5642014-05-09 14:32:24557 virtual void OnOrientationChange();
558
[email protected]29ed96a2012-02-04 18:12:16559 // Override points to notify derived classes that a paint has happened.
[email protected]0704ac32013-10-03 15:24:22560 // DidInitiatePaint happens when that has completed, and subsequent rendering
bmcquade1f070c52016-11-02 17:50:51561 // won't affect the painted content.
lfge0c2792ec2016-05-11 18:52:08562 virtual void DidInitiatePaint() {}
[email protected]a2f6bc112009-06-27 16:27:25563
[email protected]ed7defa2013-03-12 21:29:59564 virtual GURL GetURLForGraphicsContext3D();
[email protected]65225772011-05-12 21:10:24565
[email protected]bee16aab2009-08-26 15:55:03566 // Sets the "hidden" state of this widget. All accesses to is_hidden_ should
567 // use this method so that we can properly inform the RenderThread of our
568 // state.
569 void SetHidden(bool hidden);
570
[email protected]2b624c562011-10-27 22:58:26571 void DidToggleFullscreen();
572
[email protected]674741932009-02-04 23:44:46573 bool next_paint_is_resize_ack() const;
[email protected]674741932009-02-04 23:44:46574 void set_next_paint_is_resize_ack();
[email protected]674741932009-02-04 23:44:46575 void set_next_paint_is_repaint_ack();
[email protected]ec7dc112008-08-06 05:30:12576
[email protected]586871b2014-07-22 17:05:11577 // QueueMessage implementation extracted into a static method for easy
578 // testing.
dchengcedca5612016-04-09 01:40:15579 static std::unique_ptr<cc::SwapPromise> QueueMessageImpl(
[email protected]586871b2014-07-22 17:05:11580 IPC::Message* msg,
581 MessageDeliveryPolicy policy,
582 FrameSwapMessageQueue* frame_swap_message_queue,
583 scoped_refptr<IPC::SyncMessageFilter> sync_message_filter,
[email protected]586871b2014-07-22 17:05:11584 int source_frame_number);
585
[email protected]58b48a0d2012-06-13 07:01:35586 // Override point to obtain that the current composition character bounds.
587 // In the case of surrogate pairs, the character is treated as two characters:
588 // the bounds for first character is actual one, and the bounds for second
589 // character is zero width rectangle.
590 virtual void GetCompositionCharacterBounds(
591 std::vector<gfx::Rect>* character_bounds);
592
[email protected]88dbe32f2013-06-20 23:31:36593 // Returns the range of the text that is being composed or the selection if
594 // the composition does not exist.
[email protected]db4fc1e2013-09-06 20:01:51595 virtual void GetCompositionRange(gfx::Range* range);
[email protected]88dbe32f2013-06-20 23:31:36596
[email protected]58b48a0d2012-06-13 07:01:35597 // Returns true if the composition range or composition character bounds
598 // should be sent to the browser process.
599 bool ShouldUpdateCompositionInfo(
[email protected]db4fc1e2013-09-06 20:01:51600 const gfx::Range& range,
[email protected]58b48a0d2012-06-13 07:01:35601 const std::vector<gfx::Rect>& bounds);
602
[email protected]ad26ef42011-06-17 07:59:45603 // Override point to obtain that the current input method state about
604 // composition text.
605 virtual bool CanComposeInline();
[email protected]56ea1a62011-05-30 07:05:57606
[email protected]2533ce12009-05-09 00:02:24607 // Set the pending window rect.
608 // Because the real render_widget is hosted in another process, there is
609 // a time period where we may have set a new window rect which has not yet
610 // been processed by the browser. So we maintain a pending window rect
611 // size. If JS code sets the WindowRect, and then immediately calls
612 // GetWindowRect() we'll use this pending window rect as the size.
[email protected]180ef242013-11-07 06:50:46613 void SetPendingWindowRect(const blink::WebRect& r);
[email protected]2533ce12009-05-09 00:02:24614
[email protected]ce6689f2013-03-29 12:52:55615 // Check whether the WebWidget has any touch event handlers registered.
avi5c77d212015-09-25 20:08:25616 void hasTouchEventHandlers(bool has_handlers) override;
[email protected]ce6689f2013-03-29 12:52:55617
[email protected]5d0bbdfa92013-12-10 00:35:51618 // Tell the browser about the actions permitted for a new touch point.
avi5c77d212015-09-25 20:08:25619 void setTouchAction(blink::WebTouchAction touch_action) override;
[email protected]5d0bbdfa92013-12-10 00:35:51620
lfg43e08e62016-02-03 18:51:37621 // Sends an ACK to the browser process during the next compositor frame.
622 void OnWaitNextFrameForTests(int routing_id);
623
initial.commit09911bf2008-07-26 23:55:29624 // Routing ID that allows us to communicate to the parent browser process
nick8331f8ad2016-11-15 20:42:45625 // RenderWidgetHost.
626 const int32_t routing_id_;
initial.commit09911bf2008-07-26 23:55:29627
danakj6e3bf8012014-12-16 18:27:53628 // Dependencies for initializing a compositor, including flags for optional
629 // features.
dcheng35d31c112015-07-22 00:17:36630 CompositorDependencies* const compositor_deps_;
danakj6e3bf8012014-12-16 18:27:53631
lfg8ff33912016-09-13 20:59:21632 // Use GetWebWidget() instead of using webwidget_internal_ directly.
[email protected]c5b3b5e2009-02-13 06:41:11633 // We are responsible for destroying this object via its Close method.
[email protected]4ee64622014-03-21 22:34:15634 // May be NULL when the window is closing.
lfg8ff33912016-09-13 20:59:21635 blink::WebWidget* webwidget_internal_;
initial.commit09911bf2008-07-26 23:55:29636
avi40b5be7a2016-03-03 21:13:44637 // The delegate of the owner of this object.
638 RenderWidgetOwnerDelegate* owner_delegate_;
639
[email protected]8926c602013-01-23 05:32:06640 // This is lazily constructed and must not outlive webwidget_.
dchengcedca5612016-04-09 01:40:15641 std::unique_ptr<RenderWidgetCompositor> compositor_;
[email protected]8926c602013-01-23 05:32:06642
bokanc007c3a2015-02-03 07:15:56643 // The rect where this view should be initially shown.
644 gfx::Rect initial_rect_;
initial.commit09911bf2008-07-26 23:55:29645
initial.commit09911bf2008-07-26 23:55:29646 // We store the current cursor object so we can avoid spamming SetCursor
647 // messages.
648 WebCursor current_cursor_;
[email protected]88efb7ec2009-07-14 16:32:59649
initial.commit09911bf2008-07-26 23:55:29650 // The size of the RenderWidget.
651 gfx::Size size_;
652
[email protected]60d47ac2013-03-01 23:42:44653 // The size of the view's backing surface in non-DPI-adjusted pixels.
654 gfx::Size physical_backing_size_;
655
[email protected]bb6378fe2014-04-28 21:19:44656 // The size of the visible viewport in DPI-adjusted pixels.
657 gfx::Size visible_viewport_size_;
658
[email protected]53d3f302009-12-21 04:42:05659 // Flags for the next ViewHostMsg_UpdateRect message.
initial.commit09911bf2008-07-26 23:55:29660 int next_paint_flags_;
661
[email protected]847a2582013-03-09 02:29:51662 // Whether the WebWidget is in auto resize mode, which is used for example
663 // by extension popups.
664 bool auto_resize_mode_;
665
[email protected]ea3ee0a2012-05-15 03:43:09666 // True if we need to send an UpdateRect message to notify the browser about
667 // an already-completed auto-resize.
668 bool need_update_rect_for_auto_resize_;
669
initial.commit09911bf2008-07-26 23:55:29670 // Set to true if we should ignore RenderWidget::Show calls.
671 bool did_show_;
672
673 // Indicates that we shouldn't bother generated paint events.
674 bool is_hidden_;
675
[email protected]7912e822014-04-16 02:37:03676 // Indicates that we are never visible, so never produce graphical output.
sievers71c62dd52015-10-07 01:44:39677 const bool compositor_never_visible_;
[email protected]7912e822014-04-16 02:37:03678
mikhail.pozdnyakovf2c902a2015-04-14 08:09:12679 // Indicates whether tab-initiated fullscreen was granted.
680 bool is_fullscreen_granted_;
[email protected]ee41e7d22011-10-14 19:34:09681
mikhail.pozdnyakovc0e251b2015-04-15 06:51:12682 // Indicates the display mode.
683 blink::WebDisplayMode display_mode_;
684
changwanf2a707b2015-10-30 08:22:16685 // It is possible that one ImeEventGuard is nested inside another
686 // ImeEventGuard. We keep track of the outermost one, and update it as needed.
687 ImeEventGuard* ime_event_guard_;
[email protected]e8f775f2013-02-14 21:00:50688
initial.commit09911bf2008-07-26 23:55:29689 // True if we have requested this widget be closed. No more messages will
690 // be sent, except for a Close.
691 bool closing_;
692
[email protected]aeeedad2014-08-22 18:16:22693 // True if it is known that the host is in the process of being shut down.
694 bool host_closing_;
695
[email protected]992db4c2011-05-12 15:37:15696 // Whether this RenderWidget is currently swapped out, such that the view is
697 // being rendered by another process. If all RenderWidgets in a process are
698 // swapped out, the process can exit.
699 bool is_swapped_out_;
700
simonhong628f9812015-04-27 23:13:20701 // Whether this RenderWidget is for an out-of-process iframe or not.
702 bool for_oopif_;
703
[email protected]5b739cb2012-08-21 20:35:21704 // Stores information about the current text input.
[email protected]180ef242013-11-07 06:50:46705 blink::WebTextInputInfo text_input_info_;
[email protected]5b739cb2012-08-21 20:35:21706
dglazkov97b6c2b2016-10-25 17:35:55707 // Stores the current text input type of |webwidget_|.
708 ui::TextInputType text_input_type_;
709
[email protected]b256eca2013-07-11 10:57:40710 // Stores the current text input mode of |webwidget_|.
711 ui::TextInputMode text_input_mode_;
712
shuchen82ce8c52014-10-23 01:55:20713 // Stores the current text input flags of |webwidget_|.
714 int text_input_flags_;
715
[email protected]86ba5fcb2013-09-04 00:36:53716 // Stores the current type of composition text rendering of |webwidget_|.
717 bool can_compose_inline_;
718
[email protected]e99ef6f2011-10-16 01:13:00719 // Stores the current selection bounds.
[email protected]7c8873e2013-02-05 08:03:01720 gfx::Rect selection_focus_rect_;
721 gfx::Rect selection_anchor_rect_;
initial.commit09911bf2008-07-26 23:55:29722
[email protected]58b48a0d2012-06-13 07:01:35723 // Stores the current composition character bounds.
724 std::vector<gfx::Rect> composition_character_bounds_;
725
726 // Stores the current composition range.
[email protected]db4fc1e2013-09-06 20:01:51727 gfx::Range composition_range_;
[email protected]58b48a0d2012-06-13 07:01:35728
[email protected]3e2b375b2010-04-07 17:03:12729 // The kind of popup this widget represents, NONE if not a popup.
[email protected]180ef242013-11-07 06:50:46730 blink::WebPopupType popup_type_;
[email protected]0ebf3872008-11-07 21:35:03731
[email protected]80ad8622012-11-07 16:33:03732 // While we are waiting for the browser to update window sizes, we track the
733 // pending size temporarily.
[email protected]2533ce12009-05-09 00:02:24734 int pending_window_rect_count_;
lfg0140a452016-07-19 19:15:05735 gfx::Rect pending_window_rect_;
[email protected]2533ce12009-05-09 00:02:24736
[email protected]80ad8622012-11-07 16:33:03737 // The screen rects of the view and the window that contains it.
738 gfx::Rect view_screen_rect_;
739 gfx::Rect window_screen_rect_;
740
dchengcedca5612016-04-09 01:40:15741 std::unique_ptr<RenderWidgetInputHandler> input_handler_;
[email protected]12fbad812009-09-01 18:21:24742
[email protected]fd847792013-10-24 17:12:35743 // The time spent in input handlers this frame. Used to throttle input acks.
744 base::TimeDelta total_input_handling_time_this_frame_;
745
[email protected]842f10652012-06-06 01:54:04746 // Properties of the screen hosting this RenderWidget instance.
ccameron2f451532016-09-07 21:49:27747 ScreenInfo screen_info_;
[email protected]842f10652012-06-06 01:54:04748
[email protected]f1cccb32012-06-06 18:29:59749 // The device scale factor. This value is computed from the DPI entries in
750 // |screen_info_| on some platforms, and defaults to 1 on other platforms.
[email protected]faec7b12012-06-19 14:42:13751 float device_scale_factor_;
[email protected]f1cccb32012-06-06 18:29:59752
[email protected]9017d7852013-11-21 17:47:35753 // State associated with synthetic gestures. Synthetic gestures are processed
754 // in-order, so a queue is sufficient to identify the correct state for a
755 // completed gesture.
756 std::queue<SyntheticGestureCompletionCallback>
757 pending_synthetic_gesture_callbacks_;
[email protected]0e241b4b2012-08-18 09:06:27758
nonafa291792016-08-10 02:36:18759 // True if the IME requests updated composition info.
760 bool monitor_composition_info_;
761
dchengcedca5612016-04-09 01:40:15762 std::unique_ptr<RenderWidgetScreenMetricsEmulator> screen_metrics_emulator_;
[email protected]b2e4c70132013-10-03 02:07:51763
764 // Popups may be displaced when screen metrics emulation is enabled.
765 // These values are used to properly adjust popup position.
danakj2ef31b82015-10-21 18:18:02766 gfx::Point popup_view_origin_for_emulation_;
767 gfx::Point popup_screen_origin_for_emulation_;
[email protected]b2e4c70132013-10-03 02:07:51768 float popup_origin_scale_for_emulation_;
769
[email protected]586871b2014-07-22 17:05:11770 scoped_refptr<FrameSwapMessageQueue> frame_swap_message_queue_;
dchengcedca5612016-04-09 01:40:15771 std::unique_ptr<ResizingModeSelector> resizing_mode_selector_;
[email protected]5b45ad42013-10-25 00:42:04772
[email protected]e3244ed2014-06-20 20:04:27773 // Lists of RenderFrameProxy objects that need to be notified of
774 // compositing-related events (e.g. DidCommitCompositorFrame).
brettw236d3172015-06-03 16:31:43775 base::ObserverList<RenderFrameProxy> render_frame_proxies_;
[email protected]bffc8302014-01-23 20:52:16776
[email protected]de3c5d82014-05-28 22:12:59777 // A list of RenderFrames associated with this RenderWidget. Notifications
778 // are sent to each frame in the list for events such as changing
779 // visibility state for example.
brettw236d3172015-06-03 16:31:43780 base::ObserverList<RenderFrameImpl> render_frames_;
[email protected]de3c5d82014-05-28 22:12:59781
[email protected]be1af0662014-07-29 19:55:51782 bool has_host_context_menu_location_;
783 gfx::Point host_context_menu_location_;
[email protected]a09d53ce2014-01-31 00:46:42784
skyostil529caa292016-08-10 17:44:51785 std::unique_ptr<blink::scheduler::RenderWidgetSchedulingState>
alexclarke7fa93942015-10-21 15:37:11786 render_widget_scheduling_state_;
787
lfgbee1e0a2016-06-08 21:24:21788 // Mouse Lock dispatcher attached to this view.
789 std::unique_ptr<RenderWidgetMouseLockDispatcher> mouse_lock_dispatcher_;
790
791 // Wraps the |webwidget_| as a MouseLockDispatcher::LockTarget interface.
792 std::unique_ptr<MouseLockDispatcher::LockTarget> webwidget_mouse_lock_target_;
793
wjmaclean1d970622017-01-21 22:28:24794 bool has_added_input_handler_;
795
oshima50872a72016-03-04 13:26:18796 private:
bokan841fdc72016-10-06 00:16:35797 // Applies/Removes the DevTools device emulation transformation to/from a
798 // window rect.
799 void ScreenRectToEmulatedIfNeeded(blink::WebRect* window_rect) const;
800 void EmulatedToScreenRectIfNeeded(blink::WebRect* window_rect) const;
801
dtapuska014ed082016-11-11 21:58:48802 bool CreateWidget(int32_t opener_id,
803 blink::WebPopupType popup_type,
804 int32_t* routing_id);
805
806 // A variant of Send but is fatal if it fails. The browser may
807 // be waiting for this IPC Message and if the send fails the browser will
808 // be left in a state waiting for something that never comes. And if it
809 // never comes then it may later determine this is a hung renderer; so
810 // instead fail right away.
811 void SendOrCrash(IPC::Message* msg);
812
ekaramad5aff1942017-01-06 01:26:35813 // Determines whether or not RenderWidget should process IME events from the
814 // browser. It always returns true unless there is no WebFrameWidget to
815 // handle the event, or there is no page focus.
816 bool ShouldHandleImeEvents() const;
817
changwan75e3b2072017-01-16 02:55:00818 void UpdateTextInputStateInternal(bool show_virtual_keyboard,
819 bool reply_to_request);
820
lfge0c2792ec2016-05-11 18:52:08821 // Indicates whether this widget has focus.
822 bool has_focus_;
823
nickf7b38222016-11-22 21:59:35824 // A callback into the creator/opener of this widget, to be executed when
825 // WebWidgetClient::show() occurs.
826 ShowCallback show_callback_;
827
ekaramad330ba4232016-09-23 17:57:47828#if defined(OS_MACOSX)
829 // Responds to IPCs from TextInputClientMac regarding getting string at given
830 // position or range as well as finding character index at a given position.
831 std::unique_ptr<TextInputClientObserver> text_input_client_observer_;
832#endif
833
ekaramad2a46d632016-07-19 13:33:09834 // This reference is set by the RenderFrame and is used to query the IME-
835 // related state from the plugin to later send to the browser.
836 PepperPluginInstanceImpl* focused_pepper_plugin_;
837
alexmos56567492016-09-13 00:52:46838 // Stores edit commands associated to the next key event.
839 // Will be cleared as soon as the next key event is processed.
840 EditCommands edit_commands_;
841
paulmeyer6ef5a792016-11-08 20:33:58842 // This field stores drag/drop related info for the event that is currently
843 // being handled. If the current event results in starting a drag/drop
844 // session, this info is sent to the browser along with other drag/drop info.
845 DragEventSourceInfo possible_drag_event_info_;
846
tasakb95dbb50c2017-02-08 18:07:50847 bool time_to_first_active_paint_recorded_;
848 base::TimeTicks was_shown_time_;
849
wjmaclean1d970622017-01-21 22:28:24850 base::WeakPtrFactory<RenderWidget> weak_ptr_factory_;
851
[email protected]05d478752009-04-08 23:38:16852 DISALLOW_COPY_AND_ASSIGN(RenderWidget);
initial.commit09911bf2008-07-26 23:55:29853};
854
[email protected]e9ff79c2012-10-19 21:31:26855} // namespace content
856
[email protected]2cff0052011-03-18 16:51:44857#endif // CONTENT_RENDERER_RENDER_WIDGET_H_