OLD | NEW |
---|---|
1 // Copyright 2013 The Chromium Authors. All rights reserved. | 1 // Copyright 2013 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/shell/browser/shell_content_browser_client.h" | 5 #include "content/shell/browser/shell_content_browser_client.h" |
6 | 6 |
7 #include <stddef.h> | 7 #include <stddef.h> |
8 #include <utility> | 8 #include <utility> |
9 | 9 |
10 #include "base/base_switches.h" | 10 #include "base/base_switches.h" |
(...skipping 127 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
138 } | 138 } |
139 | 139 |
140 BrowserMainParts* ShellContentBrowserClient::CreateBrowserMainParts( | 140 BrowserMainParts* ShellContentBrowserClient::CreateBrowserMainParts( |
141 const MainFunctionParams& parameters) { | 141 const MainFunctionParams& parameters) { |
142 shell_browser_main_parts_ = new ShellBrowserMainParts(parameters); | 142 shell_browser_main_parts_ = new ShellBrowserMainParts(parameters); |
143 return shell_browser_main_parts_; | 143 return shell_browser_main_parts_; |
144 } | 144 } |
145 | 145 |
146 bool ShellContentBrowserClient::DoesSiteRequireDedicatedProcess( | 146 bool ShellContentBrowserClient::DoesSiteRequireDedicatedProcess( |
147 BrowserContext* browser_context, | 147 BrowserContext* browser_context, |
148 const GURL& effective_url) { | 148 const GURL& effective_site_url) { |
149 base::CommandLine* command_line = base::CommandLine::ForCurrentProcess(); | 149 base::CommandLine* command_line = base::CommandLine::ForCurrentProcess(); |
150 DCHECK(command_line->HasSwitch(switches::kIsolateSitesForTesting)); | 150 DCHECK(command_line->HasSwitch(switches::kIsolateSitesForTesting)); |
151 std::string pattern = | 151 std::string pattern = |
152 command_line->GetSwitchValueASCII(switches::kIsolateSitesForTesting); | 152 command_line->GetSwitchValueASCII(switches::kIsolateSitesForTesting); |
153 // Practically |origin| is the same as |effective_url.spec()|, except Origin | 153 url::Origin effective_url_origin(effective_site_url); |
Charlie Reis
2016/09/09 21:18:24
origin?
ncarter (slow)
2016/09/09 21:56:32
Done.
| |
154 // serialization strips the trailing "/", which makes for cleaner patterns. | 154 CHECK_EQ(effective_url_origin.scheme(), effective_site_url.scheme()) |
155 std::string origin = url::Origin(effective_url).Serialize(); | 155 << "|effective_site_url| was not a canonical site URL"; |
156 return base::MatchPattern(origin, pattern); | 156 // Practically |effective_url_origin.Serialize()| is the same as |
157 // |effective_site_url.spec()|, except Origin serialization strips the | |
158 // trailing "/", which makes for cleaner wildcard patterns. | |
159 bool result = base::MatchPattern(effective_url_origin.Serialize(), pattern); | |
Charlie Reis
2016/09/09 21:18:24
return base...
ncarter (slow)
2016/09/09 21:56:32
Done.
| |
160 return result; | |
157 } | 161 } |
158 | 162 |
159 bool ShellContentBrowserClient::IsHandledURL(const GURL& url) { | 163 bool ShellContentBrowserClient::IsHandledURL(const GURL& url) { |
160 if (!url.is_valid()) | 164 if (!url.is_valid()) |
161 return false; | 165 return false; |
162 // Keep in sync with ProtocolHandlers added by | 166 // Keep in sync with ProtocolHandlers added by |
163 // ShellURLRequestContextGetter::GetURLRequestContext(). | 167 // ShellURLRequestContextGetter::GetURLRequestContext(). |
164 static const char* const kProtocolList[] = { | 168 static const char* const kProtocolList[] = { |
165 url::kBlobScheme, | 169 url::kBlobScheme, |
166 url::kFileSystemScheme, | 170 url::kFileSystemScheme, |
(...skipping 165 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
332 ShellBrowserContext* ShellContentBrowserClient::browser_context() { | 336 ShellBrowserContext* ShellContentBrowserClient::browser_context() { |
333 return shell_browser_main_parts_->browser_context(); | 337 return shell_browser_main_parts_->browser_context(); |
334 } | 338 } |
335 | 339 |
336 ShellBrowserContext* | 340 ShellBrowserContext* |
337 ShellContentBrowserClient::off_the_record_browser_context() { | 341 ShellContentBrowserClient::off_the_record_browser_context() { |
338 return shell_browser_main_parts_->off_the_record_browser_context(); | 342 return shell_browser_main_parts_->off_the_record_browser_context(); |
339 } | 343 } |
340 | 344 |
341 } // namespace content | 345 } // namespace content |
OLD | NEW |