Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(1402)

Side by Side Diff: content/browser/browser_plugin/browser_plugin_embedder.cc

Issue 23530029: Support webview tag when the container extension is embedded in a webUI (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Removed unnecessary lines from document_custom_bindings Created 7 years, 3 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
OLDNEW
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 #include "content/browser/browser_plugin/browser_plugin_embedder.h" 5 #include "content/browser/browser_plugin/browser_plugin_embedder.h"
6 6
7 #include "base/values.h" 7 #include "base/values.h"
8 #include "content/browser/browser_plugin/browser_plugin_guest.h" 8 #include "content/browser/browser_plugin/browser_plugin_guest.h"
9 #include "content/browser/browser_plugin/browser_plugin_guest_manager.h" 9 #include "content/browser/browser_plugin/browser_plugin_guest_manager.h"
10 #include "content/browser/browser_plugin/browser_plugin_host_factory.h" 10 #include "content/browser/browser_plugin/browser_plugin_host_factory.h"
(...skipping 169 matching lines...) Expand 10 before | Expand all | Expand 10 after
180 180
181 if (guest) { 181 if (guest) {
182 // There is an implicit order expectation here: 182 // There is an implicit order expectation here:
183 // 1. The content embedder is made aware of the attachment. 183 // 1. The content embedder is made aware of the attachment.
184 // 2. BrowserPluginGuest::Attach is called. 184 // 2. BrowserPluginGuest::Attach is called.
185 // 3. The content embedder issues queued events if any that happened 185 // 3. The content embedder issues queued events if any that happened
186 // prior to attachment. 186 // prior to attachment.
187 GetContentClient()->browser()->GuestWebContentsAttached( 187 GetContentClient()->browser()->GuestWebContentsAttached(
188 guest->GetWebContents(), 188 guest->GetWebContents(),
189 web_contents(), 189 web_contents(),
190 GURL(params.embedder_frame_url),
Charlie Reis 2013/09/13 21:17:24 URLs received from the renderer should be passed t
guohui 2013/09/16 22:27:02 Done.
Charlie Reis 2013/09/18 17:42:23 Great, thanks!
guohui 2013/09/19 13:48:41 Done.
190 extra_params); 191 extra_params);
191 guest->Attach(static_cast<WebContentsImpl*>(web_contents()), params); 192 guest->Attach(static_cast<WebContentsImpl*>(web_contents()), params);
192 return; 193 return;
193 } 194 }
194 195
195 scoped_ptr<base::DictionaryValue> copy_extra_params(extra_params.DeepCopy()); 196 scoped_ptr<base::DictionaryValue> copy_extra_params(extra_params.DeepCopy());
196 guest = GetBrowserPluginGuestManager()->CreateGuest( 197 guest = GetBrowserPluginGuestManager()->CreateGuest(
197 web_contents()->GetSiteInstance(), 198 web_contents()->GetSiteInstance(),
198 instance_id, params, 199 instance_id, params,
199 copy_extra_params.Pass()); 200 copy_extra_params.Pass());
200 if (guest) { 201 if (guest) {
201 GetContentClient()->browser()->GuestWebContentsAttached( 202 GetContentClient()->browser()->GuestWebContentsAttached(
202 guest->GetWebContents(), 203 guest->GetWebContents(),
203 web_contents(), 204 web_contents(),
205 GURL(params.embedder_frame_url),
204 extra_params); 206 extra_params);
205 guest->Initialize(static_cast<WebContentsImpl*>(web_contents()), params); 207 guest->Initialize(static_cast<WebContentsImpl*>(web_contents()), params);
206 } 208 }
207 } 209 }
208 210
209 void BrowserPluginEmbedder::OnPluginAtPositionResponse( 211 void BrowserPluginEmbedder::OnPluginAtPositionResponse(
210 int instance_id, int request_id, const gfx::Point& position) { 212 int instance_id, int request_id, const gfx::Point& position) {
211 const std::map<int, WebContents::GetRenderViewHostCallback>::iterator 213 const std::map<int, WebContents::GetRenderViewHostCallback>::iterator
212 callback_iter = pending_get_render_view_callbacks_.find(request_id); 214 callback_iter = pending_get_render_view_callbacks_.find(request_id);
213 if (callback_iter == pending_get_render_view_callbacks_.end()) 215 if (callback_iter == pending_get_render_view_callbacks_.end())
214 return; 216 return;
215 217
216 RenderViewHost* render_view_host; 218 RenderViewHost* render_view_host;
217 BrowserPluginGuest* guest = NULL; 219 BrowserPluginGuest* guest = NULL;
218 if (instance_id != browser_plugin::kInstanceIDNone) { 220 if (instance_id != browser_plugin::kInstanceIDNone) {
219 guest = GetBrowserPluginGuestManager()->GetGuestByInstanceID( 221 guest = GetBrowserPluginGuestManager()->GetGuestByInstanceID(
220 instance_id, web_contents()->GetRenderProcessHost()->GetID()); 222 instance_id, web_contents()->GetRenderProcessHost()->GetID());
221 } 223 }
222 224
223 if (guest) 225 if (guest)
224 render_view_host = guest->GetWebContents()->GetRenderViewHost(); 226 render_view_host = guest->GetWebContents()->GetRenderViewHost();
225 else // No plugin, use embedder's RenderViewHost. 227 else // No plugin, use embedder's RenderViewHost.
226 render_view_host = web_contents()->GetRenderViewHost(); 228 render_view_host = web_contents()->GetRenderViewHost();
227 229
228 callback_iter->second.Run(render_view_host, position.x(), position.y()); 230 callback_iter->second.Run(render_view_host, position.x(), position.y());
229 pending_get_render_view_callbacks_.erase(callback_iter); 231 pending_get_render_view_callbacks_.erase(callback_iter);
230 } 232 }
231 233
232 } // namespace content 234 } // namespace content
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698