OLD | NEW |
1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2011 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 |
11 #include "base/basictypes.h" | 11 #include "base/basictypes.h" |
12 #include "base/file_path.h" | 12 #include "base/file_path.h" |
13 #include "base/gtest_prod_util.h" | 13 #include "base/gtest_prod_util.h" |
14 #include "base/memory/ref_counted.h" | 14 #include "base/memory/ref_counted.h" |
| 15 #include "base/time.h" |
15 #include "googleurl/src/gurl.h" | 16 #include "googleurl/src/gurl.h" |
16 #include "base/time.h" | 17 #include "net/base/net_api.h" |
17 | 18 |
18 namespace net { | 19 namespace net { |
19 | 20 |
20 class FileStream; | 21 class FileStream; |
21 | 22 |
22 // Interface implemented by callers who require callbacks when new chunks | 23 // Interface implemented by callers who require callbacks when new chunks |
23 // of data are added. | 24 // of data are added. |
24 class ChunkCallback { | 25 class NET_TEST ChunkCallback { |
25 public: | 26 public: |
26 // Invoked when a new data chunk was given for a chunked transfer upload. | 27 // Invoked when a new data chunk was given for a chunked transfer upload. |
27 virtual void OnChunkAvailable() = 0; | 28 virtual void OnChunkAvailable() = 0; |
28 | 29 |
29 protected: | 30 protected: |
30 virtual ~ChunkCallback() {} | 31 virtual ~ChunkCallback() {} |
31 }; | 32 }; |
32 | 33 |
33 class UploadData : public base::RefCounted<UploadData> { | 34 class NET_API UploadData : public base::RefCounted<UploadData> { |
34 public: | 35 public: |
35 enum Type { | 36 enum Type { |
36 TYPE_BYTES, | 37 TYPE_BYTES, |
37 TYPE_FILE, | 38 TYPE_FILE, |
38 TYPE_BLOB, | 39 TYPE_BLOB, |
39 | 40 |
40 // A block of bytes to be sent in chunked encoding immediately, without | 41 // A block of bytes to be sent in chunked encoding immediately, without |
41 // waiting for rest of the data. | 42 // waiting for rest of the data. |
42 TYPE_CHUNK, | 43 TYPE_CHUNK, |
43 }; | 44 }; |
44 | 45 |
45 class Element { | 46 class NET_API Element { |
46 public: | 47 public: |
47 Element(); | 48 Element(); |
48 ~Element(); | 49 ~Element(); |
49 | 50 |
50 Type type() const { return type_; } | 51 Type type() const { return type_; } |
51 // Explicitly sets the type of this Element. Used during IPC | 52 // Explicitly sets the type of this Element. Used during IPC |
52 // marshalling. | 53 // marshalling. |
53 void set_type(Type type) { | 54 void set_type(Type type) { |
54 type_ = type; | 55 type_ = type; |
55 } | 56 } |
(...skipping 161 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
217 | 218 |
218 inline bool operator!=(const UploadData::Element& a, | 219 inline bool operator!=(const UploadData::Element& a, |
219 const UploadData::Element& b) { | 220 const UploadData::Element& b) { |
220 return !(a == b); | 221 return !(a == b); |
221 } | 222 } |
222 #endif // defined(UNIT_TEST) | 223 #endif // defined(UNIT_TEST) |
223 | 224 |
224 } // namespace net | 225 } // namespace net |
225 | 226 |
226 #endif // NET_BASE_UPLOAD_DATA_H_ | 227 #endif // NET_BASE_UPLOAD_DATA_H_ |
OLD | NEW |