| 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/renderer_host/site_instance.h" | 5 #include "chrome/browser/renderer_host/site_instance.h" |
| 6 | 6 |
| 7 #include "chrome/browser/browsing_instance.h" | 7 #include "chrome/browser/browsing_instance.h" |
| 8 #include "chrome/browser/dom_ui/dom_ui_factory.h" | 8 #include "chrome/browser/dom_ui/dom_ui_factory.h" |
| 9 #include "chrome/browser/extensions/extensions_service.h" | 9 #include "chrome/browser/extensions/extension_service.h" |
| 10 #include "chrome/browser/renderer_host/browser_render_process_host.h" | 10 #include "chrome/browser/renderer_host/browser_render_process_host.h" |
| 11 #include "chrome/common/url_constants.h" | 11 #include "chrome/common/url_constants.h" |
| 12 #include "chrome/common/notification_service.h" | 12 #include "chrome/common/notification_service.h" |
| 13 #include "net/base/registry_controlled_domain.h" | 13 #include "net/base/registry_controlled_domain.h" |
| 14 | 14 |
| 15 // We treat javascript:, about:crash, about:hang, and about:shorthang as the | 15 // We treat javascript:, about:crash, about:hang, and about:shorthang as the |
| 16 // same site as any URL since they are actually modifiers on existing pages. | 16 // same site as any URL since they are actually modifiers on existing pages. |
| 17 static bool IsURLSameAsAnySiteInstance(const GURL& url) { | 17 static bool IsURLSameAsAnySiteInstance(const GURL& url) { |
| 18 if (!url.is_valid()) | 18 if (!url.is_valid()) |
| 19 return false; | 19 return false; |
| (...skipping 160 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 180 | 180 |
| 181 // If the schemes differ, they aren't part of the same site. | 181 // If the schemes differ, they aren't part of the same site. |
| 182 if (url1.scheme() != url2.scheme()) | 182 if (url1.scheme() != url2.scheme()) |
| 183 return false; | 183 return false; |
| 184 | 184 |
| 185 return net::RegistryControlledDomainService::SameDomainOrHost(url1, url2); | 185 return net::RegistryControlledDomainService::SameDomainOrHost(url1, url2); |
| 186 } | 186 } |
| 187 | 187 |
| 188 /*static*/ | 188 /*static*/ |
| 189 GURL SiteInstance::GetEffectiveURL(Profile* profile, const GURL& url) { | 189 GURL SiteInstance::GetEffectiveURL(Profile* profile, const GURL& url) { |
| 190 if (!profile || !profile->GetExtensionsService()) | 190 if (!profile || !profile->GetExtensionService()) |
| 191 return url; | 191 return url; |
| 192 | 192 |
| 193 const Extension* extension = | 193 const Extension* extension = |
| 194 profile->GetExtensionsService()->GetExtensionByWebExtent(url); | 194 profile->GetExtensionService()->GetExtensionByWebExtent(url); |
| 195 if (extension) { | 195 if (extension) { |
| 196 // If the URL is part of an extension's web extent, convert it to an | 196 // If the URL is part of an extension's web extent, convert it to an |
| 197 // extension URL. | 197 // extension URL. |
| 198 return extension->GetResourceURL(url.path()); | 198 return extension->GetResourceURL(url.path()); |
| 199 } else { | 199 } else { |
| 200 return url; | 200 return url; |
| 201 } | 201 } |
| 202 } | 202 } |
| 203 | 203 |
| 204 /*static*/ | 204 /*static*/ |
| (...skipping 21 matching lines...) Expand all Loading... |
| 226 } | 226 } |
| 227 | 227 |
| 228 void SiteInstance::Observe(NotificationType type, | 228 void SiteInstance::Observe(NotificationType type, |
| 229 const NotificationSource& source, | 229 const NotificationSource& source, |
| 230 const NotificationDetails& details) { | 230 const NotificationDetails& details) { |
| 231 DCHECK(type == NotificationType::RENDERER_PROCESS_TERMINATED); | 231 DCHECK(type == NotificationType::RENDERER_PROCESS_TERMINATED); |
| 232 RenderProcessHost* rph = Source<RenderProcessHost>(source).ptr(); | 232 RenderProcessHost* rph = Source<RenderProcessHost>(source).ptr(); |
| 233 if (rph == process_) | 233 if (rph == process_) |
| 234 process_ = NULL; | 234 process_ = NULL; |
| 235 } | 235 } |
| OLD | NEW |