OLD | NEW |
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 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 | 2 // Use of this source code is governed by a BSD-style license that can be |
3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
4 | 4 |
5 #ifndef CONTENT_RENDERER_RENDER_WIDGET_H_ | 5 #ifndef CONTENT_RENDERER_RENDER_WIDGET_H_ |
6 #define CONTENT_RENDERER_RENDER_WIDGET_H_ | 6 #define CONTENT_RENDERER_RENDER_WIDGET_H_ |
7 | 7 |
8 #include <deque> | 8 #include <deque> |
9 #include <map> | 9 #include <map> |
10 | 10 |
(...skipping 30 matching lines...) Expand all Loading... |
41 #include "webkit/common/cursors/webcursor.h" | 41 #include "webkit/common/cursors/webcursor.h" |
42 | 42 |
43 struct ViewHostMsg_UpdateRect_Params; | 43 struct ViewHostMsg_UpdateRect_Params; |
44 struct ViewMsg_Resize_Params; | 44 struct ViewMsg_Resize_Params; |
45 class ViewHostMsg_UpdateRect; | 45 class ViewHostMsg_UpdateRect; |
46 | 46 |
47 namespace IPC { | 47 namespace IPC { |
48 class SyncMessage; | 48 class SyncMessage; |
49 } | 49 } |
50 | 50 |
51 namespace WebKit { | 51 namespace blink { |
52 class WebGestureEvent; | 52 class WebGestureEvent; |
53 class WebInputEvent; | 53 class WebInputEvent; |
54 class WebKeyboardEvent; | 54 class WebKeyboardEvent; |
55 class WebMouseEvent; | 55 class WebMouseEvent; |
56 class WebTouchEvent; | 56 class WebTouchEvent; |
57 struct WebRenderingStatsImpl; | 57 struct WebRenderingStatsImpl; |
58 } | 58 } |
59 | 59 |
60 namespace cc { class OutputSurface; } | 60 namespace cc { class OutputSurface; } |
61 | 61 |
62 namespace gfx { | 62 namespace gfx { |
63 class Range; | 63 class Range; |
64 } | 64 } |
65 | 65 |
66 namespace content { | 66 namespace content { |
67 class ExternalPopupMenu; | 67 class ExternalPopupMenu; |
68 class PepperPluginInstanceImpl; | 68 class PepperPluginInstanceImpl; |
69 class RenderWidgetCompositor; | 69 class RenderWidgetCompositor; |
70 class RenderWidgetTest; | 70 class RenderWidgetTest; |
71 class ResizingModeSelector; | 71 class ResizingModeSelector; |
72 struct ContextMenuParams; | 72 struct ContextMenuParams; |
73 struct GpuRenderingStats; | 73 struct GpuRenderingStats; |
74 struct WebPluginGeometry; | 74 struct WebPluginGeometry; |
75 | 75 |
76 // RenderWidget provides a communication bridge between a WebWidget and | 76 // RenderWidget provides a communication bridge between a WebWidget and |
77 // a RenderWidgetHost, the latter of which lives in a different process. | 77 // a RenderWidgetHost, the latter of which lives in a different process. |
78 class CONTENT_EXPORT RenderWidget | 78 class CONTENT_EXPORT RenderWidget |
79 : public IPC::Listener, | 79 : public IPC::Listener, |
80 public IPC::Sender, | 80 public IPC::Sender, |
81 NON_EXPORTED_BASE(virtual public WebKit::WebWidgetClient), | 81 NON_EXPORTED_BASE(virtual public blink::WebWidgetClient), |
82 NON_EXPORTED_BASE(public WebGraphicsContext3DSwapBuffersClient), | 82 NON_EXPORTED_BASE(public WebGraphicsContext3DSwapBuffersClient), |
83 public base::RefCounted<RenderWidget> { | 83 public base::RefCounted<RenderWidget> { |
84 public: | 84 public: |
85 // Creates a new RenderWidget. The opener_id is the routing ID of the | 85 // Creates a new RenderWidget. The opener_id is the routing ID of the |
86 // RenderView that this widget lives inside. | 86 // RenderView that this widget lives inside. |
87 static RenderWidget* Create(int32 opener_id, | 87 static RenderWidget* Create(int32 opener_id, |
88 WebKit::WebPopupType popup_type, | 88 blink::WebPopupType popup_type, |
89 const WebKit::WebScreenInfo& screen_info); | 89 const blink::WebScreenInfo& screen_info); |
90 | 90 |
91 // Creates a WebWidget based on the popup type. | 91 // Creates a WebWidget based on the popup type. |
92 static WebKit::WebWidget* CreateWebWidget(RenderWidget* render_widget); | 92 static blink::WebWidget* CreateWebWidget(RenderWidget* render_widget); |
93 | 93 |
94 // The compositing surface assigned by the RenderWidgetHost | 94 // The compositing surface assigned by the RenderWidgetHost |
95 // (or RenderViewHost). Will be gfx::kNullPluginWindow if not assigned yet, | 95 // (or RenderViewHost). Will be gfx::kNullPluginWindow if not assigned yet, |
96 // in which case we should not create any GPU command buffers with it. | 96 // in which case we should not create any GPU command buffers with it. |
97 // The routing ID assigned by the RenderProcess. Will be MSG_ROUTING_NONE if | 97 // The routing ID assigned by the RenderProcess. Will be MSG_ROUTING_NONE if |
98 // not yet assigned a view ID, in which case, the process MUST NOT send | 98 // not yet assigned a view ID, in which case, the process MUST NOT send |
99 // messages with this ID to the parent. | 99 // messages with this ID to the parent. |
100 int32 routing_id() const { | 100 int32 routing_id() const { |
101 return routing_id_; | 101 return routing_id_; |
102 } | 102 } |
103 | 103 |
104 int32 surface_id() const { | 104 int32 surface_id() const { |
105 return surface_id_; | 105 return surface_id_; |
106 } | 106 } |
107 | 107 |
108 // May return NULL when the window is closing. | 108 // May return NULL when the window is closing. |
109 WebKit::WebWidget* webwidget() const { return webwidget_; } | 109 blink::WebWidget* webwidget() const { return webwidget_; } |
110 | 110 |
111 gfx::Size size() const { return size_; } | 111 gfx::Size size() const { return size_; } |
112 bool has_focus() const { return has_focus_; } | 112 bool has_focus() const { return has_focus_; } |
113 bool is_fullscreen() const { return is_fullscreen_; } | 113 bool is_fullscreen() const { return is_fullscreen_; } |
114 bool is_hidden() const { return is_hidden_; } | 114 bool is_hidden() const { return is_hidden_; } |
115 | 115 |
116 // IPC::Listener | 116 // IPC::Listener |
117 virtual bool OnMessageReceived(const IPC::Message& msg) OVERRIDE; | 117 virtual bool OnMessageReceived(const IPC::Message& msg) OVERRIDE; |
118 | 118 |
119 // IPC::Sender | 119 // IPC::Sender |
120 virtual bool Send(IPC::Message* msg) OVERRIDE; | 120 virtual bool Send(IPC::Message* msg) OVERRIDE; |
121 | 121 |
122 // WebKit::WebWidgetClient | 122 // blink::WebWidgetClient |
123 virtual void suppressCompositorScheduling(bool enable); | 123 virtual void suppressCompositorScheduling(bool enable); |
124 virtual void willBeginCompositorFrame(); | 124 virtual void willBeginCompositorFrame(); |
125 virtual void didInvalidateRect(const WebKit::WebRect&); | 125 virtual void didInvalidateRect(const blink::WebRect&); |
126 virtual void didScrollRect(int dx, int dy, | 126 virtual void didScrollRect(int dx, int dy, |
127 const WebKit::WebRect& clipRect); | 127 const blink::WebRect& clipRect); |
128 virtual void didAutoResize(const WebKit::WebSize& new_size); | 128 virtual void didAutoResize(const blink::WebSize& new_size); |
129 virtual void didActivateCompositor(int input_handler_identifier); | 129 virtual void didActivateCompositor(int input_handler_identifier); |
130 virtual void didDeactivateCompositor(); | 130 virtual void didDeactivateCompositor(); |
131 virtual void initializeLayerTreeView(); | 131 virtual void initializeLayerTreeView(); |
132 virtual WebKit::WebLayerTreeView* layerTreeView(); | 132 virtual blink::WebLayerTreeView* layerTreeView(); |
133 virtual void didBecomeReadyForAdditionalInput(); | 133 virtual void didBecomeReadyForAdditionalInput(); |
134 virtual void didCommitAndDrawCompositorFrame(); | 134 virtual void didCommitAndDrawCompositorFrame(); |
135 virtual void didCompleteSwapBuffers(); | 135 virtual void didCompleteSwapBuffers(); |
136 virtual void scheduleComposite(); | 136 virtual void scheduleComposite(); |
137 virtual void scheduleAnimation(); | 137 virtual void scheduleAnimation(); |
138 virtual void didFocus(); | 138 virtual void didFocus(); |
139 virtual void didBlur(); | 139 virtual void didBlur(); |
140 virtual void didChangeCursor(const WebKit::WebCursorInfo&); | 140 virtual void didChangeCursor(const blink::WebCursorInfo&); |
141 virtual void closeWidgetSoon(); | 141 virtual void closeWidgetSoon(); |
142 virtual void show(WebKit::WebNavigationPolicy); | 142 virtual void show(blink::WebNavigationPolicy); |
143 virtual void runModal() {} | 143 virtual void runModal() {} |
144 virtual WebKit::WebRect windowRect(); | 144 virtual blink::WebRect windowRect(); |
145 virtual void setToolTipText(const WebKit::WebString& text, | 145 virtual void setToolTipText(const blink::WebString& text, |
146 WebKit::WebTextDirection hint); | 146 blink::WebTextDirection hint); |
147 virtual void setWindowRect(const WebKit::WebRect&); | 147 virtual void setWindowRect(const blink::WebRect&); |
148 virtual WebKit::WebRect windowResizerRect(); | 148 virtual blink::WebRect windowResizerRect(); |
149 virtual WebKit::WebRect rootWindowRect(); | 149 virtual blink::WebRect rootWindowRect(); |
150 virtual WebKit::WebScreenInfo screenInfo(); | 150 virtual blink::WebScreenInfo screenInfo(); |
151 virtual float deviceScaleFactor(); | 151 virtual float deviceScaleFactor(); |
152 virtual void resetInputMethod(); | 152 virtual void resetInputMethod(); |
153 virtual void didHandleGestureEvent(const WebKit::WebGestureEvent& event, | 153 virtual void didHandleGestureEvent(const blink::WebGestureEvent& event, |
154 bool event_cancelled); | 154 bool event_cancelled); |
155 | 155 |
156 // Called when a plugin is moved. These events are queued up and sent with | 156 // Called when a plugin is moved. These events are queued up and sent with |
157 // the next paint or scroll message to the host. | 157 // the next paint or scroll message to the host. |
158 void SchedulePluginMove(const WebPluginGeometry& move); | 158 void SchedulePluginMove(const WebPluginGeometry& move); |
159 | 159 |
160 // Called when a plugin window has been destroyed, to make sure the currently | 160 // Called when a plugin window has been destroyed, to make sure the currently |
161 // pending moves don't try to reference it. | 161 // pending moves don't try to reference it. |
162 void CleanupWindowInPluginMoves(gfx::PluginWindowHandle window); | 162 void CleanupWindowInPluginMoves(gfx::PluginWindowHandle window); |
163 | 163 |
164 // Fills in a WebRenderingStatsImpl struct containing information about | 164 // Fills in a WebRenderingStatsImpl struct containing information about |
165 // rendering, e.g. count of frames rendered, time spent painting. | 165 // rendering, e.g. count of frames rendered, time spent painting. |
166 void GetRenderingStats(WebKit::WebRenderingStatsImpl&) const; | 166 void GetRenderingStats(blink::WebRenderingStatsImpl&) const; |
167 | 167 |
168 // Fills in a GpuRenderingStats struct containing information about | 168 // Fills in a GpuRenderingStats struct containing information about |
169 // GPU rendering, e.g. count of texture uploads performed, time spent | 169 // GPU rendering, e.g. count of texture uploads performed, time spent |
170 // uploading. | 170 // uploading. |
171 // This call is relatively expensive as it blocks on the GPU process | 171 // This call is relatively expensive as it blocks on the GPU process |
172 bool GetGpuRenderingStats(GpuRenderingStats*) const; | 172 bool GetGpuRenderingStats(GpuRenderingStats*) const; |
173 | 173 |
174 void GetBrowserRenderingStats(BrowserRenderingStats* stats); | 174 void GetBrowserRenderingStats(BrowserRenderingStats* stats); |
175 | 175 |
176 RenderWidgetCompositor* compositor() const; | 176 RenderWidgetCompositor* compositor() const; |
(...skipping 70 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
247 // without ref-counting is an error. | 247 // without ref-counting is an error. |
248 friend class base::RefCounted<RenderWidget>; | 248 friend class base::RefCounted<RenderWidget>; |
249 // For unit tests. | 249 // For unit tests. |
250 friend class RenderWidgetTest; | 250 friend class RenderWidgetTest; |
251 | 251 |
252 enum ResizeAck { | 252 enum ResizeAck { |
253 SEND_RESIZE_ACK, | 253 SEND_RESIZE_ACK, |
254 NO_RESIZE_ACK, | 254 NO_RESIZE_ACK, |
255 }; | 255 }; |
256 | 256 |
257 RenderWidget(WebKit::WebPopupType popup_type, | 257 RenderWidget(blink::WebPopupType popup_type, |
258 const WebKit::WebScreenInfo& screen_info, | 258 const blink::WebScreenInfo& screen_info, |
259 bool swapped_out, | 259 bool swapped_out, |
260 bool hidden); | 260 bool hidden); |
261 | 261 |
262 virtual ~RenderWidget(); | 262 virtual ~RenderWidget(); |
263 | 263 |
264 // Initializes this view with the given opener. CompleteInit must be called | 264 // Initializes this view with the given opener. CompleteInit must be called |
265 // later. | 265 // later. |
266 bool Init(int32 opener_id); | 266 bool Init(int32 opener_id); |
267 | 267 |
268 // Called by Init and subclasses to perform initialization. | 268 // Called by Init and subclasses to perform initialization. |
269 bool DoInit(int32 opener_id, | 269 bool DoInit(int32 opener_id, |
270 WebKit::WebWidget* web_widget, | 270 blink::WebWidget* web_widget, |
271 IPC::SyncMessage* create_widget_message); | 271 IPC::SyncMessage* create_widget_message); |
272 | 272 |
273 // Finishes creation of a pending view started with Init. | 273 // Finishes creation of a pending view started with Init. |
274 void CompleteInit(); | 274 void CompleteInit(); |
275 | 275 |
276 // Sets whether this RenderWidget has been swapped out to be displayed by | 276 // Sets whether this RenderWidget has been swapped out to be displayed by |
277 // a RenderWidget in a different process. If so, no new IPC messages will be | 277 // a RenderWidget in a different process. If so, no new IPC messages will be |
278 // sent (only ACKs) and the process is free to exit when there are no other | 278 // sent (only ACKs) and the process is free to exit when there are no other |
279 // active RenderWidgets. | 279 // active RenderWidgets. |
280 void SetSwappedOut(bool is_swapped_out); | 280 void SetSwappedOut(bool is_swapped_out); |
281 | 281 |
282 // Paints the given rectangular region of the WebWidget into canvas (a | 282 // Paints the given rectangular region of the WebWidget into canvas (a |
283 // shared memory segment returned by AllocPaintBuf on Windows). The caller | 283 // shared memory segment returned by AllocPaintBuf on Windows). The caller |
284 // must ensure that the given rect fits within the bounds of the WebWidget. | 284 // must ensure that the given rect fits within the bounds of the WebWidget. |
285 void PaintRect(const gfx::Rect& rect, const gfx::Point& canvas_origin, | 285 void PaintRect(const gfx::Rect& rect, const gfx::Point& canvas_origin, |
286 SkCanvas* canvas); | 286 SkCanvas* canvas); |
287 | 287 |
288 // Paints a border at the given rect for debugging purposes. | 288 // Paints a border at the given rect for debugging purposes. |
289 void PaintDebugBorder(const gfx::Rect& rect, SkCanvas* canvas); | 289 void PaintDebugBorder(const gfx::Rect& rect, SkCanvas* canvas); |
290 | 290 |
291 bool IsRenderingVSynced(); | 291 bool IsRenderingVSynced(); |
292 void AnimationCallback(); | 292 void AnimationCallback(); |
293 void AnimateIfNeeded(); | 293 void AnimateIfNeeded(); |
294 void InvalidationCallback(); | 294 void InvalidationCallback(); |
295 void FlushPendingInputEventAck(); | 295 void FlushPendingInputEventAck(); |
296 void DoDeferredUpdateAndSendInputAck(); | 296 void DoDeferredUpdateAndSendInputAck(); |
297 void DoDeferredUpdate(); | 297 void DoDeferredUpdate(); |
298 void DoDeferredClose(); | 298 void DoDeferredClose(); |
299 void DoDeferredSetWindowRect(const WebKit::WebRect& pos); | 299 void DoDeferredSetWindowRect(const blink::WebRect& pos); |
300 virtual void Composite(base::TimeTicks frame_begin_time); | 300 virtual void Composite(base::TimeTicks frame_begin_time); |
301 | 301 |
302 // Set the background of the render widget to a bitmap. The bitmap will be | 302 // Set the background of the render widget to a bitmap. The bitmap will be |
303 // tiled in both directions if it isn't big enough to fill the area. This is | 303 // tiled in both directions if it isn't big enough to fill the area. This is |
304 // mainly intended to be used in conjuction with WebView::SetIsTransparent(). | 304 // mainly intended to be used in conjuction with WebView::SetIsTransparent(). |
305 virtual void SetBackground(const SkBitmap& bitmap); | 305 virtual void SetBackground(const SkBitmap& bitmap); |
306 | 306 |
307 // Resizes the render widget. | 307 // Resizes the render widget. |
308 void Resize(const gfx::Size& new_size, | 308 void Resize(const gfx::Size& new_size, |
309 const gfx::Size& physical_backing_size, | 309 const gfx::Size& physical_backing_size, |
310 float overdraw_bottom_height, | 310 float overdraw_bottom_height, |
311 const gfx::Rect& resizer_rect, | 311 const gfx::Rect& resizer_rect, |
312 bool is_fullscreen, | 312 bool is_fullscreen, |
313 ResizeAck resize_ack); | 313 ResizeAck resize_ack); |
314 // Used to force the size of a window when running layout tests. | 314 // Used to force the size of a window when running layout tests. |
315 void ResizeSynchronously(const gfx::Rect& new_position); | 315 void ResizeSynchronously(const gfx::Rect& new_position); |
316 virtual void SetScreenMetricsEmulationParameters( | 316 virtual void SetScreenMetricsEmulationParameters( |
317 float device_scale_factor, float root_layer_scale); | 317 float device_scale_factor, float root_layer_scale); |
318 void SetExternalPopupOriginAdjustmentsForEmulation( | 318 void SetExternalPopupOriginAdjustmentsForEmulation( |
319 ExternalPopupMenu* popup, ScreenMetricsEmulator* emulator); | 319 ExternalPopupMenu* popup, ScreenMetricsEmulator* emulator); |
320 virtual void OnShowHostContextMenu(ContextMenuParams* params); | 320 virtual void OnShowHostContextMenu(ContextMenuParams* params); |
321 | 321 |
322 // RenderWidget IPC message handlers | 322 // RenderWidget IPC message handlers |
323 void OnHandleInputEvent(const WebKit::WebInputEvent* event, | 323 void OnHandleInputEvent(const blink::WebInputEvent* event, |
324 const ui::LatencyInfo& latency_info, | 324 const ui::LatencyInfo& latency_info, |
325 bool keyboard_shortcut); | 325 bool keyboard_shortcut); |
326 void OnCursorVisibilityChange(bool is_visible); | 326 void OnCursorVisibilityChange(bool is_visible); |
327 void OnMouseCaptureLost(); | 327 void OnMouseCaptureLost(); |
328 virtual void OnSetFocus(bool enable); | 328 virtual void OnSetFocus(bool enable); |
329 void OnClose(); | 329 void OnClose(); |
330 void OnCreatingNewAck(); | 330 void OnCreatingNewAck(); |
331 virtual void OnResize(const ViewMsg_Resize_Params& params); | 331 virtual void OnResize(const ViewMsg_Resize_Params& params); |
332 void OnChangeResizeRect(const gfx::Rect& resizer_rect); | 332 void OnChangeResizeRect(const gfx::Rect& resizer_rect); |
333 virtual void OnWasHidden(); | 333 virtual void OnWasHidden(); |
334 virtual void OnWasShown(bool needs_repainting); | 334 virtual void OnWasShown(bool needs_repainting); |
335 virtual void OnWasSwappedOut(); | 335 virtual void OnWasSwappedOut(); |
336 void OnUpdateRectAck(); | 336 void OnUpdateRectAck(); |
337 void OnCreateVideoAck(int32 video_id); | 337 void OnCreateVideoAck(int32 video_id); |
338 void OnUpdateVideoAck(int32 video_id); | 338 void OnUpdateVideoAck(int32 video_id); |
339 void OnRequestMoveAck(); | 339 void OnRequestMoveAck(); |
340 void OnSetInputMethodActive(bool is_active); | 340 void OnSetInputMethodActive(bool is_active); |
341 virtual void OnImeSetComposition( | 341 virtual void OnImeSetComposition( |
342 const string16& text, | 342 const string16& text, |
343 const std::vector<WebKit::WebCompositionUnderline>& underlines, | 343 const std::vector<blink::WebCompositionUnderline>& underlines, |
344 int selection_start, | 344 int selection_start, |
345 int selection_end); | 345 int selection_end); |
346 virtual void OnImeConfirmComposition(const string16& text, | 346 virtual void OnImeConfirmComposition(const string16& text, |
347 const gfx::Range& replacement_range, | 347 const gfx::Range& replacement_range, |
348 bool keep_selection); | 348 bool keep_selection); |
349 void OnPaintAtSize(const TransportDIB::Handle& dib_id, | 349 void OnPaintAtSize(const TransportDIB::Handle& dib_id, |
350 int tag, | 350 int tag, |
351 const gfx::Size& page_size, | 351 const gfx::Size& page_size, |
352 const gfx::Size& desired_size); | 352 const gfx::Size& desired_size); |
353 void OnRepaint(gfx::Size size_to_paint); | 353 void OnRepaint(gfx::Size size_to_paint); |
354 void OnSyntheticGestureCompleted(); | 354 void OnSyntheticGestureCompleted(); |
355 void OnSetTextDirection(WebKit::WebTextDirection direction); | 355 void OnSetTextDirection(blink::WebTextDirection direction); |
356 void OnGetFPS(); | 356 void OnGetFPS(); |
357 void OnUpdateScreenRects(const gfx::Rect& view_screen_rect, | 357 void OnUpdateScreenRects(const gfx::Rect& view_screen_rect, |
358 const gfx::Rect& window_screen_rect); | 358 const gfx::Rect& window_screen_rect); |
359 #if defined(OS_ANDROID) | 359 #if defined(OS_ANDROID) |
360 void OnShowImeIfNeeded(); | 360 void OnShowImeIfNeeded(); |
361 | 361 |
362 // Whenever an IME event that needs an acknowledgement is sent to the browser, | 362 // Whenever an IME event that needs an acknowledgement is sent to the browser, |
363 // the number of outstanding IME events that needs acknowledgement should be | 363 // the number of outstanding IME events that needs acknowledgement should be |
364 // incremented. All IME events will be dropped until we receive an ack from | 364 // incremented. All IME events will be dropped until we receive an ack from |
365 // the browser. | 365 // the browser. |
(...skipping 93 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
459 | 459 |
460 // Checks if the selection bounds have been changed. If they are changed, | 460 // Checks if the selection bounds have been changed. If they are changed, |
461 // the new value will be sent to the browser process. | 461 // the new value will be sent to the browser process. |
462 virtual void UpdateSelectionBounds(); | 462 virtual void UpdateSelectionBounds(); |
463 | 463 |
464 // Override point to obtain that the current input method state and caret | 464 // Override point to obtain that the current input method state and caret |
465 // position. | 465 // position. |
466 virtual ui::TextInputType GetTextInputType(); | 466 virtual ui::TextInputType GetTextInputType(); |
467 virtual void GetSelectionBounds(gfx::Rect* start, gfx::Rect* end); | 467 virtual void GetSelectionBounds(gfx::Rect* start, gfx::Rect* end); |
468 virtual ui::TextInputType WebKitToUiTextInputType( | 468 virtual ui::TextInputType WebKitToUiTextInputType( |
469 WebKit::WebTextInputType type); | 469 blink::WebTextInputType type); |
470 | 470 |
471 #if defined(OS_MACOSX) || defined(OS_WIN) || defined(USE_AURA) | 471 #if defined(OS_MACOSX) || defined(OS_WIN) || defined(USE_AURA) |
472 // Checks if the composition range or composition character bounds have been | 472 // Checks if the composition range or composition character bounds have been |
473 // changed. If they are changed, the new value will be sent to the browser | 473 // changed. If they are changed, the new value will be sent to the browser |
474 // process. | 474 // process. |
475 void UpdateCompositionInfo(bool should_update_range); | 475 void UpdateCompositionInfo(bool should_update_range); |
476 | 476 |
477 // Override point to obtain that the current composition character bounds. | 477 // Override point to obtain that the current composition character bounds. |
478 // In the case of surrogate pairs, the character is treated as two characters: | 478 // In the case of surrogate pairs, the character is treated as two characters: |
479 // the bounds for first character is actual one, and the bounds for second | 479 // the bounds for first character is actual one, and the bounds for second |
(...skipping 19 matching lines...) Expand all Loading... |
499 // Tells the renderer it does not have focus. Used to prevent us from getting | 499 // Tells the renderer it does not have focus. Used to prevent us from getting |
500 // the focus on our own when the browser did not focus us. | 500 // the focus on our own when the browser did not focus us. |
501 void ClearFocus(); | 501 void ClearFocus(); |
502 | 502 |
503 // Set the pending window rect. | 503 // Set the pending window rect. |
504 // Because the real render_widget is hosted in another process, there is | 504 // Because the real render_widget is hosted in another process, there is |
505 // a time period where we may have set a new window rect which has not yet | 505 // a time period where we may have set a new window rect which has not yet |
506 // been processed by the browser. So we maintain a pending window rect | 506 // been processed by the browser. So we maintain a pending window rect |
507 // size. If JS code sets the WindowRect, and then immediately calls | 507 // size. If JS code sets the WindowRect, and then immediately calls |
508 // GetWindowRect() we'll use this pending window rect as the size. | 508 // GetWindowRect() we'll use this pending window rect as the size. |
509 void SetPendingWindowRect(const WebKit::WebRect& r); | 509 void SetPendingWindowRect(const blink::WebRect& r); |
510 | 510 |
511 // Called by OnHandleInputEvent() to notify subclasses that a key event was | 511 // Called by OnHandleInputEvent() to notify subclasses that a key event was |
512 // just handled. | 512 // just handled. |
513 virtual void DidHandleKeyEvent() {} | 513 virtual void DidHandleKeyEvent() {} |
514 | 514 |
515 // Called by OnHandleInputEvent() to notify subclasses that a mouse event is | 515 // Called by OnHandleInputEvent() to notify subclasses that a mouse event is |
516 // about to be handled. | 516 // about to be handled. |
517 // Returns true if no further handling is needed. In that case, the event | 517 // Returns true if no further handling is needed. In that case, the event |
518 // won't be sent to WebKit or trigger DidHandleMouseEvent(). | 518 // won't be sent to WebKit or trigger DidHandleMouseEvent(). |
519 virtual bool WillHandleMouseEvent(const WebKit::WebMouseEvent& event); | 519 virtual bool WillHandleMouseEvent(const blink::WebMouseEvent& event); |
520 | 520 |
521 // Called by OnHandleInputEvent() to notify subclasses that a key event is | 521 // Called by OnHandleInputEvent() to notify subclasses that a key event is |
522 // about to be handled. | 522 // about to be handled. |
523 // Returns true if no further handling is needed. In that case, the event | 523 // Returns true if no further handling is needed. In that case, the event |
524 // won't be sent to WebKit or trigger DidHandleKeyEvent(). | 524 // won't be sent to WebKit or trigger DidHandleKeyEvent(). |
525 virtual bool WillHandleKeyEvent(const WebKit::WebKeyboardEvent& event); | 525 virtual bool WillHandleKeyEvent(const blink::WebKeyboardEvent& event); |
526 | 526 |
527 // Called by OnHandleInputEvent() to notify subclasses that a gesture event is | 527 // Called by OnHandleInputEvent() to notify subclasses that a gesture event is |
528 // about to be handled. | 528 // about to be handled. |
529 // Returns true if no further handling is needed. In that case, the event | 529 // Returns true if no further handling is needed. In that case, the event |
530 // won't be sent to WebKit. | 530 // won't be sent to WebKit. |
531 virtual bool WillHandleGestureEvent(const WebKit::WebGestureEvent& event); | 531 virtual bool WillHandleGestureEvent(const blink::WebGestureEvent& event); |
532 | 532 |
533 // Called by OnHandleInputEvent() to notify subclasses that a mouse event was | 533 // Called by OnHandleInputEvent() to notify subclasses that a mouse event was |
534 // just handled. | 534 // just handled. |
535 virtual void DidHandleMouseEvent(const WebKit::WebMouseEvent& event) {} | 535 virtual void DidHandleMouseEvent(const blink::WebMouseEvent& event) {} |
536 | 536 |
537 // Called by OnHandleInputEvent() to notify subclasses that a touch event was | 537 // Called by OnHandleInputEvent() to notify subclasses that a touch event was |
538 // just handled. | 538 // just handled. |
539 virtual void DidHandleTouchEvent(const WebKit::WebTouchEvent& event) {} | 539 virtual void DidHandleTouchEvent(const blink::WebTouchEvent& event) {} |
540 | 540 |
541 // Check whether the WebWidget has any touch event handlers registered | 541 // Check whether the WebWidget has any touch event handlers registered |
542 // at the given point. | 542 // at the given point. |
543 virtual bool HasTouchEventHandlersAt(const gfx::Point& point) const; | 543 virtual bool HasTouchEventHandlersAt(const gfx::Point& point) const; |
544 | 544 |
545 // Check whether the WebWidget has any touch event handlers registered. | 545 // Check whether the WebWidget has any touch event handlers registered. |
546 virtual void hasTouchEventHandlers(bool has_handlers); | 546 virtual void hasTouchEventHandlers(bool has_handlers); |
547 | 547 |
548 // Creates a 3D context associated with this view. | 548 // Creates a 3D context associated with this view. |
549 scoped_ptr<WebGraphicsContext3DCommandBufferImpl> CreateGraphicsContext3D( | 549 scoped_ptr<WebGraphicsContext3DCommandBufferImpl> CreateGraphicsContext3D( |
550 const WebKit::WebGraphicsContext3D::Attributes& attributes); | 550 const blink::WebGraphicsContext3D::Attributes& attributes); |
551 | 551 |
552 bool OnSnapshotHelper(const gfx::Rect& src_subrect, SkBitmap* bitmap); | 552 bool OnSnapshotHelper(const gfx::Rect& src_subrect, SkBitmap* bitmap); |
553 | 553 |
554 void ScheduleCompositeImpl(bool force_redraw); | 554 void ScheduleCompositeImpl(bool force_redraw); |
555 | 555 |
556 // Routing ID that allows us to communicate to the parent browser process | 556 // Routing ID that allows us to communicate to the parent browser process |
557 // RenderWidgetHost. When MSG_ROUTING_NONE, no messages may be sent. | 557 // RenderWidgetHost. When MSG_ROUTING_NONE, no messages may be sent. |
558 int32 routing_id_; | 558 int32 routing_id_; |
559 | 559 |
560 int32 surface_id_; | 560 int32 surface_id_; |
561 | 561 |
562 // We are responsible for destroying this object via its Close method. | 562 // We are responsible for destroying this object via its Close method. |
563 WebKit::WebWidget* webwidget_; | 563 blink::WebWidget* webwidget_; |
564 | 564 |
565 // This is lazily constructed and must not outlive webwidget_. | 565 // This is lazily constructed and must not outlive webwidget_. |
566 scoped_ptr<RenderWidgetCompositor> compositor_; | 566 scoped_ptr<RenderWidgetCompositor> compositor_; |
567 | 567 |
568 // Set to the ID of the view that initiated creating this view, if any. When | 568 // Set to the ID of the view that initiated creating this view, if any. When |
569 // the view was initiated by the browser (the common case), this will be | 569 // the view was initiated by the browser (the common case), this will be |
570 // MSG_ROUTING_NONE. This is used in determining ownership when opening | 570 // MSG_ROUTING_NONE. This is used in determining ownership when opening |
571 // child tabs. See RenderWidget::createWebViewWithRequest. | 571 // child tabs. See RenderWidget::createWebViewWithRequest. |
572 // | 572 // |
573 // This ID may refer to an invalid view if that view is closed before this | 573 // This ID may refer to an invalid view if that view is closed before this |
(...skipping 91 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
665 | 665 |
666 // Whether this RenderWidget is currently swapped out, such that the view is | 666 // Whether this RenderWidget is currently swapped out, such that the view is |
667 // being rendered by another process. If all RenderWidgets in a process are | 667 // being rendered by another process. If all RenderWidgets in a process are |
668 // swapped out, the process can exit. | 668 // swapped out, the process can exit. |
669 bool is_swapped_out_; | 669 bool is_swapped_out_; |
670 | 670 |
671 // Indicates if an input method is active in the browser process. | 671 // Indicates if an input method is active in the browser process. |
672 bool input_method_is_active_; | 672 bool input_method_is_active_; |
673 | 673 |
674 // Stores information about the current text input. | 674 // Stores information about the current text input. |
675 WebKit::WebTextInputInfo text_input_info_; | 675 blink::WebTextInputInfo text_input_info_; |
676 | 676 |
677 // Stores the current text input type of |webwidget_|. | 677 // Stores the current text input type of |webwidget_|. |
678 ui::TextInputType text_input_type_; | 678 ui::TextInputType text_input_type_; |
679 | 679 |
680 // Stores the current text input mode of |webwidget_|. | 680 // Stores the current text input mode of |webwidget_|. |
681 ui::TextInputMode text_input_mode_; | 681 ui::TextInputMode text_input_mode_; |
682 | 682 |
683 // Stores the current type of composition text rendering of |webwidget_|. | 683 // Stores the current type of composition text rendering of |webwidget_|. |
684 bool can_compose_inline_; | 684 bool can_compose_inline_; |
685 | 685 |
686 // Stores the current selection bounds. | 686 // Stores the current selection bounds. |
687 gfx::Rect selection_focus_rect_; | 687 gfx::Rect selection_focus_rect_; |
688 gfx::Rect selection_anchor_rect_; | 688 gfx::Rect selection_anchor_rect_; |
689 | 689 |
690 // Stores the current composition character bounds. | 690 // Stores the current composition character bounds. |
691 std::vector<gfx::Rect> composition_character_bounds_; | 691 std::vector<gfx::Rect> composition_character_bounds_; |
692 | 692 |
693 // Stores the current composition range. | 693 // Stores the current composition range. |
694 gfx::Range composition_range_; | 694 gfx::Range composition_range_; |
695 | 695 |
696 // The kind of popup this widget represents, NONE if not a popup. | 696 // The kind of popup this widget represents, NONE if not a popup. |
697 WebKit::WebPopupType popup_type_; | 697 blink::WebPopupType popup_type_; |
698 | 698 |
699 // Holds all the needed plugin window moves for a scroll. | 699 // Holds all the needed plugin window moves for a scroll. |
700 typedef std::vector<WebPluginGeometry> WebPluginGeometryVector; | 700 typedef std::vector<WebPluginGeometry> WebPluginGeometryVector; |
701 WebPluginGeometryVector plugin_window_moves_; | 701 WebPluginGeometryVector plugin_window_moves_; |
702 | 702 |
703 // A custom background for the widget. | 703 // A custom background for the widget. |
704 SkBitmap background_; | 704 SkBitmap background_; |
705 | 705 |
706 // While we are waiting for the browser to update window sizes, we track the | 706 // While we are waiting for the browser to update window sizes, we track the |
707 // pending size temporarily. | 707 // pending size temporarily. |
708 int pending_window_rect_count_; | 708 int pending_window_rect_count_; |
709 WebKit::WebRect pending_window_rect_; | 709 blink::WebRect pending_window_rect_; |
710 | 710 |
711 // The screen rects of the view and the window that contains it. | 711 // The screen rects of the view and the window that contains it. |
712 gfx::Rect view_screen_rect_; | 712 gfx::Rect view_screen_rect_; |
713 gfx::Rect window_screen_rect_; | 713 gfx::Rect window_screen_rect_; |
714 | 714 |
715 scoped_ptr<IPC::Message> pending_input_event_ack_; | 715 scoped_ptr<IPC::Message> pending_input_event_ack_; |
716 | 716 |
717 // The time spent in input handlers this frame. Used to throttle input acks. | 717 // The time spent in input handlers this frame. Used to throttle input acks. |
718 base::TimeDelta total_input_handling_time_this_frame_; | 718 base::TimeDelta total_input_handling_time_this_frame_; |
719 | 719 |
(...skipping 25 matching lines...) Expand all Loading... |
745 scoped_ptr<ViewHostMsg_UpdateRect_Params> pending_update_params_; | 745 scoped_ptr<ViewHostMsg_UpdateRect_Params> pending_update_params_; |
746 | 746 |
747 // Queue of UpdateRect messages corresponding to a SwapBuffers. We want to | 747 // Queue of UpdateRect messages corresponding to a SwapBuffers. We want to |
748 // delay sending of UpdateRect until the corresponding SwapBuffers has been | 748 // delay sending of UpdateRect until the corresponding SwapBuffers has been |
749 // executed. Since we can have several in flight, we need to keep them in a | 749 // executed. Since we can have several in flight, we need to keep them in a |
750 // queue. Note: some SwapBuffers may not correspond to an update, in which | 750 // queue. Note: some SwapBuffers may not correspond to an update, in which |
751 // case NULL is added to the queue. | 751 // case NULL is added to the queue. |
752 std::deque<ViewHostMsg_UpdateRect*> updates_pending_swap_; | 752 std::deque<ViewHostMsg_UpdateRect*> updates_pending_swap_; |
753 | 753 |
754 // Properties of the screen hosting this RenderWidget instance. | 754 // Properties of the screen hosting this RenderWidget instance. |
755 WebKit::WebScreenInfo screen_info_; | 755 blink::WebScreenInfo screen_info_; |
756 | 756 |
757 // The device scale factor. This value is computed from the DPI entries in | 757 // The device scale factor. This value is computed from the DPI entries in |
758 // |screen_info_| on some platforms, and defaults to 1 on other platforms. | 758 // |screen_info_| on some platforms, and defaults to 1 on other platforms. |
759 float device_scale_factor_; | 759 float device_scale_factor_; |
760 | 760 |
761 // State associated with the synthetic gestures function | 761 // State associated with the synthetic gestures function |
762 // (e.g. BeginSmoothScroll). | 762 // (e.g. BeginSmoothScroll). |
763 SyntheticGestureCompletionCallback pending_synthetic_gesture_; | 763 SyntheticGestureCompletionCallback pending_synthetic_gesture_; |
764 | 764 |
765 // Specified whether the compositor will run in its own thread. | 765 // Specified whether the compositor will run in its own thread. |
(...skipping 27 matching lines...) Expand all Loading... |
793 scoped_ptr<ResizingModeSelector> resizing_mode_selector_; | 793 scoped_ptr<ResizingModeSelector> resizing_mode_selector_; |
794 | 794 |
795 base::WeakPtrFactory<RenderWidget> weak_ptr_factory_; | 795 base::WeakPtrFactory<RenderWidget> weak_ptr_factory_; |
796 | 796 |
797 DISALLOW_COPY_AND_ASSIGN(RenderWidget); | 797 DISALLOW_COPY_AND_ASSIGN(RenderWidget); |
798 }; | 798 }; |
799 | 799 |
800 } // namespace content | 800 } // namespace content |
801 | 801 |
802 #endif // CONTENT_RENDERER_RENDER_WIDGET_H_ | 802 #endif // CONTENT_RENDERER_RENDER_WIDGET_H_ |
OLD | NEW |