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

Unified Diff: content/browser/loader/cross_site_resource_handler.cc

Issue 25536005: Clean up ResourceHandler API. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Rebase Created 7 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 side-by-side diff with in-line comments
Download patch
Index: content/browser/loader/cross_site_resource_handler.cc
diff --git a/content/browser/loader/cross_site_resource_handler.cc b/content/browser/loader/cross_site_resource_handler.cc
index 6bac75adde6b8246e7748a8876d22973ab1c9988..657791f62f5e6ba9f0ec4733db6dd8618ce08ef0 100644
--- a/content/browser/loader/cross_site_resource_handler.cc
+++ b/content/browser/loader/cross_site_resource_handler.cc
@@ -49,8 +49,7 @@ void OnCrossSiteResponseHelper(int render_process_id,
CrossSiteResourceHandler::CrossSiteResourceHandler(
scoped_ptr<ResourceHandler> next_handler,
net::URLRequest* request)
- : LayeredResourceHandler(next_handler.Pass()),
- request_(request),
+ : LayeredResourceHandler(request, next_handler.Pass()),
has_started_response_(false),
in_cross_site_transition_(false),
completed_during_transition_(false),
@@ -61,7 +60,7 @@ CrossSiteResourceHandler::CrossSiteResourceHandler(
CrossSiteResourceHandler::~CrossSiteResourceHandler() {
// Cleanup back-pointer stored on the request info.
- ResourceRequestInfoImpl::ForRequest(request_)->set_cross_site_handler(NULL);
+ GetRequestInfo()->set_cross_site_handler(NULL);
}
bool CrossSiteResourceHandler::OnRequestRedirected(
@@ -86,7 +85,7 @@ bool CrossSiteResourceHandler::OnResponseStarted(
DCHECK(!in_cross_site_transition_);
has_started_response_ = true;
- ResourceRequestInfoImpl* info = ResourceRequestInfoImpl::ForRequest(request_);
+ ResourceRequestInfoImpl* info = GetRequestInfo();
// We will need to swap processes if either (1) a redirect that requires a
// transfer occurred before we got here, or (2) a pending cross-site request
@@ -94,7 +93,7 @@ bool CrossSiteResourceHandler::OnResponseStarted(
// transferred back into the original process due to a redirect.
bool should_transfer =
GetContentClient()->browser()->ShouldSwapProcessesForRedirect(
- info->GetContext(), request_->original_url(), request_->url());
+ info->GetContext(), request()->original_url(), request()->url());
bool swap_needed = should_transfer ||
CrossSiteRequestManager::GetInstance()->
HasPendingCrossSiteRequest(info->GetChildID(), info->GetRouteID());
@@ -139,8 +138,7 @@ bool CrossSiteResourceHandler::OnResponseCompleted(
const net::URLRequestStatus& status,
const std::string& security_info) {
if (!in_cross_site_transition_) {
- ResourceRequestInfoImpl* info =
- ResourceRequestInfoImpl::ForRequest(request_);
+ ResourceRequestInfoImpl* info = GetRequestInfo();
// If we've already completed the transition, or we're canceling the
// request, or an error occurred with no cross-process navigation in
// progress, then we should just pass this through.
@@ -173,11 +171,10 @@ bool CrossSiteResourceHandler::OnResponseCompleted(
// We can now send the response to the new renderer, which will cause
// WebContentsImpl to swap in the new renderer and destroy the old one.
void CrossSiteResourceHandler::ResumeResponse() {
- DCHECK(request_);
+ DCHECK(request());
DCHECK(in_cross_site_transition_);
in_cross_site_transition_ = false;
- ResourceRequestInfoImpl* info =
- ResourceRequestInfoImpl::ForRequest(request_);
+ ResourceRequestInfoImpl* info = GetRequestInfo();
if (has_started_response_) {
// Send OnResponseStarted to the new renderer.
@@ -218,8 +215,7 @@ void CrossSiteResourceHandler::StartCrossSiteTransition(
// Store this handler on the ExtraRequestInfo, so that RDH can call our
// ResumeResponse method when we are ready to resume.
- ResourceRequestInfoImpl* info =
- ResourceRequestInfoImpl::ForRequest(request_);
+ ResourceRequestInfoImpl* info = GetRequestInfo();
info->set_cross_site_handler(this);
DCHECK_EQ(request_id, info->GetRequestID());
@@ -233,8 +229,8 @@ void CrossSiteResourceHandler::StartCrossSiteTransition(
Referrer referrer;
int frame_id = -1;
if (should_transfer) {
- transfer_url = request_->url();
- referrer = Referrer(GURL(request_->referrer()), info->GetReferrerPolicy());
+ transfer_url = request()->url();
+ referrer = Referrer(GURL(request()->referrer()), info->GetReferrerPolicy());
frame_id = info->GetFrameID();
ResourceDispatcherHostImpl::Get()->MarkAsTransferredNavigation(
« no previous file with comments | « content/browser/loader/cross_site_resource_handler.h ('k') | content/browser/loader/layered_resource_handler.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698