| 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 136 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 147 return shell_browser_main_parts_; | 147 return shell_browser_main_parts_; |
| 148 } | 148 } |
| 149 | 149 |
| 150 bool ShellContentBrowserClient::DoesSiteRequireDedicatedProcess( | 150 bool ShellContentBrowserClient::DoesSiteRequireDedicatedProcess( |
| 151 BrowserContext* browser_context, | 151 BrowserContext* browser_context, |
| 152 const GURL& effective_site_url) { | 152 const GURL& effective_site_url) { |
| 153 base::CommandLine* command_line = base::CommandLine::ForCurrentProcess(); | 153 base::CommandLine* command_line = base::CommandLine::ForCurrentProcess(); |
| 154 DCHECK(command_line->HasSwitch(switches::kIsolateSitesForTesting)); | 154 DCHECK(command_line->HasSwitch(switches::kIsolateSitesForTesting)); |
| 155 std::string pattern = | 155 std::string pattern = |
| 156 command_line->GetSwitchValueASCII(switches::kIsolateSitesForTesting); | 156 command_line->GetSwitchValueASCII(switches::kIsolateSitesForTesting); |
| 157 |
| 157 url::Origin origin(effective_site_url); | 158 url::Origin origin(effective_site_url); |
| 158 | 159 |
| 159 // Schemes like blob or filesystem, which have an embedded origin, should | 160 if (!origin.unique()) { |
| 160 // already have been canonicalized to the origin site. | 161 // Schemes like blob or filesystem, which have an embedded origin, should |
| 161 CHECK_EQ(origin.scheme(), effective_site_url.scheme()) | 162 // already have been canonicalized to the origin site. |
| 162 << "a site url should have the same scheme as its origin."; | 163 CHECK_EQ(origin.scheme(), effective_site_url.scheme()) |
| 164 << "a site url should have the same scheme as its origin."; |
| 165 } |
| 163 | 166 |
| 164 // Practically |origin.Serialize()| is the same as | 167 // Practically |origin.Serialize()| is the same as |
| 165 // |effective_site_url.spec()|, except Origin serialization strips the | 168 // |effective_site_url.spec()|, except Origin serialization strips the |
| 166 // trailing "/", which makes for cleaner wildcard patterns. | 169 // trailing "/", which makes for cleaner wildcard patterns. |
| 167 return base::MatchPattern(origin.Serialize(), pattern); | 170 return base::MatchPattern(origin.Serialize(), pattern); |
| 168 } | 171 } |
| 169 | 172 |
| 170 bool ShellContentBrowserClient::IsHandledURL(const GURL& url) { | 173 bool ShellContentBrowserClient::IsHandledURL(const GURL& url) { |
| 171 if (!url.is_valid()) | 174 if (!url.is_valid()) |
| 172 return false; | 175 return false; |
| (...skipping 199 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 372 ShellBrowserContext* ShellContentBrowserClient::browser_context() { | 375 ShellBrowserContext* ShellContentBrowserClient::browser_context() { |
| 373 return shell_browser_main_parts_->browser_context(); | 376 return shell_browser_main_parts_->browser_context(); |
| 374 } | 377 } |
| 375 | 378 |
| 376 ShellBrowserContext* | 379 ShellBrowserContext* |
| 377 ShellContentBrowserClient::off_the_record_browser_context() { | 380 ShellContentBrowserClient::off_the_record_browser_context() { |
| 378 return shell_browser_main_parts_->off_the_record_browser_context(); | 381 return shell_browser_main_parts_->off_the_record_browser_context(); |
| 379 } | 382 } |
| 380 | 383 |
| 381 } // namespace content | 384 } // namespace content |
| OLD | NEW |