1 // Copyright (c) 2012 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file.
5 #ifndef CONTENT_RENDERER_RENDER_WIDGET_H_
6 #define CONTENT_RENDERER_RENDER_WIDGET_H_
11 #include "base/auto_reset.h"
12 #include "base/basictypes.h"
13 #include "base/callback.h"
14 #include "base/compiler_specific.h"
15 #include "base/memory/ref_counted.h"
16 #include "base/memory/scoped_ptr.h"
17 #include "base/observer_list.h"
18 #include "base/time/time.h"
19 #include "base/timer/timer.h"
20 #include "cc/debug/rendering_stats_instrumentation.h"
21 #include "content/common/content_export.h"
22 #include "content/common/cursors/webcursor.h"
23 #include "content/common/gpu/client/webgraphicscontext3d_command_buffer_impl.h"
24 #include "content/common/input/synthetic_gesture_params.h"
25 #include "content/renderer/message_delivery_policy.h"
26 #include "ipc/ipc_listener.h"
27 #include "ipc/ipc_sender.h"
28 #include "third_party/WebKit/public/platform/WebRect.h"
29 #include "third_party/WebKit/public/web/WebCompositionUnderline.h"
30 #include "third_party/WebKit/public/web/WebInputEvent.h"
31 #include "third_party/WebKit/public/web/WebPopupType.h"
32 #include "third_party/WebKit/public/web/WebTextDirection.h"
33 #include "third_party/WebKit/public/web/WebTextInputInfo.h"
34 #include "third_party/WebKit/public/web/WebTouchAction.h"
35 #include "third_party/WebKit/public/web/WebWidget.h"
36 #include "third_party/WebKit/public/web/WebWidgetClient.h"
37 #include "third_party/skia/include/core/SkBitmap.h"
38 #include "ui/base/ime/text_input_mode.h"
39 #include "ui/base/ime/text_input_type.h"
40 #include "ui/base/ui_base_types.h"
41 #include "ui/gfx/native_widget_types.h"
42 #include "ui/gfx/range/range.h"
43 #include "ui/gfx/rect.h"
44 #include "ui/gfx/vector2d.h"
45 #include "ui/gfx/vector2d_f.h"
46 #include "ui/surface/transport_dib.h"
48 struct ViewHostMsg_UpdateRect_Params
;
49 struct ViewMsg_Resize_Params
;
50 class ViewHostMsg_UpdateRect
;
54 class SyncMessageFilter
;
58 struct WebDeviceEmulationParams
;
59 class WebGestureEvent
;
60 class WebKeyboardEvent
;
75 class ExternalPopupMenu
;
76 class FrameSwapMessageQueue
;
77 class PepperPluginInstanceImpl
;
78 class RenderFrameImpl
;
79 class RenderFrameProxy
;
80 class RenderWidgetCompositor
;
81 class RenderWidgetTest
;
82 class ResizingModeSelector
;
83 struct ContextMenuParams
;
84 struct WebPluginGeometry
;
86 // RenderWidget provides a communication bridge between a WebWidget and
87 // a RenderWidgetHost, the latter of which lives in a different process.
88 class CONTENT_EXPORT RenderWidget
89 : public IPC::Listener
,
91 NON_EXPORTED_BASE(virtual public blink::WebWidgetClient
),
92 public base::RefCounted
<RenderWidget
> {
94 // Creates a new RenderWidget. The opener_id is the routing ID of the
95 // RenderView that this widget lives inside.
96 static RenderWidget
* Create(int32 opener_id
,
97 blink::WebPopupType popup_type
,
98 const blink::WebScreenInfo
& screen_info
);
100 // Creates a WebWidget based on the popup type.
101 static blink::WebWidget
* CreateWebWidget(RenderWidget
* render_widget
);
103 int32
routing_id() const { return routing_id_
; }
104 int32
surface_id() const { return surface_id_
; }
105 blink::WebWidget
* webwidget() const { return webwidget_
; }
106 gfx::Size
size() const { return size_
; }
107 bool has_focus() const { return has_focus_
; }
108 bool is_fullscreen() const { return is_fullscreen_
; }
109 bool is_hidden() const { return is_hidden_
; }
110 bool handling_input_event() const { return handling_input_event_
; }
111 // Temporary for debugging purposes...
112 bool closing() const { return closing_
; }
113 bool is_swapped_out() { return is_swapped_out_
; }
114 ui::MenuSourceType
context_menu_source_type() {
115 return context_menu_source_type_
;
117 bool has_host_context_menu_location() {
118 return has_host_context_menu_location_
;
120 gfx::Point
host_context_menu_location() {
121 return host_context_menu_location_
;
124 // Functions to track out-of-process frames for special notifications.
125 void RegisterRenderFrameProxy(RenderFrameProxy
* proxy
);
126 void UnregisterRenderFrameProxy(RenderFrameProxy
* proxy
);
128 // Functions to track all RenderFrame objects associated with this
130 void RegisterRenderFrame(RenderFrameImpl
* frame
);
131 void UnregisterRenderFrame(RenderFrameImpl
* frame
);
133 #if defined(VIDEO_HOLE)
134 void RegisterVideoHoleFrame(RenderFrameImpl
* frame
);
135 void UnregisterVideoHoleFrame(RenderFrameImpl
* frame
);
136 #endif // defined(VIDEO_HOLE)
139 virtual bool OnMessageReceived(const IPC::Message
& msg
) OVERRIDE
;
142 virtual bool Send(IPC::Message
* msg
) OVERRIDE
;
144 // blink::WebWidgetClient
145 virtual void willBeginCompositorFrame();
146 virtual void didAutoResize(const blink::WebSize
& new_size
);
147 virtual void initializeLayerTreeView();
148 virtual blink::WebLayerTreeView
* layerTreeView();
149 virtual void didBecomeReadyForAdditionalInput();
150 virtual void didCommitAndDrawCompositorFrame();
151 virtual void didCompleteSwapBuffers();
152 virtual void scheduleComposite();
153 virtual void didFocus();
154 virtual void didBlur();
155 virtual void didChangeCursor(const blink::WebCursorInfo
&);
156 virtual void closeWidgetSoon();
157 virtual void show(blink::WebNavigationPolicy
);
158 virtual void runModal() {}
159 virtual blink::WebRect
windowRect();
160 virtual void setToolTipText(const blink::WebString
& text
,
161 blink::WebTextDirection hint
);
162 virtual void setWindowRect(const blink::WebRect
&);
163 virtual blink::WebRect
windowResizerRect();
164 virtual blink::WebRect
rootWindowRect();
165 virtual blink::WebScreenInfo
screenInfo();
166 virtual float deviceScaleFactor();
167 virtual void resetInputMethod();
168 virtual void didHandleGestureEvent(const blink::WebGestureEvent
& event
,
169 bool event_cancelled
);
170 virtual void showImeIfNeeded();
172 // Begins the compositor's scheduler to start producing frames.
173 void StartCompositor();
176 void DestroyLayerTreeView();
178 // Called when a plugin is moved. These events are queued up and sent with
179 // the next paint or scroll message to the host.
180 void SchedulePluginMove(const WebPluginGeometry
& move
);
182 // Called when a plugin window has been destroyed, to make sure the currently
183 // pending moves don't try to reference it.
184 void CleanupWindowInPluginMoves(gfx::PluginWindowHandle window
);
186 RenderWidgetCompositor
* compositor() const;
188 const ui::LatencyInfo
* current_event_latency_info() const {
189 return current_event_latency_info_
;
192 virtual scoped_ptr
<cc::OutputSurface
> CreateOutputSurface(bool fallback
);
194 // Callback for use with synthetic gestures (e.g. BeginSmoothScroll).
195 typedef base::Callback
<void()> SyntheticGestureCompletionCallback
;
197 // Send a synthetic gesture to the browser to be queued to the synthetic
198 // gesture controller.
199 void QueueSyntheticGesture(
200 scoped_ptr
<SyntheticGestureParams
> gesture_params
,
201 const SyntheticGestureCompletionCallback
& callback
);
203 // Close the underlying WebWidget.
204 virtual void Close();
206 // Notifies about a compositor frame commit operation having finished.
207 virtual void DidCommitCompositorFrame();
209 // Deliveres |message| together with compositor state change updates. The
210 // exact behavior depends on |policy|.
211 // This mechanism is not a drop-in replacement for IPC: messages sent this way
212 // will not be automatically available to BrowserMessageFilter, for example.
213 // FIFO ordering is preserved between messages enqueued with the same
214 // |policy|, the ordering between messages enqueued for different policies is
217 // |msg| message to send, ownership of |msg| is transferred.
218 // |policy| see the comment on MessageDeliveryPolicy.
219 void QueueMessage(IPC::Message
* msg
, MessageDeliveryPolicy policy
);
221 // Handle common setup/teardown for handling IME events.
222 void StartHandlingImeEvent();
223 void FinishHandlingImeEvent();
225 // Returns whether we currently should handle an IME event.
226 bool ShouldHandleImeEvent();
228 virtual void InstrumentWillBeginFrame(int frame_id
) {}
229 virtual void InstrumentDidBeginFrame() {}
230 virtual void InstrumentDidCancelFrame() {}
231 virtual void InstrumentWillComposite() {}
233 // When paused in debugger, we send ack for mouse event early. This ensures
234 // that we continue receiving mouse moves and pass them to debugger. Returns
235 // whether we are paused in mouse move event and have sent the ack.
236 bool SendAckForMouseMoveFromDebugger();
238 // When resumed from pause in debugger while handling mouse move,
239 // we should not send an extra ack (see SendAckForMouseMoveFromDebugger).
240 void IgnoreAckForMouseMoveFromDebugger();
242 // ScreenMetricsEmulator class manages screen emulation inside a render
243 // widget. This includes resizing, placing view on the screen at desired
244 // position, changing device scale factor, and scaling down the whole
245 // widget if required to fit into the browser window.
246 class ScreenMetricsEmulator
;
248 // Emulates screen and widget metrics. Supplied values override everything
250 void EnableScreenMetricsEmulation(
251 const blink::WebDeviceEmulationParams
& params
);
252 void DisableScreenMetricsEmulation();
253 void SetPopupOriginAdjustmentsForEmulation(ScreenMetricsEmulator
* emulator
);
254 gfx::Rect
AdjustValidationMessageAnchor(const gfx::Rect
& anchor
);
256 void ScheduleCompositeWithForcedRedraw();
258 // Called by the compositor in single-threaded mode when a swap is posted,
259 // completes or is aborted.
260 void OnSwapBuffersPosted();
261 void OnSwapBuffersComplete();
262 void OnSwapBuffersAborted();
264 // Checks if the selection bounds have been changed. If they are changed,
265 // the new value will be sent to the browser process.
266 void UpdateSelectionBounds();
268 virtual void GetSelectionBounds(gfx::Rect
* start
, gfx::Rect
* end
);
270 void OnShowHostContextMenu(ContextMenuParams
* params
);
282 // |show_ime| should be SHOW_IME_IF_NEEDED iff the update may cause the ime to
283 // be displayed, e.g. after a tap on an input field on mobile.
284 // |change_source| should be FROM_NON_IME when the renderer has to wait for
285 // the browser to acknowledge the change before the renderer handles any more
286 // IME events. This is when the text change did not originate from the IME in
287 // the browser side, such as changes by JavaScript or autofill.
288 void UpdateTextInputState(ShowIme show_ime
, ChangeSource change_source
);
290 #if defined(OS_MACOSX) || defined(USE_AURA)
291 // Checks if the composition range or composition character bounds have been
292 // changed. If they are changed, the new value will be sent to the browser
294 void UpdateCompositionInfo(bool should_update_range
);
297 #if defined(OS_ANDROID)
298 void DidChangeBodyBackgroundColor(SkColor bg_color
);
302 // Friend RefCounted so that the dtor can be non-public. Using this class
303 // without ref-counting is an error.
304 friend class base::RefCounted
<RenderWidget
>;
306 friend class RenderWidgetTest
;
313 RenderWidget(blink::WebPopupType popup_type
,
314 const blink::WebScreenInfo
& screen_info
,
319 virtual ~RenderWidget();
321 // Initializes this view with the given opener. CompleteInit must be called
323 bool Init(int32 opener_id
);
325 // Called by Init and subclasses to perform initialization.
326 bool DoInit(int32 opener_id
,
327 blink::WebWidget
* web_widget
,
328 IPC::SyncMessage
* create_widget_message
);
330 // Finishes creation of a pending view started with Init.
333 // Sets whether this RenderWidget has been swapped out to be displayed by
334 // a RenderWidget in a different process. If so, no new IPC messages will be
335 // sent (only ACKs) and the process is free to exit when there are no other
336 // active RenderWidgets.
337 void SetSwappedOut(bool is_swapped_out
);
339 // Allows the process to exit once the unload handler has finished, if there
340 // are no other active RenderWidgets.
341 void WasSwappedOut();
343 void FlushPendingInputEventAck();
344 void DoDeferredClose();
345 void DoDeferredSetWindowRect(const blink::WebRect
& pos
);
347 // Resizes the render widget.
348 void Resize(const gfx::Size
& new_size
,
349 const gfx::Size
& physical_backing_size
,
350 float top_controls_layout_height
,
351 const gfx::Size
& visible_viewport_size
,
352 const gfx::Rect
& resizer_rect
,
354 ResizeAck resize_ack
);
355 // Used to force the size of a window when running layout tests.
356 void ResizeSynchronously(const gfx::Rect
& new_position
);
357 virtual void SetScreenMetricsEmulationParameters(
358 float device_scale_factor
,
359 const gfx::Point
& root_layer_offset
,
360 float root_layer_scale
);
361 #if defined(OS_MACOSX) || defined(OS_ANDROID)
362 void SetExternalPopupOriginAdjustmentsForEmulation(
363 ExternalPopupMenu
* popup
, ScreenMetricsEmulator
* emulator
);
366 // RenderWidget IPC message handlers
367 void OnHandleInputEvent(const blink::WebInputEvent
* event
,
368 const ui::LatencyInfo
& latency_info
,
369 bool keyboard_shortcut
);
370 void OnCursorVisibilityChange(bool is_visible
);
371 void OnMouseCaptureLost();
372 virtual void OnSetFocus(bool enable
);
373 virtual void OnClose();
374 void OnCreatingNewAck();
375 virtual void OnResize(const ViewMsg_Resize_Params
& params
);
376 void OnChangeResizeRect(const gfx::Rect
& resizer_rect
);
377 virtual void OnWasHidden();
378 virtual void OnWasShown(bool needs_repainting
,
379 const ui::LatencyInfo
& latency_info
);
380 void OnCreateVideoAck(int32 video_id
);
381 void OnUpdateVideoAck(int32 video_id
);
382 void OnRequestMoveAck();
383 void OnSetInputMethodActive(bool is_active
);
384 void OnCandidateWindowShown();
385 void OnCandidateWindowUpdated();
386 void OnCandidateWindowHidden();
387 virtual void OnImeSetComposition(
388 const base::string16
& text
,
389 const std::vector
<blink::WebCompositionUnderline
>& underlines
,
392 virtual void OnImeConfirmComposition(const base::string16
& text
,
393 const gfx::Range
& replacement_range
,
394 bool keep_selection
);
395 void OnRepaint(gfx::Size size_to_paint
);
396 void OnSyntheticGestureCompleted();
397 void OnSetTextDirection(blink::WebTextDirection direction
);
399 void OnUpdateScreenRects(const gfx::Rect
& view_screen_rect
,
400 const gfx::Rect
& window_screen_rect
);
401 void OnShowImeIfNeeded();
403 #if defined(OS_ANDROID)
404 // Whenever an IME event that needs an acknowledgement is sent to the browser,
405 // the number of outstanding IME events that needs acknowledgement should be
406 // incremented. All IME events will be dropped until we receive an ack from
408 void IncrementOutstandingImeEventAcks();
410 // Called by the browser process for every required IME acknowledgement.
411 void OnImeEventAck();
414 // Notify the compositor about a change in viewport size. This should be
415 // used only with auto resize mode WebWidgets, as normal WebWidgets should
416 // go through OnResize.
417 void AutoResizeCompositor();
419 virtual void SetDeviceScaleFactor(float device_scale_factor
);
420 virtual bool SetDeviceColorProfile(const std::vector
<char>& color_profile
);
422 virtual void OnOrientationChange();
424 // Override points to notify derived classes that a paint has happened.
425 // DidInitiatePaint happens when that has completed, and subsequent rendering
426 // won't affect the painted content. DidFlushPaint happens once we've received
427 // the ACK that the screen has been updated. For a given paint operation,
428 // these overrides will always be called in the order DidInitiatePaint,
430 virtual void DidInitiatePaint() {}
431 virtual void DidFlushPaint() {}
433 virtual GURL
GetURLForGraphicsContext3D();
435 // Gets the scroll offset of this widget, if this widget has a notion of
437 virtual gfx::Vector2d
GetScrollOffset();
439 // Sets the "hidden" state of this widget. All accesses to is_hidden_ should
440 // use this method so that we can properly inform the RenderThread of our
442 void SetHidden(bool hidden
);
444 void WillToggleFullscreen();
445 void DidToggleFullscreen();
447 bool next_paint_is_resize_ack() const;
448 void set_next_paint_is_resize_ack();
449 void set_next_paint_is_repaint_ack();
451 // QueueMessage implementation extracted into a static method for easy
453 static scoped_ptr
<cc::SwapPromise
> QueueMessageImpl(
455 MessageDeliveryPolicy policy
,
456 FrameSwapMessageQueue
* frame_swap_message_queue
,
457 scoped_refptr
<IPC::SyncMessageFilter
> sync_message_filter
,
458 bool commit_requested
,
459 int source_frame_number
);
461 // Override point to obtain that the current input method state and caret
463 virtual ui::TextInputType
GetTextInputType();
464 virtual ui::TextInputType
WebKitToUiTextInputType(
465 blink::WebTextInputType type
);
467 #if defined(OS_MACOSX) || defined(USE_AURA)
468 // Override point to obtain that the current composition character bounds.
469 // In the case of surrogate pairs, the character is treated as two characters:
470 // the bounds for first character is actual one, and the bounds for second
471 // character is zero width rectangle.
472 virtual void GetCompositionCharacterBounds(
473 std::vector
<gfx::Rect
>* character_bounds
);
475 // Returns the range of the text that is being composed or the selection if
476 // the composition does not exist.
477 virtual void GetCompositionRange(gfx::Range
* range
);
479 // Returns true if the composition range or composition character bounds
480 // should be sent to the browser process.
481 bool ShouldUpdateCompositionInfo(
482 const gfx::Range
& range
,
483 const std::vector
<gfx::Rect
>& bounds
);
486 // Override point to obtain that the current input method state about
488 virtual bool CanComposeInline();
490 // Tells the renderer it does not have focus. Used to prevent us from getting
491 // the focus on our own when the browser did not focus us.
494 // Set the pending window rect.
495 // Because the real render_widget is hosted in another process, there is
496 // a time period where we may have set a new window rect which has not yet
497 // been processed by the browser. So we maintain a pending window rect
498 // size. If JS code sets the WindowRect, and then immediately calls
499 // GetWindowRect() we'll use this pending window rect as the size.
500 void SetPendingWindowRect(const blink::WebRect
& r
);
502 // Called by OnHandleInputEvent() to notify subclasses that a key event was
504 virtual void DidHandleKeyEvent() {}
506 // Called by OnHandleInputEvent() to notify subclasses that a mouse event is
507 // about to be handled.
508 // Returns true if no further handling is needed. In that case, the event
509 // won't be sent to WebKit or trigger DidHandleMouseEvent().
510 virtual bool WillHandleMouseEvent(const blink::WebMouseEvent
& event
);
512 // Called by OnHandleInputEvent() to notify subclasses that a gesture event is
513 // about to be handled.
514 // Returns true if no further handling is needed. In that case, the event
515 // won't be sent to WebKit.
516 virtual bool WillHandleGestureEvent(const blink::WebGestureEvent
& event
);
518 // Called by OnHandleInputEvent() to notify subclasses that a mouse event was
520 virtual void DidHandleMouseEvent(const blink::WebMouseEvent
& event
) {}
522 // Called by OnHandleInputEvent() to notify subclasses that a touch event was
524 virtual void DidHandleTouchEvent(const blink::WebTouchEvent
& event
) {}
526 // Check whether the WebWidget has any touch event handlers registered
527 // at the given point.
528 virtual bool HasTouchEventHandlersAt(const gfx::Point
& point
) const;
530 // Check whether the WebWidget has any touch event handlers registered.
531 virtual void hasTouchEventHandlers(bool has_handlers
);
533 // Tell the browser about the actions permitted for a new touch point.
534 virtual void setTouchAction(blink::WebTouchAction touch_action
);
536 // Called when value of focused text field gets dirty, e.g. value is modified
537 // by script, not by user input.
538 virtual void didUpdateTextOfFocusedElementByNonUserInput();
540 // Creates a 3D context associated with this view.
541 scoped_ptr
<WebGraphicsContext3DCommandBufferImpl
> CreateGraphicsContext3D();
543 // Routing ID that allows us to communicate to the parent browser process
544 // RenderWidgetHost. When MSG_ROUTING_NONE, no messages may be sent.
549 // We are responsible for destroying this object via its Close method.
550 // May be NULL when the window is closing.
551 blink::WebWidget
* webwidget_
;
553 // This is lazily constructed and must not outlive webwidget_.
554 scoped_ptr
<RenderWidgetCompositor
> compositor_
;
556 // Set to the ID of the view that initiated creating this view, if any. When
557 // the view was initiated by the browser (the common case), this will be
558 // MSG_ROUTING_NONE. This is used in determining ownership when opening
559 // child tabs. See RenderWidget::createWebViewWithRequest.
561 // This ID may refer to an invalid view if that view is closed before this
565 // The position where this view should be initially shown.
566 gfx::Rect initial_pos_
;
570 // We store the current cursor object so we can avoid spamming SetCursor
572 WebCursor current_cursor_
;
574 // The size of the RenderWidget.
577 // The size of the view's backing surface in non-DPI-adjusted pixels.
578 gfx::Size physical_backing_size_
;
580 // The amount that the viewport size given to Blink was shrunk by the URL-bar
581 // (always 0 on platforms where URL-bar hiding isn't supported).
582 float top_controls_layout_height_
;
584 // The size of the visible viewport in DPI-adjusted pixels.
585 gfx::Size visible_viewport_size_
;
587 // The area that must be reserved for drawing the resize corner.
588 gfx::Rect resizer_rect_
;
590 // Flags for the next ViewHostMsg_UpdateRect message.
591 int next_paint_flags_
;
593 // Whether the WebWidget is in auto resize mode, which is used for example
594 // by extension popups.
595 bool auto_resize_mode_
;
597 // True if we need to send an UpdateRect message to notify the browser about
598 // an already-completed auto-resize.
599 bool need_update_rect_for_auto_resize_
;
601 // Set to true if we should ignore RenderWidget::Show calls.
604 // Indicates that we shouldn't bother generated paint events.
607 // Indicates that we are never visible, so never produce graphical output.
610 // Indicates that we are in fullscreen mode.
613 // Indicates whether we have been focused/unfocused by the browser.
616 // Are we currently handling an input event?
617 bool handling_input_event_
;
619 // Are we currently handling an ime event?
620 bool handling_ime_event_
;
622 // Type of the input event we are currently handling.
623 blink::WebInputEvent::Type handling_event_type_
;
625 // Whether we should not send ack for the current mouse move.
626 bool ignore_ack_for_mouse_move_from_debugger_
;
628 // True if we have requested this widget be closed. No more messages will
629 // be sent, except for a Close.
632 // True if it is known that the host is in the process of being shut down.
635 // Whether this RenderWidget is currently swapped out, such that the view is
636 // being rendered by another process. If all RenderWidgets in a process are
637 // swapped out, the process can exit.
638 bool is_swapped_out_
;
640 // Indicates if an input method is active in the browser process.
641 bool input_method_is_active_
;
643 // Stores information about the current text input.
644 blink::WebTextInputInfo text_input_info_
;
646 // Stores the current text input type of |webwidget_|.
647 ui::TextInputType text_input_type_
;
649 // Stores the current text input mode of |webwidget_|.
650 ui::TextInputMode text_input_mode_
;
652 // Stores the current type of composition text rendering of |webwidget_|.
653 bool can_compose_inline_
;
655 // Stores the current selection bounds.
656 gfx::Rect selection_focus_rect_
;
657 gfx::Rect selection_anchor_rect_
;
659 // Stores the current composition character bounds.
660 std::vector
<gfx::Rect
> composition_character_bounds_
;
662 // Stores the current composition range.
663 gfx::Range composition_range_
;
665 // The kind of popup this widget represents, NONE if not a popup.
666 blink::WebPopupType popup_type_
;
668 // Holds all the needed plugin window moves for a scroll.
669 typedef std::vector
<WebPluginGeometry
> WebPluginGeometryVector
;
670 WebPluginGeometryVector plugin_window_moves_
;
672 // While we are waiting for the browser to update window sizes, we track the
673 // pending size temporarily.
674 int pending_window_rect_count_
;
675 blink::WebRect pending_window_rect_
;
677 // The screen rects of the view and the window that contains it.
678 gfx::Rect view_screen_rect_
;
679 gfx::Rect window_screen_rect_
;
681 scoped_ptr
<IPC::Message
> pending_input_event_ack_
;
683 // The time spent in input handlers this frame. Used to throttle input acks.
684 base::TimeDelta total_input_handling_time_this_frame_
;
686 // Indicates if the next sequence of Char events should be suppressed or not.
687 bool suppress_next_char_events_
;
689 // Properties of the screen hosting this RenderWidget instance.
690 blink::WebScreenInfo screen_info_
;
692 // The device scale factor. This value is computed from the DPI entries in
693 // |screen_info_| on some platforms, and defaults to 1 on other platforms.
694 float device_scale_factor_
;
696 // The device color profile on supported platforms.
697 std::vector
<char> device_color_profile_
;
699 // State associated with synthetic gestures. Synthetic gestures are processed
700 // in-order, so a queue is sufficient to identify the correct state for a
701 // completed gesture.
702 std::queue
<SyntheticGestureCompletionCallback
>
703 pending_synthetic_gesture_callbacks_
;
705 const ui::LatencyInfo
* current_event_latency_info_
;
707 uint32 next_output_surface_id_
;
709 #if defined(OS_ANDROID)
710 // Indicates value in the focused text field is in dirty state, i.e. modified
711 // by script etc., not by user input.
712 bool text_field_is_dirty_
;
714 // A counter for number of outstanding messages from the renderer to the
715 // browser regarding IME-type events that have not been acknowledged by the
716 // browser. If this value is not 0 IME events will be dropped.
717 int outstanding_ime_acks_
;
719 // The background color of the document body element. This is used as the
720 // default background color for filling the screen areas for which we don't
721 // have the actual content.
722 SkColor body_background_color_
;
725 scoped_ptr
<ScreenMetricsEmulator
> screen_metrics_emulator_
;
727 // Popups may be displaced when screen metrics emulation is enabled.
728 // These values are used to properly adjust popup position.
729 gfx::Point popup_view_origin_for_emulation_
;
730 gfx::Point popup_screen_origin_for_emulation_
;
731 float popup_origin_scale_for_emulation_
;
733 scoped_refptr
<FrameSwapMessageQueue
> frame_swap_message_queue_
;
734 scoped_ptr
<ResizingModeSelector
> resizing_mode_selector_
;
736 // Lists of RenderFrameProxy objects that need to be notified of
737 // compositing-related events (e.g. DidCommitCompositorFrame).
738 ObserverList
<RenderFrameProxy
> render_frame_proxies_
;
739 #if defined(VIDEO_HOLE)
740 ObserverList
<RenderFrameImpl
> video_hole_frames_
;
741 #endif // defined(VIDEO_HOLE)
743 // A list of RenderFrames associated with this RenderWidget. Notifications
744 // are sent to each frame in the list for events such as changing
745 // visibility state for example.
746 ObserverList
<RenderFrameImpl
> render_frames_
;
748 ui::MenuSourceType context_menu_source_type_
;
749 bool has_host_context_menu_location_
;
750 gfx::Point host_context_menu_location_
;
752 DISALLOW_COPY_AND_ASSIGN(RenderWidget
);
755 } // namespace content
757 #endif // CONTENT_RENDERER_RENDER_WIDGET_H_