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

Unified Diff: content/shell/browser/shell_content_browser_client.cc

Issue 1507333002: Add a content_shell flag to turn on partial site isolation. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Self-review fixes Created 5 years 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « content/shell/browser/shell_content_browser_client.h ('k') | content/shell/common/shell_content_client.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: content/shell/browser/shell_content_browser_client.cc
diff --git a/content/shell/browser/shell_content_browser_client.cc b/content/shell/browser/shell_content_browser_client.cc
index 8b0ca65cc15b709967a2ead352aa7906b76db481..19a60b67aea2a05029a284a0cc045d84558ae284 100644
--- a/content/shell/browser/shell_content_browser_client.cc
+++ b/content/shell/browser/shell_content_browser_client.cc
@@ -9,6 +9,7 @@
#include "base/files/file.h"
#include "base/files/file_util.h"
#include "base/path_service.h"
+#include "base/strings/pattern.h"
#include "base/strings/utf_string_conversions.h"
#include "content/public/browser/client_certificate_delegate.h"
#include "content/public/browser/page_navigator.h"
@@ -35,6 +36,7 @@
#include "content/shell/common/shell_switches.h"
#include "net/url_request/url_request_context_getter.h"
#include "url/gurl.h"
+#include "url/origin.h"
#if defined(OS_ANDROID)
#include "base/android/apk_assets.h"
@@ -146,6 +148,19 @@ BrowserMainParts* ShellContentBrowserClient::CreateBrowserMainParts(
return shell_browser_main_parts_;
}
+bool ShellContentBrowserClient::DoesSiteRequireDedicatedProcess(
+ BrowserContext* browser_context,
+ const GURL& effective_url) {
+ base::CommandLine* command_line = base::CommandLine::ForCurrentProcess();
+ DCHECK(command_line->HasSwitch(switches::kIsolateSitesForTesting));
+ std::string pattern =
+ command_line->GetSwitchValueASCII(switches::kIsolateSitesForTesting);
+ // Practically |origin| is the same as |effective_url.spec()|, except Origin
+ // serialization strips the trailing "/", which makes for cleaner patterns.
+ std::string origin = url::Origin(effective_url).Serialize();
+ return base::MatchPattern(origin, pattern);
+}
+
net::URLRequestContextGetter* ShellContentBrowserClient::CreateRequestContext(
BrowserContext* content_browser_context,
ProtocolHandlerMap* protocol_handlers,
@@ -252,6 +267,13 @@ void ShellContentBrowserClient::AppendExtraCommandLineSwitches(
switches::kEnableLeakDetection));
}
if (base::CommandLine::ForCurrentProcess()->HasSwitch(
+ switches::kIsolateSitesForTesting)) {
+ command_line->AppendSwitchASCII(
+ switches::kIsolateSitesForTesting,
+ base::CommandLine::ForCurrentProcess()->GetSwitchValueASCII(
+ switches::kIsolateSitesForTesting));
+ }
+ if (base::CommandLine::ForCurrentProcess()->HasSwitch(
switches::kRegisterFontFiles)) {
command_line->AppendSwitchASCII(
switches::kRegisterFontFiles,
« no previous file with comments | « content/shell/browser/shell_content_browser_client.h ('k') | content/shell/common/shell_content_client.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698