| 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 <set> | 7 #include <set> |
| 8 | 8 |
| 9 #include "base/logging.h" | 9 #include "base/logging.h" |
| 10 #include "base/stl_util.h" | 10 #include "base/stl_util.h" |
| (...skipping 77 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 88 | 88 |
| 89 const std::string& host = | 89 const std::string& host = |
| 90 render_view_host->GetSiteInstance()->GetSiteURL().host(); | 90 render_view_host->GetSiteInstance()->GetSiteURL().host(); |
| 91 guest_web_contents = WebContentsImpl::CreateGuest( | 91 guest_web_contents = WebContentsImpl::CreateGuest( |
| 92 web_contents()->GetBrowserContext(), | 92 web_contents()->GetBrowserContext(), |
| 93 host, | 93 host, |
| 94 instance_id); | 94 instance_id); |
| 95 | 95 |
| 96 guest = guest_web_contents->GetBrowserPluginGuest(); | 96 guest = guest_web_contents->GetBrowserPluginGuest(); |
| 97 guest->set_embedder_render_process_host(render_view_host->GetProcess()); | 97 guest->set_embedder_render_process_host(render_view_host->GetProcess()); |
| 98 guest->set_embedder_render_view_host(render_view_host); |
| 98 | 99 |
| 99 RendererPreferences* guest_renderer_prefs = | 100 RendererPreferences* guest_renderer_prefs = |
| 100 guest_web_contents->GetMutableRendererPrefs(); | 101 guest_web_contents->GetMutableRendererPrefs(); |
| 101 // Copy renderer preferences (and nothing else) from the embedder's | 102 // Copy renderer preferences (and nothing else) from the embedder's |
| 102 // TabContents to the guest. | 103 // TabContents to the guest. |
| 103 // | 104 // |
| 104 // For GTK and Aura this is necessary to get proper renderer configuration | 105 // For GTK and Aura this is necessary to get proper renderer configuration |
| 105 // values for caret blinking interval, colors related to selection and | 106 // values for caret blinking interval, colors related to selection and |
| 106 // focus. | 107 // focus. |
| 107 *guest_renderer_prefs = *web_contents()->GetMutableRendererPrefs(); | 108 *guest_renderer_prefs = *web_contents()->GetMutableRendererPrefs(); |
| (...skipping 157 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 265 DestroyGuestByInstanceID(instance_id); | 266 DestroyGuestByInstanceID(instance_id); |
| 266 } | 267 } |
| 267 | 268 |
| 268 void BrowserPluginEmbedder::SetGuestVisibility(int instance_id, | 269 void BrowserPluginEmbedder::SetGuestVisibility(int instance_id, |
| 269 bool guest_visible) { | 270 bool guest_visible) { |
| 270 BrowserPluginGuest* guest = GetGuestByInstanceID(instance_id); | 271 BrowserPluginGuest* guest = GetGuestByInstanceID(instance_id); |
| 271 if (guest) | 272 if (guest) |
| 272 guest->SetVisibility(visible_, guest_visible); | 273 guest->SetVisibility(visible_, guest_visible); |
| 273 } | 274 } |
| 274 | 275 |
| 276 void BrowserPluginEmbedder::DragStatusUpdate( |
| 277 int instance_id, |
| 278 WebKit::WebDragStatus drag_status, |
| 279 const WebDropData& drop_data, |
| 280 WebKit::WebDragOperationsMask drag_mask, |
| 281 const gfx::Point& location) { |
| 282 BrowserPluginGuest* guest = GetGuestByInstanceID(instance_id); |
| 283 if (guest) |
| 284 guest->DragStatusUpdate(drag_status, drop_data, drag_mask, location); |
| 285 } |
| 286 |
| 275 void BrowserPluginEmbedder::Go(int instance_id, int relative_index) { | 287 void BrowserPluginEmbedder::Go(int instance_id, int relative_index) { |
| 276 BrowserPluginGuest* guest = GetGuestByInstanceID(instance_id); | 288 BrowserPluginGuest* guest = GetGuestByInstanceID(instance_id); |
| 277 if (guest) | 289 if (guest) |
| 278 guest->Go(relative_index); | 290 guest->Go(relative_index); |
| 279 } | 291 } |
| 280 | 292 |
| 281 void BrowserPluginEmbedder::Stop(int instance_id) { | 293 void BrowserPluginEmbedder::Stop(int instance_id) { |
| 282 BrowserPluginGuest* guest = GetGuestByInstanceID(instance_id); | 294 BrowserPluginGuest* guest = GetGuestByInstanceID(instance_id); |
| 283 if (guest) | 295 if (guest) |
| 284 guest->Stop(); | 296 guest->Stop(); |
| (...skipping 19 matching lines...) Expand all Loading... |
| 304 bool visible = *Details<bool>(details).ptr(); | 316 bool visible = *Details<bool>(details).ptr(); |
| 305 WebContentsVisibilityChanged(visible); | 317 WebContentsVisibilityChanged(visible); |
| 306 break; | 318 break; |
| 307 } | 319 } |
| 308 default: | 320 default: |
| 309 NOTREACHED() << "Unexpected notification type: " << type; | 321 NOTREACHED() << "Unexpected notification type: " << type; |
| 310 } | 322 } |
| 311 } | 323 } |
| 312 | 324 |
| 313 } // namespace content | 325 } // namespace content |
| OLD | NEW |