| 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/renderer_host/render_view_host_impl.h" | 9 #include "content/browser/renderer_host/render_view_host_impl.h" | 
| 10 #include "content/browser/web_contents/web_contents_impl.h" | 10 #include "content/browser/web_contents/web_contents_impl.h" | 
| (...skipping 105 matching lines...) Expand 10 before | Expand all | Expand 10 after  Loading... | 
| 116 } | 116 } | 
| 117 | 117 | 
| 118 void BrowserPluginEmbedder::OnGuestCallback( | 118 void BrowserPluginEmbedder::OnGuestCallback( | 
| 119     int instance_id, | 119     int instance_id, | 
| 120     const BrowserPluginHostMsg_Attach_Params& params, | 120     const BrowserPluginHostMsg_Attach_Params& params, | 
| 121     const base::DictionaryValue* extra_params, | 121     const base::DictionaryValue* extra_params, | 
| 122     WebContents* guest_web_contents) { | 122     WebContents* guest_web_contents) { | 
| 123   BrowserPluginGuest* guest = guest_web_contents ? | 123   BrowserPluginGuest* guest = guest_web_contents ? | 
| 124       static_cast<WebContentsImpl*>(guest_web_contents)-> | 124       static_cast<WebContentsImpl*>(guest_web_contents)-> | 
| 125           GetBrowserPluginGuest() : NULL; | 125           GetBrowserPluginGuest() : NULL; | 
| 126   if (!guest) { |  | 
| 127     scoped_ptr<base::DictionaryValue> copy_extra_params( |  | 
| 128         extra_params->DeepCopy()); |  | 
| 129     guest_web_contents = GetBrowserPluginGuestManager()->CreateGuest( |  | 
| 130         GetWebContents()->GetSiteInstance(), |  | 
| 131         instance_id, |  | 
| 132         copy_extra_params.Pass()); |  | 
| 133     guest = guest_web_contents |  | 
| 134                 ? static_cast<WebContentsImpl*>(guest_web_contents) |  | 
| 135                       ->GetBrowserPluginGuest() |  | 
| 136                 : NULL; |  | 
| 137   } |  | 
| 138 |  | 
| 139   if (guest) | 126   if (guest) | 
| 140     guest->Attach(GetWebContents(), params, *extra_params); | 127     guest->Attach(GetWebContents(), params, *extra_params); | 
| 141 } | 128 } | 
| 142 | 129 | 
| 143 void BrowserPluginEmbedder::OnAttach( | 130 void BrowserPluginEmbedder::OnAttach( | 
| 144     int instance_id, | 131     int instance_id, | 
| 145     const BrowserPluginHostMsg_Attach_Params& params, | 132     const BrowserPluginHostMsg_Attach_Params& params, | 
| 146     const base::DictionaryValue& extra_params) { | 133     const base::DictionaryValue& extra_params) { | 
| 147   GetBrowserPluginGuestManager()->MaybeGetGuestByInstanceIDOrKill( | 134   GetBrowserPluginGuestManager()->MaybeGetGuestByInstanceIDOrKill( | 
| 148       instance_id, GetWebContents()->GetRenderProcessHost()->GetID(), | 135       instance_id, GetWebContents()->GetRenderProcessHost()->GetID(), | 
| 149       base::Bind(&BrowserPluginEmbedder::OnGuestCallback, | 136       base::Bind(&BrowserPluginEmbedder::OnGuestCallback, | 
| 150                  base::Unretained(this), | 137                  base::Unretained(this), | 
| 151                  instance_id, | 138                  instance_id, | 
| 152                  params, | 139                  params, | 
| 153                  &extra_params)); | 140                  &extra_params)); | 
| 154 } | 141 } | 
| 155 | 142 | 
| 156 }  // namespace content | 143 }  // namespace content | 
| OLD | NEW | 
|---|