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 61 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
72 // messages. | 72 // messages. |
73 // | 73 // |
74 // When a guest is initially created, it is in an unattached state. That is, | 74 // When a guest is initially created, it is in an unattached state. That is, |
75 // it is not visible anywhere and has no embedder WebContents assigned. | 75 // it is not visible anywhere and has no embedder WebContents assigned. |
76 // A BrowserPluginGuest is said to be "attached" if it has an embedder. | 76 // A BrowserPluginGuest is said to be "attached" if it has an embedder. |
77 // A BrowserPluginGuest can also create a new unattached guest via | 77 // A BrowserPluginGuest can also create a new unattached guest via |
78 // CreateNewWindow. The newly created guest will live in the same partition, | 78 // CreateNewWindow. The newly created guest will live in the same partition, |
79 // which means it can share storage and can script this guest. | 79 // which means it can share storage and can script this guest. |
80 class CONTENT_EXPORT BrowserPluginGuest : public WebContentsObserver { | 80 class CONTENT_EXPORT BrowserPluginGuest : public WebContentsObserver { |
81 public: | 81 public: |
82 virtual ~BrowserPluginGuest(); | 82 ~BrowserPluginGuest() override; |
83 | 83 |
84 // The WebContents passed into the factory method here has not been | 84 // The WebContents passed into the factory method here has not been |
85 // initialized yet and so it does not yet hold a SiteInstance. | 85 // initialized yet and so it does not yet hold a SiteInstance. |
86 // BrowserPluginGuest must be constructed and installed into a WebContents | 86 // BrowserPluginGuest must be constructed and installed into a WebContents |
87 // prior to its initialization because WebContents needs to determine what | 87 // prior to its initialization because WebContents needs to determine what |
88 // type of WebContentsView to construct on initialization. The content | 88 // type of WebContentsView to construct on initialization. The content |
89 // embedder needs to be aware of |guest_site_instance| on the guest's | 89 // embedder needs to be aware of |guest_site_instance| on the guest's |
90 // construction and so we pass it in here. | 90 // construction and so we pass it in here. |
91 static BrowserPluginGuest* Create(WebContentsImpl* web_contents, | 91 static BrowserPluginGuest* Create(WebContentsImpl* web_contents, |
92 BrowserPluginGuestDelegate* delegate); | 92 BrowserPluginGuestDelegate* delegate); |
(...skipping 49 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
142 void UpdateVisibility(); | 142 void UpdateVisibility(); |
143 | 143 |
144 void CopyFromCompositingSurface( | 144 void CopyFromCompositingSurface( |
145 gfx::Rect src_subrect, | 145 gfx::Rect src_subrect, |
146 gfx::Size dst_size, | 146 gfx::Size dst_size, |
147 const base::Callback<void(bool, const SkBitmap&)>& callback); | 147 const base::Callback<void(bool, const SkBitmap&)>& callback); |
148 | 148 |
149 BrowserPluginGuestManager* GetBrowserPluginGuestManager() const; | 149 BrowserPluginGuestManager* GetBrowserPluginGuestManager() const; |
150 | 150 |
151 // WebContentsObserver implementation. | 151 // WebContentsObserver implementation. |
152 virtual void DidCommitProvisionalLoadForFrame( | 152 void DidCommitProvisionalLoadForFrame( |
153 RenderFrameHost* render_frame_host, | 153 RenderFrameHost* render_frame_host, |
154 const GURL& url, | 154 const GURL& url, |
155 ui::PageTransition transition_type) override; | 155 ui::PageTransition transition_type) override; |
156 | 156 |
157 virtual void RenderViewReady() override; | 157 void RenderViewReady() override; |
158 virtual void RenderProcessGone(base::TerminationStatus status) override; | 158 void RenderProcessGone(base::TerminationStatus status) override; |
159 virtual bool OnMessageReceived(const IPC::Message& message) override; | 159 bool OnMessageReceived(const IPC::Message& message) override; |
160 virtual bool OnMessageReceived(const IPC::Message& message, | 160 bool OnMessageReceived(const IPC::Message& message, |
161 RenderFrameHost* render_frame_host) override; | 161 RenderFrameHost* render_frame_host) override; |
162 | 162 |
163 // Exposes the protected web_contents() from WebContentsObserver. | 163 // Exposes the protected web_contents() from WebContentsObserver. |
164 WebContentsImpl* GetWebContents() const; | 164 WebContentsImpl* GetWebContents() const; |
165 | 165 |
166 gfx::Point GetScreenCoordinates(const gfx::Point& relative_position) const; | 166 gfx::Point GetScreenCoordinates(const gfx::Point& relative_position) const; |
167 | 167 |
168 // Helper to send messages to embedder. This methods fills the message with | 168 // Helper to send messages to embedder. This methods fills the message with |
169 // the correct routing id. | 169 // the correct routing id. |
170 void SendMessageToEmbedder(IPC::Message* msg); | 170 void SendMessageToEmbedder(IPC::Message* msg); |
171 | 171 |
(...skipping 214 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
386 // Weak pointer used to ask GeolocationPermissionContext about geolocation | 386 // Weak pointer used to ask GeolocationPermissionContext about geolocation |
387 // permission. | 387 // permission. |
388 base::WeakPtrFactory<BrowserPluginGuest> weak_ptr_factory_; | 388 base::WeakPtrFactory<BrowserPluginGuest> weak_ptr_factory_; |
389 | 389 |
390 DISALLOW_COPY_AND_ASSIGN(BrowserPluginGuest); | 390 DISALLOW_COPY_AND_ASSIGN(BrowserPluginGuest); |
391 }; | 391 }; |
392 | 392 |
393 } // namespace content | 393 } // namespace content |
394 | 394 |
395 #endif // CONTENT_BROWSER_BROWSER_PLUGIN_BROWSER_PLUGIN_GUEST_H_ | 395 #endif // CONTENT_BROWSER_BROWSER_PLUGIN_BROWSER_PLUGIN_GUEST_H_ |
OLD | NEW |