| 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 33 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 44 struct FrameHostMsg_CompositorFrameSwappedACK_Params; | 44 struct FrameHostMsg_CompositorFrameSwappedACK_Params; |
| 45 struct FrameHostMsg_ReclaimCompositorResources_Params; | 45 struct FrameHostMsg_ReclaimCompositorResources_Params; |
| 46 struct FrameMsg_CompositorFrameSwapped_Params; | 46 struct FrameMsg_CompositorFrameSwapped_Params; |
| 47 | 47 |
| 48 #if defined(OS_MACOSX) | 48 #if defined(OS_MACOSX) |
| 49 struct FrameHostMsg_ShowPopup_Params; | 49 struct FrameHostMsg_ShowPopup_Params; |
| 50 #endif | 50 #endif |
| 51 | 51 |
| 52 namespace cc { | 52 namespace cc { |
| 53 class CompositorFrame; | 53 class CompositorFrame; |
| 54 struct SurfaceId; |
| 55 struct SurfaceSequence; |
| 54 } // namespace cc | 56 } // namespace cc |
| 55 | 57 |
| 56 namespace gfx { | 58 namespace gfx { |
| 57 class Range; | 59 class Range; |
| 58 } // namespace gfx | 60 } // namespace gfx |
| 59 | 61 |
| 60 namespace content { | 62 namespace content { |
| 61 | 63 |
| 62 class BrowserPluginGuestManager; | 64 class BrowserPluginGuestManager; |
| 63 class RenderViewHostImpl; | 65 class RenderViewHostImpl; |
| (...skipping 142 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 206 // Called when the drag started by this guest ends at an OS-level. | 208 // Called when the drag started by this guest ends at an OS-level. |
| 207 void EmbedderSystemDragEnded(); | 209 void EmbedderSystemDragEnded(); |
| 208 void EndSystemDragIfApplicable(); | 210 void EndSystemDragIfApplicable(); |
| 209 | 211 |
| 210 void RespondToPermissionRequest(int request_id, | 212 void RespondToPermissionRequest(int request_id, |
| 211 bool should_allow, | 213 bool should_allow, |
| 212 const std::string& user_input); | 214 const std::string& user_input); |
| 213 | 215 |
| 214 void PointerLockPermissionResponse(bool allow); | 216 void PointerLockPermissionResponse(bool allow); |
| 215 | 217 |
| 216 void SwapCompositorFrame(uint32 output_surface_id, | 218 // The next three functions are virtual for test purposes. |
| 217 int host_process_id, | 219 virtual void UpdateGuestSizeIfNecessary(const gfx::Size& frame_size, |
| 218 int host_routing_id, | 220 float scale_factor); |
| 219 scoped_ptr<cc::CompositorFrame> frame); | 221 virtual void SwapCompositorFrame(uint32 output_surface_id, |
| 222 int host_process_id, |
| 223 int host_routing_id, |
| 224 scoped_ptr<cc::CompositorFrame> frame); |
| 225 virtual void SetChildFrameSurface(const cc::SurfaceId& surface_id, |
| 226 const gfx::Size& frame_size, |
| 227 float scale_factor, |
| 228 const cc::SurfaceSequence& sequence); |
| 220 | 229 |
| 221 void SetContentsOpaque(bool opaque); | 230 void SetContentsOpaque(bool opaque); |
| 222 | 231 |
| 223 // Find the given |search_text| in the page. Returns true if the find request | 232 // Find the given |search_text| in the page. Returns true if the find request |
| 224 // is handled by this browser plugin guest. | 233 // is handled by this browser plugin guest. |
| 225 bool Find(int request_id, | 234 bool Find(int request_id, |
| 226 const base::string16& search_text, | 235 const base::string16& search_text, |
| 227 const blink::WebFindOptions& options); | 236 const blink::WebFindOptions& options); |
| 228 bool StopFinding(StopFindAction action); | 237 bool StopFinding(StopFindAction action); |
| 229 | 238 |
| 230 private: | 239 protected: |
| 231 class EmbedderVisibilityObserver; | |
| 232 | 240 |
| 233 // BrowserPluginGuest is a WebContentsObserver of |web_contents| and | 241 // BrowserPluginGuest is a WebContentsObserver of |web_contents| and |
| 234 // |web_contents| has to stay valid for the lifetime of BrowserPluginGuest. | 242 // |web_contents| has to stay valid for the lifetime of BrowserPluginGuest. |
| 243 // Constructor protected for testing. |
| 235 BrowserPluginGuest(bool has_render_view, | 244 BrowserPluginGuest(bool has_render_view, |
| 236 WebContentsImpl* web_contents, | 245 WebContentsImpl* web_contents, |
| 237 BrowserPluginGuestDelegate* delegate); | 246 BrowserPluginGuestDelegate* delegate); |
| 238 | 247 |
| 248 private: |
| 249 class EmbedderVisibilityObserver; |
| 250 |
| 239 void InitInternal(const BrowserPluginHostMsg_Attach_Params& params, | 251 void InitInternal(const BrowserPluginHostMsg_Attach_Params& params, |
| 240 WebContentsImpl* owner_web_contents); | 252 WebContentsImpl* owner_web_contents); |
| 241 | 253 |
| 242 bool InAutoSizeBounds(const gfx::Size& size) const; | 254 bool InAutoSizeBounds(const gfx::Size& size) const; |
| 243 | 255 |
| 256 void OnSatisfySequence(int instance_id, const cc::SurfaceSequence& sequence); |
| 257 void OnRequireSequence(int instance_id, |
| 258 const cc::SurfaceId& id, |
| 259 const cc::SurfaceSequence& sequence); |
| 244 // Message handlers for messages from embedder. | 260 // Message handlers for messages from embedder. |
| 245 void OnCompositorFrameSwappedACK( | 261 void OnCompositorFrameSwappedACK( |
| 246 int instance_id, | 262 int instance_id, |
| 247 const FrameHostMsg_CompositorFrameSwappedACK_Params& params); | 263 const FrameHostMsg_CompositorFrameSwappedACK_Params& params); |
| 248 void OnDetach(int instance_id); | 264 void OnDetach(int instance_id); |
| 249 // Handles drag events from the embedder. | 265 // Handles drag events from the embedder. |
| 250 // When dragging, the drag events go to the embedder first, and if the drag | 266 // When dragging, the drag events go to the embedder first, and if the drag |
| 251 // happens on the browser plugin, then the plugin sends a corresponding | 267 // happens on the browser plugin, then the plugin sends a corresponding |
| 252 // drag-message to the guest. This routes the drag-message to the guest | 268 // drag-message to the guest. This routes the drag-message to the guest |
| 253 // renderer. | 269 // renderer. |
| (...skipping 167 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 421 // Weak pointer used to ask GeolocationPermissionContext about geolocation | 437 // Weak pointer used to ask GeolocationPermissionContext about geolocation |
| 422 // permission. | 438 // permission. |
| 423 base::WeakPtrFactory<BrowserPluginGuest> weak_ptr_factory_; | 439 base::WeakPtrFactory<BrowserPluginGuest> weak_ptr_factory_; |
| 424 | 440 |
| 425 DISALLOW_COPY_AND_ASSIGN(BrowserPluginGuest); | 441 DISALLOW_COPY_AND_ASSIGN(BrowserPluginGuest); |
| 426 }; | 442 }; |
| 427 | 443 |
| 428 } // namespace content | 444 } // namespace content |
| 429 | 445 |
| 430 #endif // CONTENT_BROWSER_BROWSER_PLUGIN_BROWSER_PLUGIN_GUEST_H_ | 446 #endif // CONTENT_BROWSER_BROWSER_PLUGIN_BROWSER_PLUGIN_GUEST_H_ |
| OLD | NEW |