blob: ec3609a937c4e46fd26b56c0d193a7af1dc21071 [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
initial.commit09911bf2008-07-26 23:55:2911#include "base/basictypes.h"
[email protected]f3112a52011-09-30 23:47:4912#include "base/compiler_specific.h"
[email protected]3b63f8f42011-03-28 01:54:1513#include "base/memory/ref_counted.h"
[email protected]8704f89b2011-04-15 00:30:0514#include "base/memory/scoped_ptr.h"
[email protected]ed7defa2013-03-12 21:29:5915#include "base/memory/weak_ptr.h"
[email protected]abb522162013-06-28 01:54:1616#include "base/time/time.h"
17#include "base/timer/timer.h"
[email protected]6e84de22013-03-18 06:54:2718#include "cc/debug/rendering_stats.h"
[email protected]3639aa82013-06-04 11:00:0419#include "content/common/browser_rendering_stats.h"
[email protected]f3112a52011-09-30 23:47:4920#include "content/common/content_export.h"
[email protected]ed7defa2013-03-12 21:29:5921#include "content/common/gpu/client/webgraphicscontext3d_command_buffer_impl.h"
[email protected]921f1592011-03-18 00:41:0222#include "content/renderer/paint_aggregator.h"
[email protected]4f86bdb2012-11-10 19:11:1923#include "ipc/ipc_listener.h"
24#include "ipc/ipc_sender.h"
[email protected]5c30b5e02013-05-30 03:46:0825#include "third_party/WebKit/public/platform/WebRect.h"
[email protected]2255a9332013-06-17 05:12:3126#include "third_party/WebKit/public/web/WebCompositionUnderline.h"
27#include "third_party/WebKit/public/web/WebPopupType.h"
28#include "third_party/WebKit/public/web/WebTextDirection.h"
29#include "third_party/WebKit/public/web/WebTextInputInfo.h"
[email protected]0e45bd02013-07-12 20:20:0230#include "third_party/WebKit/public/web/WebWidget.h"
[email protected]2255a9332013-06-17 05:12:3131#include "third_party/WebKit/public/web/WebWidgetClient.h"
[email protected]d65adb12010-04-28 17:26:4932#include "third_party/skia/include/core/SkBitmap.h"
[email protected]b256eca2013-07-11 10:57:4033#include "ui/base/ime/text_input_mode.h"
[email protected]ad26ef42011-06-17 07:59:4534#include "ui/base/ime/text_input_type.h"
[email protected]58b48a0d2012-06-13 07:01:3535#include "ui/base/range/range.h"
[email protected]08397d52011-02-05 01:53:3836#include "ui/gfx/native_widget_types.h"
37#include "ui/gfx/rect.h"
[email protected]990278ff2012-11-13 02:12:5538#include "ui/gfx/vector2d.h"
[email protected]a2b5ded2013-05-20 21:32:5339#include "ui/gfx/vector2d_f.h"
[email protected]d353541f2012-05-03 22:45:4140#include "ui/surface/transport_dib.h"
[email protected]19df7002013-05-31 00:25:3941#include "webkit/common/cursors/webcursor.h"
initial.commit09911bf2008-07-26 23:55:2942
[email protected]aa4117f2011-12-09 22:19:2143struct ViewHostMsg_UpdateRect_Params;
[email protected]0fdd5012013-05-29 08:05:5644struct ViewMsg_Resize_Params;
[email protected]aa4117f2011-12-09 22:19:2145class ViewHostMsg_UpdateRect;
46
[email protected]484955942010-08-19 16:13:1847namespace IPC {
48class SyncMessage;
49}
50
[email protected]88efb7ec2009-07-14 16:32:5951namespace WebKit {
[email protected]41d86852012-11-07 12:23:2452class WebGestureEvent;
[email protected]0dea1652012-12-14 00:09:0953class WebInputEvent;
[email protected]f56c7872013-06-18 12:31:5754class WebKeyboardEvent;
[email protected]6a8ddba52010-09-05 04:38:0655class WebMouseEvent;
[email protected]2d0f2e92011-10-03 09:02:2456class WebTouchEvent;
[email protected]e195e582013-03-08 01:32:5957struct WebPoint;
58struct WebRenderingStatsImpl;
[email protected]526476902011-10-06 20:34:0659}
60
[email protected]ba91a792013-02-06 09:48:2861namespace cc { class OutputSurface; }
62
[email protected]4de6d1692011-10-12 08:45:4463namespace ui {
64class Range;
65}
66
[email protected]e9ff79c2012-10-19 21:31:2667namespace content {
[email protected]adab2332013-07-25 18:04:3268class PepperPluginInstanceImpl;
[email protected]ba91a792013-02-06 09:48:2869class RenderWidgetCompositor;
[email protected]e9ff79c2012-10-19 21:31:2670class RenderWidgetTest;
[email protected]29e2fb42013-07-19 01:13:4771struct GpuRenderingStats;
72struct WebPluginGeometry;
[email protected]e9ff79c2012-10-19 21:31:2673
initial.commit09911bf2008-07-26 23:55:2974// RenderWidget provides a communication bridge between a WebWidget and
75// a RenderWidgetHost, the latter of which lives in a different process.
[email protected]f3112a52011-09-30 23:47:4976class CONTENT_EXPORT RenderWidget
[email protected]c47317e2012-06-20 22:35:3177 : public IPC::Listener,
78 public IPC::Sender,
[email protected]f3112a52011-09-30 23:47:4979 NON_EXPORTED_BASE(virtual public WebKit::WebWidgetClient),
[email protected]ed7defa2013-03-12 21:29:5980 NON_EXPORTED_BASE(public WebGraphicsContext3DSwapBuffersClient),
[email protected]f3112a52011-09-30 23:47:4981 public base::RefCounted<RenderWidget> {
initial.commit09911bf2008-07-26 23:55:2982 public:
83 // Creates a new RenderWidget. The opener_id is the routing ID of the
[email protected]380244092011-10-07 17:26:2784 // RenderView that this widget lives inside.
[email protected]0ebf3872008-11-07 21:35:0385 static RenderWidget* Create(int32 opener_id,
[email protected]842f10652012-06-06 01:54:0486 WebKit::WebPopupType popup_type,
87 const WebKit::WebScreenInfo& screen_info);
initial.commit09911bf2008-07-26 23:55:2988
[email protected]484955942010-08-19 16:13:1889 // Creates a WebWidget based on the popup type.
90 static WebKit::WebWidget* CreateWebWidget(RenderWidget* render_widget);
91
[email protected]c03a6e72011-04-19 21:42:0692 // The compositing surface assigned by the RenderWidgetHost
93 // (or RenderViewHost). Will be gfx::kNullPluginWindow if not assigned yet,
94 // in which case we should not create any GPU command buffers with it.
initial.commit09911bf2008-07-26 23:55:2995 // The routing ID assigned by the RenderProcess. Will be MSG_ROUTING_NONE if
96 // not yet assigned a view ID, in which case, the process MUST NOT send
97 // messages with this ID to the parent.
98 int32 routing_id() const {
99 return routing_id_;
100 }
101
[email protected]9f4f3322012-01-18 22:29:56102 int32 surface_id() const {
103 return surface_id_;
104 }
105
initial.commit09911bf2008-07-26 23:55:29106 // May return NULL when the window is closing.
[email protected]93b9d692011-04-13 00:44:31107 WebKit::WebWidget* webwidget() const { return webwidget_; }
[email protected]ee41e7d22011-10-14 19:34:09108
[email protected]93b9d692011-04-13 00:44:31109 gfx::Size size() const { return size_; }
[email protected]589621b2010-09-23 22:01:07110 bool has_focus() const { return has_focus_; }
[email protected]ee41e7d22011-10-14 19:34:09111 bool is_fullscreen() const { return is_fullscreen_; }
[email protected]204f1df2012-01-04 20:21:13112 bool is_hidden() const { return is_hidden_; }
[email protected]589621b2010-09-23 22:01:07113
[email protected]c47317e2012-06-20 22:35:31114 // IPC::Listener
[email protected]edc64de2011-11-17 20:07:38115 virtual bool OnMessageReceived(const IPC::Message& msg) OVERRIDE;
initial.commit09911bf2008-07-26 23:55:29116
[email protected]c47317e2012-06-20 22:35:31117 // IPC::Sender
[email protected]edc64de2011-11-17 20:07:38118 virtual bool Send(IPC::Message* msg) OVERRIDE;
initial.commit09911bf2008-07-26 23:55:29119
[email protected]4873c7d2009-07-16 06:36:28120 // WebKit::WebWidgetClient
[email protected]9ed83fe2013-02-27 01:52:28121 virtual void suppressCompositorScheduling(bool enable);
[email protected]9cd43a62012-03-26 08:03:56122 virtual void willBeginCompositorFrame();
[email protected]4873c7d2009-07-16 06:36:28123 virtual void didInvalidateRect(const WebKit::WebRect&);
[email protected]990278ff2012-11-13 02:12:55124 virtual void didScrollRect(int dx, int dy,
125 const WebKit::WebRect& clipRect);
[email protected]244ac1892011-12-02 17:04:47126 virtual void didAutoResize(const WebKit::WebSize& new_size);
[email protected]91acd1c2012-03-14 08:32:39127 virtual void didActivateCompositor(int input_handler_identifier);
[email protected]ea162f92011-10-04 23:08:22128 virtual void didDeactivateCompositor();
[email protected]e195e582013-03-08 01:32:59129 virtual void initializeLayerTreeView();
[email protected]8926c602013-01-23 05:32:06130 virtual WebKit::WebLayerTreeView* layerTreeView();
[email protected]3391a0772012-03-28 00:32:07131 virtual void didBecomeReadyForAdditionalInput();
[email protected]58264a32011-11-17 23:36:15132 virtual void didCommitAndDrawCompositorFrame();
133 virtual void didCompleteSwapBuffers();
[email protected]f98d7e3c2010-09-13 22:30:46134 virtual void scheduleComposite();
[email protected]5f8b1022011-01-21 23:34:50135 virtual void scheduleAnimation();
[email protected]4873c7d2009-07-16 06:36:28136 virtual void didFocus();
137 virtual void didBlur();
138 virtual void didChangeCursor(const WebKit::WebCursorInfo&);
139 virtual void closeWidgetSoon();
140 virtual void show(WebKit::WebNavigationPolicy);
141 virtual void runModal() {}
[email protected]9b003482013-05-21 14:00:17142 virtual void didProgrammaticallyScroll(const WebKit::WebPoint& scroll_point);
[email protected]4873c7d2009-07-16 06:36:28143 virtual WebKit::WebRect windowRect();
[email protected]8a9d6ca32011-06-06 20:11:30144 virtual void setToolTipText(const WebKit::WebString& text,
145 WebKit::WebTextDirection hint);
[email protected]4873c7d2009-07-16 06:36:28146 virtual void setWindowRect(const WebKit::WebRect&);
147 virtual WebKit::WebRect windowResizerRect();
148 virtual WebKit::WebRect rootWindowRect();
149 virtual WebKit::WebScreenInfo screenInfo();
[email protected]f660d9c2012-06-06 18:31:21150 virtual float deviceScaleFactor();
[email protected]fa7b1dc2010-06-23 17:53:04151 virtual void resetInputMethod();
[email protected]c68c3e4e2013-01-24 00:36:56152 virtual void didHandleGestureEvent(const WebKit::WebGestureEvent& event,
153 bool event_cancelled);
[email protected]4873c7d2009-07-16 06:36:28154
155 // Called when a plugin is moved. These events are queued up and sent with
156 // the next paint or scroll message to the host.
[email protected]29e2fb42013-07-19 01:13:47157 void SchedulePluginMove(const WebPluginGeometry& move);
initial.commit09911bf2008-07-26 23:55:29158
[email protected]268654772009-08-06 23:02:04159 // Called when a plugin window has been destroyed, to make sure the currently
160 // pending moves don't try to reference it.
161 void CleanupWindowInPluginMoves(gfx::PluginWindowHandle window);
162
[email protected]b63d58d2012-11-26 22:37:44163 // Fills in a WebRenderingStatsImpl struct containing information about
[email protected]fef5e3972012-08-07 03:59:47164 // rendering, e.g. count of frames rendered, time spent painting.
[email protected]b63d58d2012-11-26 22:37:44165 void GetRenderingStats(WebKit::WebRenderingStatsImpl&) const;
[email protected]fef5e3972012-08-07 03:59:47166
[email protected]63b465922012-09-06 02:04:52167 // Fills in a GpuRenderingStats struct containing information about
168 // GPU rendering, e.g. count of texture uploads performed, time spent
169 // uploading.
170 // This call is relatively expensive as it blocks on the GPU process
[email protected]e9ff79c2012-10-19 21:31:26171 bool GetGpuRenderingStats(GpuRenderingStats*) const;
[email protected]63b465922012-09-06 02:04:52172
[email protected]3639aa82013-06-04 11:00:04173 void GetBrowserRenderingStats(BrowserRenderingStats* stats);
174
[email protected]24ed0432013-04-24 07:50:31175 RenderWidgetCompositor* compositor() const;
176
[email protected]ebc0e1df2013-08-01 02:46:22177 virtual scoped_ptr<cc::OutputSurface> CreateOutputSurface(bool fallback);
[email protected]ba91a792013-02-06 09:48:28178
[email protected]0e241b4b2012-08-18 09:06:27179 // Callback for use with BeginSmoothScroll.
180 typedef base::Callback<void()> SmoothScrollCompletionCallback;
181
[email protected]a39ca1652012-07-13 21:30:58182 // Directs the host to begin a smooth scroll. This scroll should have the same
[email protected]0e241b4b2012-08-18 09:06:27183 // performance characteristics as a user-initiated scroll. Returns an ID of
[email protected]53beb772013-03-06 01:57:22184 // the scroll gesture. |mouse_event_x| and |mouse_event_y| are expected to be
185 // in local DIP coordinates.
[email protected]0c2ebef2013-04-03 12:14:10186 void BeginSmoothScroll(bool scroll_down,
[email protected]ebd8b562012-10-09 14:44:29187 const SmoothScrollCompletionCallback& callback,
[email protected]267909d2012-10-20 04:36:19188 int pixels_to_scroll,
[email protected]ebd8b562012-10-09 14:44:29189 int mouse_event_x,
190 int mouse_event_y);
[email protected]a39ca1652012-07-13 21:30:58191
initial.commit09911bf2008-07-26 23:55:29192 // Close the underlying WebWidget.
[email protected]60c42a8c72009-10-09 04:08:59193 virtual void Close();
initial.commit09911bf2008-07-26 23:55:29194
[email protected]6fceb912013-02-15 06:24:15195 // Notifies about a compositor frame commit operation having finished.
196 virtual void DidCommitCompositorFrame();
197
[email protected]a1127f82011-09-08 17:27:01198 float filtered_time_per_frame() const {
199 return filtered_time_per_frame_;
200 }
201
[email protected]66fca5bc2013-05-23 06:58:29202 // Handle common setup/teardown for handling IME events.
203 void StartHandlingImeEvent();
204 void FinishHandlingImeEvent();
205
[email protected]35134e12013-02-22 20:07:40206 virtual void InstrumentWillBeginFrame() {}
207 virtual void InstrumentDidBeginFrame() {}
208 virtual void InstrumentDidCancelFrame() {}
209 virtual void InstrumentWillComposite() {}
210
[email protected]34bb3ac2013-03-08 02:41:28211 virtual bool AllowPartialSwap() const;
[email protected]c8cbae72013-05-23 10:45:03212 bool UsingSynchronousRendererCompositor() const;
[email protected]34bb3ac2013-03-08 02:41:28213
[email protected]557e9eb42013-06-21 06:52:18214 bool is_swapped_out() { return is_swapped_out_; }
215
initial.commit09911bf2008-07-26 23:55:29216 protected:
[email protected]8085dbc82008-09-26 22:53:44217 // Friend RefCounted so that the dtor can be non-public. Using this class
218 // without ref-counting is an error.
219 friend class base::RefCounted<RenderWidget>;
[email protected]7339cd22010-10-27 00:11:20220 // For unit tests.
[email protected]e9ff79c2012-10-19 21:31:26221 friend class RenderWidgetTest;
[email protected]8085dbc82008-09-26 22:53:44222
[email protected]61e2b3cc2012-03-02 16:13:34223 enum ResizeAck {
224 SEND_RESIZE_ACK,
225 NO_RESIZE_ACK,
226 };
227
[email protected]6fd35b72012-03-01 19:46:41228 RenderWidget(WebKit::WebPopupType popup_type,
[email protected]842f10652012-06-06 01:54:04229 const WebKit::WebScreenInfo& screen_info,
[email protected]1ac10dca2013-08-20 20:47:04230 bool swapped_out,
231 bool hidden);
[email protected]ce2b28e2012-08-09 15:53:57232
[email protected]8085dbc82008-09-26 22:53:44233 virtual ~RenderWidget();
initial.commit09911bf2008-07-26 23:55:29234
235 // Initializes this view with the given opener. CompleteInit must be called
236 // later.
[email protected]a635f942012-12-07 10:34:29237 bool Init(int32 opener_id);
initial.commit09911bf2008-07-26 23:55:29238
[email protected]484955942010-08-19 16:13:18239 // Called by Init and subclasses to perform initialization.
[email protected]a635f942012-12-07 10:34:29240 bool DoInit(int32 opener_id,
[email protected]484955942010-08-19 16:13:18241 WebKit::WebWidget* web_widget,
242 IPC::SyncMessage* create_widget_message);
243
initial.commit09911bf2008-07-26 23:55:29244 // Finishes creation of a pending view started with Init.
[email protected]fc4404d2012-11-07 19:53:30245 void CompleteInit();
initial.commit09911bf2008-07-26 23:55:29246
[email protected]992db4c2011-05-12 15:37:15247 // Sets whether this RenderWidget has been swapped out to be displayed by
248 // a RenderWidget in a different process. If so, no new IPC messages will be
249 // sent (only ACKs) and the process is free to exit when there are no other
250 // active RenderWidgets.
251 void SetSwappedOut(bool is_swapped_out);
252
[email protected]661eb9d2009-02-03 02:11:48253 // Paints the given rectangular region of the WebWidget into canvas (a
254 // shared memory segment returned by AllocPaintBuf on Windows). The caller
255 // must ensure that the given rect fits within the bounds of the WebWidget.
[email protected]4fb66842009-12-04 21:41:00256 void PaintRect(const gfx::Rect& rect, const gfx::Point& canvas_origin,
[email protected]9d611ca2012-11-14 13:46:56257 SkCanvas* canvas);
[email protected]4fb66842009-12-04 21:41:00258
259 // Paints a border at the given rect for debugging purposes.
[email protected]9d611ca2012-11-14 13:46:56260 void PaintDebugBorder(const gfx::Rect& rect, SkCanvas* canvas);
initial.commit09911bf2008-07-26 23:55:29261
[email protected]bd37ae252011-06-03 01:28:18262 bool IsRenderingVSynced();
[email protected]52ccd0ea2011-02-16 01:09:05263 void AnimationCallback();
264 void AnimateIfNeeded();
[email protected]65225772011-05-12 21:10:24265 void InvalidationCallback();
266 void DoDeferredUpdateAndSendInputAck();
[email protected]552e6002009-11-19 05:24:57267 void DoDeferredUpdate();
[email protected]2533ce12009-05-09 00:02:24268 void DoDeferredClose();
269 void DoDeferredSetWindowRect(const WebKit::WebRect& pos);
[email protected]f0c2a242013-03-15 19:34:52270 virtual void Composite(base::TimeTicks frame_begin_time);
initial.commit09911bf2008-07-26 23:55:29271
[email protected]699ab0d2009-04-23 23:19:14272 // Set the background of the render widget to a bitmap. The bitmap will be
273 // tiled in both directions if it isn't big enough to fill the area. This is
274 // mainly intended to be used in conjuction with WebView::SetIsTransparent().
275 virtual void SetBackground(const SkBitmap& bitmap);
276
[email protected]61e2b3cc2012-03-02 16:13:34277 // Resizes the render widget.
278 void Resize(const gfx::Size& new_size,
[email protected]60d47ac2013-03-01 23:42:44279 const gfx::Size& physical_backing_size,
[email protected]d9083762013-03-24 01:36:40280 float overdraw_bottom_height,
[email protected]61e2b3cc2012-03-02 16:13:34281 const gfx::Rect& resizer_rect,
282 bool is_fullscreen,
283 ResizeAck resize_ack);
284
initial.commit09911bf2008-07-26 23:55:29285 // RenderWidget IPC message handlers
[email protected]c084330e02013-04-27 01:08:15286 void OnHandleInputEvent(const WebKit::WebInputEvent* event,
[email protected]4b157662013-05-29 04:05:05287 const ui::LatencyInfo& latency_info,
[email protected]c084330e02013-04-27 01:08:15288 bool keyboard_shortcut);
[email protected]34202de2013-05-06 23:36:22289 void OnCursorVisibilityChange(bool is_visible);
[email protected]c084330e02013-04-27 01:08:15290 void OnMouseCaptureLost();
291 virtual void OnSetFocus(bool enable);
initial.commit09911bf2008-07-26 23:55:29292 void OnClose();
[email protected]fc4404d2012-11-07 19:53:30293 void OnCreatingNewAck();
[email protected]0fdd5012013-05-29 08:05:56294 virtual void OnResize(const ViewMsg_Resize_Params& params);
[email protected]b5913d72012-02-07 22:26:54295 void OnChangeResizeRect(const gfx::Rect& resizer_rect);
[email protected]941e4552010-02-01 21:23:43296 virtual void OnWasHidden();
[email protected]9e2e4632012-07-27 16:38:41297 virtual void OnWasShown(bool needs_repainting);
[email protected]992db4c2011-05-12 15:37:15298 virtual void OnWasSwappedOut();
[email protected]53d3f302009-12-21 04:42:05299 void OnUpdateRectAck();
[email protected]8400e032010-02-26 18:50:11300 void OnCreateVideoAck(int32 video_id);
301 void OnUpdateVideoAck(int32 video_id);
[email protected]2533ce12009-05-09 00:02:24302 void OnRequestMoveAck();
[email protected]fa7b1dc2010-06-23 17:53:04303 void OnSetInputMethodActive(bool is_active);
[email protected]56ea1a62011-05-30 07:05:57304 virtual void OnImeSetComposition(
[email protected]fa7b1dc2010-06-23 17:53:04305 const string16& text,
306 const std::vector<WebKit::WebCompositionUnderline>& underlines,
307 int selection_start,
308 int selection_end);
[email protected]0e45bd02013-07-12 20:20:02309 virtual void OnImeConfirmComposition(const string16& text,
310 const ui::Range& replacement_range,
311 bool keep_selection);
[email protected]3d9ec5052013-01-02 22:05:25312 void OnPaintAtSize(const TransportDIB::Handle& dib_id,
313 int tag,
314 const gfx::Size& page_size,
315 const gfx::Size& desired_size);
[email protected]0bc1f572013-04-17 01:46:31316 void OnRepaint(gfx::Size size_to_paint);
[email protected]4a9dba42013-04-29 18:24:22317 void OnSmoothScrollCompleted();
[email protected]4873c7d2009-07-16 06:36:28318 void OnSetTextDirection(WebKit::WebTextDirection direction);
[email protected]872ae5b2011-05-26 20:20:50319 void OnGetFPS();
[email protected]80ad8622012-11-07 16:33:03320 void OnUpdateScreenRects(const gfx::Rect& view_screen_rect,
321 const gfx::Rect& window_screen_rect);
[email protected]105dffb42013-02-20 03:46:21322#if defined(OS_ANDROID)
323 void OnImeBatchStateChanged(bool is_begin);
[email protected]2384b6c2013-02-28 23:58:51324 void OnShowImeIfNeeded();
[email protected]0d1ebed12013-08-05 22:01:13325
326 // Whenever an IME event that needs an acknowledgement is sent to the browser,
327 // the number of outstanding IME events that needs acknowledgement should be
328 // incremented. All IME events will be dropped until we receive an ack from
329 // the browser.
330 void IncrementOutstandingImeEventAcks();
331
332 // Called by the browser process for every required IME acknowledgement.
333 void OnImeEventAck();
[email protected]105dffb42013-02-20 03:46:21334#endif
[email protected]0d1ebed12013-08-05 22:01:13335 // Returns whether we currently should handle an IME event.
336 bool ShouldHandleImeEvent();
337
[email protected]51a49502013-03-23 01:50:19338 void OnSnapshot(const gfx::Rect& src_subrect);
[email protected]3639aa82013-06-04 11:00:04339 void OnSetBrowserRenderingStats(const BrowserRenderingStats& stats);
initial.commit09911bf2008-07-26 23:55:29340
[email protected]847a2582013-03-09 02:29:51341 // Notify the compositor about a change in viewport size. This should be
342 // used only with auto resize mode WebWidgets, as normal WebWidgets should
343 // go through OnResize.
[email protected]97e1bf72013-03-06 14:06:05344 void AutoResizeCompositor();
345
[email protected]468ac582012-11-20 00:53:19346 virtual void SetDeviceScaleFactor(float device_scale_factor);
347
[email protected]29ed96a2012-02-04 18:12:16348 // Override points to notify derived classes that a paint has happened.
349 // WillInitiatePaint happens when we're about to generate a new bitmap and
350 // send it to the browser. DidInitiatePaint happens when that has completed,
351 // and subsequent rendering won't affect the painted content. DidFlushPaint
352 // happens once we've received the ACK that the screen has been updated.
353 // For a given paint operation, these overrides will always be called in the
354 // order WillInitiatePaint, DidInitiatePaint, DidFlushPaint.
355 virtual void WillInitiatePaint() {}
[email protected]00c39612010-03-06 02:53:28356 virtual void DidInitiatePaint() {}
357 virtual void DidFlushPaint() {}
[email protected]a2f6bc112009-06-27 16:27:25358
[email protected]65225772011-05-12 21:10:24359 // Override and return true when the widget is rendered with a graphics
[email protected]37a6f302011-07-11 23:43:08360 // context that supports asynchronous swapbuffers. When returning true, the
361 // subclass must call OnSwapBuffersPosted() when swap is posted,
362 // OnSwapBuffersComplete() when swaps complete, and OnSwapBuffersAborted if
363 // the context is lost.
[email protected]65225772011-05-12 21:10:24364 virtual bool SupportsAsynchronousSwapBuffers();
[email protected]ed7defa2013-03-12 21:29:59365 virtual GURL GetURLForGraphicsContext3D();
[email protected]65225772011-05-12 21:10:24366
[email protected]479b0172012-10-29 19:27:09367 virtual bool ForceCompositingModeEnabled();
368
[email protected]ed7defa2013-03-12 21:29:59369 // WebGraphicsContext3DSwapBuffersClient implementation.
370
371 // Called by a GraphicsContext associated with this view when swapbuffers
372 // is posted, completes or is aborted.
373 virtual void OnViewContextSwapBuffersPosted() OVERRIDE;
374 virtual void OnViewContextSwapBuffersComplete() OVERRIDE;
375 virtual void OnViewContextSwapBuffersAborted() OVERRIDE;
[email protected]65225772011-05-12 21:10:24376
[email protected]ca4847f2010-09-24 05:39:15377 // Detects if a suitable opaque plugin covers the given paint bounds with no
378 // compositing necessary.
379 //
[email protected]719b36f2010-12-22 20:36:46380 // Returns the plugin instance that's the source of the paint if the paint
381 // can be handled by just blitting the plugin bitmap. In this case, the
382 // location, clipping, and ID of the backing store will be filled into the
383 // given output parameters.
[email protected]ca4847f2010-09-24 05:39:15384 //
[email protected]719b36f2010-12-22 20:36:46385 // A return value of null means optimized painting can not be used and we
[email protected]ca4847f2010-09-24 05:39:15386 // should continue with the normal painting code path.
[email protected]adab2332013-07-25 18:04:32387 virtual PepperPluginInstanceImpl* GetBitmapForOptimizedPluginPaint(
[email protected]ca4847f2010-09-24 05:39:15388 const gfx::Rect& paint_bounds,
389 TransportDIB** dib,
390 gfx::Rect* location,
[email protected]0f3a2d12012-09-01 03:37:20391 gfx::Rect* clip,
392 float* scale_factor);
[email protected]ca4847f2010-09-24 05:39:15393
[email protected]d54169e92011-01-21 09:19:52394 // Gets the scroll offset of this widget, if this widget has a notion of
395 // scroll offset.
[email protected]ceb36f7d2012-10-31 18:33:24396 virtual gfx::Vector2d GetScrollOffset();
[email protected]d54169e92011-01-21 09:19:52397
[email protected]bee16aab2009-08-26 15:55:03398 // Sets the "hidden" state of this widget. All accesses to is_hidden_ should
399 // use this method so that we can properly inform the RenderThread of our
400 // state.
401 void SetHidden(bool hidden);
402
[email protected]2b624c562011-10-27 22:58:26403 void WillToggleFullscreen();
404 void DidToggleFullscreen();
405
[email protected]674741932009-02-04 23:44:46406 bool next_paint_is_resize_ack() const;
407 bool next_paint_is_restore_ack() const;
408 void set_next_paint_is_resize_ack();
409 void set_next_paint_is_restore_ack();
410 void set_next_paint_is_repaint_ack();
[email protected]ec7dc112008-08-06 05:30:12411
[email protected]e99ef6f2011-10-16 01:13:00412 // Checks if the text input state and compose inline mode have been changed.
[email protected]fa7b1dc2010-06-23 17:53:04413 // If they are changed, the new value will be sent to the browser process.
[email protected]cb9e2632013-06-18 11:26:47414 void UpdateTextInputType();
415
416#if defined(OS_ANDROID)
[email protected]0d1ebed12013-08-05 22:01:13417 // |show_ime_if_needed| should be true iff the update may cause the ime to be
418 // displayed, e.g. after a tap on an input field on mobile.
419 // |send_ime_ack| should be true iff the browser side is required to
420 // acknowledge the change before the renderer handles any more IME events.
421 // This is when the event did not originate from the browser side IME, such as
422 // changes from JavaScript or autofill.
423 void UpdateTextInputState(bool show_ime_if_needed, bool send_ime_ack);
[email protected]cb9e2632013-06-18 11:26:47424#endif
[email protected]e99ef6f2011-10-16 01:13:00425
426 // Checks if the selection bounds have been changed. If they are changed,
427 // the new value will be sent to the browser process.
[email protected]58b48a0d2012-06-13 07:01:35428 virtual void UpdateSelectionBounds();
429
[email protected]56ea1a62011-05-30 07:05:57430 // Override point to obtain that the current input method state and caret
431 // position.
[email protected]ad26ef42011-06-17 07:59:45432 virtual ui::TextInputType GetTextInputType();
[email protected]3f783362011-10-21 22:40:50433 virtual void GetSelectionBounds(gfx::Rect* start, gfx::Rect* end);
[email protected]5b739cb2012-08-21 20:35:21434 virtual ui::TextInputType WebKitToUiTextInputType(
435 WebKit::WebTextInputType type);
[email protected]ad26ef42011-06-17 07:59:45436
[email protected]501ea13d2013-07-09 17:03:29437#if defined(OS_MACOSX) || defined(OS_WIN) || defined(USE_AURA)
438 // Checks if the composition range or composition character bounds have been
439 // changed. If they are changed, the new value will be sent to the browser
440 // process.
441 void UpdateCompositionInfo(bool should_update_range);
442
[email protected]58b48a0d2012-06-13 07:01:35443 // Override point to obtain that the current composition character bounds.
444 // In the case of surrogate pairs, the character is treated as two characters:
445 // the bounds for first character is actual one, and the bounds for second
446 // character is zero width rectangle.
447 virtual void GetCompositionCharacterBounds(
448 std::vector<gfx::Rect>* character_bounds);
449
[email protected]88dbe32f2013-06-20 23:31:36450 // Returns the range of the text that is being composed or the selection if
451 // the composition does not exist.
452 virtual void GetCompositionRange(ui::Range* range);
453
[email protected]58b48a0d2012-06-13 07:01:35454 // Returns true if the composition range or composition character bounds
455 // should be sent to the browser process.
456 bool ShouldUpdateCompositionInfo(
457 const ui::Range& range,
458 const std::vector<gfx::Rect>& bounds);
[email protected]501ea13d2013-07-09 17:03:29459#endif
[email protected]58b48a0d2012-06-13 07:01:35460
[email protected]ad26ef42011-06-17 07:59:45461 // Override point to obtain that the current input method state about
462 // composition text.
463 virtual bool CanComposeInline();
[email protected]56ea1a62011-05-30 07:05:57464
initial.commit09911bf2008-07-26 23:55:29465 // Tells the renderer it does not have focus. Used to prevent us from getting
466 // the focus on our own when the browser did not focus us.
467 void ClearFocus();
468
[email protected]2533ce12009-05-09 00:02:24469 // Set the pending window rect.
470 // Because the real render_widget is hosted in another process, there is
471 // a time period where we may have set a new window rect which has not yet
472 // been processed by the browser. So we maintain a pending window rect
473 // size. If JS code sets the WindowRect, and then immediately calls
474 // GetWindowRect() we'll use this pending window rect as the size.
475 void SetPendingWindowRect(const WebKit::WebRect& r);
476
[email protected]446705872009-09-10 07:22:48477 // Called by OnHandleInputEvent() to notify subclasses that a key event was
478 // just handled.
479 virtual void DidHandleKeyEvent() {}
480
[email protected]67bfb83f2011-09-22 03:36:37481 // Called by OnHandleInputEvent() to notify subclasses that a mouse event is
482 // about to be handled.
483 // Returns true if no further handling is needed. In that case, the event
484 // won't be sent to WebKit or trigger DidHandleMouseEvent().
485 virtual bool WillHandleMouseEvent(const WebKit::WebMouseEvent& event);
486
[email protected]f56c7872013-06-18 12:31:57487 // Called by OnHandleInputEvent() to notify subclasses that a key event is
488 // about to be handled.
489 // Returns true if no further handling is needed. In that case, the event
490 // won't be sent to WebKit or trigger DidHandleKeyEvent().
491 virtual bool WillHandleKeyEvent(const WebKit::WebKeyboardEvent& event);
492
[email protected]41d86852012-11-07 12:23:24493 // Called by OnHandleInputEvent() to notify subclasses that a gesture event is
494 // about to be handled.
495 // Returns true if no further handling is needed. In that case, the event
496 // won't be sent to WebKit.
497 virtual bool WillHandleGestureEvent(const WebKit::WebGestureEvent& event);
498
[email protected]6a8ddba52010-09-05 04:38:06499 // Called by OnHandleInputEvent() to notify subclasses that a mouse event was
500 // just handled.
501 virtual void DidHandleMouseEvent(const WebKit::WebMouseEvent& event) {}
502
[email protected]2d0f2e92011-10-03 09:02:24503 // Called by OnHandleInputEvent() to notify subclasses that a touch event was
504 // just handled.
505 virtual void DidHandleTouchEvent(const WebKit::WebTouchEvent& event) {}
506
[email protected]3d5c243b2012-11-30 00:26:01507 // Check whether the WebWidget has any touch event handlers registered
508 // at the given point.
509 virtual bool HasTouchEventHandlersAt(const gfx::Point& point) const;
510
[email protected]ce6689f2013-03-29 12:52:55511 // Check whether the WebWidget has any touch event handlers registered.
512 virtual void hasTouchEventHandlers(bool has_handlers);
513
[email protected]ed7defa2013-03-12 21:29:59514 // Creates a 3D context associated with this view.
[email protected]0634cdd42013-08-16 00:46:09515 scoped_ptr<WebGraphicsContext3DCommandBufferImpl> CreateGraphicsContext3D(
[email protected]ed7defa2013-03-12 21:29:59516 const WebKit::WebGraphicsContext3D::Attributes& attributes);
517
[email protected]51a49502013-03-23 01:50:19518 bool OnSnapshotHelper(const gfx::Rect& src_subrect, SkBitmap* bitmap);
519
initial.commit09911bf2008-07-26 23:55:29520 // Routing ID that allows us to communicate to the parent browser process
521 // RenderWidgetHost. When MSG_ROUTING_NONE, no messages may be sent.
522 int32 routing_id_;
523
[email protected]9f4f3322012-01-18 22:29:56524 int32 surface_id_;
525
[email protected]c5b3b5e2009-02-13 06:41:11526 // We are responsible for destroying this object via its Close method.
[email protected]4873c7d2009-07-16 06:36:28527 WebKit::WebWidget* webwidget_;
initial.commit09911bf2008-07-26 23:55:29528
[email protected]8926c602013-01-23 05:32:06529 // This is lazily constructed and must not outlive webwidget_.
[email protected]ba91a792013-02-06 09:48:28530 scoped_ptr<RenderWidgetCompositor> compositor_;
[email protected]8926c602013-01-23 05:32:06531
initial.commit09911bf2008-07-26 23:55:29532 // Set to the ID of the view that initiated creating this view, if any. When
533 // the view was initiated by the browser (the common case), this will be
534 // MSG_ROUTING_NONE. This is used in determining ownership when opening
535 // child tabs. See RenderWidget::createWebViewWithRequest.
536 //
537 // This ID may refer to an invalid view if that view is closed before this
538 // view is.
539 int32 opener_id_;
540
541 // The position where this view should be initially shown.
542 gfx::Rect initial_pos_;
543
[email protected]fc4404d2012-11-07 19:53:30544 bool init_complete_;
initial.commit09911bf2008-07-26 23:55:29545
546 // We store the current cursor object so we can avoid spamming SetCursor
547 // messages.
548 WebCursor current_cursor_;
[email protected]88efb7ec2009-07-14 16:32:59549
initial.commit09911bf2008-07-26 23:55:29550 // The size of the RenderWidget.
551 gfx::Size size_;
552
[email protected]b4d08452010-10-05 17:34:35553 // The TransportDIB that is being used to transfer an image to the browser.
554 TransportDIB* current_paint_buf_;
initial.commit09911bf2008-07-26 23:55:29555
[email protected]552e6002009-11-19 05:24:57556 PaintAggregator paint_aggregator_;
initial.commit09911bf2008-07-26 23:55:29557
[email protected]60d47ac2013-03-01 23:42:44558 // The size of the view's backing surface in non-DPI-adjusted pixels.
559 gfx::Size physical_backing_size_;
560
[email protected]d9083762013-03-24 01:36:40561 // The height of the physical backing surface that is overdrawn opaquely in
562 // the browser, for example by an on-screen-keyboard (in DPI-adjusted pixels).
563 float overdraw_bottom_height_;
564
[email protected]f21c613a2009-02-12 14:46:17565 // The area that must be reserved for drawing the resize corner.
566 gfx::Rect resizer_rect_;
567
[email protected]53d3f302009-12-21 04:42:05568 // Flags for the next ViewHostMsg_UpdateRect message.
initial.commit09911bf2008-07-26 23:55:29569 int next_paint_flags_;
570
[email protected]872ae5b2011-05-26 20:20:50571 // Filtered time per frame based on UpdateRect messages.
572 float filtered_time_per_frame_;
573
[email protected]53d3f302009-12-21 04:42:05574 // True if we are expecting an UpdateRect_ACK message (i.e., that a
575 // UpdateRect message has been sent).
576 bool update_reply_pending_;
initial.commit09911bf2008-07-26 23:55:29577
[email protected]847a2582013-03-09 02:29:51578 // Whether the WebWidget is in auto resize mode, which is used for example
579 // by extension popups.
580 bool auto_resize_mode_;
581
[email protected]ea3ee0a2012-05-15 03:43:09582 // True if we need to send an UpdateRect message to notify the browser about
583 // an already-completed auto-resize.
584 bool need_update_rect_for_auto_resize_;
585
[email protected]65225772011-05-12 21:10:24586 // True if the underlying graphics context supports asynchronous swap.
587 // Cached on the RenderWidget because determining support is costly.
588 bool using_asynchronous_swapbuffers_;
589
590 // Number of OnSwapBuffersComplete we are expecting. Incremented each time
591 // WebWidget::composite has been been performed when the RenderWidget subclass
592 // SupportsAsynchronousSwapBuffers. Decremented in OnSwapBuffers. Will block
593 // rendering.
594 int num_swapbuffers_complete_pending_;
595
596 // When accelerated rendering is on, is the maximum number of swapbuffers that
597 // can be outstanding before we start throttling based on
598 // OnSwapBuffersComplete callback.
[email protected]82ca9b92011-09-12 23:33:07599 static const int kMaxSwapBuffersPending = 2;
[email protected]65225772011-05-12 21:10:24600
initial.commit09911bf2008-07-26 23:55:29601 // Set to true if we should ignore RenderWidget::Show calls.
602 bool did_show_;
603
604 // Indicates that we shouldn't bother generated paint events.
605 bool is_hidden_;
606
[email protected]ee41e7d22011-10-14 19:34:09607 // Indicates that we are in fullscreen mode.
608 bool is_fullscreen_;
609
initial.commit09911bf2008-07-26 23:55:29610 // Indicates that we should be repainted when restored. This flag is set to
611 // true if we receive an invalidation / scroll event from webkit while our
612 // is_hidden_ flag is set to true. This is used to force a repaint once we
613 // restore to account for the fact that our host would not know about the
614 // invalidation / scroll event(s) from webkit while we are hidden.
615 bool needs_repainting_on_restore_;
616
617 // Indicates whether we have been focused/unfocused by the browser.
618 bool has_focus_;
619
[email protected]5dd768212009-08-13 23:34:49620 // Are we currently handling an input event?
621 bool handling_input_event_;
622
[email protected]e8f775f2013-02-14 21:00:50623 // Are we currently handling an ime event?
624 bool handling_ime_event_;
625
initial.commit09911bf2008-07-26 23:55:29626 // True if we have requested this widget be closed. No more messages will
627 // be sent, except for a Close.
628 bool closing_;
629
[email protected]992db4c2011-05-12 15:37:15630 // Whether this RenderWidget is currently swapped out, such that the view is
631 // being rendered by another process. If all RenderWidgets in a process are
632 // swapped out, the process can exit.
633 bool is_swapped_out_;
634
[email protected]fa7b1dc2010-06-23 17:53:04635 // Indicates if an input method is active in the browser process.
636 bool input_method_is_active_;
initial.commit09911bf2008-07-26 23:55:29637
[email protected]5b739cb2012-08-21 20:35:21638 // Stores information about the current text input.
639 WebKit::WebTextInputInfo text_input_info_;
640
[email protected]fa7b1dc2010-06-23 17:53:04641 // Stores the current text input type of |webwidget_|.
[email protected]ad26ef42011-06-17 07:59:45642 ui::TextInputType text_input_type_;
643
644 // Stores the current type of composition text rendering of |webwidget_|.
645 bool can_compose_inline_;
[email protected]fa7b1dc2010-06-23 17:53:04646
[email protected]b256eca2013-07-11 10:57:40647 // Stores the current text input mode of |webwidget_|.
648 ui::TextInputMode text_input_mode_;
649
[email protected]e99ef6f2011-10-16 01:13:00650 // Stores the current selection bounds.
[email protected]7c8873e2013-02-05 08:03:01651 gfx::Rect selection_focus_rect_;
652 gfx::Rect selection_anchor_rect_;
initial.commit09911bf2008-07-26 23:55:29653
[email protected]58b48a0d2012-06-13 07:01:35654 // Stores the current composition character bounds.
655 std::vector<gfx::Rect> composition_character_bounds_;
656
657 // Stores the current composition range.
658 ui::Range composition_range_;
659
[email protected]3e2b375b2010-04-07 17:03:12660 // The kind of popup this widget represents, NONE if not a popup.
661 WebKit::WebPopupType popup_type_;
[email protected]0ebf3872008-11-07 21:35:03662
initial.commit09911bf2008-07-26 23:55:29663 // Holds all the needed plugin window moves for a scroll.
[email protected]29e2fb42013-07-19 01:13:47664 typedef std::vector<WebPluginGeometry> WebPluginGeometryVector;
[email protected]268654772009-08-06 23:02:04665 WebPluginGeometryVector plugin_window_moves_;
initial.commit09911bf2008-07-26 23:55:29666
[email protected]699ab0d2009-04-23 23:19:14667 // A custom background for the widget.
668 SkBitmap background_;
669
[email protected]80ad8622012-11-07 16:33:03670 // While we are waiting for the browser to update window sizes, we track the
671 // pending size temporarily.
[email protected]2533ce12009-05-09 00:02:24672 int pending_window_rect_count_;
673 WebKit::WebRect pending_window_rect_;
674
[email protected]80ad8622012-11-07 16:33:03675 // The screen rects of the view and the window that contains it.
676 gfx::Rect view_screen_rect_;
677 gfx::Rect window_screen_rect_;
678
[email protected]12fbad812009-09-01 18:21:24679 scoped_ptr<IPC::Message> pending_input_event_ack_;
680
[email protected]b68a0e52011-12-08 15:11:12681 // Indicates if the next sequence of Char events should be suppressed or not.
682 bool suppress_next_char_events_;
683
[email protected]a79d8a632010-11-18 22:35:56684 // Set to true if painting to the window is handled by the accelerated
685 // compositor.
686 bool is_accelerated_compositing_active_;
[email protected]edbcde932010-05-07 17:10:46687
[email protected]350ce8702012-03-09 04:23:38688 base::OneShotTimer<RenderWidget> animation_timer_;
[email protected]5f8b1022011-01-21 23:34:50689 base::Time animation_floor_time_;
690 bool animation_update_pending_;
[email protected]65225772011-05-12 21:10:24691 bool invalidation_task_posted_;
[email protected]5f8b1022011-01-21 23:34:50692
[email protected]bd37ae252011-06-03 01:28:18693 bool has_disable_gpu_vsync_switch_;
[email protected]0fb93f52011-05-18 23:13:56694 base::TimeTicks last_do_deferred_update_time_;
695
[email protected]b63d58d2012-11-26 22:37:44696 cc::RenderingStats software_stats_;
[email protected]fef5e3972012-08-07 03:59:47697
[email protected]aa4117f2011-12-09 22:19:21698 // UpdateRect parameters for the current compositing pass. This is used to
699 // pass state between DoDeferredUpdate and OnSwapBuffersPosted.
700 scoped_ptr<ViewHostMsg_UpdateRect_Params> pending_update_params_;
701
702 // Queue of UpdateRect messages corresponding to a SwapBuffers. We want to
703 // delay sending of UpdateRect until the corresponding SwapBuffers has been
704 // executed. Since we can have several in flight, we need to keep them in a
705 // queue. Note: some SwapBuffers may not correspond to an update, in which
706 // case NULL is added to the queue.
707 std::deque<ViewHostMsg_UpdateRect*> updates_pending_swap_;
708
[email protected]842f10652012-06-06 01:54:04709 // Properties of the screen hosting this RenderWidget instance.
710 WebKit::WebScreenInfo screen_info_;
711
[email protected]f1cccb32012-06-06 18:29:59712 // The device scale factor. This value is computed from the DPI entries in
713 // |screen_info_| on some platforms, and defaults to 1 on other platforms.
[email protected]faec7b12012-06-19 14:42:13714 float device_scale_factor_;
[email protected]f1cccb32012-06-06 18:29:59715
[email protected]0e241b4b2012-08-18 09:06:27716 // State associated with the BeginSmoothScroll synthetic scrolling function.
[email protected]4a9dba42013-04-29 18:24:22717 SmoothScrollCompletionCallback pending_smooth_scroll_gesture_;
[email protected]0e241b4b2012-08-18 09:06:27718
[email protected]cb6430932012-10-31 00:53:36719 // Specified whether the compositor will run in its own thread.
720 bool is_threaded_compositing_enabled_;
721
[email protected]3639aa82013-06-04 11:00:04722 // The last set of rendering stats received from the browser. This is only
723 // received when using the --enable-gpu-benchmarking flag.
724 BrowserRenderingStats browser_rendering_stats_;
725
[email protected]256737c2013-06-08 04:39:10726 // The latency information for any current non-accelerated-compositing
727 // frame.
728 ui::LatencyInfo latency_info_;
729
[email protected]53b4cc12013-07-18 23:02:30730 uint32 next_output_surface_id_;
731
[email protected]0d1ebed12013-08-05 22:01:13732#if defined(OS_ANDROID)
733 // A counter for number of outstanding messages from the renderer to the
734 // browser regarding IME-type events that have not been acknowledged by the
735 // browser. If this value is not 0 IME events will be dropped.
736 int outstanding_ime_acks_;
737#endif
738
[email protected]ed7defa2013-03-12 21:29:59739 base::WeakPtrFactory<RenderWidget> weak_ptr_factory_;
740
[email protected]05d478752009-04-08 23:38:16741 DISALLOW_COPY_AND_ASSIGN(RenderWidget);
initial.commit09911bf2008-07-26 23:55:29742};
743
[email protected]e9ff79c2012-10-19 21:31:26744} // namespace content
745
[email protected]2cff0052011-03-18 16:51:44746#endif // CONTENT_RENDERER_RENDER_WIDGET_H_