OLD | NEW |
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 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_impl.h" | 5 #include "content/browser/site_instance_impl.h" |
6 | 6 |
7 #include "base/command_line.h" | 7 #include "base/command_line.h" |
8 #include "content/browser/browsing_instance.h" | 8 #include "content/browser/browsing_instance.h" |
9 #include "content/browser/child_process_security_policy_impl.h" | 9 #include "content/browser/child_process_security_policy_impl.h" |
10 #include "content/browser/renderer_host/render_process_host_impl.h" | 10 #include "content/browser/renderer_host/render_process_host_impl.h" |
11 #include "content/browser/storage_partition_impl.h" | 11 #include "content/browser/storage_partition_impl.h" |
12 #include "content/public/browser/content_browser_client.h" | 12 #include "content/public/browser/content_browser_client.h" |
13 #include "content/public/browser/notification_service.h" | 13 #include "content/public/browser/notification_service.h" |
14 #include "content/public/browser/notification_types.h" | 14 #include "content/public/browser/notification_types.h" |
15 #include "content/public/browser/render_process_host_factory.h" | 15 #include "content/public/browser/render_process_host_factory.h" |
16 #include "content/public/browser/web_ui_controller_factory.h" | 16 #include "content/public/browser/web_ui_controller_factory.h" |
17 #include "content/public/common/content_switches.h" | 17 #include "content/public/common/content_switches.h" |
18 #include "content/public/common/url_constants.h" | 18 #include "content/public/common/url_constants.h" |
19 #include "net/base/registry_controlled_domains/registry_controlled_domain.h" | 19 #include "net/base/registry_controlled_domains/registry_controlled_domain.h" |
20 | 20 |
21 namespace content { | 21 namespace content { |
22 | 22 |
23 static bool IsURLSameAsAnySiteInstance(const GURL& url) { | 23 static bool IsURLSameAsAnySiteInstance(const GURL& url) { |
24 if (!url.is_valid()) | 24 if (!url.is_valid()) |
25 return false; | 25 return false; |
26 | 26 |
27 // We treat javascript: as the same site as any URL since it is actually | 27 // We treat javascript: as the same site as any URL since it is actually |
28 // a modifier on existing pages. | 28 // a modifier on existing pages. |
29 if (url.SchemeIs(chrome::kJavaScriptScheme)) | 29 if (url.SchemeIs(kJavaScriptScheme)) |
30 return true; | 30 return true; |
31 | 31 |
32 return url == GURL(kChromeUICrashURL) || | 32 return url == GURL(kChromeUICrashURL) || |
33 url == GURL(kChromeUIKillURL) || | 33 url == GURL(kChromeUIKillURL) || |
34 url == GURL(kChromeUIHangURL) || | 34 url == GURL(kChromeUIHangURL) || |
35 url == GURL(kChromeUIShorthangURL); | 35 url == GURL(kChromeUIShorthangURL); |
36 } | 36 } |
37 | 37 |
38 const RenderProcessHostFactory* | 38 const RenderProcessHostFactory* |
39 SiteInstanceImpl::g_render_process_host_factory_ = NULL; | 39 SiteInstanceImpl::g_render_process_host_factory_ = NULL; |
(...skipping 301 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
341 const CommandLine& command_line = *CommandLine::ForCurrentProcess(); | 341 const CommandLine& command_line = *CommandLine::ForCurrentProcess(); |
342 if (command_line.HasSwitch(switches::kEnableStrictSiteIsolation) || | 342 if (command_line.HasSwitch(switches::kEnableStrictSiteIsolation) || |
343 command_line.HasSwitch(switches::kSitePerProcess)) { | 343 command_line.HasSwitch(switches::kSitePerProcess)) { |
344 ChildProcessSecurityPolicyImpl* policy = | 344 ChildProcessSecurityPolicyImpl* policy = |
345 ChildProcessSecurityPolicyImpl::GetInstance(); | 345 ChildProcessSecurityPolicyImpl::GetInstance(); |
346 policy->LockToOrigin(process_->GetID(), site_); | 346 policy->LockToOrigin(process_->GetID(), site_); |
347 } | 347 } |
348 } | 348 } |
349 | 349 |
350 } // namespace content | 350 } // namespace content |
OLD | NEW |