OLD | NEW |
1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2011 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 #pragma once | 7 #pragma once |
8 | 8 |
9 #include <vector> | 9 #include <vector> |
10 | 10 |
(...skipping 136 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
147 | 147 |
148 // Called by Init and subclasses to perform initialization. | 148 // Called by Init and subclasses to perform initialization. |
149 void DoInit(int32 opener_id, | 149 void DoInit(int32 opener_id, |
150 WebKit::WebWidget* web_widget, | 150 WebKit::WebWidget* web_widget, |
151 IPC::SyncMessage* create_widget_message); | 151 IPC::SyncMessage* create_widget_message); |
152 | 152 |
153 // Finishes creation of a pending view started with Init. | 153 // Finishes creation of a pending view started with Init. |
154 void CompleteInit(gfx::NativeViewId parent, | 154 void CompleteInit(gfx::NativeViewId parent, |
155 gfx::PluginWindowHandle compositing_surface); | 155 gfx::PluginWindowHandle compositing_surface); |
156 | 156 |
| 157 // Sets whether this RenderWidget has been swapped out to be displayed by |
| 158 // a RenderWidget in a different process. If so, no new IPC messages will be |
| 159 // sent (only ACKs) and the process is free to exit when there are no other |
| 160 // active RenderWidgets. |
| 161 void SetSwappedOut(bool is_swapped_out); |
| 162 |
157 // Paints the given rectangular region of the WebWidget into canvas (a | 163 // Paints the given rectangular region of the WebWidget into canvas (a |
158 // shared memory segment returned by AllocPaintBuf on Windows). The caller | 164 // shared memory segment returned by AllocPaintBuf on Windows). The caller |
159 // must ensure that the given rect fits within the bounds of the WebWidget. | 165 // must ensure that the given rect fits within the bounds of the WebWidget. |
160 void PaintRect(const gfx::Rect& rect, const gfx::Point& canvas_origin, | 166 void PaintRect(const gfx::Rect& rect, const gfx::Point& canvas_origin, |
161 skia::PlatformCanvas* canvas); | 167 skia::PlatformCanvas* canvas); |
162 | 168 |
163 // Paints a border at the given rect for debugging purposes. | 169 // Paints a border at the given rect for debugging purposes. |
164 void PaintDebugBorder(const gfx::Rect& rect, skia::PlatformCanvas* canvas); | 170 void PaintDebugBorder(const gfx::Rect& rect, skia::PlatformCanvas* canvas); |
165 | 171 |
166 void AnimationCallback(); | 172 void AnimationCallback(); |
167 void AnimateIfNeeded(); | 173 void AnimateIfNeeded(); |
168 void CallDoDeferredUpdate(); | 174 void CallDoDeferredUpdate(); |
169 void DoDeferredUpdate(); | 175 void DoDeferredUpdate(); |
170 void DoDeferredClose(); | 176 void DoDeferredClose(); |
171 void DoDeferredSetWindowRect(const WebKit::WebRect& pos); | 177 void DoDeferredSetWindowRect(const WebKit::WebRect& pos); |
172 | 178 |
173 // Set the background of the render widget to a bitmap. The bitmap will be | 179 // Set the background of the render widget to a bitmap. The bitmap will be |
174 // tiled in both directions if it isn't big enough to fill the area. This is | 180 // tiled in both directions if it isn't big enough to fill the area. This is |
175 // mainly intended to be used in conjuction with WebView::SetIsTransparent(). | 181 // mainly intended to be used in conjuction with WebView::SetIsTransparent(). |
176 virtual void SetBackground(const SkBitmap& bitmap); | 182 virtual void SetBackground(const SkBitmap& bitmap); |
177 | 183 |
178 // RenderWidget IPC message handlers | 184 // RenderWidget IPC message handlers |
179 void OnClose(); | 185 void OnClose(); |
180 void OnCreatingNewAck(gfx::NativeViewId parent, | 186 void OnCreatingNewAck(gfx::NativeViewId parent, |
181 gfx::PluginWindowHandle compositing_surface); | 187 gfx::PluginWindowHandle compositing_surface); |
182 virtual void OnResize(const gfx::Size& new_size, | 188 virtual void OnResize(const gfx::Size& new_size, |
183 const gfx::Rect& resizer_rect); | 189 const gfx::Rect& resizer_rect); |
184 virtual void OnWasHidden(); | 190 virtual void OnWasHidden(); |
185 virtual void OnWasRestored(bool needs_repainting); | 191 virtual void OnWasRestored(bool needs_repainting); |
| 192 virtual void OnWasSwappedOut(); |
186 void OnUpdateRectAck(); | 193 void OnUpdateRectAck(); |
187 void OnCreateVideoAck(int32 video_id); | 194 void OnCreateVideoAck(int32 video_id); |
188 void OnUpdateVideoAck(int32 video_id); | 195 void OnUpdateVideoAck(int32 video_id); |
189 void OnRequestMoveAck(); | 196 void OnRequestMoveAck(); |
190 void OnHandleInputEvent(const IPC::Message& message); | 197 void OnHandleInputEvent(const IPC::Message& message); |
191 void OnMouseCaptureLost(); | 198 void OnMouseCaptureLost(); |
192 virtual void OnSetFocus(bool enable); | 199 virtual void OnSetFocus(bool enable); |
193 void OnSetInputMethodActive(bool is_active); | 200 void OnSetInputMethodActive(bool is_active); |
194 void OnImeSetComposition( | 201 void OnImeSetComposition( |
195 const string16& text, | 202 const string16& text, |
(...skipping 140 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
336 // Indicates whether we have been focused/unfocused by the browser. | 343 // Indicates whether we have been focused/unfocused by the browser. |
337 bool has_focus_; | 344 bool has_focus_; |
338 | 345 |
339 // Are we currently handling an input event? | 346 // Are we currently handling an input event? |
340 bool handling_input_event_; | 347 bool handling_input_event_; |
341 | 348 |
342 // True if we have requested this widget be closed. No more messages will | 349 // True if we have requested this widget be closed. No more messages will |
343 // be sent, except for a Close. | 350 // be sent, except for a Close. |
344 bool closing_; | 351 bool closing_; |
345 | 352 |
| 353 // Whether this RenderWidget is currently swapped out, such that the view is |
| 354 // being rendered by another process. If all RenderWidgets in a process are |
| 355 // swapped out, the process can exit. |
| 356 bool is_swapped_out_; |
| 357 |
346 // Indicates if an input method is active in the browser process. | 358 // Indicates if an input method is active in the browser process. |
347 bool input_method_is_active_; | 359 bool input_method_is_active_; |
348 | 360 |
349 // Stores the current text input type of |webwidget_|. | 361 // Stores the current text input type of |webwidget_|. |
350 WebKit::WebTextInputType text_input_type_; | 362 WebKit::WebTextInputType text_input_type_; |
351 | 363 |
352 // Stores the current caret bounds of input focus. | 364 // Stores the current caret bounds of input focus. |
353 WebKit::WebRect caret_bounds_; | 365 WebKit::WebRect caret_bounds_; |
354 | 366 |
355 // The kind of popup this widget represents, NONE if not a popup. | 367 // The kind of popup this widget represents, NONE if not a popup. |
(...skipping 25 matching lines...) Expand all Loading... |
381 gfx::PluginWindowHandle compositing_surface_; | 393 gfx::PluginWindowHandle compositing_surface_; |
382 | 394 |
383 base::Time animation_floor_time_; | 395 base::Time animation_floor_time_; |
384 bool animation_update_pending_; | 396 bool animation_update_pending_; |
385 bool animation_task_posted_; | 397 bool animation_task_posted_; |
386 | 398 |
387 DISALLOW_COPY_AND_ASSIGN(RenderWidget); | 399 DISALLOW_COPY_AND_ASSIGN(RenderWidget); |
388 }; | 400 }; |
389 | 401 |
390 #endif // CONTENT_RENDERER_RENDER_WIDGET_H_ | 402 #endif // CONTENT_RENDERER_RENDER_WIDGET_H_ |
OLD | NEW |