| OLD | NEW |
| 1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2011 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/browser/site_instance.h" | 5 #include "content/browser/site_instance.h" |
| 6 | 6 |
| 7 #include "content/browser/browsing_instance.h" | 7 #include "content/browser/browsing_instance.h" |
| 8 #include "content/browser/content_browser_client.h" | 8 #include "content/browser/content_browser_client.h" |
| 9 #include "content/browser/renderer_host/browser_render_process_host.h" | 9 #include "content/browser/renderer_host/browser_render_process_host.h" |
| 10 #include "content/browser/webui/web_ui_factory.h" | 10 #include "content/browser/webui/web_ui_factory.h" |
| 11 #include "content/common/content_client.h" | 11 #include "content/common/content_client.h" |
| 12 #include "content/common/notification_service.h" | 12 #include "content/common/notification_service.h" |
| 13 #include "content/common/url_constants.h" | 13 #include "content/common/url_constants.h" |
| 14 #include "net/base/registry_controlled_domain.h" | 14 #include "net/base/registry_controlled_domain.h" |
| 15 | 15 |
| 16 static bool IsURLSameAsAnySiteInstance(const GURL& url) { | 16 static bool IsURLSameAsAnySiteInstance(const GURL& url) { |
| 17 if (!url.is_valid()) | 17 if (!url.is_valid()) |
| 18 return false; | 18 return false; |
| 19 | 19 |
| 20 // We treat javascript: and about:crash as the same site as any URL since they | 20 // We treat javascript: as the same site as any URL since it is actually |
| 21 // are actually modifiers on existing pages. | 21 // a modifier on existing pages. |
| 22 if (url.SchemeIs(chrome::kJavaScriptScheme) || | 22 if (url.SchemeIs(chrome::kJavaScriptScheme)) |
| 23 url.spec() == chrome::kAboutCrashURL) { | |
| 24 return true; | 23 return true; |
| 25 } | |
| 26 | 24 |
| 27 return | 25 return |
| 28 content::GetContentClient()->browser()->IsURLSameAsAnySiteInstance(url); | 26 content::GetContentClient()->browser()->IsURLSameAsAnySiteInstance(url); |
| 29 } | 27 } |
| 30 | 28 |
| 31 int32 SiteInstance::next_site_instance_id_ = 1; | 29 int32 SiteInstance::next_site_instance_id_ = 1; |
| 32 | 30 |
| 33 SiteInstance::SiteInstance(BrowsingInstance* browsing_instance) | 31 SiteInstance::SiteInstance(BrowsingInstance* browsing_instance) |
| 34 : id_(next_site_instance_id_++), | 32 : id_(next_site_instance_id_++), |
| 35 browsing_instance_(browsing_instance), | 33 browsing_instance_(browsing_instance), |
| (...skipping 199 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 235 } | 233 } |
| 236 | 234 |
| 237 void SiteInstance::Observe(NotificationType type, | 235 void SiteInstance::Observe(NotificationType type, |
| 238 const NotificationSource& source, | 236 const NotificationSource& source, |
| 239 const NotificationDetails& details) { | 237 const NotificationDetails& details) { |
| 240 DCHECK(type == NotificationType::RENDERER_PROCESS_TERMINATED); | 238 DCHECK(type == NotificationType::RENDERER_PROCESS_TERMINATED); |
| 241 RenderProcessHost* rph = Source<RenderProcessHost>(source).ptr(); | 239 RenderProcessHost* rph = Source<RenderProcessHost>(source).ptr(); |
| 242 if (rph == process_) | 240 if (rph == process_) |
| 243 process_ = NULL; | 241 process_ = NULL; |
| 244 } | 242 } |
| OLD | NEW |