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 #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 185 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
196 scoped_ptr<base::DictionaryValue> copy_extra_params(extra_params.DeepCopy()); | 196 scoped_ptr<base::DictionaryValue> copy_extra_params(extra_params.DeepCopy()); |
197 guest = GetBrowserPluginGuestManager()->CreateGuest( | 197 guest = GetBrowserPluginGuestManager()->CreateGuest( |
198 web_contents()->GetSiteInstance(), | 198 web_contents()->GetSiteInstance(), |
199 instance_id, params, | 199 instance_id, params, |
200 copy_extra_params.Pass()); | 200 copy_extra_params.Pass()); |
201 if (guest) { | 201 if (guest) { |
202 GetContentClient()->browser()->GuestWebContentsAttached( | 202 GetContentClient()->browser()->GuestWebContentsAttached( |
203 guest->GetWebContents(), | 203 guest->GetWebContents(), |
204 web_contents(), | 204 web_contents(), |
205 extra_params); | 205 extra_params); |
206 guest->Initialize(static_cast<WebContentsImpl*>(web_contents()), params); | 206 guest->Initialize(params, static_cast<WebContentsImpl*>(web_contents())); |
207 } | 207 } |
208 } | 208 } |
209 | 209 |
210 void BrowserPluginEmbedder::OnPluginAtPositionResponse( | 210 void BrowserPluginEmbedder::OnPluginAtPositionResponse( |
211 int instance_id, int request_id, const gfx::Point& position) { | 211 int instance_id, int request_id, const gfx::Point& position) { |
212 const std::map<int, WebContents::GetRenderViewHostCallback>::iterator | 212 const std::map<int, WebContents::GetRenderViewHostCallback>::iterator |
213 callback_iter = pending_get_render_view_callbacks_.find(request_id); | 213 callback_iter = pending_get_render_view_callbacks_.find(request_id); |
214 if (callback_iter == pending_get_render_view_callbacks_.end()) | 214 if (callback_iter == pending_get_render_view_callbacks_.end()) |
215 return; | 215 return; |
216 | 216 |
217 RenderViewHost* render_view_host; | 217 RenderViewHost* render_view_host; |
218 BrowserPluginGuest* guest = NULL; | 218 BrowserPluginGuest* guest = NULL; |
219 if (instance_id != browser_plugin::kInstanceIDNone) { | 219 if (instance_id != browser_plugin::kInstanceIDNone) { |
220 guest = GetBrowserPluginGuestManager()->GetGuestByInstanceID( | 220 guest = GetBrowserPluginGuestManager()->GetGuestByInstanceID( |
221 instance_id, web_contents()->GetRenderProcessHost()->GetID()); | 221 instance_id, web_contents()->GetRenderProcessHost()->GetID()); |
222 } | 222 } |
223 | 223 |
224 if (guest) | 224 if (guest) |
225 render_view_host = guest->GetWebContents()->GetRenderViewHost(); | 225 render_view_host = guest->GetWebContents()->GetRenderViewHost(); |
226 else // No plugin, use embedder's RenderViewHost. | 226 else // No plugin, use embedder's RenderViewHost. |
227 render_view_host = web_contents()->GetRenderViewHost(); | 227 render_view_host = web_contents()->GetRenderViewHost(); |
228 | 228 |
229 callback_iter->second.Run(render_view_host, position.x(), position.y()); | 229 callback_iter->second.Run(render_view_host, position.x(), position.y()); |
230 pending_get_render_view_callbacks_.erase(callback_iter); | 230 pending_get_render_view_callbacks_.erase(callback_iter); |
231 } | 231 } |
232 | 232 |
233 } // namespace content | 233 } // namespace content |
OLD | NEW |