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

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

Issue 6319001: Support window.opener after a process swap. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Merge with trunk. 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" 7 #include "chrome/common/url_constants.h"
8 #include "content/browser/browsing_instance.h" 8 #include "content/browser/browsing_instance.h"
9 #include "content/browser/content_browser_client.h" 9 #include "content/browser/content_browser_client.h"
10 #include "content/browser/renderer_host/browser_render_process_host.h" 10 #include "content/browser/renderer_host/browser_render_process_host.h"
11 #include "content/browser/webui/web_ui_factory.h" 11 #include "content/browser/webui/web_ui_factory.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/content_client.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 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. 17 // same site as any URL since they are actually modifiers on existing pages.
18 static bool IsURLSameAsAnySiteInstance(const GURL& url) { 18 static bool IsURLSameAsAnySiteInstance(const GURL& url) {
19 if (!url.is_valid()) 19 if (!url.is_valid())
20 return false; 20 return false;
21 return url.SchemeIs(chrome::kJavaScriptScheme) || 21 return url.SchemeIs(chrome::kJavaScriptScheme) ||
22 url.spec() == chrome::kAboutCrashURL || 22 url.spec() == chrome::kAboutCrashURL ||
23 url.spec() == chrome::kAboutKillURL || 23 url.spec() == chrome::kAboutKillURL ||
24 url.spec() == chrome::kAboutHangURL || 24 url.spec() == chrome::kAboutHangURL ||
25 url.spec() == chrome::kAboutShorthangURL; 25 url.spec() == chrome::kAboutShorthangURL;
26 } 26 }
27 27
28 int32 SiteInstance::next_site_instance_id_ = 1;
29
28 SiteInstance::SiteInstance(BrowsingInstance* browsing_instance) 30 SiteInstance::SiteInstance(BrowsingInstance* browsing_instance)
29 : browsing_instance_(browsing_instance), 31 : id_(next_site_instance_id_++),
32 browsing_instance_(browsing_instance),
30 render_process_host_factory_(NULL), 33 render_process_host_factory_(NULL),
31 process_(NULL), 34 process_(NULL),
32 max_page_id_(-1), 35 max_page_id_(-1),
33 has_site_(false) { 36 has_site_(false) {
34 DCHECK(browsing_instance); 37 DCHECK(browsing_instance);
35 38
36 registrar_.Add(this, NotificationType::RENDERER_PROCESS_TERMINATED, 39 registrar_.Add(this, NotificationType::RENDERER_PROCESS_TERMINATED,
37 NotificationService::AllSources()); 40 NotificationService::AllSources());
38 } 41 }
39 42
(...skipping 177 matching lines...) Expand 10 before | Expand all | Expand 10 after
217 } 220 }
218 221
219 void SiteInstance::Observe(NotificationType type, 222 void SiteInstance::Observe(NotificationType type,
220 const NotificationSource& source, 223 const NotificationSource& source,
221 const NotificationDetails& details) { 224 const NotificationDetails& details) {
222 DCHECK(type == NotificationType::RENDERER_PROCESS_TERMINATED); 225 DCHECK(type == NotificationType::RENDERER_PROCESS_TERMINATED);
223 RenderProcessHost* rph = Source<RenderProcessHost>(source).ptr(); 226 RenderProcessHost* rph = Source<RenderProcessHost>(source).ptr();
224 if (rph == process_) 227 if (rph == process_)
225 process_ = NULL; 228 process_ = NULL;
226 } 229 }
OLDNEW
« no previous file with comments | « content/browser/site_instance.h ('k') | content/browser/tab_contents/render_view_host_manager.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698