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 // A BrowserPluginGuest is the browser side of a browser <--> embedder | 5 // A BrowserPluginGuest is the browser side of a browser <--> embedder |
6 // renderer channel. A BrowserPlugin (a WebPlugin) is on the embedder | 6 // renderer channel. A BrowserPlugin (a WebPlugin) is on the embedder |
7 // renderer side of browser <--> embedder renderer communication. | 7 // renderer side of browser <--> embedder renderer communication. |
8 // | 8 // |
9 // BrowserPluginGuest lives on the UI thread of the browser process. Any | 9 // BrowserPluginGuest lives on the UI thread of the browser process. Any |
10 // messages about the guest render process that the embedder might be interested | 10 // messages about the guest render process that the embedder might be interested |
(...skipping 236 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
247 void OnLockMouseAck(int instance_id, bool succeeded); | 247 void OnLockMouseAck(int instance_id, bool succeeded); |
248 void OnPluginDestroyed(int instance_id); | 248 void OnPluginDestroyed(int instance_id); |
249 // Resizes the guest's web contents. | 249 // Resizes the guest's web contents. |
250 void OnResizeGuest( | 250 void OnResizeGuest( |
251 int instance_id, const BrowserPluginHostMsg_ResizeGuest_Params& params); | 251 int instance_id, const BrowserPluginHostMsg_ResizeGuest_Params& params); |
252 void OnSetFocus(int instance_id, bool focused); | 252 void OnSetFocus(int instance_id, bool focused); |
253 // Sets the name of the guest so that other guests in the same partition can | 253 // Sets the name of the guest so that other guests in the same partition can |
254 // access it. | 254 // access it. |
255 void OnSetName(int instance_id, const std::string& name); | 255 void OnSetName(int instance_id, const std::string& name); |
256 // Updates the size state of the guest. | 256 // Updates the size state of the guest. |
| 257 void OnSetAutoSize( |
| 258 int instance_id, |
| 259 const BrowserPluginHostMsg_AutoSize_Params& auto_size_params, |
| 260 const BrowserPluginHostMsg_ResizeGuest_Params& resize_guest_params); |
257 void OnSetEditCommandsForNextKeyEvent( | 261 void OnSetEditCommandsForNextKeyEvent( |
258 int instance_id, | 262 int instance_id, |
259 const std::vector<EditCommand>& edit_commands); | 263 const std::vector<EditCommand>& edit_commands); |
260 void OnSetContentsOpaque(int instance_id, bool opaque); | 264 void OnSetContentsOpaque(int instance_id, bool opaque); |
261 // The guest WebContents is visible if both its embedder is visible and | 265 // The guest WebContents is visible if both its embedder is visible and |
262 // the browser plugin element is visible. If either one is not then the | 266 // the browser plugin element is visible. If either one is not then the |
263 // WebContents is marked as hidden. A hidden WebContents will consume | 267 // WebContents is marked as hidden. A hidden WebContents will consume |
264 // fewer GPU and CPU resources. | 268 // fewer GPU and CPU resources. |
265 // | 269 // |
266 // When every WebContents in a RenderProcessHost is hidden, it will lower | 270 // When every WebContents in a RenderProcessHost is hidden, it will lower |
(...skipping 63 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
330 const int instance_id_; | 334 const int instance_id_; |
331 float guest_device_scale_factor_; | 335 float guest_device_scale_factor_; |
332 gfx::Rect guest_window_rect_; | 336 gfx::Rect guest_window_rect_; |
333 gfx::Rect guest_screen_rect_; | 337 gfx::Rect guest_screen_rect_; |
334 bool focused_; | 338 bool focused_; |
335 bool mouse_locked_; | 339 bool mouse_locked_; |
336 bool pending_lock_request_; | 340 bool pending_lock_request_; |
337 bool guest_visible_; | 341 bool guest_visible_; |
338 bool guest_opaque_; | 342 bool guest_opaque_; |
339 bool embedder_visible_; | 343 bool embedder_visible_; |
| 344 std::string name_; |
| 345 bool auto_size_enabled_; |
| 346 gfx::Size max_auto_size_; |
| 347 gfx::Size min_auto_size_; |
| 348 gfx::Size full_size_; |
340 | 349 |
341 // Each copy-request is identified by a unique number. The unique number is | 350 // Each copy-request is identified by a unique number. The unique number is |
342 // used to keep track of the right callback. | 351 // used to keep track of the right callback. |
343 int copy_request_id_; | 352 int copy_request_id_; |
344 typedef base::Callback<void(bool, const SkBitmap&)> CopyRequestCallback; | 353 typedef base::Callback<void(bool, const SkBitmap&)> CopyRequestCallback; |
345 typedef std::map<int, const CopyRequestCallback> CopyRequestMap; | 354 typedef std::map<int, const CopyRequestCallback> CopyRequestMap; |
346 CopyRequestMap copy_request_callbacks_; | 355 CopyRequestMap copy_request_callbacks_; |
347 | 356 |
348 // Indicates that this BrowserPluginGuest has associated renderer-side state. | 357 // Indicates that this BrowserPluginGuest has associated renderer-side state. |
349 // This is used to determine whether or not to create a new RenderView when | 358 // This is used to determine whether or not to create a new RenderView when |
350 // this guest is attached. A BrowserPluginGuest would have renderer-side state | 359 // this guest is attached. A BrowserPluginGuest would have renderer-side state |
351 // prior to attachment if it is created via a call to window.open and | 360 // prior to attachment if it is created via a call to window.open and |
352 // maintains a JavaScript reference to its opener. | 361 // maintains a JavaScript reference to its opener. |
353 bool has_render_view_; | 362 bool has_render_view_; |
354 | 363 |
355 // Last seen size of guest contents (by OnUpdateRect). | 364 // Last seen size of guest contents (by OnUpdateRect). |
356 gfx::Size last_seen_view_size_; | 365 gfx::Size last_seen_view_size_; |
357 // Last seen size of BrowserPlugin (by OnResizeGuest). | 366 // Last seen autosize attribute state (by OnUpdateRect). |
358 gfx::Size last_seen_browser_plugin_size_; | 367 bool last_seen_auto_size_enabled_; |
359 | 368 |
360 bool is_in_destruction_; | 369 bool is_in_destruction_; |
361 | 370 |
362 // Text input type states. | 371 // Text input type states. |
363 ui::TextInputType last_text_input_type_; | 372 ui::TextInputType last_text_input_type_; |
364 ui::TextInputMode last_input_mode_; | 373 ui::TextInputMode last_input_mode_; |
365 bool last_can_compose_inline_; | 374 bool last_can_compose_inline_; |
366 | 375 |
367 // This is a queue of messages that are destined to be sent to the embedder | 376 // This is a queue of messages that are destined to be sent to the embedder |
368 // once the guest is attached to a particular embedder. | 377 // once the guest is attached to a particular embedder. |
369 std::deque<linked_ptr<IPC::Message> > pending_messages_; | 378 std::deque<linked_ptr<IPC::Message> > pending_messages_; |
370 | 379 |
371 BrowserPluginGuestDelegate* const delegate_; | 380 BrowserPluginGuestDelegate* const delegate_; |
372 | 381 |
373 // Weak pointer used to ask GeolocationPermissionContext about geolocation | 382 // Weak pointer used to ask GeolocationPermissionContext about geolocation |
374 // permission. | 383 // permission. |
375 base::WeakPtrFactory<BrowserPluginGuest> weak_ptr_factory_; | 384 base::WeakPtrFactory<BrowserPluginGuest> weak_ptr_factory_; |
376 | 385 |
377 DISALLOW_COPY_AND_ASSIGN(BrowserPluginGuest); | 386 DISALLOW_COPY_AND_ASSIGN(BrowserPluginGuest); |
378 }; | 387 }; |
379 | 388 |
380 } // namespace content | 389 } // namespace content |
381 | 390 |
382 #endif // CONTENT_BROWSER_BROWSER_PLUGIN_BROWSER_PLUGIN_GUEST_H_ | 391 #endif // CONTENT_BROWSER_BROWSER_PLUGIN_BROWSER_PLUGIN_GUEST_H_ |
OLD | NEW |