| 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 1240 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1251 // OnAuthRequired. | 1251 // OnAuthRequired. |
| 1252 // | 1252 // |
| 1253 // We have to do this via InvokeLater to avoid "recursing" the consumer. | 1253 // We have to do this via InvokeLater to avoid "recursing" the consumer. |
| 1254 // | 1254 // |
| 1255 base::ThreadTaskRunnerHandle::Get()->PostTask( | 1255 base::ThreadTaskRunnerHandle::Get()->PostTask( |
| 1256 FROM_HERE, base::Bind(&URLRequestHttpJob::OnStartCompleted, | 1256 FROM_HERE, base::Bind(&URLRequestHttpJob::OnStartCompleted, |
| 1257 weak_factory_.GetWeakPtr(), OK)); | 1257 weak_factory_.GetWeakPtr(), OK)); |
| 1258 } | 1258 } |
| 1259 | 1259 |
| 1260 void URLRequestHttpJob::ContinueWithCertificate( | 1260 void URLRequestHttpJob::ContinueWithCertificate( |
| 1261 X509Certificate* client_cert) { | 1261 X509Certificate* client_cert, |
| 1262 SSLPrivateKey* client_private_key) { |
| 1262 DCHECK(transaction_.get()); | 1263 DCHECK(transaction_.get()); |
| 1263 | 1264 |
| 1264 DCHECK(!response_info_) << "should not have a response yet"; | 1265 DCHECK(!response_info_) << "should not have a response yet"; |
| 1265 receive_headers_end_ = base::TimeTicks(); | 1266 receive_headers_end_ = base::TimeTicks(); |
| 1266 | 1267 |
| 1267 ResetTimer(); | 1268 ResetTimer(); |
| 1268 | 1269 |
| 1269 // No matter what, we want to report our status as IO pending since we will | 1270 // No matter what, we want to report our status as IO pending since we will |
| 1270 // be notifying our consumer asynchronously via OnStartCompleted. | 1271 // be notifying our consumer asynchronously via OnStartCompleted. |
| 1271 SetStatus(URLRequestStatus(URLRequestStatus::IO_PENDING, 0)); | 1272 SetStatus(URLRequestStatus(URLRequestStatus::IO_PENDING, 0)); |
| 1272 | 1273 |
| 1273 int rv = transaction_->RestartWithCertificate(client_cert, start_callback_); | 1274 int rv = transaction_->RestartWithCertificate(client_cert, client_private_key, |
| 1275 start_callback_); |
| 1274 if (rv == ERR_IO_PENDING) | 1276 if (rv == ERR_IO_PENDING) |
| 1275 return; | 1277 return; |
| 1276 | 1278 |
| 1277 // The transaction started synchronously, but we need to notify the | 1279 // The transaction started synchronously, but we need to notify the |
| 1278 // URLRequest delegate via the message loop. | 1280 // URLRequest delegate via the message loop. |
| 1279 base::ThreadTaskRunnerHandle::Get()->PostTask( | 1281 base::ThreadTaskRunnerHandle::Get()->PostTask( |
| 1280 FROM_HERE, base::Bind(&URLRequestHttpJob::OnStartCompleted, | 1282 FROM_HERE, base::Bind(&URLRequestHttpJob::OnStartCompleted, |
| 1281 weak_factory_.GetWeakPtr(), rv)); | 1283 weak_factory_.GetWeakPtr(), rv)); |
| 1282 } | 1284 } |
| 1283 | 1285 |
| (...skipping 296 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1580 return override_response_headers_.get() ? | 1582 return override_response_headers_.get() ? |
| 1581 override_response_headers_.get() : | 1583 override_response_headers_.get() : |
| 1582 transaction_->GetResponseInfo()->headers.get(); | 1584 transaction_->GetResponseInfo()->headers.get(); |
| 1583 } | 1585 } |
| 1584 | 1586 |
| 1585 void URLRequestHttpJob::NotifyURLRequestDestroyed() { | 1587 void URLRequestHttpJob::NotifyURLRequestDestroyed() { |
| 1586 awaiting_callback_ = false; | 1588 awaiting_callback_ = false; |
| 1587 } | 1589 } |
| 1588 | 1590 |
| 1589 } // namespace net | 1591 } // namespace net |
| OLD | NEW |