| OLD | NEW |
| 1 // Copyright (c) 2006-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> |
| 13 |
| 14 #include "base/string16.h" |
| 15 #include "base/time.h" |
| 12 #include "net/base/net_log.h" | 16 #include "net/base/net_log.h" |
| 13 #include "base/time.h" | |
| 14 #include "net/http/http_cache.h" | 17 #include "net/http/http_cache.h" |
| 15 #include "net/http/http_response_info.h" | 18 #include "net/http/http_response_info.h" |
| 16 #include "net/http/http_transaction.h" | 19 #include "net/http/http_transaction.h" |
| 17 | 20 |
| 18 namespace net { | 21 namespace net { |
| 19 | 22 |
| 20 class HttpResponseHeaders; | 23 class HttpResponseHeaders; |
| 21 class PartialData; | 24 class PartialData; |
| 22 | 25 |
| 23 // This is the transaction that is returned by the HttpCache transaction | 26 // This is the transaction that is returned by the HttpCache transaction |
| 24 // factory. | 27 // factory. |
| 25 class HttpCache::Transaction : public HttpTransaction { | 28 class HttpCache::Transaction : public HttpTransaction { |
| 26 public: | 29 public: |
| 27 Transaction(HttpCache* cache, bool enable_range_support); | 30 Transaction(HttpCache* cache, bool enable_range_support); |
| 28 virtual ~Transaction(); | 31 virtual ~Transaction(); |
| 29 | 32 |
| 30 // HttpTransaction methods: | 33 // HttpTransaction methods: |
| 31 virtual int Start(const HttpRequestInfo*, CompletionCallback*, | 34 virtual int Start(const HttpRequestInfo*, CompletionCallback*, |
| 32 const BoundNetLog&); | 35 const BoundNetLog&); |
| 33 virtual int RestartIgnoringLastError(CompletionCallback* callback); | 36 virtual int RestartIgnoringLastError(CompletionCallback* callback); |
| 34 virtual int RestartWithCertificate(X509Certificate* client_cert, | 37 virtual int RestartWithCertificate(X509Certificate* client_cert, |
| 35 CompletionCallback* callback); | 38 CompletionCallback* callback); |
| 36 virtual int RestartWithAuth(const std::wstring& username, | 39 virtual int RestartWithAuth(const string16& username, |
| 37 const std::wstring& password, | 40 const string16& password, |
| 38 CompletionCallback* callback); | 41 CompletionCallback* callback); |
| 39 virtual bool IsReadyToRestartForAuth(); | 42 virtual bool IsReadyToRestartForAuth(); |
| 40 virtual int Read(IOBuffer* buf, int buf_len, CompletionCallback* callback); | 43 virtual int Read(IOBuffer* buf, int buf_len, CompletionCallback* callback); |
| 41 virtual void StopCaching(); | 44 virtual void StopCaching(); |
| 42 virtual const HttpResponseInfo* GetResponseInfo() const; | 45 virtual const HttpResponseInfo* GetResponseInfo() const; |
| 43 virtual LoadState GetLoadState() const; | 46 virtual LoadState GetLoadState() const; |
| 44 virtual uint64 GetUploadProgress(void) const; | 47 virtual uint64 GetUploadProgress(void) const; |
| 45 | 48 |
| 46 // The transaction has the following modes, which apply to how it may access | 49 // The transaction has the following modes, which apply to how it may access |
| 47 // its cache entry. | 50 // its cache entry. |
| (...skipping 195 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 243 // Called to restart a network transaction after an error. Returns network | 246 // Called to restart a network transaction after an error. Returns network |
| 244 // error code. | 247 // error code. |
| 245 int RestartNetworkRequest(); | 248 int RestartNetworkRequest(); |
| 246 | 249 |
| 247 // Called to restart a network transaction with a client certificate. | 250 // Called to restart a network transaction with a client certificate. |
| 248 // Returns network error code. | 251 // Returns network error code. |
| 249 int RestartNetworkRequestWithCertificate(X509Certificate* client_cert); | 252 int RestartNetworkRequestWithCertificate(X509Certificate* client_cert); |
| 250 | 253 |
| 251 // Called to restart a network transaction with authentication credentials. | 254 // Called to restart a network transaction with authentication credentials. |
| 252 // Returns network error code. | 255 // Returns network error code. |
| 253 int RestartNetworkRequestWithAuth(const std::wstring& username, | 256 int RestartNetworkRequestWithAuth(const string16& username, |
| 254 const std::wstring& password); | 257 const string16& password); |
| 255 | 258 |
| 256 // Called to determine if we need to validate the cache entry before using it. | 259 // Called to determine if we need to validate the cache entry before using it. |
| 257 bool RequiresValidation(); | 260 bool RequiresValidation(); |
| 258 | 261 |
| 259 // Called to make the request conditional (to ask the server if the cached | 262 // Called to make the request conditional (to ask the server if the cached |
| 260 // copy is valid). Returns true if able to make the request conditional. | 263 // copy is valid). Returns true if able to make the request conditional. |
| 261 bool ConditionalizeRequest(); | 264 bool ConditionalizeRequest(); |
| 262 | 265 |
| 263 // Makes sure that a 206 response is expected. Returns true on success. | 266 // Makes sure that a 206 response is expected. Returns true on success. |
| 264 // On success, |partial_content| will be set to true if we are processing a | 267 // On success, |partial_content| will be set to true if we are processing a |
| (...skipping 80 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 345 uint64 final_upload_progress_; | 348 uint64 final_upload_progress_; |
| 346 CompletionCallbackImpl<Transaction> io_callback_; | 349 CompletionCallbackImpl<Transaction> io_callback_; |
| 347 scoped_refptr<CancelableCompletionCallback<Transaction> > cache_callback_; | 350 scoped_refptr<CancelableCompletionCallback<Transaction> > cache_callback_; |
| 348 scoped_refptr<CancelableCompletionCallback<Transaction> > | 351 scoped_refptr<CancelableCompletionCallback<Transaction> > |
| 349 write_headers_callback_; | 352 write_headers_callback_; |
| 350 }; | 353 }; |
| 351 | 354 |
| 352 } // namespace net | 355 } // namespace net |
| 353 | 356 |
| 354 #endif // NET_HTTP_HTTP_CACHE_TRANSACTION_H_ | 357 #endif // NET_HTTP_HTTP_CACHE_TRANSACTION_H_ |
| OLD | NEW |