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" |
(...skipping 177 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
188 | 188 |
189 bool SiteInstanceImpl::HasRelatedSiteInstance(const GURL& url) { | 189 bool SiteInstanceImpl::HasRelatedSiteInstance(const GURL& url) { |
190 return browsing_instance_->HasSiteInstance(url); | 190 return browsing_instance_->HasSiteInstance(url); |
191 } | 191 } |
192 | 192 |
193 SiteInstance* SiteInstanceImpl::GetRelatedSiteInstance(const GURL& url) { | 193 SiteInstance* SiteInstanceImpl::GetRelatedSiteInstance(const GURL& url) { |
194 return browsing_instance_->GetSiteInstanceForURL(url); | 194 return browsing_instance_->GetSiteInstanceForURL(url); |
195 } | 195 } |
196 | 196 |
197 bool SiteInstanceImpl::IsRelatedSiteInstance(const SiteInstance* instance) { | 197 bool SiteInstanceImpl::IsRelatedSiteInstance(const SiteInstance* instance) { |
198 return browsing_instance_ == | 198 return browsing_instance_.get() == static_cast<const SiteInstanceImpl*>( |
199 static_cast<const SiteInstanceImpl*>(instance)->browsing_instance_; | 199 instance)->browsing_instance_.get(); |
200 } | 200 } |
201 | 201 |
202 bool SiteInstanceImpl::HasWrongProcessForURL(const GURL& url) { | 202 bool SiteInstanceImpl::HasWrongProcessForURL(const GURL& url) { |
203 // Having no process isn't a problem, since we'll assign it correctly. | 203 // Having no process isn't a problem, since we'll assign it correctly. |
204 // Note that HasProcess() may return true if process_ is null, in | 204 // Note that HasProcess() may return true if process_ is null, in |
205 // process-per-site cases where there's an existing process available. | 205 // process-per-site cases where there's an existing process available. |
206 // We want to use such a process in the IsSuitableHost check, so we | 206 // We want to use such a process in the IsSuitableHost check, so we |
207 // may end up assigning process_ in the GetProcess() call below. | 207 // may end up assigning process_ in the GetProcess() call below. |
208 if (!HasProcess()) | 208 if (!HasProcess()) |
209 return false; | 209 return false; |
(...skipping 125 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
335 const CommandLine& command_line = *CommandLine::ForCurrentProcess(); | 335 const CommandLine& command_line = *CommandLine::ForCurrentProcess(); |
336 if (command_line.HasSwitch(switches::kEnableStrictSiteIsolation) || | 336 if (command_line.HasSwitch(switches::kEnableStrictSiteIsolation) || |
337 command_line.HasSwitch(switches::kSitePerProcess)) { | 337 command_line.HasSwitch(switches::kSitePerProcess)) { |
338 ChildProcessSecurityPolicyImpl* policy = | 338 ChildProcessSecurityPolicyImpl* policy = |
339 ChildProcessSecurityPolicyImpl::GetInstance(); | 339 ChildProcessSecurityPolicyImpl::GetInstance(); |
340 policy->LockToOrigin(process_->GetID(), site_); | 340 policy->LockToOrigin(process_->GetID(), site_); |
341 } | 341 } |
342 } | 342 } |
343 | 343 |
344 } // namespace content | 344 } // namespace content |
OLD | NEW |