Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(644)

Side by Side Diff: content/browser/site_instance.cc

Issue 7044013: Drop url_constants dependency in content/. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: reinsert Created 9 years, 7 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
OLDNEW
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 "chrome/common/url_constants.h"
8 #include "content/browser/browsing_instance.h" 7 #include "content/browser/browsing_instance.h"
9 #include "content/browser/content_browser_client.h" 8 #include "content/browser/content_browser_client.h"
10 #include "content/browser/renderer_host/browser_render_process_host.h" 9 #include "content/browser/renderer_host/browser_render_process_host.h"
11 #include "content/browser/webui/web_ui_factory.h" 10 #include "content/browser/webui/web_ui_factory.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/content_client.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 // We treat javascript:, about:crash, about:hang, and about:shorthang as the
17 // same site as any URL since they are actually modifiers on existing pages.
18 static bool IsURLSameAsAnySiteInstance(const GURL& url) { 16 static bool IsURLSameAsAnySiteInstance(const GURL& url) {
19 if (!url.is_valid()) 17 if (!url.is_valid())
20 return false; 18 return false;
21 return url.SchemeIs(chrome::kJavaScriptScheme) || 19
22 url.spec() == chrome::kAboutCrashURL || 20 // We treat javascript: and about:crash as the same site as any URL since they
23 url.spec() == chrome::kAboutKillURL || 21 // are actually modifiers on existing pages.
24 url.spec() == chrome::kAboutHangURL || 22 if (url.SchemeIs(chrome::kJavaScriptScheme) ||
25 url.spec() == chrome::kAboutShorthangURL; 23 url.spec() == chrome::kAboutCrashURL) {
24 return true;
25 }
26
27 return
28 content::GetContentClient()->browser()->IsURLSameAsAnySiteInstance(url);
26 } 29 }
27 30
28 int32 SiteInstance::next_site_instance_id_ = 1; 31 int32 SiteInstance::next_site_instance_id_ = 1;
29 32
30 SiteInstance::SiteInstance(BrowsingInstance* browsing_instance) 33 SiteInstance::SiteInstance(BrowsingInstance* browsing_instance)
31 : id_(next_site_instance_id_++), 34 : id_(next_site_instance_id_++),
32 browsing_instance_(browsing_instance), 35 browsing_instance_(browsing_instance),
33 render_process_host_factory_(NULL), 36 render_process_host_factory_(NULL),
34 process_(NULL), 37 process_(NULL),
35 max_page_id_(-1), 38 max_page_id_(-1),
(...skipping 184 matching lines...) Expand 10 before | Expand all | Expand 10 after
220 } 223 }
221 224
222 void SiteInstance::Observe(NotificationType type, 225 void SiteInstance::Observe(NotificationType type,
223 const NotificationSource& source, 226 const NotificationSource& source,
224 const NotificationDetails& details) { 227 const NotificationDetails& details) {
225 DCHECK(type == NotificationType::RENDERER_PROCESS_TERMINATED); 228 DCHECK(type == NotificationType::RENDERER_PROCESS_TERMINATED);
226 RenderProcessHost* rph = Source<RenderProcessHost>(source).ptr(); 229 RenderProcessHost* rph = Source<RenderProcessHost>(source).ptr();
227 if (rph == process_) 230 if (rph == process_)
228 process_ = NULL; 231 process_ = NULL;
229 } 232 }
OLDNEW
« no previous file with comments | « content/browser/renderer_host/x509_user_cert_resource_handler.cc ('k') | content/browser/site_instance_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698