| 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 "net/url_request/url_request.h" | 5 #include "net/url_request/url_request.h" |
| 6 | 6 |
| 7 #include "base/bind.h" | 7 #include "base/bind.h" |
| 8 #include "base/bind_helpers.h" | 8 #include "base/bind_helpers.h" |
| 9 #include "base/callback.h" | 9 #include "base/callback.h" |
| 10 #include "base/compiler_specific.h" | 10 #include "base/compiler_specific.h" |
| (...skipping 488 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 499 if (error != OK) { | 499 if (error != OK) { |
| 500 std::string source("delegate"); | 500 std::string source("delegate"); |
| 501 net_log_.AddEvent(NetLog::TYPE_CANCELLED, | 501 net_log_.AddEvent(NetLog::TYPE_CANCELLED, |
| 502 NetLog::StringCallback("source", &source)); | 502 NetLog::StringCallback("source", &source)); |
| 503 StartJob(new URLRequestErrorJob(this, network_delegate_, error)); | 503 StartJob(new URLRequestErrorJob(this, network_delegate_, error)); |
| 504 } else if (!delegate_redirect_url_.is_empty()) { | 504 } else if (!delegate_redirect_url_.is_empty()) { |
| 505 GURL new_url; | 505 GURL new_url; |
| 506 new_url.Swap(&delegate_redirect_url_); | 506 new_url.Swap(&delegate_redirect_url_); |
| 507 | 507 |
| 508 URLRequestRedirectJob* job = new URLRequestRedirectJob( | 508 URLRequestRedirectJob* job = new URLRequestRedirectJob( |
| 509 this, network_delegate_, new_url); | 509 this, network_delegate_, new_url, |
| 510 // Use status code 307 to preserve the method, so POST requests work. | 510 // Use status code 307 to preserve the method, so POST requests work. |
| 511 job->set_redirect_code( | |
| 512 URLRequestRedirectJob::REDIRECT_307_TEMPORARY_REDIRECT); | 511 URLRequestRedirectJob::REDIRECT_307_TEMPORARY_REDIRECT); |
| 513 StartJob(job); | 512 StartJob(job); |
| 514 } else { | 513 } else { |
| 515 StartJob(URLRequestJobManager::GetInstance()->CreateJob( | 514 StartJob(URLRequestJobManager::GetInstance()->CreateJob( |
| 516 this, network_delegate_)); | 515 this, network_delegate_)); |
| 517 } | 516 } |
| 518 } | 517 } |
| 519 | 518 |
| 520 void URLRequest::StartJob(URLRequestJob* job) { | 519 void URLRequest::StartJob(URLRequestJob* job) { |
| 521 DCHECK(!is_pending_); | 520 DCHECK(!is_pending_); |
| (...skipping 465 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 987 new base::debug::StackTrace(NULL, 0); | 986 new base::debug::StackTrace(NULL, 0); |
| 988 *stack_trace_copy = stack_trace; | 987 *stack_trace_copy = stack_trace; |
| 989 stack_trace_.reset(stack_trace_copy); | 988 stack_trace_.reset(stack_trace_copy); |
| 990 } | 989 } |
| 991 | 990 |
| 992 const base::debug::StackTrace* URLRequest::stack_trace() const { | 991 const base::debug::StackTrace* URLRequest::stack_trace() const { |
| 993 return stack_trace_.get(); | 992 return stack_trace_.get(); |
| 994 } | 993 } |
| 995 | 994 |
| 996 } // namespace net | 995 } // namespace net |
| OLD | NEW |