| 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_http_job.h" | 5 #include "net/url_request/url_request_http_job.h" |
| 6 | 6 |
| 7 #include "base/base_switches.h" | 7 #include "base/base_switches.h" |
| 8 #include "base/bind.h" | 8 #include "base/bind.h" |
| 9 #include "base/bind_helpers.h" | 9 #include "base/bind_helpers.h" |
| 10 #include "base/command_line.h" | 10 #include "base/command_line.h" |
| (...skipping 771 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 782 if (context->network_delegate()) { | 782 if (context->network_delegate()) { |
| 783 // Note that |this| may not be deleted until | 783 // Note that |this| may not be deleted until |
| 784 // |on_headers_received_callback_| or | 784 // |on_headers_received_callback_| or |
| 785 // |NetworkDelegate::URLRequestDestroyed()| has been called. | 785 // |NetworkDelegate::URLRequestDestroyed()| has been called. |
| 786 int error = context->network_delegate()-> | 786 int error = context->network_delegate()-> |
| 787 NotifyHeadersReceived(request_, on_headers_received_callback_, | 787 NotifyHeadersReceived(request_, on_headers_received_callback_, |
| 788 headers, &override_response_headers_); | 788 headers, &override_response_headers_); |
| 789 if (error != net::OK) { | 789 if (error != net::OK) { |
| 790 if (error == net::ERR_IO_PENDING) { | 790 if (error == net::ERR_IO_PENDING) { |
| 791 awaiting_callback_ = true; | 791 awaiting_callback_ = true; |
| 792 request_->net_log().BeginEvent( | 792 SetBlockedOnDelegate(); |
| 793 NetLog::TYPE_URL_REQUEST_BLOCKED_ON_DELEGATE); | |
| 794 } else { | 793 } else { |
| 795 std::string source("delegate"); | 794 std::string source("delegate"); |
| 796 request_->net_log().AddEvent(NetLog::TYPE_CANCELLED, | 795 request_->net_log().AddEvent(NetLog::TYPE_CANCELLED, |
| 797 NetLog::StringCallback("source", | 796 NetLog::StringCallback("source", |
| 798 &source)); | 797 &source)); |
| 799 NotifyStartError(URLRequestStatus(URLRequestStatus::FAILED, error)); | 798 NotifyStartError(URLRequestStatus(URLRequestStatus::FAILED, error)); |
| 800 } | 799 } |
| 801 return; | 800 return; |
| 802 } | 801 } |
| 803 } | 802 } |
| (...skipping 14 matching lines...) Expand all Loading... |
| 818 NotifySSLCertificateError(transaction_->GetResponseInfo()->ssl_info, fatal); | 817 NotifySSLCertificateError(transaction_->GetResponseInfo()->ssl_info, fatal); |
| 819 } else if (result == ERR_SSL_CLIENT_AUTH_CERT_NEEDED) { | 818 } else if (result == ERR_SSL_CLIENT_AUTH_CERT_NEEDED) { |
| 820 NotifyCertificateRequested( | 819 NotifyCertificateRequested( |
| 821 transaction_->GetResponseInfo()->cert_request_info); | 820 transaction_->GetResponseInfo()->cert_request_info); |
| 822 } else { | 821 } else { |
| 823 NotifyStartError(URLRequestStatus(URLRequestStatus::FAILED, result)); | 822 NotifyStartError(URLRequestStatus(URLRequestStatus::FAILED, result)); |
| 824 } | 823 } |
| 825 } | 824 } |
| 826 | 825 |
| 827 void URLRequestHttpJob::OnHeadersReceivedCallback(int result) { | 826 void URLRequestHttpJob::OnHeadersReceivedCallback(int result) { |
| 828 request_->net_log().EndEvent(NetLog::TYPE_URL_REQUEST_BLOCKED_ON_DELEGATE); | 827 SetUnblockedOnDelegate(); |
| 829 awaiting_callback_ = false; | 828 awaiting_callback_ = false; |
| 830 | 829 |
| 831 // Check that there are no callbacks to already canceled requests. | 830 // Check that there are no callbacks to already canceled requests. |
| 832 DCHECK_NE(URLRequestStatus::CANCELED, GetStatus().status()); | 831 DCHECK_NE(URLRequestStatus::CANCELED, GetStatus().status()); |
| 833 | 832 |
| 834 SaveCookiesAndNotifyHeadersComplete(result); | 833 SaveCookiesAndNotifyHeadersComplete(result); |
| 835 } | 834 } |
| 836 | 835 |
| 837 void URLRequestHttpJob::OnReadCompleted(int result) { | 836 void URLRequestHttpJob::OnReadCompleted(int result) { |
| 838 read_in_progress_ = false; | 837 read_in_progress_ = false; |
| (...skipping 665 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1504 | 1503 |
| 1505 void URLRequestHttpJob::NotifyURLRequestDestroyed() { | 1504 void URLRequestHttpJob::NotifyURLRequestDestroyed() { |
| 1506 awaiting_callback_ = false; | 1505 awaiting_callback_ = false; |
| 1507 } | 1506 } |
| 1508 | 1507 |
| 1509 void URLRequestHttpJob::OnDetachRequest() { | 1508 void URLRequestHttpJob::OnDetachRequest() { |
| 1510 http_transaction_delegate_->OnDetachRequest(); | 1509 http_transaction_delegate_->OnDetachRequest(); |
| 1511 } | 1510 } |
| 1512 | 1511 |
| 1513 } // namespace net | 1512 } // namespace net |
| OLD | NEW |