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/compiler_specific.h"
14 #include "base/memory/ref_counted.h"
15 #include "base/memory/scoped_ptr.h"
16 #include "base/observer_list.h"
17 #include "base/time/time.h"
18 #include "base/timer/timer.h"
19 #include "cc/debug/rendering_stats_instrumentation.h"
20 #include "content/common/content_export.h"
21 #include "content/common/cursors/webcursor.h"
22 #include "content/common/gpu/client/webgraphicscontext3d_command_buffer_impl.h"
23 #include "content/common/input/synthetic_gesture_params.h"
24 #include "ipc/ipc_listener.h"
25 #include "ipc/ipc_sender.h"
26 #include "third_party/WebKit/public/platform/WebRect.h"
27 #include "third_party/WebKit/public/web/WebCompositionUnderline.h"
28 #include "third_party/WebKit/public/web/WebInputEvent.h"
29 #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"
32 #include "third_party/WebKit/public/web/WebTouchAction.h"
33 #include "third_party/WebKit/public/web/WebWidget.h"
34 #include "third_party/WebKit/public/web/WebWidgetClient.h"
35 #include "third_party/skia/include/core/SkBitmap.h"
36 #include "ui/base/ime/text_input_mode.h"
37 #include "ui/base/ime/text_input_type.h"
38 #include "ui/base/ui_base_types.h"
39 #include "ui/gfx/native_widget_types.h"
40 #include "ui/gfx/range/range.h"
41 #include "ui/gfx/rect.h"
42 #include "ui/gfx/vector2d.h"
43 #include "ui/gfx/vector2d_f.h"
44 #include "ui/surface/transport_dib.h"
46 struct ViewHostMsg_UpdateRect_Params;
47 struct ViewMsg_Resize_Params;
48 class ViewHostMsg_UpdateRect;
55 struct WebDeviceEmulationParams;
56 class WebGestureEvent;
57 class WebKeyboardEvent;
62 namespace cc { class OutputSurface; }
69 class ExternalPopupMenu;
70 class PepperPluginInstanceImpl;
71 class RenderFrameImpl;
72 class RenderFrameProxy;
73 class RenderWidgetCompositor;
74 class RenderWidgetTest;
75 class ResizingModeSelector;
76 struct ContextMenuParams;
77 struct WebPluginGeometry;
79 // RenderWidget provides a communication bridge between a WebWidget and
80 // a RenderWidgetHost, the latter of which lives in a different process.
81 class CONTENT_EXPORT RenderWidget
82 : public IPC::Listener,
84 NON_EXPORTED_BASE(virtual public blink::WebWidgetClient),
85 public base::RefCounted<RenderWidget> {
87 // Creates a new RenderWidget. The opener_id is the routing ID of the
88 // RenderView that this widget lives inside.
89 static RenderWidget* Create(int32 opener_id,
90 blink::WebPopupType popup_type,
91 const blink::WebScreenInfo& screen_info);
93 // Creates a WebWidget based on the popup type.
94 static blink::WebWidget* CreateWebWidget(RenderWidget* render_widget);
96 int32 routing_id() const { return routing_id_; }
97 int32 surface_id() const { return surface_id_; }
98 blink::WebWidget* webwidget() const { return webwidget_; }
99 gfx::Size size() const { return size_; }
100 bool has_focus() const { return has_focus_; }
101 bool is_fullscreen() const { return is_fullscreen_; }
102 bool is_hidden() const { return is_hidden_; }
103 bool handling_input_event() const { return handling_input_event_; }
104 // Temporary for debugging purposes...
105 bool closing() const { return closing_; }
106 bool is_swapped_out() { return is_swapped_out_; }
107 ui::MenuSourceType context_menu_source_type() {
108 return context_menu_source_type_;
110 bool has_host_context_menu_location() {
111 return has_host_context_menu_location_;
113 gfx::Point host_context_menu_location() {
114 return host_context_menu_location_;
117 // Functions to track out-of-process frames for special notifications.
118 void RegisterRenderFrameProxy(RenderFrameProxy* proxy);
119 void UnregisterRenderFrameProxy(RenderFrameProxy* proxy);
121 // Functions to track all RenderFrame objects associated with this
123 void RegisterRenderFrame(RenderFrameImpl* frame);
124 void UnregisterRenderFrame(RenderFrameImpl* frame);
126 #if defined(VIDEO_HOLE)
127 void RegisterVideoHoleFrame(RenderFrameImpl* frame);
128 void UnregisterVideoHoleFrame(RenderFrameImpl* frame);
129 #endif // defined(VIDEO_HOLE)
132 virtual bool OnMessageReceived(const IPC::Message& msg) OVERRIDE;
135 virtual bool Send(IPC::Message* msg) OVERRIDE;
137 // blink::WebWidgetClient
138 virtual void suppressCompositorScheduling(bool enable);
139 virtual void willBeginCompositorFrame();
140 virtual void didAutoResize(const blink::WebSize& new_size);
141 virtual void initializeLayerTreeView();
142 virtual blink::WebLayerTreeView* layerTreeView();
143 virtual void didBecomeReadyForAdditionalInput();
144 virtual void didCommitAndDrawCompositorFrame();
145 virtual void didCompleteSwapBuffers();
146 virtual void scheduleComposite();
147 virtual void didFocus();
148 virtual void didBlur();
149 virtual void didChangeCursor(const blink::WebCursorInfo&);
150 virtual void closeWidgetSoon();
151 virtual void show(blink::WebNavigationPolicy);
152 virtual void runModal() {}
153 virtual blink::WebRect windowRect();
154 virtual void setToolTipText(const blink::WebString& text,
155 blink::WebTextDirection hint);
156 virtual void setWindowRect(const blink::WebRect&);
157 virtual blink::WebRect windowResizerRect();
158 virtual blink::WebRect rootWindowRect();
159 virtual blink::WebScreenInfo screenInfo();
160 virtual float deviceScaleFactor();
161 virtual void resetInputMethod();
162 virtual void didHandleGestureEvent(const blink::WebGestureEvent& event,
163 bool event_cancelled);
165 // Begins the compositor's scheduler to start producing frames.
166 void StartCompositor();
168 // Called when a plugin is moved. These events are queued up and sent with
169 // the next paint or scroll message to the host.
170 void SchedulePluginMove(const WebPluginGeometry& move);
172 // Called when a plugin window has been destroyed, to make sure the currently
173 // pending moves don't try to reference it.
174 void CleanupWindowInPluginMoves(gfx::PluginWindowHandle window);
176 RenderWidgetCompositor* compositor() const;
178 const ui::LatencyInfo* current_event_latency_info() const {
179 return current_event_latency_info_;
182 virtual scoped_ptr<cc::OutputSurface> CreateOutputSurface(bool fallback);
184 // Callback for use with synthetic gestures (e.g. BeginSmoothScroll).
185 typedef base::Callback<void()> SyntheticGestureCompletionCallback;
187 // Send a synthetic gesture to the browser to be queued to the synthetic
188 // gesture controller.
189 void QueueSyntheticGesture(
190 scoped_ptr<SyntheticGestureParams> gesture_params,
191 const SyntheticGestureCompletionCallback& callback);
193 // Close the underlying WebWidget.
194 virtual void Close();
196 // Notifies about a compositor frame commit operation having finished.
197 virtual void DidCommitCompositorFrame();
199 // Handle common setup/teardown for handling IME events.
200 void StartHandlingImeEvent();
201 void FinishHandlingImeEvent();
203 // Returns whether we currently should handle an IME event.
204 bool ShouldHandleImeEvent();
206 virtual void InstrumentWillBeginFrame(int frame_id) {}
207 virtual void InstrumentDidBeginFrame() {}
208 virtual void InstrumentDidCancelFrame() {}
209 virtual void InstrumentWillComposite() {}
211 // When paused in debugger, we send ack for mouse event early. This ensures
212 // that we continue receiving mouse moves and pass them to debugger. Returns
213 // whether we are paused in mouse move event and have sent the ack.
214 bool SendAckForMouseMoveFromDebugger();
216 // When resumed from pause in debugger while handling mouse move,
217 // we should not send an extra ack (see SendAckForMouseMoveFromDebugger).
218 void IgnoreAckForMouseMoveFromDebugger();
220 // ScreenMetricsEmulator class manages screen emulation inside a render
221 // widget. This includes resizing, placing view on the screen at desired
222 // position, changing device scale factor, and scaling down the whole
223 // widget if required to fit into the browser window.
224 class ScreenMetricsEmulator;
226 // Emulates screen and widget metrics. Supplied values override everything
228 void EnableScreenMetricsEmulation(
229 const blink::WebDeviceEmulationParams& params);
230 void DisableScreenMetricsEmulation();
231 void SetPopupOriginAdjustmentsForEmulation(ScreenMetricsEmulator* emulator);
233 void ScheduleCompositeWithForcedRedraw();
235 // Called by the compositor in single-threaded mode when a swap is posted,
236 // completes or is aborted.
237 void OnSwapBuffersPosted();
238 void OnSwapBuffersComplete();
239 void OnSwapBuffersAborted();
241 // Checks if the selection bounds have been changed. If they are changed,
242 // the new value will be sent to the browser process.
243 void UpdateSelectionBounds();
245 virtual void GetSelectionBounds(gfx::Rect* start, gfx::Rect* end);
247 void OnShowHostContextMenu(ContextMenuParams* params);
259 // |show_ime| should be SHOW_IME_IF_NEEDED iff the update may cause the ime to
260 // be displayed, e.g. after a tap on an input field on mobile.
261 // |change_source| should be FROM_NON_IME when the renderer has to wait for
262 // the browser to acknowledge the change before the renderer handles any more
263 // IME events. This is when the text change did not originate from the IME in
264 // the browser side, such as changes by JavaScript or autofill.
265 void UpdateTextInputState(ShowIme show_ime, ChangeSource change_source);
267 #if defined(OS_MACOSX) || defined(USE_AURA)
268 // Checks if the composition range or composition character bounds have been
269 // changed. If they are changed, the new value will be sent to the browser
271 void UpdateCompositionInfo(bool should_update_range);
274 #if defined(OS_ANDROID)
275 void DidChangeBodyBackgroundColor(SkColor bg_color);
279 // Friend RefCounted so that the dtor can be non-public. Using this class
280 // without ref-counting is an error.
281 friend class base::RefCounted<RenderWidget>;
283 friend class RenderWidgetTest;
290 RenderWidget(blink::WebPopupType popup_type,
291 const blink::WebScreenInfo& screen_info,
296 virtual ~RenderWidget();
298 // Initializes this view with the given opener. CompleteInit must be called
300 bool Init(int32 opener_id);
302 // Called by Init and subclasses to perform initialization.
303 bool DoInit(int32 opener_id,
304 blink::WebWidget* web_widget,
305 IPC::SyncMessage* create_widget_message);
307 // Finishes creation of a pending view started with Init.
310 // Sets whether this RenderWidget has been swapped out to be displayed by
311 // a RenderWidget in a different process. If so, no new IPC messages will be
312 // sent (only ACKs) and the process is free to exit when there are no other
313 // active RenderWidgets.
314 void SetSwappedOut(bool is_swapped_out);
316 void FlushPendingInputEventAck();
317 void DoDeferredClose();
318 void DoDeferredSetWindowRect(const blink::WebRect& pos);
320 // Resizes the render widget.
321 void Resize(const gfx::Size& new_size,
322 const gfx::Size& physical_backing_size,
323 float overdraw_bottom_height,
324 const gfx::Size& visible_viewport_size,
325 const gfx::Rect& resizer_rect,
327 ResizeAck resize_ack);
328 // Used to force the size of a window when running layout tests.
329 void ResizeSynchronously(const gfx::Rect& new_position);
330 virtual void SetScreenMetricsEmulationParameters(
331 float device_scale_factor,
332 const gfx::Point& root_layer_offset,
333 float root_layer_scale);
334 #if defined(OS_MACOSX) || defined(OS_ANDROID)
335 void SetExternalPopupOriginAdjustmentsForEmulation(
336 ExternalPopupMenu* popup, ScreenMetricsEmulator* emulator);
339 // RenderWidget IPC message handlers
340 void OnHandleInputEvent(const blink::WebInputEvent* event,
341 const ui::LatencyInfo& latency_info,
342 bool keyboard_shortcut);
343 void OnCursorVisibilityChange(bool is_visible);
344 void OnMouseCaptureLost();
345 virtual void OnSetFocus(bool enable);
346 virtual void OnClose();
347 void OnCreatingNewAck();
348 virtual void OnResize(const ViewMsg_Resize_Params& params);
349 void OnChangeResizeRect(const gfx::Rect& resizer_rect);
350 virtual void OnWasHidden();
351 virtual void OnWasShown(bool needs_repainting);
352 virtual void OnWasSwappedOut();
353 void OnCreateVideoAck(int32 video_id);
354 void OnUpdateVideoAck(int32 video_id);
355 void OnRequestMoveAck();
356 void OnSetInputMethodActive(bool is_active);
357 void OnCandidateWindowShown();
358 void OnCandidateWindowUpdated();
359 void OnCandidateWindowHidden();
360 virtual void OnImeSetComposition(
361 const base::string16& text,
362 const std::vector<blink::WebCompositionUnderline>& underlines,
365 virtual void OnImeConfirmComposition(const base::string16& text,
366 const gfx::Range& replacement_range,
367 bool keep_selection);
368 void OnRepaint(gfx::Size size_to_paint);
369 void OnSyntheticGestureCompleted();
370 void OnSetTextDirection(blink::WebTextDirection direction);
372 void OnUpdateScreenRects(const gfx::Rect& view_screen_rect,
373 const gfx::Rect& window_screen_rect);
374 #if defined(OS_ANDROID)
375 void OnShowImeIfNeeded();
377 // Whenever an IME event that needs an acknowledgement is sent to the browser,
378 // the number of outstanding IME events that needs acknowledgement should be
379 // incremented. All IME events will be dropped until we receive an ack from
381 void IncrementOutstandingImeEventAcks();
383 // Called by the browser process for every required IME acknowledgement.
384 void OnImeEventAck();
387 // Notify the compositor about a change in viewport size. This should be
388 // used only with auto resize mode WebWidgets, as normal WebWidgets should
389 // go through OnResize.
390 void AutoResizeCompositor();
392 virtual void SetDeviceScaleFactor(float device_scale_factor);
393 virtual bool SetDeviceColorProfile(const std::vector<char>& color_profile);
395 virtual void OnOrientationChange();
397 // Override points to notify derived classes that a paint has happened.
398 // DidInitiatePaint happens when that has completed, and subsequent rendering
399 // won't affect the painted content. DidFlushPaint happens once we've received
400 // the ACK that the screen has been updated. For a given paint operation,
401 // these overrides will always be called in the order DidInitiatePaint,
403 virtual void DidInitiatePaint() {}
404 virtual void DidFlushPaint() {}
406 virtual GURL GetURLForGraphicsContext3D();
408 // Gets the scroll offset of this widget, if this widget has a notion of
410 virtual gfx::Vector2d GetScrollOffset();
412 // Sets the "hidden" state of this widget. All accesses to is_hidden_ should
413 // use this method so that we can properly inform the RenderThread of our
415 void SetHidden(bool hidden);
417 void WillToggleFullscreen();
418 void DidToggleFullscreen();
420 bool next_paint_is_resize_ack() const;
421 void set_next_paint_is_resize_ack();
422 void set_next_paint_is_repaint_ack();
424 // Override point to obtain that the current input method state and caret
426 virtual ui::TextInputType GetTextInputType();
427 virtual ui::TextInputType WebKitToUiTextInputType(
428 blink::WebTextInputType type);
430 #if defined(OS_MACOSX) || defined(USE_AURA)
431 // Override point to obtain that the current composition character bounds.
432 // In the case of surrogate pairs, the character is treated as two characters:
433 // the bounds for first character is actual one, and the bounds for second
434 // character is zero width rectangle.
435 virtual void GetCompositionCharacterBounds(
436 std::vector<gfx::Rect>* character_bounds);
438 // Returns the range of the text that is being composed or the selection if
439 // the composition does not exist.
440 virtual void GetCompositionRange(gfx::Range* range);
442 // Returns true if the composition range or composition character bounds
443 // should be sent to the browser process.
444 bool ShouldUpdateCompositionInfo(
445 const gfx::Range& range,
446 const std::vector<gfx::Rect>& bounds);
449 // Override point to obtain that the current input method state about
451 virtual bool CanComposeInline();
453 // Tells the renderer it does not have focus. Used to prevent us from getting
454 // the focus on our own when the browser did not focus us.
457 // Set the pending window rect.
458 // Because the real render_widget is hosted in another process, there is
459 // a time period where we may have set a new window rect which has not yet
460 // been processed by the browser. So we maintain a pending window rect
461 // size. If JS code sets the WindowRect, and then immediately calls
462 // GetWindowRect() we'll use this pending window rect as the size.
463 void SetPendingWindowRect(const blink::WebRect& r);
465 // Called by OnHandleInputEvent() to notify subclasses that a key event was
467 virtual void DidHandleKeyEvent() {}
469 // Called by OnHandleInputEvent() to notify subclasses that a mouse event is
470 // about to be handled.
471 // Returns true if no further handling is needed. In that case, the event
472 // won't be sent to WebKit or trigger DidHandleMouseEvent().
473 virtual bool WillHandleMouseEvent(const blink::WebMouseEvent& event);
475 // Called by OnHandleInputEvent() to notify subclasses that a gesture event is
476 // about to be handled.
477 // Returns true if no further handling is needed. In that case, the event
478 // won't be sent to WebKit.
479 virtual bool WillHandleGestureEvent(const blink::WebGestureEvent& event);
481 // Called by OnHandleInputEvent() to notify subclasses that a mouse event was
483 virtual void DidHandleMouseEvent(const blink::WebMouseEvent& event) {}
485 // Called by OnHandleInputEvent() to notify subclasses that a touch event was
487 virtual void DidHandleTouchEvent(const blink::WebTouchEvent& event) {}
489 // Check whether the WebWidget has any touch event handlers registered
490 // at the given point.
491 virtual bool HasTouchEventHandlersAt(const gfx::Point& point) const;
493 // Check whether the WebWidget has any touch event handlers registered.
494 virtual void hasTouchEventHandlers(bool has_handlers);
496 // Tell the browser about the actions permitted for a new touch point.
497 virtual void setTouchAction(blink::WebTouchAction touch_action);
499 // Called when value of focused text field gets dirty, e.g. value is modified
500 // by script, not by user input.
501 virtual void didUpdateTextOfFocusedElementByNonUserInput();
503 // Creates a 3D context associated with this view.
504 scoped_ptr<WebGraphicsContext3DCommandBufferImpl> CreateGraphicsContext3D();
506 // Routing ID that allows us to communicate to the parent browser process
507 // RenderWidgetHost. When MSG_ROUTING_NONE, no messages may be sent.
512 // We are responsible for destroying this object via its Close method.
513 // May be NULL when the window is closing.
514 blink::WebWidget* webwidget_;
516 // This is lazily constructed and must not outlive webwidget_.
517 scoped_ptr<RenderWidgetCompositor> compositor_;
519 // Set to the ID of the view that initiated creating this view, if any. When
520 // the view was initiated by the browser (the common case), this will be
521 // MSG_ROUTING_NONE. This is used in determining ownership when opening
522 // child tabs. See RenderWidget::createWebViewWithRequest.
524 // This ID may refer to an invalid view if that view is closed before this
528 // The position where this view should be initially shown.
529 gfx::Rect initial_pos_;
533 // We store the current cursor object so we can avoid spamming SetCursor
535 WebCursor current_cursor_;
537 // The size of the RenderWidget.
540 // The size of the view's backing surface in non-DPI-adjusted pixels.
541 gfx::Size physical_backing_size_;
543 // The height of the physical backing surface that is overdrawn opaquely in
544 // the browser, for example by an on-screen-keyboard (in DPI-adjusted pixels).
545 float overdraw_bottom_height_;
547 // The size of the visible viewport in DPI-adjusted pixels.
548 gfx::Size visible_viewport_size_;
550 // The area that must be reserved for drawing the resize corner.
551 gfx::Rect resizer_rect_;
553 // Flags for the next ViewHostMsg_UpdateRect message.
554 int next_paint_flags_;
556 // Whether the WebWidget is in auto resize mode, which is used for example
557 // by extension popups.
558 bool auto_resize_mode_;
560 // True if we need to send an UpdateRect message to notify the browser about
561 // an already-completed auto-resize.
562 bool need_update_rect_for_auto_resize_;
564 // Set to true if we should ignore RenderWidget::Show calls.
567 // Indicates that we shouldn't bother generated paint events.
570 // Indicates that we are never visible, so never produce graphical output.
573 // Indicates that we are in fullscreen mode.
576 // Indicates whether we have been focused/unfocused by the browser.
579 // Are we currently handling an input event?
580 bool handling_input_event_;
582 // Are we currently handling an ime event?
583 bool handling_ime_event_;
585 // Type of the input event we are currently handling.
586 blink::WebInputEvent::Type handling_event_type_;
588 // Whether we should not send ack for the current mouse move.
589 bool ignore_ack_for_mouse_move_from_debugger_;
591 // True if we have requested this widget be closed. No more messages will
592 // be sent, except for a Close.
595 // Whether this RenderWidget is currently swapped out, such that the view is
596 // being rendered by another process. If all RenderWidgets in a process are
597 // swapped out, the process can exit.
598 bool is_swapped_out_;
600 // Indicates if an input method is active in the browser process.
601 bool input_method_is_active_;
603 // Stores information about the current text input.
604 blink::WebTextInputInfo text_input_info_;
606 // Stores the current text input type of |webwidget_|.
607 ui::TextInputType text_input_type_;
609 // Stores the current text input mode of |webwidget_|.
610 ui::TextInputMode text_input_mode_;
612 // Stores the current type of composition text rendering of |webwidget_|.
613 bool can_compose_inline_;
615 // Stores the current selection bounds.
616 gfx::Rect selection_focus_rect_;
617 gfx::Rect selection_anchor_rect_;
619 // Stores the current composition character bounds.
620 std::vector<gfx::Rect> composition_character_bounds_;
622 // Stores the current composition range.
623 gfx::Range composition_range_;
625 // The kind of popup this widget represents, NONE if not a popup.
626 blink::WebPopupType popup_type_;
628 // Holds all the needed plugin window moves for a scroll.
629 typedef std::vector<WebPluginGeometry> WebPluginGeometryVector;
630 WebPluginGeometryVector plugin_window_moves_;
632 // While we are waiting for the browser to update window sizes, we track the
633 // pending size temporarily.
634 int pending_window_rect_count_;
635 blink::WebRect pending_window_rect_;
637 // The screen rects of the view and the window that contains it.
638 gfx::Rect view_screen_rect_;
639 gfx::Rect window_screen_rect_;
641 scoped_ptr<IPC::Message> pending_input_event_ack_;
643 // The time spent in input handlers this frame. Used to throttle input acks.
644 base::TimeDelta total_input_handling_time_this_frame_;
646 // Indicates if the next sequence of Char events should be suppressed or not.
647 bool suppress_next_char_events_;
649 // Properties of the screen hosting this RenderWidget instance.
650 blink::WebScreenInfo screen_info_;
652 // The device scale factor. This value is computed from the DPI entries in
653 // |screen_info_| on some platforms, and defaults to 1 on other platforms.
654 float device_scale_factor_;
656 // The device color profile on supported platforms.
657 std::vector<char> device_color_profile_;
659 // State associated with synthetic gestures. Synthetic gestures are processed
660 // in-order, so a queue is sufficient to identify the correct state for a
661 // completed gesture.
662 std::queue<SyntheticGestureCompletionCallback>
663 pending_synthetic_gesture_callbacks_;
665 // Specified whether the compositor will run in its own thread.
666 bool is_threaded_compositing_enabled_;
668 const ui::LatencyInfo* current_event_latency_info_;
670 uint32 next_output_surface_id_;
672 #if defined(OS_ANDROID)
673 // Indicates value in the focused text field is in dirty state, i.e. modified
674 // by script etc., not by user input.
675 bool text_field_is_dirty_;
677 // A counter for number of outstanding messages from the renderer to the
678 // browser regarding IME-type events that have not been acknowledged by the
679 // browser. If this value is not 0 IME events will be dropped.
680 int outstanding_ime_acks_;
682 // The background color of the document body element. This is used as the
683 // default background color for filling the screen areas for which we don't
684 // have the actual content.
685 SkColor body_background_color_;
688 scoped_ptr<ScreenMetricsEmulator> screen_metrics_emulator_;
690 // Popups may be displaced when screen metrics emulation is enabled.
691 // These values are used to properly adjust popup position.
692 gfx::Point popup_view_origin_for_emulation_;
693 gfx::Point popup_screen_origin_for_emulation_;
694 float popup_origin_scale_for_emulation_;
696 scoped_ptr<ResizingModeSelector> resizing_mode_selector_;
698 // Lists of RenderFrameProxy objects that need to be notified of
699 // compositing-related events (e.g. DidCommitCompositorFrame).
700 ObserverList<RenderFrameProxy> render_frame_proxies_;
701 #if defined(VIDEO_HOLE)
702 ObserverList<RenderFrameImpl> video_hole_frames_;
703 #endif // defined(VIDEO_HOLE)
705 // A list of RenderFrames associated with this RenderWidget. Notifications
706 // are sent to each frame in the list for events such as changing
707 // visibility state for example.
708 ObserverList<RenderFrameImpl> render_frames_;
710 ui::MenuSourceType context_menu_source_type_;
711 bool has_host_context_menu_location_;
712 gfx::Point host_context_menu_location_;
714 DISALLOW_COPY_AND_ASSIGN(RenderWidget);
717 } // namespace content
719 #endif // CONTENT_RENDERER_RENDER_WIDGET_H_