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 377 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
388 const WebContentsImpl* base_web_contents, | 388 const WebContentsImpl* base_web_contents, |
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(BrowserContext* browser_context, | 397 WebContentsImpl* WebContentsImpl::CreateGuest(BrowserContext* browser_context, |
398 const std::string& host_url, | 398 SiteInstance* site_instance, |
399 int guest_instance_id, | 399 int guest_instance_id, |
400 bool focused, | 400 bool focused, |
401 bool visible) { | 401 bool visible) { |
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 2914 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
3336 | 3329 |
3337 BrowserPluginGuest* WebContentsImpl::GetBrowserPluginGuest() { | 3330 BrowserPluginGuest* WebContentsImpl::GetBrowserPluginGuest() { |
3338 return browser_plugin_guest_.get(); | 3331 return browser_plugin_guest_.get(); |
3339 } | 3332 } |
3340 | 3333 |
3341 BrowserPluginEmbedder* WebContentsImpl::GetBrowserPluginEmbedder() { | 3334 BrowserPluginEmbedder* WebContentsImpl::GetBrowserPluginEmbedder() { |
3342 return browser_plugin_embedder_.get(); | 3335 return browser_plugin_embedder_.get(); |
3343 } | 3336 } |
3344 | 3337 |
3345 } // namespace content | 3338 } // namespace content |
OLD | NEW |