| 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 #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 | 7 |
| 8 #include <string> | 8 #include <string> |
| 9 #include <vector> | 9 #include <vector> |
| 10 | 10 |
| 11 #include "base/ref_counted.h" | 11 #include "base/ref_counted.h" |
| 12 | 12 |
| 13 namespace net { | 13 namespace net { |
| 14 | 14 |
| 15 class UploadData : public base::RefCounted<UploadData> { | 15 class UploadData : public base::RefCounted<UploadData> { |
| 16 public: | 16 public: |
| 17 UploadData() {} | 17 UploadData() : identifier_(0) {} |
| 18 | 18 |
| 19 enum Type { | 19 enum Type { |
| 20 TYPE_BYTES, | 20 TYPE_BYTES, |
| 21 TYPE_FILE | 21 TYPE_FILE |
| 22 }; | 22 }; |
| 23 | 23 |
| 24 class Element { | 24 class Element { |
| 25 public: | 25 public: |
| 26 Element() : type_(TYPE_BYTES), file_range_offset_(0), | 26 Element() : type_(TYPE_BYTES), file_range_offset_(0), |
| 27 file_range_length_(kuint64max) { | 27 file_range_length_(kuint64max) { |
| (...skipping 56 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 84 uint64 GetContentLength() const; | 84 uint64 GetContentLength() const; |
| 85 | 85 |
| 86 const std::vector<Element>& elements() const { | 86 const std::vector<Element>& elements() const { |
| 87 return elements_; | 87 return elements_; |
| 88 } | 88 } |
| 89 | 89 |
| 90 void set_elements(const std::vector<Element>& elements) { | 90 void set_elements(const std::vector<Element>& elements) { |
| 91 elements_ = elements; | 91 elements_ = elements; |
| 92 } | 92 } |
| 93 | 93 |
| 94 void swap_elements(std::vector<Element>* elements) { |
| 95 elements_.swap(*elements); |
| 96 } |
| 97 |
| 98 // Identifies a particular upload instance, which is used by the cache to |
| 99 // formulate a cache key. This value should be unique across browser |
| 100 // sessions. A value of 0 is used to indicate an unspecified identifier. |
| 101 void set_identifier(int64 id) { identifier_ = id; } |
| 102 int64 identifier() const { return identifier_; } |
| 103 |
| 94 private: | 104 private: |
| 95 std::vector<Element> elements_; | 105 std::vector<Element> elements_; |
| 106 int64 identifier_; |
| 96 }; | 107 }; |
| 97 | 108 |
| 98 } // namespace net | 109 } // namespace net |
| 99 | 110 |
| 100 #endif // NET_BASE_UPLOAD_DATA_H_ | 111 #endif // NET_BASE_UPLOAD_DATA_H_ |
| OLD | NEW |