| OLD | NEW |
| 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 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_BASE_UPLOAD_DATA_H_ | 5 #ifndef NET_BASE_UPLOAD_DATA_H_ |
| 6 #define NET_BASE_UPLOAD_DATA_H_ | 6 #define NET_BASE_UPLOAD_DATA_H_ |
| 7 #pragma once | 7 #pragma once |
| 8 | 8 |
| 9 #include <vector> | 9 #include <vector> |
| 10 | 10 |
| (...skipping 148 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 159 void set_chunk_callback(ChunkCallback* callback); | 159 void set_chunk_callback(ChunkCallback* callback); |
| 160 | 160 |
| 161 // Initializes the object to send chunks of upload data over time rather | 161 // Initializes the object to send chunks of upload data over time rather |
| 162 // than all at once. | 162 // than all at once. |
| 163 void set_is_chunked(bool set) { is_chunked_ = set; } | 163 void set_is_chunked(bool set) { is_chunked_ = set; } |
| 164 bool is_chunked() const { return is_chunked_; } | 164 bool is_chunked() const { return is_chunked_; } |
| 165 | 165 |
| 166 // Returns the total size in bytes of the data to upload. | 166 // Returns the total size in bytes of the data to upload. |
| 167 uint64 GetContentLength(); | 167 uint64 GetContentLength(); |
| 168 | 168 |
| 169 // Returns true if the upload data is entirely in memory (i.e. the |
| 170 // upload data is not chunked, and all elemnts are of TYPE_BYTES). |
| 171 bool IsInMemory() const; |
| 172 |
| 169 std::vector<Element>* elements() { | 173 std::vector<Element>* elements() { |
| 170 return &elements_; | 174 return &elements_; |
| 171 } | 175 } |
| 172 | 176 |
| 173 void SetElements(const std::vector<Element>& elements); | 177 void SetElements(const std::vector<Element>& elements); |
| 174 | 178 |
| 175 void swap_elements(std::vector<Element>* elements) { | 179 void swap_elements(std::vector<Element>* elements) { |
| 176 elements_.swap(*elements); | 180 elements_.swap(*elements); |
| 177 } | 181 } |
| 178 | 182 |
| (...skipping 37 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 216 | 220 |
| 217 inline bool operator!=(const UploadData::Element& a, | 221 inline bool operator!=(const UploadData::Element& a, |
| 218 const UploadData::Element& b) { | 222 const UploadData::Element& b) { |
| 219 return !(a == b); | 223 return !(a == b); |
| 220 } | 224 } |
| 221 #endif // defined(UNIT_TEST) | 225 #endif // defined(UNIT_TEST) |
| 222 | 226 |
| 223 } // namespace net | 227 } // namespace net |
| 224 | 228 |
| 225 #endif // NET_BASE_UPLOAD_DATA_H_ | 229 #endif // NET_BASE_UPLOAD_DATA_H_ |
| OLD | NEW |