| Index: content/browser/loader/resource_loader.cc
|
| diff --git a/content/browser/loader/resource_loader.cc b/content/browser/loader/resource_loader.cc
|
| index e30970b991e525ca45aaf946afc12a8ecc6b6e99..bb77021ac8fa20c3d369154da1b6f0adcd0df945 100644
|
| --- a/content/browser/loader/resource_loader.cc
|
| +++ b/content/browser/loader/resource_loader.cc
|
| @@ -157,6 +157,11 @@
|
| }
|
|
|
| void ResourceLoader::StartRequest() {
|
| + if (delegate_->HandleExternalProtocol(this, request_->url())) {
|
| + CancelAndIgnore();
|
| + return;
|
| + }
|
| +
|
| // Give the handler a chance to delay the URLRequest from being started.
|
| bool defer_start = false;
|
| if (!handler_->OnWillStart(request_->url(), &defer_start)) {
|
| @@ -268,6 +273,12 @@
|
| }
|
| }
|
|
|
| + if (delegate_->HandleExternalProtocol(this, redirect_info.new_url)) {
|
| + // The request is complete so we can remove it.
|
| + CancelAndIgnore();
|
| + return;
|
| + }
|
| +
|
| scoped_refptr<ResourceResponse> response = new ResourceResponse();
|
| PopulateResourceResponse(info, request_.get(), response.get());
|
| delegate_->DidReceiveRedirect(this, redirect_info.new_url, response.get());
|
| @@ -275,12 +286,6 @@
|
| Cancel();
|
| } else if (*defer) {
|
| deferred_stage_ = DEFERRED_REDIRECT; // Follow redirect when resumed.
|
| - DCHECK(deferred_redirect_url_.is_empty());
|
| - deferred_redirect_url_ = redirect_info.new_url;
|
| - } else if (delegate_->HandleExternalProtocol(this, redirect_info.new_url)) {
|
| - // The request is complete so we can remove it.
|
| - CancelAndIgnore();
|
| - return;
|
| }
|
| }
|
|
|
| @@ -445,7 +450,7 @@
|
| StartRequestInternal();
|
| break;
|
| case DEFERRED_REDIRECT:
|
| - FollowDeferredRedirectInternal();
|
| + request_->FollowDeferredRedirect();
|
| break;
|
| case DEFERRED_READ:
|
| base::ThreadTaskRunnerHandle::Get()->PostTask(
|
| @@ -473,14 +478,7 @@
|
| void ResourceLoader::StartRequestInternal() {
|
| DCHECK(!request_->is_pending());
|
|
|
| - // Note: at this point any possible deferred start actions are already over.
|
| -
|
| if (!request_->status().is_success()) {
|
| - return;
|
| - }
|
| -
|
| - if (delegate_->HandleExternalProtocol(this, request_->url())) {
|
| - CancelAndIgnore();
|
| return;
|
| }
|
|
|
| @@ -533,17 +531,6 @@
|
| base::ThreadTaskRunnerHandle::Get()->PostTask(
|
| FROM_HERE, base::Bind(&ResourceLoader::ResponseCompleted,
|
| weak_ptr_factory_.GetWeakPtr()));
|
| - }
|
| -}
|
| -
|
| -void ResourceLoader::FollowDeferredRedirectInternal() {
|
| - DCHECK(!deferred_redirect_url_.is_empty());
|
| - GURL redirect_url = deferred_redirect_url_;
|
| - deferred_redirect_url_ = GURL();
|
| - if (delegate_->HandleExternalProtocol(this, deferred_redirect_url_)) {
|
| - CancelAndIgnore();
|
| - } else {
|
| - request_->FollowDeferredRedirect();
|
| }
|
| }
|
|
|
|
|