OLD | NEW |
1 // Copyright (c) 2006-2008 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2006-2008 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.h" | 5 #include "net/http/http_cache.h" |
6 | 6 |
7 #include <algorithm> | 7 #include <algorithm> |
8 | 8 |
9 #include "base/compiler_specific.h" | 9 #include "base/compiler_specific.h" |
10 | 10 |
(...skipping 148 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
159 | 159 |
160 // Clean up the transaction. | 160 // Clean up the transaction. |
161 virtual ~Transaction(); | 161 virtual ~Transaction(); |
162 | 162 |
163 // HttpTransaction methods: | 163 // HttpTransaction methods: |
164 virtual int Start(const HttpRequestInfo*, CompletionCallback*); | 164 virtual int Start(const HttpRequestInfo*, CompletionCallback*); |
165 virtual int RestartIgnoringLastError(CompletionCallback*); | 165 virtual int RestartIgnoringLastError(CompletionCallback*); |
166 virtual int RestartWithAuth(const std::wstring& username, | 166 virtual int RestartWithAuth(const std::wstring& username, |
167 const std::wstring& password, | 167 const std::wstring& password, |
168 CompletionCallback* callback); | 168 CompletionCallback* callback); |
| 169 virtual bool IsReadyToRestartForAuth(); |
169 virtual int Read(IOBuffer* buf, int buf_len, CompletionCallback*); | 170 virtual int Read(IOBuffer* buf, int buf_len, CompletionCallback*); |
170 virtual const HttpResponseInfo* GetResponseInfo() const; | 171 virtual const HttpResponseInfo* GetResponseInfo() const; |
171 virtual LoadState GetLoadState() const; | 172 virtual LoadState GetLoadState() const; |
172 virtual uint64 GetUploadProgress(void) const; | 173 virtual uint64 GetUploadProgress(void) const; |
173 | 174 |
174 // The transaction has the following modes, which apply to how it may access | 175 // The transaction has the following modes, which apply to how it may access |
175 // its cache entry. | 176 // its cache entry. |
176 // | 177 // |
177 // o If the mode of the transaction is NONE, then it is in "pass through" | 178 // o If the mode of the transaction is NONE, then it is in "pass through" |
178 // mode and all methods just forward to the inner network transaction. | 179 // mode and all methods just forward to the inner network transaction. |
(...skipping 216 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
395 auth_response_ = HttpResponseInfo(); | 396 auth_response_ = HttpResponseInfo(); |
396 | 397 |
397 int rv = RestartNetworkRequestWithAuth(username, password); | 398 int rv = RestartNetworkRequestWithAuth(username, password); |
398 | 399 |
399 if (rv == ERR_IO_PENDING) | 400 if (rv == ERR_IO_PENDING) |
400 callback_ = callback; | 401 callback_ = callback; |
401 | 402 |
402 return rv; | 403 return rv; |
403 } | 404 } |
404 | 405 |
| 406 bool HttpCache::Transaction::IsReadyToRestartForAuth() { |
| 407 if (!network_trans_.get()) |
| 408 return false; |
| 409 return network_trans_->IsReadyToRestartForAuth(); |
| 410 } |
| 411 |
405 int HttpCache::Transaction::Read(IOBuffer* buf, int buf_len, | 412 int HttpCache::Transaction::Read(IOBuffer* buf, int buf_len, |
406 CompletionCallback* callback) { | 413 CompletionCallback* callback) { |
407 DCHECK(buf); | 414 DCHECK(buf); |
408 DCHECK(buf_len > 0); | 415 DCHECK(buf_len > 0); |
409 DCHECK(callback); | 416 DCHECK(callback); |
410 | 417 |
411 DCHECK(!callback_); | 418 DCHECK(!callback_); |
412 | 419 |
413 if (revoked()) | 420 if (revoked()) |
414 return ERR_UNEXPECTED; | 421 return ERR_UNEXPECTED; |
(...skipping 1062 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1477 return; // have to wait | 1484 return; // have to wait |
1478 | 1485 |
1479 entry->pending_queue.erase(entry->pending_queue.begin()); | 1486 entry->pending_queue.erase(entry->pending_queue.begin()); |
1480 | 1487 |
1481 AddTransactionToEntry(entry, next); | 1488 AddTransactionToEntry(entry, next); |
1482 } | 1489 } |
1483 | 1490 |
1484 //----------------------------------------------------------------------------- | 1491 //----------------------------------------------------------------------------- |
1485 | 1492 |
1486 } // namespace net | 1493 } // namespace net |
OLD | NEW |