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 "base/time.h" |
16 #include "googleurl/src/gurl.h" | 16 #include "googleurl/src/gurl.h" |
17 #include "net/base/net_api.h" | 17 #include "net/base/net_export.h" |
18 | 18 |
19 namespace net { | 19 namespace net { |
20 | 20 |
21 class FileStream; | 21 class FileStream; |
22 | 22 |
23 // Interface implemented by callers who require callbacks when new chunks | 23 // Interface implemented by callers who require callbacks when new chunks |
24 // of data are added. | 24 // of data are added. |
25 class NET_TEST ChunkCallback { | 25 class NET_EXPORT_PRIVATE ChunkCallback { |
26 public: | 26 public: |
27 // 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. |
28 virtual void OnChunkAvailable() = 0; | 28 virtual void OnChunkAvailable() = 0; |
29 | 29 |
30 protected: | 30 protected: |
31 virtual ~ChunkCallback() {} | 31 virtual ~ChunkCallback() {} |
32 }; | 32 }; |
33 | 33 |
34 class NET_API UploadData : public base::RefCounted<UploadData> { | 34 class NET_EXPORT UploadData : public base::RefCounted<UploadData> { |
35 public: | 35 public: |
36 enum Type { | 36 enum Type { |
37 TYPE_BYTES, | 37 TYPE_BYTES, |
38 TYPE_FILE, | 38 TYPE_FILE, |
39 TYPE_BLOB, | 39 TYPE_BLOB, |
40 | 40 |
41 // 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 |
42 // waiting for rest of the data. | 42 // waiting for rest of the data. |
43 TYPE_CHUNK, | 43 TYPE_CHUNK, |
44 }; | 44 }; |
45 | 45 |
46 class NET_API Element { | 46 class NET_EXPORT Element { |
47 public: | 47 public: |
48 Element(); | 48 Element(); |
49 ~Element(); | 49 ~Element(); |
50 | 50 |
51 Type type() const { return type_; } | 51 Type type() const { return type_; } |
52 // Explicitly sets the type of this Element. Used during IPC | 52 // Explicitly sets the type of this Element. Used during IPC |
53 // marshalling. | 53 // marshalling. |
54 void set_type(Type type) { | 54 void set_type(Type type) { |
55 type_ = type; | 55 type_ = type; |
56 } | 56 } |
(...skipping 161 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
218 | 218 |
219 inline bool operator!=(const UploadData::Element& a, | 219 inline bool operator!=(const UploadData::Element& a, |
220 const UploadData::Element& b) { | 220 const UploadData::Element& b) { |
221 return !(a == b); | 221 return !(a == b); |
222 } | 222 } |
223 #endif // defined(UNIT_TEST) | 223 #endif // defined(UNIT_TEST) |
224 | 224 |
225 } // namespace net | 225 } // namespace net |
226 | 226 |
227 #endif // NET_BASE_UPLOAD_DATA_H_ | 227 #endif // NET_BASE_UPLOAD_DATA_H_ |
OLD | NEW |