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 118 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
129 guest_web_contents = GetBrowserPluginGuestManager()->CreateGuest( | 129 guest_web_contents = GetBrowserPluginGuestManager()->CreateGuest( |
130 GetWebContents()->GetSiteInstance(), | 130 GetWebContents()->GetSiteInstance(), |
131 instance_id, | 131 instance_id, |
132 copy_extra_params.Pass()); | 132 copy_extra_params.Pass()); |
133 guest = guest_web_contents | 133 guest = guest_web_contents |
134 ? static_cast<WebContentsImpl*>(guest_web_contents) | 134 ? static_cast<WebContentsImpl*>(guest_web_contents) |
135 ->GetBrowserPluginGuest() | 135 ->GetBrowserPluginGuest() |
136 : NULL; | 136 : NULL; |
137 } | 137 } |
138 | 138 |
139 if (guest) { | 139 if (guest) |
140 // There is an implicit order expectation here: | |
141 // 1. The content embedder is made aware of the attachment. | |
142 // 2. BrowserPluginGuest::Attach is called. | |
143 // 3. The content embedder issues queued events if any that happened | |
144 // prior to attachment. | |
145 GetContentClient()->browser()->GuestWebContentsAttached( | |
146 guest->GetWebContents(), | |
147 GetWebContents(), | |
148 *extra_params); | |
149 guest->Attach(GetWebContents(), params, *extra_params); | 140 guest->Attach(GetWebContents(), params, *extra_params); |
150 } | |
151 } | 141 } |
152 | 142 |
153 void BrowserPluginEmbedder::OnAttach( | 143 void BrowserPluginEmbedder::OnAttach( |
154 int instance_id, | 144 int instance_id, |
155 const BrowserPluginHostMsg_Attach_Params& params, | 145 const BrowserPluginHostMsg_Attach_Params& params, |
156 const base::DictionaryValue& extra_params) { | 146 const base::DictionaryValue& extra_params) { |
157 GetBrowserPluginGuestManager()->MaybeGetGuestByInstanceIDOrKill( | 147 GetBrowserPluginGuestManager()->MaybeGetGuestByInstanceIDOrKill( |
158 instance_id, GetWebContents()->GetRenderProcessHost()->GetID(), | 148 instance_id, GetWebContents()->GetRenderProcessHost()->GetID(), |
159 base::Bind(&BrowserPluginEmbedder::OnGuestCallback, | 149 base::Bind(&BrowserPluginEmbedder::OnGuestCallback, |
160 base::Unretained(this), | 150 base::Unretained(this), |
161 instance_id, | 151 instance_id, |
162 params, | 152 params, |
163 &extra_params)); | 153 &extra_params)); |
164 } | 154 } |
165 | 155 |
166 } // namespace content | 156 } // namespace content |
OLD | NEW |