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/web_contents/web_contents_impl.h" | 5 #include "content/browser/web_contents/web_contents_impl.h" |
6 | 6 |
7 #include <utility> | 7 #include <utility> |
8 | 8 |
9 #include "base/command_line.h" | 9 #include "base/command_line.h" |
10 #include "base/metrics/histogram.h" | 10 #include "base/metrics/histogram.h" |
(...skipping 378 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
389 WebContentsImpl* opener) { | 389 WebContentsImpl* opener) { |
390 WebContentsImpl* new_contents = new WebContentsImpl(browser_context, opener); | 390 WebContentsImpl* new_contents = new WebContentsImpl(browser_context, opener); |
391 | 391 |
392 new_contents->Init(browser_context, site_instance, routing_id, | 392 new_contents->Init(browser_context, site_instance, routing_id, |
393 static_cast<const WebContentsImpl*>(base_web_contents)); | 393 static_cast<const WebContentsImpl*>(base_web_contents)); |
394 return new_contents; | 394 return new_contents; |
395 } | 395 } |
396 | 396 |
397 WebContentsImpl* WebContentsImpl::CreateGuest( | 397 WebContentsImpl* WebContentsImpl::CreateGuest( |
398 BrowserContext* browser_context, | 398 BrowserContext* browser_context, |
399 const std::string& host_url, | 399 SiteInstance* site_instance, |
400 int guest_instance_id, | 400 int guest_instance_id, |
401 const BrowserPluginHostMsg_CreateGuest_Params& params) { | 401 const BrowserPluginHostMsg_CreateGuest_Params& params) { |
402 // The SiteInstance of a given guest is based on the fact that it's a guest | |
403 // in addition to which platform application the guest belongs to, rather | |
404 // than the URL that the guest is being navigated to. | |
405 GURL guest_site( | |
406 base::StringPrintf("%s://%s", chrome::kGuestScheme, host_url.c_str())); | |
407 SiteInstance* guest_site_instance = | |
408 SiteInstance::CreateForURL(browser_context, guest_site); | |
409 WebContentsImpl* new_contents = WebContentsImpl::Create( | 402 WebContentsImpl* new_contents = WebContentsImpl::Create( |
410 browser_context, | 403 browser_context, |
411 guest_site_instance, | 404 site_instance, |
412 MSG_ROUTING_NONE, | 405 MSG_ROUTING_NONE, |
413 NULL); // base WebContents | 406 NULL); // base WebContents |
414 WebContentsImpl* new_contents_impl = | 407 WebContentsImpl* new_contents_impl = |
415 static_cast<WebContentsImpl*>(new_contents); | 408 static_cast<WebContentsImpl*>(new_contents); |
416 | 409 |
417 // This makes |new_contents| act as a guest. | 410 // This makes |new_contents| act as a guest. |
418 // For more info, see comment above class BrowserPluginGuest. | 411 // For more info, see comment above class BrowserPluginGuest. |
419 new_contents_impl->browser_plugin_guest_.reset( | 412 new_contents_impl->browser_plugin_guest_.reset( |
420 BrowserPluginGuest::Create( | 413 BrowserPluginGuest::Create( |
421 guest_instance_id, | 414 guest_instance_id, |
(...skipping 2907 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
3329 | 3322 |
3330 BrowserPluginGuest* WebContentsImpl::GetBrowserPluginGuest() { | 3323 BrowserPluginGuest* WebContentsImpl::GetBrowserPluginGuest() { |
3331 return browser_plugin_guest_.get(); | 3324 return browser_plugin_guest_.get(); |
3332 } | 3325 } |
3333 | 3326 |
3334 BrowserPluginEmbedder* WebContentsImpl::GetBrowserPluginEmbedder() { | 3327 BrowserPluginEmbedder* WebContentsImpl::GetBrowserPluginEmbedder() { |
3335 return browser_plugin_embedder_.get(); | 3328 return browser_plugin_embedder_.get(); |
3336 } | 3329 } |
3337 | 3330 |
3338 } // namespace content | 3331 } // namespace content |
OLD | NEW |