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/loader/cross_site_resource_handler.h" | 5 #include "content/browser/loader/cross_site_resource_handler.h" |
6 | 6 |
7 #include <string> | 7 #include <string> |
8 | 8 |
9 #include "base/bind.h" | 9 #include "base/bind.h" |
10 #include "base/command_line.h" | 10 #include "base/command_line.h" |
(...skipping 79 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
90 } | 90 } |
91 | 91 |
92 // Returns whether a transfer is needed by doing a check on the UI thread. | 92 // Returns whether a transfer is needed by doing a check on the UI thread. |
93 bool CheckNavigationPolicyOnUI(GURL url, int process_id, int render_frame_id) { | 93 bool CheckNavigationPolicyOnUI(GURL url, int process_id, int render_frame_id) { |
94 CHECK(CommandLine::ForCurrentProcess()->HasSwitch(switches::kSitePerProcess)); | 94 CHECK(CommandLine::ForCurrentProcess()->HasSwitch(switches::kSitePerProcess)); |
95 RenderFrameHostImpl* rfh = | 95 RenderFrameHostImpl* rfh = |
96 RenderFrameHostImpl::FromID(process_id, render_frame_id); | 96 RenderFrameHostImpl::FromID(process_id, render_frame_id); |
97 if (!rfh) | 97 if (!rfh) |
98 return false; | 98 return false; |
99 | 99 |
| 100 // A transfer is not needed if the current SiteInstance doesn't yet have a |
| 101 // site. This is the case for tests that use NavigateToURL. |
| 102 if (!rfh->GetSiteInstance()->HasSite()) |
| 103 return false; |
| 104 |
100 // TODO(nasko): This check is very simplistic and is used temporarily only | 105 // TODO(nasko): This check is very simplistic and is used temporarily only |
101 // for --site-per-process. It should be updated to match the check performed | 106 // for --site-per-process. It should be updated to match the check performed |
102 // by RenderFrameHostManager::UpdateStateForNavigate. | 107 // by RenderFrameHostManager::UpdateStateForNavigate. |
103 return !SiteInstance::IsSameWebSite( | 108 return !SiteInstance::IsSameWebSite( |
104 rfh->GetSiteInstance()->GetBrowserContext(), | 109 rfh->GetSiteInstance()->GetBrowserContext(), |
105 rfh->GetSiteInstance()->GetSiteURL(), url); | 110 rfh->GetSiteInstance()->GetSiteURL(), url); |
106 } | 111 } |
107 | 112 |
108 } // namespace | 113 } // namespace |
109 | 114 |
(...skipping 306 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
416 controller()->Resume(); | 421 controller()->Resume(); |
417 } | 422 } |
418 } | 423 } |
419 | 424 |
420 void CrossSiteResourceHandler::OnDidDefer() { | 425 void CrossSiteResourceHandler::OnDidDefer() { |
421 did_defer_ = true; | 426 did_defer_ = true; |
422 request()->LogBlockedBy("CrossSiteResourceHandler"); | 427 request()->LogBlockedBy("CrossSiteResourceHandler"); |
423 } | 428 } |
424 | 429 |
425 } // namespace content | 430 } // namespace content |
OLD | NEW |