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

Side by Side Diff: content/browser/loader/cross_site_resource_handler.cc

Issue 1378203002: Handle hosted apps consistently in --isolate-extensions. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 5 years, 2 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
« no previous file with comments | « chrome/browser/site_details_browsertest.cc ('k') | content/common/site_isolation_policy.h » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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 69 matching lines...) Expand 10 before | Expand all | Expand 10 after
80 params.transfer_url_chain, params.referrer, 80 params.transfer_url_chain, params.referrer,
81 params.page_transition, params.should_replace_current_entry); 81 params.page_transition, params.should_replace_current_entry);
82 } else if (leak_requests_for_testing_ && cross_site_transferring_request) { 82 } else if (leak_requests_for_testing_ && cross_site_transferring_request) {
83 // Some unit tests expect requests to be leaked in this case, so they can 83 // Some unit tests expect requests to be leaked in this case, so they can
84 // pass them along manually. 84 // pass them along manually.
85 cross_site_transferring_request->ReleaseRequest(); 85 cross_site_transferring_request->ReleaseRequest();
86 } 86 }
87 } 87 }
88 88
89 // Returns whether a transfer is needed by doing a check on the UI thread. 89 // Returns whether a transfer is needed by doing a check on the UI thread.
90 bool CheckNavigationPolicyOnUI(GURL url, int process_id, int render_frame_id) { 90 bool CheckNavigationPolicyOnUI(GURL real_url,
91 int process_id,
92 int render_frame_id) {
91 CHECK(SiteIsolationPolicy::AreCrossProcessFramesPossible()); 93 CHECK(SiteIsolationPolicy::AreCrossProcessFramesPossible());
92 RenderFrameHostImpl* rfh = 94 RenderFrameHostImpl* rfh =
93 RenderFrameHostImpl::FromID(process_id, render_frame_id); 95 RenderFrameHostImpl::FromID(process_id, render_frame_id);
94 if (!rfh) 96 if (!rfh)
95 return false; 97 return false;
96 98
97 // A transfer is not needed if the current SiteInstance doesn't yet have a 99 // A transfer is not needed if the current SiteInstance doesn't yet have a
98 // site. This is the case for tests that use NavigateToURL. 100 // site. This is the case for tests that use NavigateToURL.
99 if (!rfh->GetSiteInstance()->HasSite()) 101 if (!rfh->GetSiteInstance()->HasSite())
100 return false; 102 return false;
101 103
102 // For now, GuestViews never transfer on cross-site navigations. 104 // For now, GuestViews never transfer on cross-site navigations.
103 WebContentsImpl* web_contents = 105 WebContentsImpl* web_contents =
104 static_cast<WebContentsImpl*>(WebContents::FromRenderFrameHost(rfh)); 106 static_cast<WebContentsImpl*>(WebContents::FromRenderFrameHost(rfh));
105 if (web_contents->GetBrowserPluginGuest()) 107 if (web_contents->GetBrowserPluginGuest())
106 return false; 108 return false;
107 109
110 GURL effective_url = SiteInstanceImpl::GetEffectiveURL(
111 rfh->GetSiteInstance()->GetBrowserContext(), real_url);
112
108 // TODO(nasko, nick): These following --site-per-process checks are 113 // TODO(nasko, nick): These following --site-per-process checks are
109 // overly simplistic. Update them to match all the cases 114 // overly simplistic. Update them to match all the cases
110 // considered by RenderFrameHostManager::DetermineSiteInstanceForURL. 115 // considered by RenderFrameHostManager::DetermineSiteInstanceForURL.
111 if (SiteInstance::IsSameWebSite(rfh->GetSiteInstance()->GetBrowserContext(), 116 if (SiteInstance::IsSameWebSite(rfh->GetSiteInstance()->GetBrowserContext(),
112 rfh->GetSiteInstance()->GetSiteURL(), url)) { 117 rfh->GetSiteInstance()->GetSiteURL(),
118 real_url)) {
113 return false; // The same site, no transition needed. 119 return false; // The same site, no transition needed.
114 } 120 }
115 121
116 // The sites differ. If either one requires a dedicated process, 122 // The sites differ. If either one requires a dedicated process,
117 // then a transfer is needed. 123 // then a transfer is needed.
118 return rfh->GetSiteInstance()->RequiresDedicatedProcess() || 124 return rfh->GetSiteInstance()->RequiresDedicatedProcess() ||
119 SiteIsolationPolicy::DoesSiteRequireDedicatedProcess(url); 125 SiteIsolationPolicy::DoesSiteRequireDedicatedProcess(effective_url);
120 } 126 }
121 127
122 } // namespace 128 } // namespace
123 129
124 CrossSiteResourceHandler::CrossSiteResourceHandler( 130 CrossSiteResourceHandler::CrossSiteResourceHandler(
125 scoped_ptr<ResourceHandler> next_handler, 131 scoped_ptr<ResourceHandler> next_handler,
126 net::URLRequest* request) 132 net::URLRequest* request)
127 : LayeredResourceHandler(request, next_handler.Pass()), 133 : LayeredResourceHandler(request, next_handler.Pass()),
128 has_started_response_(false), 134 has_started_response_(false),
129 in_cross_site_transition_(false), 135 in_cross_site_transition_(false),
(...skipping 257 matching lines...) Expand 10 before | Expand all | Expand 10 after
387 controller()->Resume(); 393 controller()->Resume();
388 } 394 }
389 } 395 }
390 396
391 void CrossSiteResourceHandler::OnDidDefer() { 397 void CrossSiteResourceHandler::OnDidDefer() {
392 did_defer_ = true; 398 did_defer_ = true;
393 request()->LogBlockedBy("CrossSiteResourceHandler"); 399 request()->LogBlockedBy("CrossSiteResourceHandler");
394 } 400 }
395 401
396 } // namespace content 402 } // namespace content
OLDNEW
« no previous file with comments | « chrome/browser/site_details_browsertest.cc ('k') | content/common/site_isolation_policy.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698