OLD | NEW |
1 // Copyright 2012 The Chromium Authors. All rights reserved. | 1 // Copyright 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_BROWSER_PLUGIN_BROWSER_PLUGIN_H_ | 5 #ifndef CONTENT_RENDERER_BROWSER_PLUGIN_BROWSER_PLUGIN_H_ |
6 #define CONTENT_RENDERER_BROWSER_PLUGIN_BROWSER_PLUGIN_H_ | 6 #define CONTENT_RENDERER_BROWSER_PLUGIN_BROWSER_PLUGIN_H_ |
7 | 7 |
8 #include "third_party/WebKit/public/web/WebPlugin.h" | 8 #include "third_party/WebKit/public/web/WebPlugin.h" |
9 | 9 |
10 #include "base/memory/scoped_ptr.h" | 10 #include "base/memory/scoped_ptr.h" |
(...skipping 234 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
245 virtual base::SharedMemory* CreateDamageBuffer( | 245 virtual base::SharedMemory* CreateDamageBuffer( |
246 const size_t size, | 246 const size_t size, |
247 base::SharedMemoryHandle* shared_memory_handle); | 247 base::SharedMemoryHandle* shared_memory_handle); |
248 // Swaps out the |current_damage_buffer_| with the |pending_damage_buffer_|. | 248 // Swaps out the |current_damage_buffer_| with the |pending_damage_buffer_|. |
249 void SwapDamageBuffers(); | 249 void SwapDamageBuffers(); |
250 | 250 |
251 // Populates BrowserPluginHostMsg_ResizeGuest_Params with resize state and | 251 // Populates BrowserPluginHostMsg_ResizeGuest_Params with resize state and |
252 // allocates a new |pending_damage_buffer_| if in software rendering mode. | 252 // allocates a new |pending_damage_buffer_| if in software rendering mode. |
253 void PopulateResizeGuestParameters( | 253 void PopulateResizeGuestParameters( |
254 BrowserPluginHostMsg_ResizeGuest_Params* params, | 254 BrowserPluginHostMsg_ResizeGuest_Params* params, |
255 const gfx::Rect& view_size, | 255 const gfx::Rect& view_size); |
256 bool needs_repaint); | |
257 | 256 |
258 // Populates BrowserPluginHostMsg_AutoSize_Params object with autosize state. | 257 // Populates BrowserPluginHostMsg_AutoSize_Params object with autosize state. |
259 void PopulateAutoSizeParameters( | 258 void PopulateAutoSizeParameters( |
260 BrowserPluginHostMsg_AutoSize_Params* params, bool auto_size_enabled); | 259 BrowserPluginHostMsg_AutoSize_Params* params, bool current_auto_size); |
261 | 260 |
262 // Populates both AutoSize and ResizeGuest parameters based on the current | 261 // Populates both AutoSize and ResizeGuest parameters based on the current |
263 // autosize state. | 262 // autosize state. |
264 void GetDamageBufferWithSizeParams( | 263 void GetDamageBufferWithSizeParams( |
265 BrowserPluginHostMsg_AutoSize_Params* auto_size_params, | 264 BrowserPluginHostMsg_AutoSize_Params* auto_size_params, |
266 BrowserPluginHostMsg_ResizeGuest_Params* resize_guest_params, | 265 BrowserPluginHostMsg_ResizeGuest_Params* resize_guest_params); |
267 bool needs_repaint); | |
268 | 266 |
269 // Informs the guest of an updated autosize state. | 267 // Informs the guest of an updated autosize state. |
270 void UpdateGuestAutoSizeState(bool auto_size_enabled); | 268 void UpdateGuestAutoSizeState(bool current_auto_size); |
271 | 269 |
272 // Indicates whether a damage buffer was used by the guest process for the | 270 // Indicates whether a damage buffer was used by the guest process for the |
273 // provided |params|. | 271 // provided |params|. |
274 static bool UsesDamageBuffer( | 272 static bool UsesDamageBuffer( |
275 const BrowserPluginMsg_UpdateRect_Params& params); | 273 const BrowserPluginMsg_UpdateRect_Params& params); |
276 | 274 |
277 // Indicates whether the |pending_damage_buffer_| was used to copy over pixels | 275 // Indicates whether the |pending_damage_buffer_| was used to copy over pixels |
278 // given the provided |params|. | 276 // given the provided |params|. |
279 bool UsesPendingDamageBuffer( | 277 bool UsesPendingDamageBuffer( |
280 const BrowserPluginMsg_UpdateRect_Params& params); | 278 const BrowserPluginMsg_UpdateRect_Params& params); |
(...skipping 26 matching lines...) Expand all Loading... |
307 // We cache the |render_view_|'s routing ID because we need it on destruction. | 305 // We cache the |render_view_|'s routing ID because we need it on destruction. |
308 // If the |render_view_| is destroyed before the BrowserPlugin is destroyed | 306 // If the |render_view_| is destroyed before the BrowserPlugin is destroyed |
309 // then we will attempt to access a NULL pointer. | 307 // then we will attempt to access a NULL pointer. |
310 int render_view_routing_id_; | 308 int render_view_routing_id_; |
311 WebKit::WebPluginContainer* container_; | 309 WebKit::WebPluginContainer* container_; |
312 scoped_ptr<BrowserPluginBindings> bindings_; | 310 scoped_ptr<BrowserPluginBindings> bindings_; |
313 scoped_ptr<BrowserPluginBackingStore> backing_store_; | 311 scoped_ptr<BrowserPluginBackingStore> backing_store_; |
314 scoped_ptr<base::SharedMemory> current_damage_buffer_; | 312 scoped_ptr<base::SharedMemory> current_damage_buffer_; |
315 scoped_ptr<base::SharedMemory> pending_damage_buffer_; | 313 scoped_ptr<base::SharedMemory> pending_damage_buffer_; |
316 uint32 damage_buffer_sequence_id_; | 314 uint32 damage_buffer_sequence_id_; |
317 bool paint_ack_received_; | 315 bool resize_ack_received_; |
318 gfx::Rect plugin_rect_; | 316 gfx::Rect plugin_rect_; |
319 float last_device_scale_factor_; | 317 float last_device_scale_factor_; |
320 // Bitmap for crashed plugin. Lazily initialized, non-owning pointer. | 318 // Bitmap for crashed plugin. Lazily initialized, non-owning pointer. |
321 SkBitmap* sad_guest_; | 319 SkBitmap* sad_guest_; |
322 bool guest_crashed_; | 320 bool guest_crashed_; |
323 scoped_ptr<BrowserPluginHostMsg_ResizeGuest_Params> pending_resize_params_; | 321 scoped_ptr<BrowserPluginHostMsg_ResizeGuest_Params> pending_resize_params_; |
324 bool is_auto_size_state_dirty_; | 322 bool auto_size_ack_pending_; |
325 // Maximum size constraint for autosize. | |
326 gfx::Size max_auto_size_; | |
327 std::string storage_partition_id_; | 323 std::string storage_partition_id_; |
328 bool persist_storage_; | 324 bool persist_storage_; |
329 bool valid_partition_id_; | 325 bool valid_partition_id_; |
330 int content_window_routing_id_; | 326 int content_window_routing_id_; |
331 bool plugin_focused_; | 327 bool plugin_focused_; |
332 // Tracks the visibility of the browser plugin regardless of the whole | 328 // Tracks the visibility of the browser plugin regardless of the whole |
333 // embedder RenderView's visibility. | 329 // embedder RenderView's visibility. |
334 bool visible_; | 330 bool visible_; |
335 | 331 |
336 WebCursor cursor_; | 332 WebCursor cursor_; |
(...skipping 22 matching lines...) Expand all Loading... |
359 base::WeakPtrFactory<BrowserPlugin> weak_ptr_factory_; | 355 base::WeakPtrFactory<BrowserPlugin> weak_ptr_factory_; |
360 | 356 |
361 std::vector<EditCommand> edit_commands_; | 357 std::vector<EditCommand> edit_commands_; |
362 | 358 |
363 DISALLOW_COPY_AND_ASSIGN(BrowserPlugin); | 359 DISALLOW_COPY_AND_ASSIGN(BrowserPlugin); |
364 }; | 360 }; |
365 | 361 |
366 } // namespace content | 362 } // namespace content |
367 | 363 |
368 #endif // CONTENT_RENDERER_BROWSER_PLUGIN_BROWSER_PLUGIN_H_ | 364 #endif // CONTENT_RENDERER_BROWSER_PLUGIN_BROWSER_PLUGIN_H_ |
OLD | NEW |