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