OLD | NEW |
1 // Copyright (c) 2006-2008 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2006-2008 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 "chrome/browser/tab_contents/site_instance.h" | 5 #include "chrome/browser/tab_contents/site_instance.h" |
6 | 6 |
7 #include "chrome/browser/renderer_host/browser_render_process_host.h" | 7 #include "chrome/browser/renderer_host/browser_render_process_host.h" |
8 #include "chrome/common/url_constants.h" | 8 #include "chrome/common/url_constants.h" |
9 #include "net/base/registry_controlled_domain.h" | 9 #include "net/base/registry_controlled_domain.h" |
10 | 10 |
(...skipping 117 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
128 if (url1.SchemeIs(chrome::kJavaScriptScheme) || | 128 if (url1.SchemeIs(chrome::kJavaScriptScheme) || |
129 url2.SchemeIs(chrome::kJavaScriptScheme)) | 129 url2.SchemeIs(chrome::kJavaScriptScheme)) |
130 return true; | 130 return true; |
131 | 131 |
132 // We treat about:crash, about:hang, and about:shorthang as the same site as | 132 // We treat about:crash, about:hang, and about:shorthang as the same site as |
133 // any URL, since they are used as demos for crashing/hanging a process. | 133 // any URL, since they are used as demos for crashing/hanging a process. |
134 GURL about_crash = GURL("about:crash"); | 134 GURL about_crash = GURL("about:crash"); |
135 GURL about_hang = GURL("about:hang"); | 135 GURL about_hang = GURL("about:hang"); |
136 GURL about_shorthang = GURL("about:shorthang"); | 136 GURL about_shorthang = GURL("about:shorthang"); |
137 if (url1 == about_crash || url2 == about_crash || | 137 if (url1 == about_crash || url2 == about_crash || |
138 » url1 == about_hang || url2 == about_hang || | 138 url1 == about_hang || url2 == about_hang || |
139 » url1 == about_shorthang || url2 == about_shorthang) | 139 url1 == about_shorthang || url2 == about_shorthang) |
140 return true; | 140 return true; |
141 | 141 |
142 // If either URL is invalid, they aren't part of the same site. | 142 // If either URL is invalid, they aren't part of the same site. |
143 if (!url1.is_valid() || !url2.is_valid()) { | 143 if (!url1.is_valid() || !url2.is_valid()) { |
144 return false; | 144 return false; |
145 } | 145 } |
146 | 146 |
147 // If the schemes differ, they aren't part of the same site. | 147 // If the schemes differ, they aren't part of the same site. |
148 if (url1.scheme() != url2.scheme()) { | 148 if (url1.scheme() != url2.scheme()) { |
149 return false; | 149 return false; |
150 } | 150 } |
151 | 151 |
152 return net::RegistryControlledDomainService::SameDomainOrHost(url1, url2); | 152 return net::RegistryControlledDomainService::SameDomainOrHost(url1, url2); |
153 } | 153 } |
154 | 154 |
OLD | NEW |