| 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 60 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 71 return NULL; | 71 return NULL; |
| 72 } | 72 } |
| 73 | 73 |
| 74 void BrowserPluginEmbedder::AddGuest(int instance_id, | 74 void BrowserPluginEmbedder::AddGuest(int instance_id, |
| 75 WebContents* guest_web_contents) { | 75 WebContents* guest_web_contents) { |
| 76 DCHECK(guest_web_contents_by_instance_id_.find(instance_id) == | 76 DCHECK(guest_web_contents_by_instance_id_.find(instance_id) == |
| 77 guest_web_contents_by_instance_id_.end()); | 77 guest_web_contents_by_instance_id_.end()); |
| 78 guest_web_contents_by_instance_id_[instance_id] = guest_web_contents; | 78 guest_web_contents_by_instance_id_[instance_id] = guest_web_contents; |
| 79 } | 79 } |
| 80 | 80 |
| 81 void BrowserPluginEmbedder::CreateGuest(RenderViewHost* render_view_host, | 81 void BrowserPluginEmbedder::CreateGuest( |
| 82 int instance_id, | 82 RenderViewHost* render_view_host, |
| 83 std::string storage_partition_id, | 83 int instance_id, |
| 84 bool persist_storage, | 84 const BrowserPluginHostMsg_CreateGuest_Params& params) { |
| 85 bool focused, | |
| 86 bool visible) { | |
| 87 WebContentsImpl* guest_web_contents = NULL; | 85 WebContentsImpl* guest_web_contents = NULL; |
| 88 BrowserPluginGuest* guest = GetGuestByInstanceID(instance_id); | 86 BrowserPluginGuest* guest = GetGuestByInstanceID(instance_id); |
| 89 CHECK(!guest); | 87 CHECK(!guest); |
| 90 | 88 |
| 91 const std::string& host = | 89 const std::string& host = |
| 92 render_view_host->GetSiteInstance()->GetSiteURL().host(); | 90 render_view_host->GetSiteInstance()->GetSiteURL().host(); |
| 93 guest_web_contents = WebContentsImpl::CreateGuest( | 91 guest_web_contents = WebContentsImpl::CreateGuest( |
| 94 web_contents()->GetBrowserContext(), | 92 web_contents()->GetBrowserContext(), |
| 95 host, | 93 host, |
| 96 instance_id, | 94 instance_id, |
| 97 focused, | 95 params); |
| 98 visible); | |
| 99 | 96 |
| 100 guest = guest_web_contents->GetBrowserPluginGuest(); | 97 guest = guest_web_contents->GetBrowserPluginGuest(); |
| 101 guest->set_embedder_web_contents( | 98 guest->set_embedder_web_contents( |
| 102 static_cast<WebContentsImpl*>(web_contents())); | 99 static_cast<WebContentsImpl*>(web_contents())); |
| 103 | 100 |
| 104 RendererPreferences* guest_renderer_prefs = | 101 RendererPreferences* guest_renderer_prefs = |
| 105 guest_web_contents->GetMutableRendererPrefs(); | 102 guest_web_contents->GetMutableRendererPrefs(); |
| 106 // Copy renderer preferences (and nothing else) from the embedder's | 103 // Copy renderer preferences (and nothing else) from the embedder's |
| 107 // TabContents to the guest. | 104 // TabContents to the guest. |
| 108 // | 105 // |
| (...skipping 225 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 334 bool visible = *Details<bool>(details).ptr(); | 331 bool visible = *Details<bool>(details).ptr(); |
| 335 WebContentsVisibilityChanged(visible); | 332 WebContentsVisibilityChanged(visible); |
| 336 break; | 333 break; |
| 337 } | 334 } |
| 338 default: | 335 default: |
| 339 NOTREACHED() << "Unexpected notification type: " << type; | 336 NOTREACHED() << "Unexpected notification type: " << type; |
| 340 } | 337 } |
| 341 } | 338 } |
| 342 | 339 |
| 343 } // namespace content | 340 } // namespace content |
| OLD | NEW |