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 98 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
109 guest_started_drag_->EndSystemDrag(); | 109 guest_started_drag_->EndSystemDrag(); |
110 guest_started_drag_.reset(); | 110 guest_started_drag_.reset(); |
111 guest_dragging_over_.reset(); | 111 guest_dragging_over_.reset(); |
112 } | 112 } |
113 | 113 |
114 void BrowserPluginEmbedder::OnUpdateDragCursor(bool* handled) { | 114 void BrowserPluginEmbedder::OnUpdateDragCursor(bool* handled) { |
115 *handled = (guest_dragging_over_.get() != NULL); | 115 *handled = (guest_dragging_over_.get() != NULL); |
116 } | 116 } |
117 | 117 |
118 void BrowserPluginEmbedder::OnGuestCallback( | 118 void BrowserPluginEmbedder::OnGuestCallback( |
119 int instance_id, | 119 int browser_plugin_instance_id, |
120 const BrowserPluginHostMsg_Attach_Params& params, | 120 const BrowserPluginHostMsg_Attach_Params& params, |
121 const base::DictionaryValue* extra_params, | |
122 WebContents* guest_web_contents) { | 121 WebContents* guest_web_contents) { |
123 BrowserPluginGuest* guest = guest_web_contents ? | 122 BrowserPluginGuest* guest = guest_web_contents ? |
124 static_cast<WebContentsImpl*>(guest_web_contents)-> | 123 static_cast<WebContentsImpl*>(guest_web_contents)-> |
125 GetBrowserPluginGuest() : NULL; | 124 GetBrowserPluginGuest() : NULL; |
126 if (guest) | 125 if (guest) |
127 guest->Attach(GetWebContents(), params, *extra_params); | 126 guest->Attach(browser_plugin_instance_id, GetWebContents(), params); |
128 } | 127 } |
129 | 128 |
130 void BrowserPluginEmbedder::OnAttach( | 129 void BrowserPluginEmbedder::OnAttach( |
131 int instance_id, | 130 int browser_plugin_instance_id, |
132 const BrowserPluginHostMsg_Attach_Params& params, | 131 const BrowserPluginHostMsg_Attach_Params& params) { |
133 const base::DictionaryValue& extra_params) { | 132 int embedder_render_process_id = |
| 133 GetWebContents()->GetRenderProcessHost()->GetID(); |
| 134 int guest_instance_id = |
| 135 GetBrowserPluginGuestManager()->GetGuestInstanceIDForPluginID( |
| 136 GetWebContents(), browser_plugin_instance_id); |
134 GetBrowserPluginGuestManager()->MaybeGetGuestByInstanceIDOrKill( | 137 GetBrowserPluginGuestManager()->MaybeGetGuestByInstanceIDOrKill( |
135 instance_id, GetWebContents()->GetRenderProcessHost()->GetID(), | 138 guest_instance_id, |
| 139 embedder_render_process_id, |
136 base::Bind(&BrowserPluginEmbedder::OnGuestCallback, | 140 base::Bind(&BrowserPluginEmbedder::OnGuestCallback, |
137 base::Unretained(this), | 141 base::Unretained(this), |
138 instance_id, | 142 browser_plugin_instance_id, |
139 params, | 143 params)); |
140 &extra_params)); | |
141 } | 144 } |
142 | 145 |
143 } // namespace content | 146 } // namespace content |
OLD | NEW |