| 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 185 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 196 bool should_allow, | 196 bool should_allow, |
| 197 const std::string& user_input); | 197 const std::string& user_input); |
| 198 | 198 |
| 199 void PointerLockPermissionResponse(bool allow); | 199 void PointerLockPermissionResponse(bool allow); |
| 200 | 200 |
| 201 void SwapCompositorFrame(uint32 output_surface_id, | 201 void SwapCompositorFrame(uint32 output_surface_id, |
| 202 int host_process_id, | 202 int host_process_id, |
| 203 int host_routing_id, | 203 int host_routing_id, |
| 204 scoped_ptr<cc::CompositorFrame> frame); | 204 scoped_ptr<cc::CompositorFrame> frame); |
| 205 | 205 |
| 206 void SetContentsOpaque(bool opaque); |
| 207 |
| 206 private: | 208 private: |
| 207 class EmbedderWebContentsObserver; | 209 class EmbedderWebContentsObserver; |
| 208 | 210 |
| 209 // BrowserPluginGuest is a WebContentsObserver of |web_contents| and | 211 // BrowserPluginGuest is a WebContentsObserver of |web_contents| and |
| 210 // |web_contents| has to stay valid for the lifetime of BrowserPluginGuest. | 212 // |web_contents| has to stay valid for the lifetime of BrowserPluginGuest. |
| 211 BrowserPluginGuest(bool has_render_view, | 213 BrowserPluginGuest(bool has_render_view, |
| 212 WebContentsImpl* web_contents, | 214 WebContentsImpl* web_contents, |
| 213 BrowserPluginGuestDelegate* delegate); | 215 BrowserPluginGuestDelegate* delegate); |
| 214 | 216 |
| 215 void WillDestroy(); | 217 void WillDestroy(); |
| (...skipping 40 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 256 void OnResizeGuest( | 258 void OnResizeGuest( |
| 257 int instance_id, const BrowserPluginHostMsg_ResizeGuest_Params& params); | 259 int instance_id, const BrowserPluginHostMsg_ResizeGuest_Params& params); |
| 258 void OnSetFocus(int instance_id, bool focused); | 260 void OnSetFocus(int instance_id, bool focused); |
| 259 // Sets the name of the guest so that other guests in the same partition can | 261 // Sets the name of the guest so that other guests in the same partition can |
| 260 // access it. | 262 // access it. |
| 261 void OnSetName(int instance_id, const std::string& name); | 263 void OnSetName(int instance_id, const std::string& name); |
| 262 // Updates the size state of the guest. | 264 // Updates the size state of the guest. |
| 263 void OnSetEditCommandsForNextKeyEvent( | 265 void OnSetEditCommandsForNextKeyEvent( |
| 264 int instance_id, | 266 int instance_id, |
| 265 const std::vector<EditCommand>& edit_commands); | 267 const std::vector<EditCommand>& edit_commands); |
| 266 void OnSetContentsOpaque(int instance_id, bool opaque); | |
| 267 // The guest WebContents is visible if both its embedder is visible and | 268 // The guest WebContents is visible if both its embedder is visible and |
| 268 // the browser plugin element is visible. If either one is not then the | 269 // the browser plugin element is visible. If either one is not then the |
| 269 // WebContents is marked as hidden. A hidden WebContents will consume | 270 // WebContents is marked as hidden. A hidden WebContents will consume |
| 270 // fewer GPU and CPU resources. | 271 // fewer GPU and CPU resources. |
| 271 // | 272 // |
| 272 // When every WebContents in a RenderProcessHost is hidden, it will lower | 273 // When every WebContents in a RenderProcessHost is hidden, it will lower |
| 273 // the priority of the process (see RenderProcessHostImpl::WidgetHidden). | 274 // the priority of the process (see RenderProcessHostImpl::WidgetHidden). |
| 274 // | 275 // |
| 275 // It will also send a message to the guest renderer process to cleanup | 276 // It will also send a message to the guest renderer process to cleanup |
| 276 // resources such as dropping back buffers and adjusting memory limits (if in | 277 // resources such as dropping back buffers and adjusting memory limits (if in |
| (...skipping 52 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 329 WebContentsImpl* embedder_web_contents_; | 330 WebContentsImpl* embedder_web_contents_; |
| 330 | 331 |
| 331 // An identifier that uniquely identifies a browser plugin within an embedder. | 332 // An identifier that uniquely identifies a browser plugin within an embedder. |
| 332 int browser_plugin_instance_id_; | 333 int browser_plugin_instance_id_; |
| 333 float guest_device_scale_factor_; | 334 float guest_device_scale_factor_; |
| 334 gfx::Rect guest_window_rect_; | 335 gfx::Rect guest_window_rect_; |
| 335 bool focused_; | 336 bool focused_; |
| 336 bool mouse_locked_; | 337 bool mouse_locked_; |
| 337 bool pending_lock_request_; | 338 bool pending_lock_request_; |
| 338 bool guest_visible_; | 339 bool guest_visible_; |
| 339 bool guest_opaque_; | |
| 340 bool embedder_visible_; | 340 bool embedder_visible_; |
| 341 | 341 |
| 342 // Each copy-request is identified by a unique number. The unique number is | 342 // Each copy-request is identified by a unique number. The unique number is |
| 343 // used to keep track of the right callback. | 343 // used to keep track of the right callback. |
| 344 int copy_request_id_; | 344 int copy_request_id_; |
| 345 typedef base::Callback<void(bool, const SkBitmap&)> CopyRequestCallback; | 345 typedef base::Callback<void(bool, const SkBitmap&)> CopyRequestCallback; |
| 346 typedef std::map<int, const CopyRequestCallback> CopyRequestMap; | 346 typedef std::map<int, const CopyRequestCallback> CopyRequestMap; |
| 347 CopyRequestMap copy_request_callbacks_; | 347 CopyRequestMap copy_request_callbacks_; |
| 348 | 348 |
| 349 // Indicates that this BrowserPluginGuest has associated renderer-side state. | 349 // Indicates that this BrowserPluginGuest has associated renderer-side state. |
| (...skipping 24 matching lines...) Expand all Loading... |
| 374 // Weak pointer used to ask GeolocationPermissionContext about geolocation | 374 // Weak pointer used to ask GeolocationPermissionContext about geolocation |
| 375 // permission. | 375 // permission. |
| 376 base::WeakPtrFactory<BrowserPluginGuest> weak_ptr_factory_; | 376 base::WeakPtrFactory<BrowserPluginGuest> weak_ptr_factory_; |
| 377 | 377 |
| 378 DISALLOW_COPY_AND_ASSIGN(BrowserPluginGuest); | 378 DISALLOW_COPY_AND_ASSIGN(BrowserPluginGuest); |
| 379 }; | 379 }; |
| 380 | 380 |
| 381 } // namespace content | 381 } // namespace content |
| 382 | 382 |
| 383 #endif // CONTENT_BROWSER_BROWSER_PLUGIN_BROWSER_PLUGIN_GUEST_H_ | 383 #endif // CONTENT_BROWSER_BROWSER_PLUGIN_BROWSER_PLUGIN_GUEST_H_ |
| OLD | NEW |