OLD | NEW |
1 // Copyright (c) 2010 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2010 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/http/http_cache_transaction.h" | 5 #include "net/http/http_cache_transaction.h" |
6 | 6 |
7 #include "base/compiler_specific.h" | 7 #include "build/build_config.h" |
8 | 8 |
9 #if defined(OS_POSIX) | 9 #if defined(OS_POSIX) |
10 #include <unistd.h> | 10 #include <unistd.h> |
11 #endif | 11 #endif |
12 | 12 |
| 13 #include <string> |
| 14 |
| 15 #include "base/compiler_specific.h" |
13 #include "base/histogram.h" | 16 #include "base/histogram.h" |
14 #include "base/ref_counted.h" | 17 #include "base/ref_counted.h" |
15 #include "base/string_util.h" | 18 #include "base/string_util.h" |
16 #include "base/time.h" | 19 #include "base/time.h" |
17 #include "net/base/io_buffer.h" | 20 #include "net/base/io_buffer.h" |
18 #include "net/base/load_flags.h" | 21 #include "net/base/load_flags.h" |
19 #include "net/base/net_errors.h" | 22 #include "net/base/net_errors.h" |
20 #include "net/base/net_log.h" | 23 #include "net/base/net_log.h" |
21 #include "net/base/ssl_cert_request_info.h" | 24 #include "net/base/ssl_cert_request_info.h" |
22 #include "net/disk_cache/disk_cache.h" | 25 #include "net/disk_cache/disk_cache.h" |
(...skipping 193 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
216 | 219 |
217 int rv = RestartNetworkRequestWithCertificate(client_cert); | 220 int rv = RestartNetworkRequestWithCertificate(client_cert); |
218 | 221 |
219 if (rv == ERR_IO_PENDING) | 222 if (rv == ERR_IO_PENDING) |
220 callback_ = callback; | 223 callback_ = callback; |
221 | 224 |
222 return rv; | 225 return rv; |
223 } | 226 } |
224 | 227 |
225 int HttpCache::Transaction::RestartWithAuth( | 228 int HttpCache::Transaction::RestartWithAuth( |
226 const std::wstring& username, | 229 const string16& username, |
227 const std::wstring& password, | 230 const string16& password, |
228 CompletionCallback* callback) { | 231 CompletionCallback* callback) { |
229 DCHECK(auth_response_.headers); | 232 DCHECK(auth_response_.headers); |
230 DCHECK(callback); | 233 DCHECK(callback); |
231 | 234 |
232 // Ensure that we only have one asynchronous call at a time. | 235 // Ensure that we only have one asynchronous call at a time. |
233 DCHECK(!callback_); | 236 DCHECK(!callback_); |
234 | 237 |
235 if (!cache_) | 238 if (!cache_) |
236 return ERR_UNEXPECTED; | 239 return ERR_UNEXPECTED; |
237 | 240 |
(...skipping 1252 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1490 DCHECK_EQ(STATE_NONE, next_state_); | 1493 DCHECK_EQ(STATE_NONE, next_state_); |
1491 | 1494 |
1492 next_state_ = STATE_SEND_REQUEST_COMPLETE; | 1495 next_state_ = STATE_SEND_REQUEST_COMPLETE; |
1493 int rv = network_trans_->RestartWithCertificate(client_cert, &io_callback_); | 1496 int rv = network_trans_->RestartWithCertificate(client_cert, &io_callback_); |
1494 if (rv != ERR_IO_PENDING) | 1497 if (rv != ERR_IO_PENDING) |
1495 return DoLoop(rv); | 1498 return DoLoop(rv); |
1496 return rv; | 1499 return rv; |
1497 } | 1500 } |
1498 | 1501 |
1499 int HttpCache::Transaction::RestartNetworkRequestWithAuth( | 1502 int HttpCache::Transaction::RestartNetworkRequestWithAuth( |
1500 const std::wstring& username, | 1503 const string16& username, |
1501 const std::wstring& password) { | 1504 const string16& password) { |
1502 DCHECK(mode_ & WRITE || mode_ == NONE); | 1505 DCHECK(mode_ & WRITE || mode_ == NONE); |
1503 DCHECK(network_trans_.get()); | 1506 DCHECK(network_trans_.get()); |
1504 DCHECK_EQ(STATE_NONE, next_state_); | 1507 DCHECK_EQ(STATE_NONE, next_state_); |
1505 | 1508 |
1506 next_state_ = STATE_SEND_REQUEST_COMPLETE; | 1509 next_state_ = STATE_SEND_REQUEST_COMPLETE; |
1507 int rv = network_trans_->RestartWithAuth(username, password, &io_callback_); | 1510 int rv = network_trans_->RestartWithAuth(username, password, &io_callback_); |
1508 if (rv != ERR_IO_PENDING) | 1511 if (rv != ERR_IO_PENDING) |
1509 return DoLoop(rv); | 1512 return DoLoop(rv); |
1510 return rv; | 1513 return rv; |
1511 } | 1514 } |
(...skipping 357 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1869 // |value| goes from 0 to 63. Actually, the max value should be 47 (0x2f) | 1872 // |value| goes from 0 to 63. Actually, the max value should be 47 (0x2f) |
1870 // but we'll see. | 1873 // but we'll see. |
1871 UMA_HISTOGRAM_ENUMERATION("HttpCache.ResponseHeaders", value, 65); | 1874 UMA_HISTOGRAM_ENUMERATION("HttpCache.ResponseHeaders", value, 65); |
1872 } | 1875 } |
1873 | 1876 |
1874 void HttpCache::Transaction::OnIOComplete(int result) { | 1877 void HttpCache::Transaction::OnIOComplete(int result) { |
1875 DoLoop(result); | 1878 DoLoop(result); |
1876 } | 1879 } |
1877 | 1880 |
1878 } // namespace net | 1881 } // namespace net |
OLD | NEW |