Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(472)

Side by Side Diff: content/browser/site_instance_impl.cc

Issue 2964033002: Disable cross-process navigations in --single-process. (Closed)
Patch Set: Only update --site-per-process Created 3 years, 5 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
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/site_instance_impl.h" 5 #include "content/browser/site_instance_impl.h"
6 6
7 #include "base/command_line.h"
7 #include "base/macros.h" 8 #include "base/macros.h"
8 #include "base/memory/ptr_util.h" 9 #include "base/memory/ptr_util.h"
9 #include "content/browser/browsing_instance.h" 10 #include "content/browser/browsing_instance.h"
10 #include "content/browser/child_process_security_policy_impl.h" 11 #include "content/browser/child_process_security_policy_impl.h"
11 #include "content/browser/frame_host/debug_urls.h" 12 #include "content/browser/frame_host/debug_urls.h"
12 #include "content/browser/frame_host/frame_tree_node.h" 13 #include "content/browser/frame_host/frame_tree_node.h"
13 #include "content/browser/renderer_host/render_process_host_impl.h" 14 #include "content/browser/renderer_host/render_process_host_impl.h"
14 #include "content/browser/storage_partition_impl.h" 15 #include "content/browser/storage_partition_impl.h"
15 #include "content/common/site_isolation_policy.h" 16 #include "content/common/site_isolation_policy.h"
16 #include "content/public/browser/content_browser_client.h" 17 #include "content/public/browser/content_browser_client.h"
17 #include "content/public/browser/render_process_host_factory.h" 18 #include "content/public/browser/render_process_host_factory.h"
18 #include "content/public/browser/web_ui_controller_factory.h" 19 #include "content/public/browser/web_ui_controller_factory.h"
20 #include "content/public/common/content_switches.h"
19 #include "content/public/common/url_constants.h" 21 #include "content/public/common/url_constants.h"
20 #include "net/base/registry_controlled_domains/registry_controlled_domain.h" 22 #include "net/base/registry_controlled_domains/registry_controlled_domain.h"
21 23
22 namespace content { 24 namespace content {
23 25
24 int32_t SiteInstanceImpl::next_site_instance_id_ = 1; 26 int32_t SiteInstanceImpl::next_site_instance_id_ = 1;
25 27
26 SiteInstanceImpl::SiteInstanceImpl(BrowsingInstance* browsing_instance) 28 SiteInstanceImpl::SiteInstanceImpl(BrowsingInstance* browsing_instance)
27 : id_(next_site_instance_id_++), 29 : id_(next_site_instance_id_++),
28 active_frame_count_(0), 30 active_frame_count_(0),
(...skipping 398 matching lines...) Expand 10 before | Expand all | Expand 10 after
427 browser_context, site_url)) { 429 browser_context, site_url)) {
428 return true; 430 return true;
429 } 431 }
430 432
431 return false; 433 return false;
432 } 434 }
433 435
434 // static 436 // static
435 bool SiteInstanceImpl::ShouldLockToOrigin(BrowserContext* browser_context, 437 bool SiteInstanceImpl::ShouldLockToOrigin(BrowserContext* browser_context,
436 GURL site_url) { 438 GURL site_url) {
439 // Don't lock to origin in --single-process mode, since this mode puts
440 // cross-site pages into the same process.
441 if (base::CommandLine::ForCurrentProcess()->HasSwitch(
442 switches::kSingleProcess))
443 return false;
444
437 if (!DoesSiteRequireDedicatedProcess(browser_context, site_url)) 445 if (!DoesSiteRequireDedicatedProcess(browser_context, site_url))
438 return false; 446 return false;
439 447
440 // Guest processes cannot be locked to their site because guests always have 448 // Guest processes cannot be locked to their site because guests always have
441 // a fixed SiteInstance. The site of GURLs a guest loads doesn't match that 449 // a fixed SiteInstance. The site of GURLs a guest loads doesn't match that
442 // SiteInstance. So we skip locking the guest process to the site. 450 // SiteInstance. So we skip locking the guest process to the site.
443 // TODO(ncarter): Remove this exclusion once we can make origin lock per 451 // TODO(ncarter): Remove this exclusion once we can make origin lock per
444 // RenderFrame routing id. 452 // RenderFrame routing id.
445 if (site_url.SchemeIs(content::kGuestScheme)) 453 if (site_url.SchemeIs(content::kGuestScheme))
446 return false; 454 return false;
(...skipping 56 matching lines...) Expand 10 before | Expand all | Expand 10 after
503 // prevent the non-isolated sites from requesting resources for isolated 511 // prevent the non-isolated sites from requesting resources for isolated
504 // sites. https://crbug.com/509125 512 // sites. https://crbug.com/509125
505 if (ShouldLockToOrigin(GetBrowserContext(), site_)) { 513 if (ShouldLockToOrigin(GetBrowserContext(), site_)) {
506 ChildProcessSecurityPolicyImpl* policy = 514 ChildProcessSecurityPolicyImpl* policy =
507 ChildProcessSecurityPolicyImpl::GetInstance(); 515 ChildProcessSecurityPolicyImpl::GetInstance();
508 policy->LockToOrigin(process_->GetID(), site_); 516 policy->LockToOrigin(process_->GetID(), site_);
509 } 517 }
510 } 518 }
511 519
512 } // namespace content 520 } // namespace content
OLDNEW
« no previous file with comments | « content/browser/frame_host/render_frame_host_manager.cc ('k') | content/public/common/content_switches.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698