| 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 "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/web_ui_factory.h" | 8 #include "chrome/browser/dom_ui/web_ui_factory.h" |
| 9 #include "chrome/browser/extensions/extension_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" |
| (...skipping 194 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 205 /*static*/ | 205 /*static*/ |
| 206 RenderProcessHost::Type SiteInstance::RendererTypeForURL(const GURL& url) { | 206 RenderProcessHost::Type SiteInstance::RendererTypeForURL(const GURL& url) { |
| 207 if (!url.is_valid()) | 207 if (!url.is_valid()) |
| 208 return RenderProcessHost::TYPE_NORMAL; | 208 return RenderProcessHost::TYPE_NORMAL; |
| 209 | 209 |
| 210 if (url.SchemeIs(chrome::kExtensionScheme)) | 210 if (url.SchemeIs(chrome::kExtensionScheme)) |
| 211 return RenderProcessHost::TYPE_EXTENSION; | 211 return RenderProcessHost::TYPE_EXTENSION; |
| 212 | 212 |
| 213 // TODO(erikkay) creis recommends using UseWebUIForURL instead. | 213 // TODO(erikkay) creis recommends using UseWebUIForURL instead. |
| 214 if (WebUIFactory::HasWebUIScheme(url)) | 214 if (WebUIFactory::HasWebUIScheme(url)) |
| 215 return RenderProcessHost::TYPE_DOMUI; | 215 return RenderProcessHost::TYPE_WEBUI; |
| 216 | 216 |
| 217 return RenderProcessHost::TYPE_NORMAL; | 217 return RenderProcessHost::TYPE_NORMAL; |
| 218 } | 218 } |
| 219 | 219 |
| 220 RenderProcessHost::Type SiteInstance::GetRendererType() { | 220 RenderProcessHost::Type SiteInstance::GetRendererType() { |
| 221 // We may not have a site at this point, which generally means this is a | 221 // We may not have a site at this point, which generally means this is a |
| 222 // normal navigation. | 222 // normal navigation. |
| 223 if (!has_site_) | 223 if (!has_site_) |
| 224 return RenderProcessHost::TYPE_NORMAL; | 224 return RenderProcessHost::TYPE_NORMAL; |
| 225 | 225 |
| 226 return RendererTypeForURL(site_); | 226 return RendererTypeForURL(site_); |
| 227 } | 227 } |
| 228 | 228 |
| 229 void SiteInstance::Observe(NotificationType type, | 229 void SiteInstance::Observe(NotificationType type, |
| 230 const NotificationSource& source, | 230 const NotificationSource& source, |
| 231 const NotificationDetails& details) { | 231 const NotificationDetails& details) { |
| 232 DCHECK(type == NotificationType::RENDERER_PROCESS_TERMINATED); | 232 DCHECK(type == NotificationType::RENDERER_PROCESS_TERMINATED); |
| 233 RenderProcessHost* rph = Source<RenderProcessHost>(source).ptr(); | 233 RenderProcessHost* rph = Source<RenderProcessHost>(source).ptr(); |
| 234 if (rph == process_) | 234 if (rph == process_) |
| 235 process_ = NULL; | 235 process_ = NULL; |
| 236 } | 236 } |
| OLD | NEW |