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 // This file declares HttpCache::Transaction, a private class of HttpCache so | 5 // This file declares HttpCache::Transaction, a private class of HttpCache so |
6 // it should only be included by http_cache.cc | 6 // it should only be included by http_cache.cc |
7 | 7 |
8 #ifndef NET_HTTP_HTTP_CACHE_TRANSACTION_H_ | 8 #ifndef NET_HTTP_HTTP_CACHE_TRANSACTION_H_ |
9 #define NET_HTTP_HTTP_CACHE_TRANSACTION_H_ | 9 #define NET_HTTP_HTTP_CACHE_TRANSACTION_H_ |
10 #pragma once | 10 #pragma once |
11 | 11 |
12 #include <string> | 12 #include <string> |
13 | 13 |
14 #include "base/string16.h" | 14 #include "base/string16.h" |
15 #include "base/time.h" | 15 #include "base/time.h" |
16 #include "net/base/net_log.h" | 16 #include "net/base/net_log.h" |
17 #include "net/http/http_cache.h" | 17 #include "net/http/http_cache.h" |
18 #include "net/http/http_response_info.h" | 18 #include "net/http/http_response_info.h" |
19 #include "net/http/http_transaction.h" | 19 #include "net/http/http_transaction.h" |
20 | 20 |
21 namespace net { | 21 namespace net { |
22 | 22 |
| 23 class AuthData; |
23 class HttpResponseHeaders; | 24 class HttpResponseHeaders; |
24 class PartialData; | 25 class PartialData; |
25 struct HttpRequestInfo; | 26 struct HttpRequestInfo; |
26 | 27 |
27 // This is the transaction that is returned by the HttpCache transaction | 28 // This is the transaction that is returned by the HttpCache transaction |
28 // factory. | 29 // factory. |
29 class HttpCache::Transaction : public HttpTransaction { | 30 class HttpCache::Transaction : public HttpTransaction { |
30 public: | 31 public: |
31 // The transaction has the following modes, which apply to how it may access | 32 // The transaction has the following modes, which apply to how it may access |
32 // its cache entry. | 33 // its cache entry. |
(...skipping 62 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
95 CompletionCallback* io_callback() { return &io_callback_; } | 96 CompletionCallback* io_callback() { return &io_callback_; } |
96 | 97 |
97 const BoundNetLog& net_log() const; | 98 const BoundNetLog& net_log() const; |
98 | 99 |
99 // HttpTransaction methods: | 100 // HttpTransaction methods: |
100 virtual int Start(const HttpRequestInfo*, CompletionCallback*, | 101 virtual int Start(const HttpRequestInfo*, CompletionCallback*, |
101 const BoundNetLog&); | 102 const BoundNetLog&); |
102 virtual int RestartIgnoringLastError(CompletionCallback* callback); | 103 virtual int RestartIgnoringLastError(CompletionCallback* callback); |
103 virtual int RestartWithCertificate(X509Certificate* client_cert, | 104 virtual int RestartWithCertificate(X509Certificate* client_cert, |
104 CompletionCallback* callback); | 105 CompletionCallback* callback); |
| 106 virtual void SetTLSLoginAuthData(AuthData* auth_data); |
| 107 virtual int RestartWithTLSLogin(CompletionCallback *callback); |
105 virtual int RestartWithAuth(const string16& username, | 108 virtual int RestartWithAuth(const string16& username, |
106 const string16& password, | 109 const string16& password, |
107 CompletionCallback* callback); | 110 CompletionCallback* callback); |
108 virtual bool IsReadyToRestartForAuth(); | 111 virtual bool IsReadyToRestartForAuth(); |
109 virtual int Read(IOBuffer* buf, int buf_len, CompletionCallback* callback); | 112 virtual int Read(IOBuffer* buf, int buf_len, CompletionCallback* callback); |
110 virtual void StopCaching(); | 113 virtual void StopCaching(); |
111 virtual const HttpResponseInfo* GetResponseInfo() const; | 114 virtual const HttpResponseInfo* GetResponseInfo() const; |
112 virtual LoadState GetLoadState() const; | 115 virtual LoadState GetLoadState() const; |
113 virtual uint64 GetUploadProgress(void) const; | 116 virtual uint64 GetUploadProgress(void) const; |
114 | 117 |
(...skipping 132 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
247 int BeginExternallyConditionalizedRequest(); | 250 int BeginExternallyConditionalizedRequest(); |
248 | 251 |
249 // Called to restart a network transaction after an error. Returns network | 252 // Called to restart a network transaction after an error. Returns network |
250 // error code. | 253 // error code. |
251 int RestartNetworkRequest(); | 254 int RestartNetworkRequest(); |
252 | 255 |
253 // Called to restart a network transaction with a client certificate. | 256 // Called to restart a network transaction with a client certificate. |
254 // Returns network error code. | 257 // Returns network error code. |
255 int RestartNetworkRequestWithCertificate(X509Certificate* client_cert); | 258 int RestartNetworkRequestWithCertificate(X509Certificate* client_cert); |
256 | 259 |
| 260 int RestartNetworkRequestWithTLSLogin(); |
| 261 |
257 // Called to restart a network transaction with authentication credentials. | 262 // Called to restart a network transaction with authentication credentials. |
258 // Returns network error code. | 263 // Returns network error code. |
259 int RestartNetworkRequestWithAuth(const string16& username, | 264 int RestartNetworkRequestWithAuth(const string16& username, |
260 const string16& password); | 265 const string16& password); |
261 | 266 |
262 // Called to determine if we need to validate the cache entry before using it. | 267 // Called to determine if we need to validate the cache entry before using it. |
263 bool RequiresValidation(); | 268 bool RequiresValidation(); |
264 | 269 |
265 // Called to make the request conditional (to ask the server if the cached | 270 // Called to make the request conditional (to ask the server if the cached |
266 // copy is valid). Returns true if able to make the request conditional. | 271 // copy is valid). Returns true if able to make the request conditional. |
(...skipping 58 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
325 // |external_validation_| contains the value of those headers. | 330 // |external_validation_| contains the value of those headers. |
326 ValidationHeaders external_validation_; | 331 ValidationHeaders external_validation_; |
327 base::WeakPtr<HttpCache> cache_; | 332 base::WeakPtr<HttpCache> cache_; |
328 HttpCache::ActiveEntry* entry_; | 333 HttpCache::ActiveEntry* entry_; |
329 base::TimeTicks entry_lock_waiting_since_; | 334 base::TimeTicks entry_lock_waiting_since_; |
330 HttpCache::ActiveEntry* new_entry_; | 335 HttpCache::ActiveEntry* new_entry_; |
331 scoped_ptr<HttpTransaction> network_trans_; | 336 scoped_ptr<HttpTransaction> network_trans_; |
332 CompletionCallback* callback_; // Consumer's callback. | 337 CompletionCallback* callback_; // Consumer's callback. |
333 HttpResponseInfo response_; | 338 HttpResponseInfo response_; |
334 HttpResponseInfo auth_response_; | 339 HttpResponseInfo auth_response_; |
| 340 AuthData* tls_login_auth_data_; |
335 const HttpResponseInfo* new_response_; | 341 const HttpResponseInfo* new_response_; |
336 std::string cache_key_; | 342 std::string cache_key_; |
337 Mode mode_; | 343 Mode mode_; |
338 State target_state_; | 344 State target_state_; |
339 bool reading_; // We are already reading. | 345 bool reading_; // We are already reading. |
340 bool invalid_range_; // We may bypass the cache for this request. | 346 bool invalid_range_; // We may bypass the cache for this request. |
341 bool truncated_; // We don't have all the response data. | 347 bool truncated_; // We don't have all the response data. |
342 bool is_sparse_; // The data is stored in sparse byte ranges. | 348 bool is_sparse_; // The data is stored in sparse byte ranges. |
343 bool server_responded_206_; | 349 bool server_responded_206_; |
344 bool cache_pending_; // We are waiting for the HttpCache. | 350 bool cache_pending_; // We are waiting for the HttpCache. |
345 scoped_refptr<IOBuffer> read_buf_; | 351 scoped_refptr<IOBuffer> read_buf_; |
346 int io_buf_len_; | 352 int io_buf_len_; |
347 int read_offset_; | 353 int read_offset_; |
348 int effective_load_flags_; | 354 int effective_load_flags_; |
349 int write_len_; | 355 int write_len_; |
350 scoped_ptr<PartialData> partial_; // We are dealing with range requests. | 356 scoped_ptr<PartialData> partial_; // We are dealing with range requests. |
351 uint64 final_upload_progress_; | 357 uint64 final_upload_progress_; |
352 CompletionCallbackImpl<Transaction> io_callback_; | 358 CompletionCallbackImpl<Transaction> io_callback_; |
353 scoped_refptr<CancelableCompletionCallback<Transaction> > cache_callback_; | 359 scoped_refptr<CancelableCompletionCallback<Transaction> > cache_callback_; |
354 scoped_refptr<CancelableCompletionCallback<Transaction> > | 360 scoped_refptr<CancelableCompletionCallback<Transaction> > |
355 write_headers_callback_; | 361 write_headers_callback_; |
356 }; | 362 }; |
357 | 363 |
358 } // namespace net | 364 } // namespace net |
359 | 365 |
360 #endif // NET_HTTP_HTTP_CACHE_TRANSACTION_H_ | 366 #endif // NET_HTTP_HTTP_CACHE_TRANSACTION_H_ |
OLD | NEW |