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

Side by Side Diff: content/common/site_isolation_policy.cc

Issue 2831683002: Introduce support for origins that require process isolation. (Closed)
Patch Set: Rebase Created 3 years, 7 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 2015 The Chromium Authors. All rights reserved. 1 // Copyright 2015 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/common/site_isolation_policy.h" 5 #include "content/common/site_isolation_policy.h"
6 6
7 #include "base/command_line.h" 7 #include "base/command_line.h"
8 #include "base/feature_list.h" 8 #include "base/feature_list.h"
9 #include "content/public/common/content_client.h" 9 #include "content/public/common/content_client.h"
10 #include "content/public/common/content_features.h" 10 #include "content/public/common/content_features.h"
11 #include "content/public/common/content_switches.h" 11 #include "content/public/common/content_switches.h"
12 12
13 namespace content { 13 namespace content {
14 14
15 // static 15 // static
16 bool SiteIsolationPolicy::AreCrossProcessFramesPossible() { 16 bool SiteIsolationPolicy::AreCrossProcessFramesPossible() {
17 // Before turning this on for Android, input event routing needs to be 17 // Before turning this on for Android, input event routing needs to be
18 // completed there, and perf regressions in https://crbug.com/690229 need to be 18 // completed there, and perf regressions in https://crbug.com/690229 need to be
19 // investigated. 19 // investigated.
20 #if defined(OS_ANDROID) 20 #if defined(OS_ANDROID)
21 return UseDedicatedProcessesForAllSites() || 21 return UseDedicatedProcessesForAllSites() ||
22 IsTopDocumentIsolationEnabled() || 22 IsTopDocumentIsolationEnabled() || AreIsolatedOriginsEnabled() ||
23 GetContentClient()->IsSupplementarySiteIsolationModeEnabled() || 23 GetContentClient()->IsSupplementarySiteIsolationModeEnabled() ||
24 base::FeatureList::IsEnabled(::features::kGuestViewCrossProcessFrames); 24 base::FeatureList::IsEnabled(::features::kGuestViewCrossProcessFrames);
25 #else 25 #else
26 return true; 26 return true;
27 #endif 27 #endif
28 } 28 }
29 29
30 // static 30 // static
31 bool SiteIsolationPolicy::UseDedicatedProcessesForAllSites() { 31 bool SiteIsolationPolicy::UseDedicatedProcessesForAllSites() {
32 return base::CommandLine::ForCurrentProcess()->HasSwitch( 32 return base::CommandLine::ForCurrentProcess()->HasSwitch(
33 switches::kSitePerProcess); 33 switches::kSitePerProcess);
34 } 34 }
35 35
36 // static 36 // static
37 bool SiteIsolationPolicy::IsTopDocumentIsolationEnabled() { 37 bool SiteIsolationPolicy::IsTopDocumentIsolationEnabled() {
38 // --site-per-process trumps --top-document-isolation. 38 // --site-per-process trumps --top-document-isolation.
39 if (UseDedicatedProcessesForAllSites()) 39 if (UseDedicatedProcessesForAllSites())
40 return false; 40 return false;
41 41
42 return base::CommandLine::ForCurrentProcess()->HasSwitch( 42 return base::CommandLine::ForCurrentProcess()->HasSwitch(
43 switches::kTopDocumentIsolation); 43 switches::kTopDocumentIsolation);
44 } 44 }
45 45
46 // static
47 bool SiteIsolationPolicy::AreIsolatedOriginsEnabled() {
48 // TODO(alexmos): This currently assumes that isolated origins are only added
49 // via the command-line switch, which may not be true in the future. Remove
Charlie Reis 2017/05/05 23:18:51 Ooh, that's a problem for adding a public API (e.g
alexmos 2017/05/16 17:26:38 Per offline email thread, the sign-in isolation wi
50 // this function when AreCrossProcessFramesPossible becomes true on Android
51 // above.
52 return base::CommandLine::ForCurrentProcess()->HasSwitch(
53 switches::kIsolateOrigins);
54 }
55
46 } // namespace content 56 } // namespace content
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698