| 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 795 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 806 if (context->network_delegate()) { | 806 if (context->network_delegate()) { |
| 807 // Note that |this| may not be deleted until | 807 // Note that |this| may not be deleted until |
| 808 // |on_headers_received_callback_| or | 808 // |on_headers_received_callback_| or |
| 809 // |NetworkDelegate::URLRequestDestroyed()| has been called. | 809 // |NetworkDelegate::URLRequestDestroyed()| has been called. |
| 810 int error = context->network_delegate()-> | 810 int error = context->network_delegate()-> |
| 811 NotifyHeadersReceived(request_, on_headers_received_callback_, | 811 NotifyHeadersReceived(request_, on_headers_received_callback_, |
| 812 headers, &override_response_headers_); | 812 headers, &override_response_headers_); |
| 813 if (error != net::OK) { | 813 if (error != net::OK) { |
| 814 if (error == net::ERR_IO_PENDING) { | 814 if (error == net::ERR_IO_PENDING) { |
| 815 awaiting_callback_ = true; | 815 awaiting_callback_ = true; |
| 816 request_->net_log().BeginEvent( | 816 SetBlockedOnDelegate(); |
| 817 NetLog::TYPE_URL_REQUEST_BLOCKED_ON_DELEGATE); | |
| 818 } else { | 817 } else { |
| 819 std::string source("delegate"); | 818 std::string source("delegate"); |
| 820 request_->net_log().AddEvent(NetLog::TYPE_CANCELLED, | 819 request_->net_log().AddEvent(NetLog::TYPE_CANCELLED, |
| 821 NetLog::StringCallback("source", | 820 NetLog::StringCallback("source", |
| 822 &source)); | 821 &source)); |
| 823 NotifyStartError(URLRequestStatus(URLRequestStatus::FAILED, error)); | 822 NotifyStartError(URLRequestStatus(URLRequestStatus::FAILED, error)); |
| 824 } | 823 } |
| 825 return; | 824 return; |
| 826 } | 825 } |
| 827 } | 826 } |
| (...skipping 14 matching lines...) Expand all Loading... |
| 842 NotifySSLCertificateError(transaction_->GetResponseInfo()->ssl_info, fatal); | 841 NotifySSLCertificateError(transaction_->GetResponseInfo()->ssl_info, fatal); |
| 843 } else if (result == ERR_SSL_CLIENT_AUTH_CERT_NEEDED) { | 842 } else if (result == ERR_SSL_CLIENT_AUTH_CERT_NEEDED) { |
| 844 NotifyCertificateRequested( | 843 NotifyCertificateRequested( |
| 845 transaction_->GetResponseInfo()->cert_request_info); | 844 transaction_->GetResponseInfo()->cert_request_info); |
| 846 } else { | 845 } else { |
| 847 NotifyStartError(URLRequestStatus(URLRequestStatus::FAILED, result)); | 846 NotifyStartError(URLRequestStatus(URLRequestStatus::FAILED, result)); |
| 848 } | 847 } |
| 849 } | 848 } |
| 850 | 849 |
| 851 void URLRequestHttpJob::OnHeadersReceivedCallback(int result) { | 850 void URLRequestHttpJob::OnHeadersReceivedCallback(int result) { |
| 852 request_->net_log().EndEvent(NetLog::TYPE_URL_REQUEST_BLOCKED_ON_DELEGATE); | 851 SetUnblockedOnDelegate(); |
| 853 awaiting_callback_ = false; | 852 awaiting_callback_ = false; |
| 854 | 853 |
| 855 // Check that there are no callbacks to already canceled requests. | 854 // Check that there are no callbacks to already canceled requests. |
| 856 DCHECK_NE(URLRequestStatus::CANCELED, GetStatus().status()); | 855 DCHECK_NE(URLRequestStatus::CANCELED, GetStatus().status()); |
| 857 | 856 |
| 858 SaveCookiesAndNotifyHeadersComplete(result); | 857 SaveCookiesAndNotifyHeadersComplete(result); |
| 859 } | 858 } |
| 860 | 859 |
| 861 void URLRequestHttpJob::OnReadCompleted(int result) { | 860 void URLRequestHttpJob::OnReadCompleted(int result) { |
| 862 read_in_progress_ = false; | 861 read_in_progress_ = false; |
| (...skipping 712 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1575 | 1574 |
| 1576 void URLRequestHttpJob::NotifyURLRequestDestroyed() { | 1575 void URLRequestHttpJob::NotifyURLRequestDestroyed() { |
| 1577 awaiting_callback_ = false; | 1576 awaiting_callback_ = false; |
| 1578 } | 1577 } |
| 1579 | 1578 |
| 1580 void URLRequestHttpJob::OnDetachRequest() { | 1579 void URLRequestHttpJob::OnDetachRequest() { |
| 1581 http_transaction_delegate_->OnDetachRequest(); | 1580 http_transaction_delegate_->OnDetachRequest(); |
| 1582 } | 1581 } |
| 1583 | 1582 |
| 1584 } // namespace net | 1583 } // namespace net |
| OLD | NEW |