blob: 0712b7752a2228dbb5ef15a4b71663671a249534 [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
[email protected]aa4117f2011-12-09 22:19:218#include <deque>
[email protected]0e241b4b2012-08-18 09:06:279#include <map>
[email protected]010ea08a2009-10-11 20:21:3210
[email protected]8062ab262014-05-27 16:56:4311#include "base/auto_reset.h"
initial.commit09911bf2008-07-26 23:55:2912#include "base/basictypes.h"
[email protected]586871b2014-07-22 17:05:1113#include "base/callback.h"
[email protected]f3112a52011-09-30 23:47:4914#include "base/compiler_specific.h"
[email protected]3b63f8f42011-03-28 01:54:1515#include "base/memory/ref_counted.h"
[email protected]8704f89b2011-04-15 00:30:0516#include "base/memory/scoped_ptr.h"
[email protected]bffc8302014-01-23 20:52:1617#include "base/observer_list.h"
[email protected]abb522162013-06-28 01:54:1618#include "base/time/time.h"
[email protected]f3112a52011-09-30 23:47:4919#include "content/common/content_export.h"
[email protected]c2809346d2014-03-20 00:11:0320#include "content/common/cursors/webcursor.h"
[email protected]ed7defa2013-03-12 21:29:5921#include "content/common/gpu/client/webgraphicscontext3d_command_buffer_impl.h"
[email protected]9017d7852013-11-21 17:47:3522#include "content/common/input/synthetic_gesture_params.h"
[email protected]586871b2014-07-22 17:05:1123#include "content/renderer/message_delivery_policy.h"
[email protected]4f86bdb2012-11-10 19:11:1924#include "ipc/ipc_listener.h"
25#include "ipc/ipc_sender.h"
[email protected]5c30b5e02013-05-30 03:46:0826#include "third_party/WebKit/public/platform/WebRect.h"
[email protected]2255a9332013-06-17 05:12:3127#include "third_party/WebKit/public/web/WebCompositionUnderline.h"
[email protected]c27dd4f2014-05-22 18:05:1928#include "third_party/WebKit/public/web/WebInputEvent.h"
[email protected]2255a9332013-06-17 05:12:3129#include "third_party/WebKit/public/web/WebPopupType.h"
30#include "third_party/WebKit/public/web/WebTextDirection.h"
31#include "third_party/WebKit/public/web/WebTextInputInfo.h"
[email protected]5d0bbdfa92013-12-10 00:35:5132#include "third_party/WebKit/public/web/WebTouchAction.h"
[email protected]0e45bd02013-07-12 20:20:0233#include "third_party/WebKit/public/web/WebWidget.h"
[email protected]2255a9332013-06-17 05:12:3134#include "third_party/WebKit/public/web/WebWidgetClient.h"
[email protected]d65adb12010-04-28 17:26:4935#include "third_party/skia/include/core/SkBitmap.h"
[email protected]b256eca2013-07-11 10:57:4036#include "ui/base/ime/text_input_mode.h"
[email protected]ad26ef42011-06-17 07:59:4537#include "ui/base/ime/text_input_type.h"
[email protected]a09d53ce2014-01-31 00:46:4238#include "ui/base/ui_base_types.h"
tfarina93bfa912014-12-05 14:23:1539#include "ui/gfx/geometry/rect.h"
40#include "ui/gfx/geometry/vector2d.h"
41#include "ui/gfx/geometry/vector2d_f.h"
[email protected]08397d52011-02-05 01:53:3842#include "ui/gfx/native_widget_types.h"
[email protected]db4fc1e2013-09-06 20:01:5143#include "ui/gfx/range/range.h"
[email protected]d353541f2012-05-03 22:45:4144#include "ui/surface/transport_dib.h"
initial.commit09911bf2008-07-26 23:55:2945
[email protected]aa4117f2011-12-09 22:19:2146struct ViewHostMsg_UpdateRect_Params;
[email protected]0fdd5012013-05-29 08:05:5647struct ViewMsg_Resize_Params;
[email protected]aa4117f2011-12-09 22:19:2148class ViewHostMsg_UpdateRect;
49
[email protected]484955942010-08-19 16:13:1850namespace IPC {
51class SyncMessage;
[email protected]586871b2014-07-22 17:05:1152class SyncMessageFilter;
[email protected]484955942010-08-19 16:13:1853}
54
[email protected]180ef242013-11-07 06:50:4655namespace blink {
[email protected]19193682014-04-03 15:01:4356struct WebDeviceEmulationParams;
kenrba7199832015-01-22 23:44:5957class WebFrameWidget;
[email protected]41d86852012-11-07 12:23:2458class WebGestureEvent;
[email protected]f56c7872013-06-18 12:31:5759class WebKeyboardEvent;
kenrba7199832015-01-22 23:44:5960class WebLocalFrame;
[email protected]6a8ddba52010-09-05 04:38:0661class WebMouseEvent;
donnda070f3c2015-01-16 19:54:1162class WebNode;
63struct WebPoint;
[email protected]2d0f2e92011-10-03 09:02:2464class WebTouchEvent;
kenrba7199832015-01-22 23:44:5965class WebView;
[email protected]526476902011-10-06 20:34:0666}
67
[email protected]586871b2014-07-22 17:05:1168namespace cc {
ccamerond4ba47902014-12-17 07:20:3169struct InputHandlerScrollResult;
[email protected]586871b2014-07-22 17:05:1170class OutputSurface;
71class SwapPromise;
72}
[email protected]ba91a792013-02-06 09:48:2873
[email protected]db4fc1e2013-09-06 20:01:5174namespace gfx {
[email protected]4de6d1692011-10-12 08:45:4475class Range;
76}
77
[email protected]e9ff79c2012-10-19 21:31:2678namespace content {
danakj6e3bf8012014-12-16 18:27:5379class CompositorDependencies;
[email protected]b2e4c70132013-10-03 02:07:5180class ExternalPopupMenu;
[email protected]586871b2014-07-22 17:05:1181class FrameSwapMessageQueue;
[email protected]adab2332013-07-25 18:04:3282class PepperPluginInstanceImpl;
[email protected]bffc8302014-01-23 20:52:1683class RenderFrameImpl;
[email protected]e3244ed2014-06-20 20:04:2784class RenderFrameProxy;
[email protected]ba91a792013-02-06 09:48:2885class RenderWidgetCompositor;
[email protected]e9ff79c2012-10-19 21:31:2686class RenderWidgetTest;
[email protected]5b45ad42013-10-25 00:42:0487class ResizingModeSelector;
[email protected]b2e4c70132013-10-03 02:07:5188struct ContextMenuParams;
[email protected]29e2fb42013-07-19 01:13:4789struct WebPluginGeometry;
[email protected]e9ff79c2012-10-19 21:31:2690
initial.commit09911bf2008-07-26 23:55:2991// RenderWidget provides a communication bridge between a WebWidget and
92// a RenderWidgetHost, the latter of which lives in a different process.
[email protected]f3112a52011-09-30 23:47:4993class CONTENT_EXPORT RenderWidget
[email protected]c47317e2012-06-20 22:35:3194 : public IPC::Listener,
95 public IPC::Sender,
[email protected]180ef242013-11-07 06:50:4696 NON_EXPORTED_BASE(virtual public blink::WebWidgetClient),
[email protected]f3112a52011-09-30 23:47:4997 public base::RefCounted<RenderWidget> {
initial.commit09911bf2008-07-26 23:55:2998 public:
99 // Creates a new RenderWidget. The opener_id is the routing ID of the
[email protected]380244092011-10-07 17:26:27100 // RenderView that this widget lives inside.
[email protected]0ebf3872008-11-07 21:35:03101 static RenderWidget* Create(int32 opener_id,
danakj6e3bf8012014-12-16 18:27:53102 CompositorDependencies* compositor_deps,
[email protected]180ef242013-11-07 06:50:46103 blink::WebPopupType popup_type,
104 const blink::WebScreenInfo& screen_info);
initial.commit09911bf2008-07-26 23:55:29105
kenrba7199832015-01-22 23:44:59106 // Creates a new RenderWidget that will be attached to a RenderFrame.
107 static RenderWidget* CreateForFrame(int routing_id,
108 int surface_id,
109 bool hidden,
110 const blink::WebScreenInfo& screen_info,
111 CompositorDependencies* compositor_deps,
112 blink::WebLocalFrame* frame);
113
114 static blink::WebWidget* CreateWebFrameWidget(RenderWidget* render_widget,
115 blink::WebLocalFrame* frame);
116
[email protected]484955942010-08-19 16:13:18117 // Creates a WebWidget based on the popup type.
[email protected]180ef242013-11-07 06:50:46118 static blink::WebWidget* CreateWebWidget(RenderWidget* render_widget);
[email protected]484955942010-08-19 16:13:18119
[email protected]4ee64622014-03-21 22:34:15120 int32 routing_id() const { return routing_id_; }
121 int32 surface_id() const { return surface_id_; }
danakj6e3bf8012014-12-16 18:27:53122 CompositorDependencies* compositor_deps() const { return compositor_deps_; }
[email protected]180ef242013-11-07 06:50:46123 blink::WebWidget* webwidget() const { return webwidget_; }
[email protected]93b9d692011-04-13 00:44:31124 gfx::Size size() const { return size_; }
[email protected]589621b2010-09-23 22:01:07125 bool has_focus() const { return has_focus_; }
[email protected]ee41e7d22011-10-14 19:34:09126 bool is_fullscreen() const { return is_fullscreen_; }
[email protected]204f1df2012-01-04 20:21:13127 bool is_hidden() const { return is_hidden_; }
[email protected]4ee64622014-03-21 22:34:15128 bool handling_input_event() const { return handling_input_event_; }
129 // Temporary for debugging purposes...
130 bool closing() const { return closing_; }
131 bool is_swapped_out() { return is_swapped_out_; }
132 ui::MenuSourceType context_menu_source_type() {
[email protected]be1af0662014-07-29 19:55:51133 return context_menu_source_type_;
134 }
135 bool has_host_context_menu_location() {
136 return has_host_context_menu_location_;
137 }
138 gfx::Point host_context_menu_location() {
139 return host_context_menu_location_;
[email protected]4ee64622014-03-21 22:34:15140 }
[email protected]589621b2010-09-23 22:01:07141
kenrba7199832015-01-22 23:44:59142 // ScreenInfo exposed so it can be passed to subframe RenderWidgets.
143 blink::WebScreenInfo screen_info() const { return screen_info_; }
144
[email protected]bffc8302014-01-23 20:52:16145 // Functions to track out-of-process frames for special notifications.
[email protected]e3244ed2014-06-20 20:04:27146 void RegisterRenderFrameProxy(RenderFrameProxy* proxy);
147 void UnregisterRenderFrameProxy(RenderFrameProxy* proxy);
[email protected]bffc8302014-01-23 20:52:16148
[email protected]de3c5d82014-05-28 22:12:59149 // Functions to track all RenderFrame objects associated with this
150 // RenderWidget.
151 void RegisterRenderFrame(RenderFrameImpl* frame);
152 void UnregisterRenderFrame(RenderFrameImpl* frame);
153
[email protected]a017938b2014-05-27 21:17:17154#if defined(VIDEO_HOLE)
155 void RegisterVideoHoleFrame(RenderFrameImpl* frame);
156 void UnregisterVideoHoleFrame(RenderFrameImpl* frame);
157#endif // defined(VIDEO_HOLE)
158
[email protected]c47317e2012-06-20 22:35:31159 // IPC::Listener
dcheng6d18e402014-10-21 12:32:52160 bool OnMessageReceived(const IPC::Message& msg) override;
initial.commit09911bf2008-07-26 23:55:29161
[email protected]c47317e2012-06-20 22:35:31162 // IPC::Sender
dcheng6d18e402014-10-21 12:32:52163 bool Send(IPC::Message* msg) override;
initial.commit09911bf2008-07-26 23:55:29164
[email protected]180ef242013-11-07 06:50:46165 // blink::WebWidgetClient
[email protected]9cd43a62012-03-26 08:03:56166 virtual void willBeginCompositorFrame();
[email protected]180ef242013-11-07 06:50:46167 virtual void didAutoResize(const blink::WebSize& new_size);
[email protected]e195e582013-03-08 01:32:59168 virtual void initializeLayerTreeView();
[email protected]180ef242013-11-07 06:50:46169 virtual blink::WebLayerTreeView* layerTreeView();
[email protected]3391a0772012-03-28 00:32:07170 virtual void didBecomeReadyForAdditionalInput();
[email protected]58264a32011-11-17 23:36:15171 virtual void didCommitAndDrawCompositorFrame();
172 virtual void didCompleteSwapBuffers();
[email protected]8b9e52b2014-01-17 16:35:31173 virtual void scheduleComposite();
[email protected]4873c7d2009-07-16 06:36:28174 virtual void didFocus();
175 virtual void didBlur();
[email protected]180ef242013-11-07 06:50:46176 virtual void didChangeCursor(const blink::WebCursorInfo&);
[email protected]4873c7d2009-07-16 06:36:28177 virtual void closeWidgetSoon();
[email protected]180ef242013-11-07 06:50:46178 virtual void show(blink::WebNavigationPolicy);
[email protected]dd48d492014-03-16 05:04:39179 virtual void runModal() {}
[email protected]180ef242013-11-07 06:50:46180 virtual blink::WebRect windowRect();
181 virtual void setToolTipText(const blink::WebString& text,
182 blink::WebTextDirection hint);
183 virtual void setWindowRect(const blink::WebRect&);
184 virtual blink::WebRect windowResizerRect();
185 virtual blink::WebRect rootWindowRect();
186 virtual blink::WebScreenInfo screenInfo();
[email protected]f660d9c2012-06-06 18:31:21187 virtual float deviceScaleFactor();
[email protected]fa7b1dc2010-06-23 17:53:04188 virtual void resetInputMethod();
[email protected]180ef242013-11-07 06:50:46189 virtual void didHandleGestureEvent(const blink::WebGestureEvent& event,
[email protected]c68c3e4e2013-01-24 00:36:56190 bool event_cancelled);
[email protected]adb362312014-06-28 06:04:24191 virtual void showImeIfNeeded();
[email protected]4873c7d2009-07-16 06:36:28192
donnda070f3c2015-01-16 19:54:11193#if defined(OS_ANDROID)
194 // Notifies that a tap was not consumed, so showing a UI for the unhandled
195 // tap may be needed.
196 virtual void showUnhandledTapUIIfNeeded(
197 const blink::WebPoint& tapped_position,
198 const blink::WebNode& tapped_node,
199 bool page_changed) override;
200#endif
201
[email protected]7912e822014-04-16 02:37:03202 // Begins the compositor's scheduler to start producing frames.
203 void StartCompositor();
204
[email protected]aeeedad2014-08-22 18:16:22205 // Stop compositing.
ennef3c58142014-12-09 21:44:38206 void WillCloseLayerTreeView();
[email protected]aeeedad2014-08-22 18:16:22207
[email protected]4873c7d2009-07-16 06:36:28208 // Called when a plugin is moved. These events are queued up and sent with
209 // the next paint or scroll message to the host.
[email protected]29e2fb42013-07-19 01:13:47210 void SchedulePluginMove(const WebPluginGeometry& move);
initial.commit09911bf2008-07-26 23:55:29211
[email protected]268654772009-08-06 23:02:04212 // Called when a plugin window has been destroyed, to make sure the currently
213 // pending moves don't try to reference it.
214 void CleanupWindowInPluginMoves(gfx::PluginWindowHandle window);
215
[email protected]24ed0432013-04-24 07:50:31216 RenderWidgetCompositor* compositor() const;
217
[email protected]8062ab262014-05-27 16:56:43218 const ui::LatencyInfo* current_event_latency_info() const {
219 return current_event_latency_info_;
220 }
221
[email protected]ebc0e1df2013-08-01 02:46:22222 virtual scoped_ptr<cc::OutputSurface> CreateOutputSurface(bool fallback);
[email protected]ba91a792013-02-06 09:48:28223
[email protected]79fa22e2013-08-23 15:18:12224 // Callback for use with synthetic gestures (e.g. BeginSmoothScroll).
225 typedef base::Callback<void()> SyntheticGestureCompletionCallback;
[email protected]0e241b4b2012-08-18 09:06:27226
[email protected]9017d7852013-11-21 17:47:35227 // Send a synthetic gesture to the browser to be queued to the synthetic
228 // gesture controller.
229 void QueueSyntheticGesture(
230 scoped_ptr<SyntheticGestureParams> gesture_params,
231 const SyntheticGestureCompletionCallback& callback);
[email protected]1e1dd182013-09-12 01:51:15232
initial.commit09911bf2008-07-26 23:55:29233 // Close the underlying WebWidget.
[email protected]60c42a8c72009-10-09 04:08:59234 virtual void Close();
initial.commit09911bf2008-07-26 23:55:29235
[email protected]6fceb912013-02-15 06:24:15236 // Notifies about a compositor frame commit operation having finished.
237 virtual void DidCommitCompositorFrame();
238
[email protected]586871b2014-07-22 17:05:11239 // Deliveres |message| together with compositor state change updates. The
240 // exact behavior depends on |policy|.
241 // This mechanism is not a drop-in replacement for IPC: messages sent this way
242 // will not be automatically available to BrowserMessageFilter, for example.
243 // FIFO ordering is preserved between messages enqueued with the same
244 // |policy|, the ordering between messages enqueued for different policies is
245 // undefined.
246 //
247 // |msg| message to send, ownership of |msg| is transferred.
248 // |policy| see the comment on MessageDeliveryPolicy.
249 void QueueMessage(IPC::Message* msg, MessageDeliveryPolicy policy);
250
[email protected]66fca5bc2013-05-23 06:58:29251 // Handle common setup/teardown for handling IME events.
252 void StartHandlingImeEvent();
253 void FinishHandlingImeEvent();
254
[email protected]4ee64622014-03-21 22:34:15255 // Returns whether we currently should handle an IME event.
256 bool ShouldHandleImeEvent();
257
[email protected]33004772013-11-12 09:49:23258 virtual void InstrumentWillBeginFrame(int frame_id) {}
[email protected]35134e12013-02-22 20:07:40259 virtual void InstrumentDidBeginFrame() {}
260 virtual void InstrumentDidCancelFrame() {}
261 virtual void InstrumentWillComposite() {}
262
rouslanf7ebd8832015-01-22 01:54:14263 // Called by the compositor when page scale animation completed.
264 virtual void DidCompletePageScaleAnimation() {}
265
[email protected]c27dd4f2014-05-22 18:05:19266 // When paused in debugger, we send ack for mouse event early. This ensures
267 // that we continue receiving mouse moves and pass them to debugger. Returns
268 // whether we are paused in mouse move event and have sent the ack.
269 bool SendAckForMouseMoveFromDebugger();
270
271 // When resumed from pause in debugger while handling mouse move,
272 // we should not send an extra ack (see SendAckForMouseMoveFromDebugger).
273 void IgnoreAckForMouseMoveFromDebugger();
274
[email protected]b2e4c70132013-10-03 02:07:51275 // ScreenMetricsEmulator class manages screen emulation inside a render
276 // widget. This includes resizing, placing view on the screen at desired
277 // position, changing device scale factor, and scaling down the whole
278 // widget if required to fit into the browser window.
279 class ScreenMetricsEmulator;
280
281 // Emulates screen and widget metrics. Supplied values override everything
282 // coming from host.
283 void EnableScreenMetricsEmulation(
[email protected]19193682014-04-03 15:01:43284 const blink::WebDeviceEmulationParams& params);
[email protected]b2e4c70132013-10-03 02:07:51285 void DisableScreenMetricsEmulation();
286 void SetPopupOriginAdjustmentsForEmulation(ScreenMetricsEmulator* emulator);
[email protected]2d6836f42014-07-02 17:25:31287 gfx::Rect AdjustValidationMessageAnchor(const gfx::Rect& anchor);
[email protected]b2e4c70132013-10-03 02:07:51288
[email protected]7d08a9352013-10-15 08:24:56289 void ScheduleCompositeWithForcedRedraw();
290
[email protected]4d7e46a2013-11-08 05:33:40291 // Called by the compositor in single-threaded mode when a swap is posted,
292 // completes or is aborted.
293 void OnSwapBuffersPosted();
294 void OnSwapBuffersComplete();
295 void OnSwapBuffersAborted();
296
shuchen3517bb62014-10-15 03:55:57297 // Checks if the text input state and compose inline mode have been changed.
298 // If they are changed, the new value will be sent to the browser process.
299 void UpdateTextInputType();
300
[email protected]7a4e2532013-12-02 21:30:02301 // Checks if the selection bounds have been changed. If they are changed,
302 // the new value will be sent to the browser process.
303 void UpdateSelectionBounds();
304
[email protected]e5e438d62014-03-27 21:47:16305 virtual void GetSelectionBounds(gfx::Rect* start, gfx::Rect* end);
306
[email protected]a09d53ce2014-01-31 00:46:42307 void OnShowHostContextMenu(ContextMenuParams* params);
[email protected]7a4e2532013-12-02 21:30:02308
shuchen3517bb62014-10-15 03:55:57309#if defined(OS_ANDROID) || defined(USE_AURA)
[email protected]90f24152014-04-09 12:41:36310 enum ShowIme {
311 SHOW_IME_IF_NEEDED,
312 NO_SHOW_IME,
313 };
314
315 enum ChangeSource {
316 FROM_NON_IME,
317 FROM_IME,
318 };
319
320 // |show_ime| should be SHOW_IME_IF_NEEDED iff the update may cause the ime to
321 // be displayed, e.g. after a tap on an input field on mobile.
322 // |change_source| should be FROM_NON_IME when the renderer has to wait for
323 // the browser to acknowledge the change before the renderer handles any more
324 // IME events. This is when the text change did not originate from the IME in
325 // the browser side, such as changes by JavaScript or autofill.
326 void UpdateTextInputState(ShowIme show_ime, ChangeSource change_source);
shuchen3517bb62014-10-15 03:55:57327#endif
[email protected]4ee64622014-03-21 22:34:15328
rouslanf7ebd8832015-01-22 01:54:14329 // Called when animations due to focus change have completed (if any). Can be
330 // called from the renderer, browser, or compositor.
331 virtual void FocusChangeComplete() {}
332
[email protected]7a4e2532013-12-02 21:30:02333 // Checks if the composition range or composition character bounds have been
334 // changed. If they are changed, the new value will be sent to the browser
yukawa5f21c6a2014-10-27 17:09:30335 // process. This method does nothing when the browser process is not able to
336 // handle composition range and composition character bounds.
[email protected]7a4e2532013-12-02 21:30:02337 void UpdateCompositionInfo(bool should_update_range);
[email protected]7a4e2532013-12-02 21:30:02338
[email protected]a4f0d882014-05-01 23:48:10339#if defined(OS_ANDROID)
340 void DidChangeBodyBackgroundColor(SkColor bg_color);
timav7a5032e2014-12-05 01:59:43341 bool DoesRecordFullLayer() const;
[email protected]a4f0d882014-05-01 23:48:10342#endif
343
ennef3c58142014-12-09 21:44:38344 bool host_closing() const { return host_closing_; }
345
initial.commit09911bf2008-07-26 23:55:29346 protected:
[email protected]8085dbc82008-09-26 22:53:44347 // Friend RefCounted so that the dtor can be non-public. Using this class
348 // without ref-counting is an error.
349 friend class base::RefCounted<RenderWidget>;
[email protected]7339cd22010-10-27 00:11:20350 // For unit tests.
[email protected]e9ff79c2012-10-19 21:31:26351 friend class RenderWidgetTest;
[email protected]8085dbc82008-09-26 22:53:44352
[email protected]61e2b3cc2012-03-02 16:13:34353 enum ResizeAck {
354 SEND_RESIZE_ACK,
355 NO_RESIZE_ACK,
356 };
357
[email protected]180ef242013-11-07 06:50:46358 RenderWidget(blink::WebPopupType popup_type,
359 const blink::WebScreenInfo& screen_info,
[email protected]1ac10dca2013-08-20 20:47:04360 bool swapped_out,
[email protected]7912e822014-04-16 02:37:03361 bool hidden,
362 bool never_visible);
[email protected]ce2b28e2012-08-09 15:53:57363
dcheng6d18e402014-10-21 12:32:52364 ~RenderWidget() override;
initial.commit09911bf2008-07-26 23:55:29365
366 // Initializes this view with the given opener. CompleteInit must be called
367 // later.
danakj6e3bf8012014-12-16 18:27:53368 bool Init(int32 opener_id, CompositorDependencies* compositor_deps);
initial.commit09911bf2008-07-26 23:55:29369
[email protected]484955942010-08-19 16:13:18370 // Called by Init and subclasses to perform initialization.
[email protected]a635f942012-12-07 10:34:29371 bool DoInit(int32 opener_id,
danakj6e3bf8012014-12-16 18:27:53372 CompositorDependencies* compositor_deps,
[email protected]180ef242013-11-07 06:50:46373 blink::WebWidget* web_widget,
[email protected]484955942010-08-19 16:13:18374 IPC::SyncMessage* create_widget_message);
375
initial.commit09911bf2008-07-26 23:55:29376 // Finishes creation of a pending view started with Init.
[email protected]fc4404d2012-11-07 19:53:30377 void CompleteInit();
initial.commit09911bf2008-07-26 23:55:29378
[email protected]992db4c2011-05-12 15:37:15379 // Sets whether this RenderWidget has been swapped out to be displayed by
380 // a RenderWidget in a different process. If so, no new IPC messages will be
381 // sent (only ACKs) and the process is free to exit when there are no other
382 // active RenderWidgets.
383 void SetSwappedOut(bool is_swapped_out);
384
[email protected]949b6592014-08-20 13:17:52385 // Allows the process to exit once the unload handler has finished, if there
386 // are no other active RenderWidgets.
387 void WasSwappedOut();
388
[email protected]fd847792013-10-24 17:12:35389 void FlushPendingInputEventAck();
[email protected]2533ce12009-05-09 00:02:24390 void DoDeferredClose();
[email protected]180ef242013-11-07 06:50:46391 void DoDeferredSetWindowRect(const blink::WebRect& pos);
initial.commit09911bf2008-07-26 23:55:29392
[email protected]61e2b3cc2012-03-02 16:13:34393 // Resizes the render widget.
394 void Resize(const gfx::Size& new_size,
[email protected]60d47ac2013-03-01 23:42:44395 const gfx::Size& physical_backing_size,
dtrainorcb7779b82014-12-04 01:08:02396 bool top_controls_shrink_blink_size,
397 float top_controls_height,
[email protected]bb6378fe2014-04-28 21:19:44398 const gfx::Size& visible_viewport_size,
[email protected]61e2b3cc2012-03-02 16:13:34399 const gfx::Rect& resizer_rect,
400 bool is_fullscreen,
401 ResizeAck resize_ack);
[email protected]92650162013-10-30 03:31:02402 // Used to force the size of a window when running layout tests.
bokanc007c3a2015-02-03 07:15:56403 void SetWindowRectSynchronously(const gfx::Rect& new_window_rect);
[email protected]b2e4c70132013-10-03 02:07:51404 virtual void SetScreenMetricsEmulationParameters(
[email protected]7f99fc22013-11-08 14:05:58405 float device_scale_factor,
406 const gfx::Point& root_layer_offset,
407 float root_layer_scale);
[email protected]53907862014-03-25 15:42:40408#if defined(OS_MACOSX) || defined(OS_ANDROID)
[email protected]b2e4c70132013-10-03 02:07:51409 void SetExternalPopupOriginAdjustmentsForEmulation(
410 ExternalPopupMenu* popup, ScreenMetricsEmulator* emulator);
[email protected]53907862014-03-25 15:42:40411#endif
[email protected]61e2b3cc2012-03-02 16:13:34412
initial.commit09911bf2008-07-26 23:55:29413 // RenderWidget IPC message handlers
[email protected]180ef242013-11-07 06:50:46414 void OnHandleInputEvent(const blink::WebInputEvent* event,
[email protected]205294b2014-03-18 20:48:35415 const ui::LatencyInfo& latency_info,
[email protected]c084330e02013-04-27 01:08:15416 bool keyboard_shortcut);
[email protected]34202de2013-05-06 23:36:22417 void OnCursorVisibilityChange(bool is_visible);
[email protected]c084330e02013-04-27 01:08:15418 void OnMouseCaptureLost();
419 virtual void OnSetFocus(bool enable);
[email protected]6de7fc482014-06-06 10:46:44420 virtual void OnClose();
[email protected]fc4404d2012-11-07 19:53:30421 void OnCreatingNewAck();
[email protected]0fdd5012013-05-29 08:05:56422 virtual void OnResize(const ViewMsg_Resize_Params& params);
noel89949e62014-09-30 01:12:41423 void OnColorProfile(const std::vector<char>& color_profile);
[email protected]b5913d72012-02-07 22:26:54424 void OnChangeResizeRect(const gfx::Rect& resizer_rect);
[email protected]941e4552010-02-01 21:23:43425 virtual void OnWasHidden();
[email protected]3399dd822014-08-09 11:14:24426 virtual void OnWasShown(bool needs_repainting,
427 const ui::LatencyInfo& latency_info);
[email protected]8400e032010-02-26 18:50:11428 void OnCreateVideoAck(int32 video_id);
429 void OnUpdateVideoAck(int32 video_id);
[email protected]2533ce12009-05-09 00:02:24430 void OnRequestMoveAck();
[email protected]fa7b1dc2010-06-23 17:53:04431 void OnSetInputMethodActive(bool is_active);
[email protected]37a241c2013-12-03 03:16:17432 void OnCandidateWindowShown();
433 void OnCandidateWindowUpdated();
434 void OnCandidateWindowHidden();
[email protected]56ea1a62011-05-30 07:05:57435 virtual void OnImeSetComposition(
[email protected]fcf75d42013-12-03 20:11:26436 const base::string16& text,
[email protected]180ef242013-11-07 06:50:46437 const std::vector<blink::WebCompositionUnderline>& underlines,
[email protected]fa7b1dc2010-06-23 17:53:04438 int selection_start,
439 int selection_end);
[email protected]fcf75d42013-12-03 20:11:26440 virtual void OnImeConfirmComposition(const base::string16& text,
[email protected]db4fc1e2013-09-06 20:01:51441 const gfx::Range& replacement_range,
[email protected]0e45bd02013-07-12 20:20:02442 bool keep_selection);
[email protected]0bc1f572013-04-17 01:46:31443 void OnRepaint(gfx::Size size_to_paint);
[email protected]79fa22e2013-08-23 15:18:12444 void OnSyntheticGestureCompleted();
[email protected]180ef242013-11-07 06:50:46445 void OnSetTextDirection(blink::WebTextDirection direction);
[email protected]872ae5b2011-05-26 20:20:50446 void OnGetFPS();
[email protected]80ad8622012-11-07 16:33:03447 void OnUpdateScreenRects(const gfx::Rect& view_screen_rect,
448 const gfx::Rect& window_screen_rect);
[email protected]2384b6c2013-02-28 23:58:51449 void OnShowImeIfNeeded();
[email protected]0d1ebed12013-08-05 22:01:13450
[email protected]adb362312014-06-28 06:04:24451#if defined(OS_ANDROID)
[email protected]0d1ebed12013-08-05 22:01:13452 // Whenever an IME event that needs an acknowledgement is sent to the browser,
453 // the number of outstanding IME events that needs acknowledgement should be
454 // incremented. All IME events will be dropped until we receive an ack from
455 // the browser.
456 void IncrementOutstandingImeEventAcks();
457
458 // Called by the browser process for every required IME acknowledgement.
459 void OnImeEventAck();
[email protected]105dffb42013-02-20 03:46:21460#endif
[email protected]0d1ebed12013-08-05 22:01:13461
[email protected]847a2582013-03-09 02:29:51462 // Notify the compositor about a change in viewport size. This should be
463 // used only with auto resize mode WebWidgets, as normal WebWidgets should
464 // go through OnResize.
[email protected]97e1bf72013-03-06 14:06:05465 void AutoResizeCompositor();
466
[email protected]468ac582012-11-20 00:53:19467 virtual void SetDeviceScaleFactor(float device_scale_factor);
[email protected]28ed6b32014-06-08 02:16:27468 virtual bool SetDeviceColorProfile(const std::vector<char>& color_profile);
noeldb4df152014-09-16 17:45:20469 virtual void ResetDeviceColorProfileForTesting();
[email protected]468ac582012-11-20 00:53:19470
[email protected]fcdc5642014-05-09 14:32:24471 virtual void OnOrientationChange();
472
[email protected]29ed96a2012-02-04 18:12:16473 // Override points to notify derived classes that a paint has happened.
[email protected]0704ac32013-10-03 15:24:22474 // DidInitiatePaint happens when that has completed, and subsequent rendering
475 // won't affect the painted content. DidFlushPaint happens once we've received
476 // the ACK that the screen has been updated. For a given paint operation,
477 // these overrides will always be called in the order DidInitiatePaint,
478 // DidFlushPaint.
[email protected]00c39612010-03-06 02:53:28479 virtual void DidInitiatePaint() {}
480 virtual void DidFlushPaint() {}
[email protected]a2f6bc112009-06-27 16:27:25481
[email protected]ed7defa2013-03-12 21:29:59482 virtual GURL GetURLForGraphicsContext3D();
[email protected]65225772011-05-12 21:10:24483
[email protected]d54169e92011-01-21 09:19:52484 // Gets the scroll offset of this widget, if this widget has a notion of
485 // scroll offset.
[email protected]ceb36f7d2012-10-31 18:33:24486 virtual gfx::Vector2d GetScrollOffset();
[email protected]d54169e92011-01-21 09:19:52487
[email protected]bee16aab2009-08-26 15:55:03488 // Sets the "hidden" state of this widget. All accesses to is_hidden_ should
489 // use this method so that we can properly inform the RenderThread of our
490 // state.
491 void SetHidden(bool hidden);
492
[email protected]2b624c562011-10-27 22:58:26493 void WillToggleFullscreen();
494 void DidToggleFullscreen();
495
[email protected]674741932009-02-04 23:44:46496 bool next_paint_is_resize_ack() const;
[email protected]674741932009-02-04 23:44:46497 void set_next_paint_is_resize_ack();
[email protected]674741932009-02-04 23:44:46498 void set_next_paint_is_repaint_ack();
[email protected]ec7dc112008-08-06 05:30:12499
[email protected]586871b2014-07-22 17:05:11500 // QueueMessage implementation extracted into a static method for easy
501 // testing.
502 static scoped_ptr<cc::SwapPromise> QueueMessageImpl(
503 IPC::Message* msg,
504 MessageDeliveryPolicy policy,
505 FrameSwapMessageQueue* frame_swap_message_queue,
506 scoped_refptr<IPC::SyncMessageFilter> sync_message_filter,
507 bool commit_requested,
508 int source_frame_number);
509
[email protected]56ea1a62011-05-30 07:05:57510 // Override point to obtain that the current input method state and caret
511 // position.
[email protected]ad26ef42011-06-17 07:59:45512 virtual ui::TextInputType GetTextInputType();
[email protected]5b739cb2012-08-21 20:35:21513 virtual ui::TextInputType WebKitToUiTextInputType(
[email protected]180ef242013-11-07 06:50:46514 blink::WebTextInputType type);
[email protected]ad26ef42011-06-17 07:59:45515
[email protected]58b48a0d2012-06-13 07:01:35516 // Override point to obtain that the current composition character bounds.
517 // In the case of surrogate pairs, the character is treated as two characters:
518 // the bounds for first character is actual one, and the bounds for second
519 // character is zero width rectangle.
520 virtual void GetCompositionCharacterBounds(
521 std::vector<gfx::Rect>* character_bounds);
522
[email protected]88dbe32f2013-06-20 23:31:36523 // Returns the range of the text that is being composed or the selection if
524 // the composition does not exist.
[email protected]db4fc1e2013-09-06 20:01:51525 virtual void GetCompositionRange(gfx::Range* range);
[email protected]88dbe32f2013-06-20 23:31:36526
[email protected]58b48a0d2012-06-13 07:01:35527 // Returns true if the composition range or composition character bounds
528 // should be sent to the browser process.
529 bool ShouldUpdateCompositionInfo(
[email protected]db4fc1e2013-09-06 20:01:51530 const gfx::Range& range,
[email protected]58b48a0d2012-06-13 07:01:35531 const std::vector<gfx::Rect>& bounds);
532
[email protected]ad26ef42011-06-17 07:59:45533 // Override point to obtain that the current input method state about
534 // composition text.
535 virtual bool CanComposeInline();
[email protected]56ea1a62011-05-30 07:05:57536
initial.commit09911bf2008-07-26 23:55:29537 // Tells the renderer it does not have focus. Used to prevent us from getting
538 // the focus on our own when the browser did not focus us.
539 void ClearFocus();
540
[email protected]2533ce12009-05-09 00:02:24541 // Set the pending window rect.
542 // Because the real render_widget is hosted in another process, there is
543 // a time period where we may have set a new window rect which has not yet
544 // been processed by the browser. So we maintain a pending window rect
545 // size. If JS code sets the WindowRect, and then immediately calls
546 // GetWindowRect() we'll use this pending window rect as the size.
[email protected]180ef242013-11-07 06:50:46547 void SetPendingWindowRect(const blink::WebRect& r);
[email protected]2533ce12009-05-09 00:02:24548
[email protected]446705872009-09-10 07:22:48549 // Called by OnHandleInputEvent() to notify subclasses that a key event was
550 // just handled.
551 virtual void DidHandleKeyEvent() {}
552
[email protected]67bfb83f2011-09-22 03:36:37553 // Called by OnHandleInputEvent() to notify subclasses that a mouse event is
554 // about to be handled.
555 // Returns true if no further handling is needed. In that case, the event
556 // won't be sent to WebKit or trigger DidHandleMouseEvent().
[email protected]180ef242013-11-07 06:50:46557 virtual bool WillHandleMouseEvent(const blink::WebMouseEvent& event);
[email protected]67bfb83f2011-09-22 03:36:37558
[email protected]41d86852012-11-07 12:23:24559 // Called by OnHandleInputEvent() to notify subclasses that a gesture event is
560 // about to be handled.
561 // Returns true if no further handling is needed. In that case, the event
562 // won't be sent to WebKit.
[email protected]180ef242013-11-07 06:50:46563 virtual bool WillHandleGestureEvent(const blink::WebGestureEvent& event);
[email protected]41d86852012-11-07 12:23:24564
[email protected]6a8ddba52010-09-05 04:38:06565 // Called by OnHandleInputEvent() to notify subclasses that a mouse event was
566 // just handled.
[email protected]180ef242013-11-07 06:50:46567 virtual void DidHandleMouseEvent(const blink::WebMouseEvent& event) {}
[email protected]6a8ddba52010-09-05 04:38:06568
[email protected]2d0f2e92011-10-03 09:02:24569 // Called by OnHandleInputEvent() to notify subclasses that a touch event was
570 // just handled.
[email protected]180ef242013-11-07 06:50:46571 virtual void DidHandleTouchEvent(const blink::WebTouchEvent& event) {}
[email protected]2d0f2e92011-10-03 09:02:24572
ccamerond4ba47902014-12-17 07:20:31573 // Called by OnHandleInputEvent() to forward a mouse wheel event to the
574 // compositor thread, to effect the elastic overscroll effect.
ccamerona7644752014-12-30 01:16:31575 void ObserveWheelEventAndResult(const blink::WebMouseWheelEvent& wheel_event,
576 bool event_processed);
ccamerond4ba47902014-12-17 07:20:31577
[email protected]3d5c243b2012-11-30 00:26:01578 // Check whether the WebWidget has any touch event handlers registered
579 // at the given point.
580 virtual bool HasTouchEventHandlersAt(const gfx::Point& point) const;
581
[email protected]ce6689f2013-03-29 12:52:55582 // Check whether the WebWidget has any touch event handlers registered.
583 virtual void hasTouchEventHandlers(bool has_handlers);
584
[email protected]5d0bbdfa92013-12-10 00:35:51585 // Tell the browser about the actions permitted for a new touch point.
586 virtual void setTouchAction(blink::WebTouchAction touch_action);
587
[email protected]90f24152014-04-09 12:41:36588 // Called when value of focused text field gets dirty, e.g. value is modified
589 // by script, not by user input.
590 virtual void didUpdateTextOfFocusedElementByNonUserInput();
591
[email protected]ed7defa2013-03-12 21:29:59592 // Creates a 3D context associated with this view.
[email protected]828a3932014-04-02 14:43:13593 scoped_ptr<WebGraphicsContext3DCommandBufferImpl> CreateGraphicsContext3D();
[email protected]ed7defa2013-03-12 21:29:59594
initial.commit09911bf2008-07-26 23:55:29595 // Routing ID that allows us to communicate to the parent browser process
596 // RenderWidgetHost. When MSG_ROUTING_NONE, no messages may be sent.
597 int32 routing_id_;
598
[email protected]9f4f3322012-01-18 22:29:56599 int32 surface_id_;
600
danakj6e3bf8012014-12-16 18:27:53601 // Dependencies for initializing a compositor, including flags for optional
602 // features.
603 CompositorDependencies* compositor_deps_;
604
[email protected]c5b3b5e2009-02-13 06:41:11605 // We are responsible for destroying this object via its Close method.
[email protected]4ee64622014-03-21 22:34:15606 // May be NULL when the window is closing.
[email protected]180ef242013-11-07 06:50:46607 blink::WebWidget* webwidget_;
initial.commit09911bf2008-07-26 23:55:29608
[email protected]8926c602013-01-23 05:32:06609 // This is lazily constructed and must not outlive webwidget_.
[email protected]ba91a792013-02-06 09:48:28610 scoped_ptr<RenderWidgetCompositor> compositor_;
[email protected]8926c602013-01-23 05:32:06611
initial.commit09911bf2008-07-26 23:55:29612 // Set to the ID of the view that initiated creating this view, if any. When
613 // the view was initiated by the browser (the common case), this will be
614 // MSG_ROUTING_NONE. This is used in determining ownership when opening
615 // child tabs. See RenderWidget::createWebViewWithRequest.
616 //
617 // This ID may refer to an invalid view if that view is closed before this
618 // view is.
619 int32 opener_id_;
620
bokanc007c3a2015-02-03 07:15:56621 // The rect where this view should be initially shown.
622 gfx::Rect initial_rect_;
initial.commit09911bf2008-07-26 23:55:29623
[email protected]fc4404d2012-11-07 19:53:30624 bool init_complete_;
initial.commit09911bf2008-07-26 23:55:29625
626 // We store the current cursor object so we can avoid spamming SetCursor
627 // messages.
628 WebCursor current_cursor_;
[email protected]88efb7ec2009-07-14 16:32:59629
initial.commit09911bf2008-07-26 23:55:29630 // The size of the RenderWidget.
631 gfx::Size size_;
632
[email protected]60d47ac2013-03-01 23:42:44633 // The size of the view's backing surface in non-DPI-adjusted pixels.
634 gfx::Size physical_backing_size_;
635
dtrainorcb7779b82014-12-04 01:08:02636 // Whether or not Blink's viewport size should be shrunk by the height of the
637 // URL-bar (always false on platforms where URL-bar hiding isn't supported).
638 bool top_controls_shrink_blink_size_;
639
640 // The height of the top controls (always 0 on platforms where URL-bar hiding
641 // isn't supported).
642 float top_controls_height_;
[email protected]d9083762013-03-24 01:36:40643
[email protected]bb6378fe2014-04-28 21:19:44644 // The size of the visible viewport in DPI-adjusted pixels.
645 gfx::Size visible_viewport_size_;
646
[email protected]f21c613a2009-02-12 14:46:17647 // The area that must be reserved for drawing the resize corner.
648 gfx::Rect resizer_rect_;
649
[email protected]53d3f302009-12-21 04:42:05650 // Flags for the next ViewHostMsg_UpdateRect message.
initial.commit09911bf2008-07-26 23:55:29651 int next_paint_flags_;
652
[email protected]847a2582013-03-09 02:29:51653 // Whether the WebWidget is in auto resize mode, which is used for example
654 // by extension popups.
655 bool auto_resize_mode_;
656
[email protected]ea3ee0a2012-05-15 03:43:09657 // True if we need to send an UpdateRect message to notify the browser about
658 // an already-completed auto-resize.
659 bool need_update_rect_for_auto_resize_;
660
initial.commit09911bf2008-07-26 23:55:29661 // Set to true if we should ignore RenderWidget::Show calls.
662 bool did_show_;
663
664 // Indicates that we shouldn't bother generated paint events.
665 bool is_hidden_;
666
[email protected]7912e822014-04-16 02:37:03667 // Indicates that we are never visible, so never produce graphical output.
668 bool never_visible_;
669
[email protected]ee41e7d22011-10-14 19:34:09670 // Indicates that we are in fullscreen mode.
671 bool is_fullscreen_;
672
initial.commit09911bf2008-07-26 23:55:29673 // Indicates whether we have been focused/unfocused by the browser.
674 bool has_focus_;
675
[email protected]5dd768212009-08-13 23:34:49676 // Are we currently handling an input event?
677 bool handling_input_event_;
678
[email protected]e8f775f2013-02-14 21:00:50679 // Are we currently handling an ime event?
680 bool handling_ime_event_;
681
[email protected]c27dd4f2014-05-22 18:05:19682 // Type of the input event we are currently handling.
683 blink::WebInputEvent::Type handling_event_type_;
684
685 // Whether we should not send ack for the current mouse move.
686 bool ignore_ack_for_mouse_move_from_debugger_;
[email protected]5d0bbdfa92013-12-10 00:35:51687
initial.commit09911bf2008-07-26 23:55:29688 // True if we have requested this widget be closed. No more messages will
689 // be sent, except for a Close.
690 bool closing_;
691
[email protected]aeeedad2014-08-22 18:16:22692 // True if it is known that the host is in the process of being shut down.
693 bool host_closing_;
694
[email protected]992db4c2011-05-12 15:37:15695 // Whether this RenderWidget is currently swapped out, such that the view is
696 // being rendered by another process. If all RenderWidgets in a process are
697 // swapped out, the process can exit.
698 bool is_swapped_out_;
699
[email protected]fa7b1dc2010-06-23 17:53:04700 // Indicates if an input method is active in the browser process.
701 bool input_method_is_active_;
initial.commit09911bf2008-07-26 23:55:29702
[email protected]5b739cb2012-08-21 20:35:21703 // Stores information about the current text input.
[email protected]180ef242013-11-07 06:50:46704 blink::WebTextInputInfo text_input_info_;
[email protected]5b739cb2012-08-21 20:35:21705
[email protected]fa7b1dc2010-06-23 17:53:04706 // Stores the current text input type of |webwidget_|.
[email protected]ad26ef42011-06-17 07:59:45707 ui::TextInputType text_input_type_;
708
[email protected]b256eca2013-07-11 10:57:40709 // Stores the current text input mode of |webwidget_|.
710 ui::TextInputMode text_input_mode_;
711
shuchen82ce8c52014-10-23 01:55:20712 // Stores the current text input flags of |webwidget_|.
713 int text_input_flags_;
714
[email protected]86ba5fcb2013-09-04 00:36:53715 // Stores the current type of composition text rendering of |webwidget_|.
716 bool can_compose_inline_;
717
[email protected]e99ef6f2011-10-16 01:13:00718 // Stores the current selection bounds.
[email protected]7c8873e2013-02-05 08:03:01719 gfx::Rect selection_focus_rect_;
720 gfx::Rect selection_anchor_rect_;
initial.commit09911bf2008-07-26 23:55:29721
[email protected]58b48a0d2012-06-13 07:01:35722 // Stores the current composition character bounds.
723 std::vector<gfx::Rect> composition_character_bounds_;
724
725 // Stores the current composition range.
[email protected]db4fc1e2013-09-06 20:01:51726 gfx::Range composition_range_;
[email protected]58b48a0d2012-06-13 07:01:35727
[email protected]3e2b375b2010-04-07 17:03:12728 // The kind of popup this widget represents, NONE if not a popup.
[email protected]180ef242013-11-07 06:50:46729 blink::WebPopupType popup_type_;
[email protected]0ebf3872008-11-07 21:35:03730
initial.commit09911bf2008-07-26 23:55:29731 // Holds all the needed plugin window moves for a scroll.
[email protected]29e2fb42013-07-19 01:13:47732 typedef std::vector<WebPluginGeometry> WebPluginGeometryVector;
[email protected]268654772009-08-06 23:02:04733 WebPluginGeometryVector plugin_window_moves_;
initial.commit09911bf2008-07-26 23:55:29734
[email protected]80ad8622012-11-07 16:33:03735 // While we are waiting for the browser to update window sizes, we track the
736 // pending size temporarily.
[email protected]2533ce12009-05-09 00:02:24737 int pending_window_rect_count_;
[email protected]180ef242013-11-07 06:50:46738 blink::WebRect pending_window_rect_;
[email protected]2533ce12009-05-09 00:02:24739
[email protected]80ad8622012-11-07 16:33:03740 // The screen rects of the view and the window that contains it.
741 gfx::Rect view_screen_rect_;
742 gfx::Rect window_screen_rect_;
743
[email protected]12fbad812009-09-01 18:21:24744 scoped_ptr<IPC::Message> pending_input_event_ack_;
745
[email protected]fd847792013-10-24 17:12:35746 // The time spent in input handlers this frame. Used to throttle input acks.
747 base::TimeDelta total_input_handling_time_this_frame_;
748
[email protected]b68a0e52011-12-08 15:11:12749 // Indicates if the next sequence of Char events should be suppressed or not.
750 bool suppress_next_char_events_;
751
[email protected]842f10652012-06-06 01:54:04752 // Properties of the screen hosting this RenderWidget instance.
[email protected]180ef242013-11-07 06:50:46753 blink::WebScreenInfo screen_info_;
[email protected]842f10652012-06-06 01:54:04754
[email protected]f1cccb32012-06-06 18:29:59755 // The device scale factor. This value is computed from the DPI entries in
756 // |screen_info_| on some platforms, and defaults to 1 on other platforms.
[email protected]faec7b12012-06-19 14:42:13757 float device_scale_factor_;
[email protected]f1cccb32012-06-06 18:29:59758
[email protected]28ed6b32014-06-08 02:16:27759 // The device color profile on supported platforms.
760 std::vector<char> device_color_profile_;
761
[email protected]9017d7852013-11-21 17:47:35762 // State associated with synthetic gestures. Synthetic gestures are processed
763 // in-order, so a queue is sufficient to identify the correct state for a
764 // completed gesture.
765 std::queue<SyntheticGestureCompletionCallback>
766 pending_synthetic_gesture_callbacks_;
[email protected]0e241b4b2012-08-18 09:06:27767
[email protected]8062ab262014-05-27 16:56:43768 const ui::LatencyInfo* current_event_latency_info_;
769
[email protected]53b4cc12013-07-18 23:02:30770 uint32 next_output_surface_id_;
771
[email protected]0d1ebed12013-08-05 22:01:13772#if defined(OS_ANDROID)
[email protected]90f24152014-04-09 12:41:36773 // Indicates value in the focused text field is in dirty state, i.e. modified
774 // by script etc., not by user input.
775 bool text_field_is_dirty_;
776
[email protected]0d1ebed12013-08-05 22:01:13777 // A counter for number of outstanding messages from the renderer to the
778 // browser regarding IME-type events that have not been acknowledged by the
779 // browser. If this value is not 0 IME events will be dropped.
780 int outstanding_ime_acks_;
[email protected]a4f0d882014-05-01 23:48:10781
782 // The background color of the document body element. This is used as the
783 // default background color for filling the screen areas for which we don't
784 // have the actual content.
785 SkColor body_background_color_;
[email protected]0d1ebed12013-08-05 22:01:13786#endif
787
[email protected]b2e4c70132013-10-03 02:07:51788 scoped_ptr<ScreenMetricsEmulator> screen_metrics_emulator_;
789
790 // Popups may be displaced when screen metrics emulation is enabled.
791 // These values are used to properly adjust popup position.
792 gfx::Point popup_view_origin_for_emulation_;
793 gfx::Point popup_screen_origin_for_emulation_;
794 float popup_origin_scale_for_emulation_;
795
[email protected]586871b2014-07-22 17:05:11796 scoped_refptr<FrameSwapMessageQueue> frame_swap_message_queue_;
[email protected]5b45ad42013-10-25 00:42:04797 scoped_ptr<ResizingModeSelector> resizing_mode_selector_;
798
[email protected]e3244ed2014-06-20 20:04:27799 // Lists of RenderFrameProxy objects that need to be notified of
800 // compositing-related events (e.g. DidCommitCompositorFrame).
801 ObserverList<RenderFrameProxy> render_frame_proxies_;
[email protected]a017938b2014-05-27 21:17:17802#if defined(VIDEO_HOLE)
803 ObserverList<RenderFrameImpl> video_hole_frames_;
804#endif // defined(VIDEO_HOLE)
[email protected]bffc8302014-01-23 20:52:16805
[email protected]de3c5d82014-05-28 22:12:59806 // A list of RenderFrames associated with this RenderWidget. Notifications
807 // are sent to each frame in the list for events such as changing
808 // visibility state for example.
809 ObserverList<RenderFrameImpl> render_frames_;
810
[email protected]a09d53ce2014-01-31 00:46:42811 ui::MenuSourceType context_menu_source_type_;
[email protected]be1af0662014-07-29 19:55:51812 bool has_host_context_menu_location_;
813 gfx::Point host_context_menu_location_;
[email protected]a09d53ce2014-01-31 00:46:42814
[email protected]05d478752009-04-08 23:38:16815 DISALLOW_COPY_AND_ASSIGN(RenderWidget);
initial.commit09911bf2008-07-26 23:55:29816};
817
[email protected]e9ff79c2012-10-19 21:31:26818} // namespace content
819
[email protected]2cff0052011-03-18 16:51:44820#endif // CONTENT_RENDERER_RENDER_WIDGET_H_