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" |
(...skipping 19 matching lines...) Expand all Loading... |
30 | 30 |
31 SiteInstance::SiteInstance(BrowsingInstance* browsing_instance) | 31 SiteInstance::SiteInstance(BrowsingInstance* browsing_instance) |
32 : id_(next_site_instance_id_++), | 32 : id_(next_site_instance_id_++), |
33 browsing_instance_(browsing_instance), | 33 browsing_instance_(browsing_instance), |
34 render_process_host_factory_(NULL), | 34 render_process_host_factory_(NULL), |
35 process_(NULL), | 35 process_(NULL), |
36 max_page_id_(-1), | 36 max_page_id_(-1), |
37 has_site_(false) { | 37 has_site_(false) { |
38 DCHECK(browsing_instance); | 38 DCHECK(browsing_instance); |
39 | 39 |
40 registrar_.Add(this, NotificationType::RENDERER_PROCESS_TERMINATED, | 40 registrar_.Add(this, content::NOTIFICATION_RENDERER_PROCESS_TERMINATED, |
41 NotificationService::AllSources()); | 41 NotificationService::AllSources()); |
42 } | 42 } |
43 | 43 |
44 SiteInstance::~SiteInstance() { | 44 SiteInstance::~SiteInstance() { |
45 // Now that no one is referencing us, we can safely remove ourselves from | 45 // Now that no one is referencing us, we can safely remove ourselves from |
46 // the BrowsingInstance. Any future visits to a page from this site | 46 // the BrowsingInstance. Any future visits to a page from this site |
47 // (within the same BrowsingInstance) can safely create a new SiteInstance. | 47 // (within the same BrowsingInstance) can safely create a new SiteInstance. |
48 if (has_site_) | 48 if (has_site_) |
49 browsing_instance_->UnregisterSiteInstance(this); | 49 browsing_instance_->UnregisterSiteInstance(this); |
50 } | 50 } |
(...skipping 174 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
225 | 225 |
226 RenderProcessHost::Type SiteInstance::GetRendererType() { | 226 RenderProcessHost::Type SiteInstance::GetRendererType() { |
227 // We may not have a site at this point, which generally means this is a | 227 // We may not have a site at this point, which generally means this is a |
228 // normal navigation. | 228 // normal navigation. |
229 if (!has_site_) | 229 if (!has_site_) |
230 return RenderProcessHost::TYPE_NORMAL; | 230 return RenderProcessHost::TYPE_NORMAL; |
231 | 231 |
232 return RendererTypeForURL(site_); | 232 return RendererTypeForURL(site_); |
233 } | 233 } |
234 | 234 |
235 void SiteInstance::Observe(NotificationType type, | 235 void SiteInstance::Observe(int type, |
236 const NotificationSource& source, | 236 const NotificationSource& source, |
237 const NotificationDetails& details) { | 237 const NotificationDetails& details) { |
238 DCHECK(type == NotificationType::RENDERER_PROCESS_TERMINATED); | 238 DCHECK(type == content::NOTIFICATION_RENDERER_PROCESS_TERMINATED); |
239 RenderProcessHost* rph = Source<RenderProcessHost>(source).ptr(); | 239 RenderProcessHost* rph = Source<RenderProcessHost>(source).ptr(); |
240 if (rph == process_) | 240 if (rph == process_) |
241 process_ = NULL; | 241 process_ = NULL; |
242 } | 242 } |
OLD | NEW |