| OLD | NEW |
| 1 // Copyright (c) 2009 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2009 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 #ifndef NET_HTTP_PARTIAL_DATA_H_ | 5 #ifndef NET_HTTP_PARTIAL_DATA_H_ |
| 6 #define NET_HTTP_PARTIAL_DATA_H_ | 6 #define NET_HTTP_PARTIAL_DATA_H_ |
| 7 | 7 |
| 8 #include <string> | 8 #include <string> |
| 9 | 9 |
| 10 #include "base/basictypes.h" | 10 #include "base/basictypes.h" |
| (...skipping 28 matching lines...) Expand all Loading... |
| 39 // Performs initialization of the object by parsing the request |headers| | 39 // Performs initialization of the object by parsing the request |headers| |
| 40 // and verifying that we can process the requested range. Returns true if | 40 // and verifying that we can process the requested range. Returns true if |
| 41 // we can process the requested range, and false otherwise. | 41 // we can process the requested range, and false otherwise. |
| 42 bool Init(const std::string& headers); | 42 bool Init(const std::string& headers); |
| 43 | 43 |
| 44 // Sets the headers that we should use to make byte range requests. This is a | 44 // Sets the headers that we should use to make byte range requests. This is a |
| 45 // subset of the request extra headers, with byte-range related headers | 45 // subset of the request extra headers, with byte-range related headers |
| 46 // removed. | 46 // removed. |
| 47 void SetHeaders(const std::string& headers); | 47 void SetHeaders(const std::string& headers); |
| 48 | 48 |
| 49 // Restores the byte-range header that was removed during Init(), by appending | 49 // Restores the byte-range headers, by appending the byte range to the headers |
| 50 // the data to the provided |headers|. | 50 // provided to SetHeaders(). |
| 51 void RestoreHeaders(std::string* headers) const; | 51 void RestoreHeaders(std::string* headers) const; |
| 52 | 52 |
| 53 // Builds the required |headers| to perform the proper cache validation for | 53 // Builds the required |headers| to perform the proper cache validation for |
| 54 // the next range to be fetched. Returns 0 when there is no need to perform | 54 // the next range to be fetched. Returns 0 when there is no need to perform |
| 55 // more operations because we reached the end of the request (so 0 bytes | 55 // more operations because we reached the end of the request (so 0 bytes |
| 56 // should be actually returned to the user), a positive number to indicate | 56 // should be actually returned to the user), a positive number to indicate |
| 57 // that |headers| should be used to validate the cache, or an appropriate | 57 // that |headers| should be used to validate the cache, or an appropriate |
| 58 // error code. | 58 // error code. |
| 59 int PrepareCacheValidation(disk_cache::Entry* entry, std::string* headers); | 59 int PrepareCacheValidation(disk_cache::Entry* entry, std::string* headers); |
| 60 | 60 |
| (...skipping 56 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 117 bool final_range_; | 117 bool final_range_; |
| 118 bool sparse_entry_; | 118 bool sparse_entry_; |
| 119 bool truncated_; // We have an incomplete 200 stored. | 119 bool truncated_; // We have an incomplete 200 stored. |
| 120 | 120 |
| 121 DISALLOW_COPY_AND_ASSIGN(PartialData); | 121 DISALLOW_COPY_AND_ASSIGN(PartialData); |
| 122 }; | 122 }; |
| 123 | 123 |
| 124 } // namespace net | 124 } // namespace net |
| 125 | 125 |
| 126 #endif // NET_HTTP_PARTIAL_DATA_H_ | 126 #endif // NET_HTTP_PARTIAL_DATA_H_ |
| OLD | NEW |