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 58 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
69 // A browser plugin guest provides functionality for WebContents to operate in | 69 // A browser plugin guest provides functionality for WebContents to operate in |
70 // the guest role and implements guest-specific overrides for ViewHostMsg_* | 70 // the guest role and implements guest-specific overrides for ViewHostMsg_* |
71 // messages. | 71 // messages. |
72 // | 72 // |
73 // When a guest is initially created, it is in an unattached state. That is, | 73 // When a guest is initially created, it is in an unattached state. That is, |
74 // it is not visible anywhere and has no embedder WebContents assigned. | 74 // it is not visible anywhere and has no embedder WebContents assigned. |
75 // A BrowserPluginGuest is said to be "attached" if it has an embedder. | 75 // A BrowserPluginGuest is said to be "attached" if it has an embedder. |
76 // A BrowserPluginGuest can also create a new unattached guest via | 76 // A BrowserPluginGuest can also create a new unattached guest via |
77 // CreateNewWindow. The newly created guest will live in the same partition, | 77 // CreateNewWindow. The newly created guest will live in the same partition, |
78 // which means it can share storage and can script this guest. | 78 // which means it can share storage and can script this guest. |
79 class CONTENT_EXPORT BrowserPluginGuest | 79 class CONTENT_EXPORT BrowserPluginGuest |
lazyboy
2014/05/23 16:06:09
nit: can fit in one line
Fady Samuel
2014/05/23 16:34:08
Done.
| |
80 : public WebContentsDelegate, | 80 : public WebContentsObserver { |
81 public WebContentsObserver { | |
82 public: | 81 public: |
83 virtual ~BrowserPluginGuest(); | 82 virtual ~BrowserPluginGuest(); |
84 | 83 |
85 // The WebContents passed into the factory method here has not been | 84 // The WebContents passed into the factory method here has not been |
86 // initialized yet and so it does not yet hold a SiteInstance. | 85 // initialized yet and so it does not yet hold a SiteInstance. |
87 // BrowserPluginGuest must be constructed and installed into a WebContents | 86 // BrowserPluginGuest must be constructed and installed into a WebContents |
88 // prior to its initialization because WebContents needs to determine what | 87 // prior to its initialization because WebContents needs to determine what |
89 // type of WebContentsView to construct on initialization. The content | 88 // type of WebContentsView to construct on initialization. The content |
90 // 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 |
91 // construction and so we pass it in here. | 90 // construction and so we pass it in here. |
(...skipping 62 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
154 bool is_main_frame, | 153 bool is_main_frame, |
155 const GURL& url, | 154 const GURL& url, |
156 PageTransition transition_type, | 155 PageTransition transition_type, |
157 RenderViewHost* render_view_host) OVERRIDE; | 156 RenderViewHost* render_view_host) OVERRIDE; |
158 virtual void DidStopLoading(RenderViewHost* render_view_host) OVERRIDE; | 157 virtual void DidStopLoading(RenderViewHost* render_view_host) OVERRIDE; |
159 | 158 |
160 virtual void RenderViewReady() OVERRIDE; | 159 virtual void RenderViewReady() OVERRIDE; |
161 virtual void RenderProcessGone(base::TerminationStatus status) OVERRIDE; | 160 virtual void RenderProcessGone(base::TerminationStatus status) OVERRIDE; |
162 virtual bool OnMessageReceived(const IPC::Message& message) OVERRIDE; | 161 virtual bool OnMessageReceived(const IPC::Message& message) OVERRIDE; |
163 | 162 |
164 // WebContentsDelegate implementation. | |
165 virtual bool AddMessageToConsole(WebContents* source, | |
166 int32 level, | |
167 const base::string16& message, | |
168 int32 line_no, | |
169 const base::string16& source_id) OVERRIDE; | |
170 // If a new window is created with target="_blank" and rel="noreferrer", then | |
171 // this method is called, indicating that the new WebContents is ready to be | |
172 // attached. | |
173 virtual void AddNewContents(WebContents* source, | |
174 WebContents* new_contents, | |
175 WindowOpenDisposition disposition, | |
176 const gfx::Rect& initial_pos, | |
177 bool user_gesture, | |
178 bool* was_blocked) OVERRIDE; | |
179 virtual void CanDownload(RenderViewHost* render_view_host, | |
180 const GURL& url, | |
181 const std::string& request_method, | |
182 const base::Callback<void(bool)>& callback) OVERRIDE; | |
183 virtual void LoadProgressChanged(WebContents* source, | |
184 double progress) OVERRIDE; | |
185 virtual void CloseContents(WebContents* source) OVERRIDE; | |
186 virtual JavaScriptDialogManager* GetJavaScriptDialogManager() OVERRIDE; | |
187 virtual ColorChooser* OpenColorChooser( | |
188 WebContents* web_contents, | |
189 SkColor color, | |
190 const std::vector<ColorSuggestion>& suggestions) OVERRIDE; | |
191 virtual bool HandleContextMenu(const ContextMenuParams& params) OVERRIDE; | |
192 virtual void HandleKeyboardEvent( | |
193 WebContents* source, | |
194 const NativeWebKeyboardEvent& event) OVERRIDE; | |
195 virtual void FindReply(WebContents* contents, | |
196 int request_id, | |
197 int number_of_matches, | |
198 const gfx::Rect& selection_rect, | |
199 int active_match_ordinal, | |
200 bool final_update) OVERRIDE; | |
201 virtual WebContents* OpenURLFromTab(WebContents* source, | |
202 const OpenURLParams& params) OVERRIDE; | |
203 virtual void WebContentsCreated(WebContents* source_contents, | |
204 int opener_render_frame_id, | |
205 const base::string16& frame_name, | |
206 const GURL& target_url, | |
207 WebContents* new_contents) OVERRIDE; | |
208 virtual void RendererUnresponsive(WebContents* source) OVERRIDE; | |
209 virtual void RendererResponsive(WebContents* source) OVERRIDE; | |
210 virtual void RunFileChooser(WebContents* web_contents, | |
211 const FileChooserParams& params) OVERRIDE; | |
212 virtual bool ShouldFocusPageAfterCrash() OVERRIDE; | |
213 virtual void RequestMediaAccessPermission( | |
214 WebContents* web_contents, | |
215 const MediaStreamRequest& request, | |
216 const MediaResponseCallback& callback) OVERRIDE; | |
217 virtual bool PreHandleGestureEvent( | |
218 content::WebContents* source, | |
219 const blink::WebGestureEvent& event) OVERRIDE; | |
220 | |
221 // Exposes the protected web_contents() from WebContentsObserver. | 163 // Exposes the protected web_contents() from WebContentsObserver. |
222 WebContentsImpl* GetWebContents() const; | 164 WebContentsImpl* GetWebContents() const; |
223 | 165 |
224 gfx::Point GetScreenCoordinates(const gfx::Point& relative_position) const; | 166 gfx::Point GetScreenCoordinates(const gfx::Point& relative_position) const; |
225 | 167 |
226 // 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 |
227 // the correct routing id. | 169 // the correct routing id. |
228 // Overridden in test implementation since we want to intercept certain | 170 // Overridden in test implementation since we want to intercept certain |
229 // messages for testing. | 171 // messages for testing. |
230 virtual void SendMessageToEmbedder(IPC::Message* msg); | 172 virtual void SendMessageToEmbedder(IPC::Message* msg); |
(...skipping 225 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
456 // Weak pointer used to ask GeolocationPermissionContext about geolocation | 398 // Weak pointer used to ask GeolocationPermissionContext about geolocation |
457 // permission. | 399 // permission. |
458 base::WeakPtrFactory<BrowserPluginGuest> weak_ptr_factory_; | 400 base::WeakPtrFactory<BrowserPluginGuest> weak_ptr_factory_; |
459 | 401 |
460 DISALLOW_COPY_AND_ASSIGN(BrowserPluginGuest); | 402 DISALLOW_COPY_AND_ASSIGN(BrowserPluginGuest); |
461 }; | 403 }; |
462 | 404 |
463 } // namespace content | 405 } // namespace content |
464 | 406 |
465 #endif // CONTENT_BROWSER_BROWSER_PLUGIN_BROWSER_PLUGIN_GUEST_H_ | 407 #endif // CONTENT_BROWSER_BROWSER_PLUGIN_BROWSER_PLUGIN_GUEST_H_ |
OLD | NEW |