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 WEBKIT_GLUE_RESOURCE_REQUEST_BODY_H_ | 5 #ifndef WEBKIT_GLUE_RESOURCE_REQUEST_BODY_H_ |
6 #define WEBKIT_GLUE_RESOURCE_REQUEST_BODY_H_ | 6 #define WEBKIT_GLUE_RESOURCE_REQUEST_BODY_H_ |
7 | 7 |
8 #include <vector> | 8 #include <vector> |
9 | 9 |
10 #include "base/basictypes.h" | 10 #include "base/basictypes.h" |
11 #include "base/memory/ref_counted.h" | 11 #include "base/memory/ref_counted.h" |
12 #include "base/supports_user_data.h" | 12 #include "base/supports_user_data.h" |
13 #include "webkit/base/data_element.h" | 13 #include "webkit/base/data_element.h" |
14 #include "webkit/glue/webkit_glue_export.h" | 14 #include "webkit/glue/webkit_glue_export.h" |
15 | 15 |
16 namespace net { | 16 namespace net { |
17 class UploadData; | 17 class UploadDataStream; |
18 class UploadElement; | |
19 } | 18 } |
20 | 19 |
21 namespace webkit_blob { | 20 namespace webkit_blob { |
22 class BlobStorageController; | 21 class BlobStorageController; |
23 } | 22 } |
24 | 23 |
25 namespace webkit_glue { | 24 namespace webkit_glue { |
26 | 25 |
27 // A struct used to represent upload data. The data field is populated by | 26 // A struct used to represent upload data. The data field is populated by |
28 // WebURLLoader from the data given as WebHTTPBody. | 27 // WebURLLoader from the data given as WebHTTPBody. |
29 class WEBKIT_GLUE_EXPORT ResourceRequestBody | 28 class WEBKIT_GLUE_EXPORT ResourceRequestBody |
30 : public base::RefCounted<ResourceRequestBody>, | 29 : public base::RefCounted<ResourceRequestBody>, |
31 public base::SupportsUserData { | 30 public base::SupportsUserData { |
32 public: | 31 public: |
33 typedef webkit_base::DataElement Element; | 32 typedef webkit_base::DataElement Element; |
34 | 33 |
35 ResourceRequestBody(); | 34 ResourceRequestBody(); |
36 | 35 |
37 void AppendBytes(const char* bytes, int bytes_len); | 36 void AppendBytes(const char* bytes, int bytes_len); |
38 void AppendFileRange(const FilePath& file_path, | 37 void AppendFileRange(const FilePath& file_path, |
39 uint64 offset, uint64 length, | 38 uint64 offset, uint64 length, |
40 const base::Time& expected_modification_time); | 39 const base::Time& expected_modification_time); |
41 void AppendBlob(const GURL& blob_url); | 40 void AppendBlob(const GURL& blob_url); |
42 void AppendFileSystemFileRange(const GURL& url, uint64 offset, uint64 length, | 41 void AppendFileSystemFileRange(const GURL& url, uint64 offset, uint64 length, |
43 const base::Time& expected_modification_time); | 42 const base::Time& expected_modification_time); |
44 | 43 |
45 // Creates a new UploadData from this request body. This also resolves | 44 // Creates a new UploadDataStream from this request body. This also resolves |
46 // any blob references using given |blob_controller|. | 45 // any blob references using given |blob_controller|. |
47 // TODO(kinuko): Clean up this hack. | 46 // TODO(kinuko): Clean up this hack. |
48 net::UploadData* ResolveElementsAndCreateUploadData( | 47 net::UploadDataStream* ResolveElementsAndCreateUploadData( |
mmenke
2012/12/11 18:53:21
Maybe AndCreateUploadStream? AndCreateUploadStrea
hashimoto
2012/12/12 10:29:07
Renamed to ResolveElementsAndCreateUploadDataStrea
| |
49 webkit_blob::BlobStorageController* blob_controller); | 48 webkit_blob::BlobStorageController* blob_controller); |
50 | 49 |
51 const std::vector<Element>* elements() const { return &elements_; } | 50 const std::vector<Element>* elements() const { return &elements_; } |
52 std::vector<Element>* elements_mutable() { return &elements_; } | 51 std::vector<Element>* elements_mutable() { return &elements_; } |
53 void swap_elements(std::vector<Element>* elements) { | 52 void swap_elements(std::vector<Element>* elements) { |
54 elements_.swap(*elements); | 53 elements_.swap(*elements); |
55 } | 54 } |
56 | 55 |
57 // Identifies a particular upload instance, which is used by the cache to | 56 // Identifies a particular upload instance, which is used by the cache to |
58 // formulate a cache key. This value should be unique across browser | 57 // formulate a cache key. This value should be unique across browser |
(...skipping 13 matching lines...) Expand all Loading... | |
72 | 71 |
73 std::vector<Element> elements_; | 72 std::vector<Element> elements_; |
74 int64 identifier_; | 73 int64 identifier_; |
75 | 74 |
76 DISALLOW_COPY_AND_ASSIGN(ResourceRequestBody); | 75 DISALLOW_COPY_AND_ASSIGN(ResourceRequestBody); |
77 }; | 76 }; |
78 | 77 |
79 } // namespace webkit_glue | 78 } // namespace webkit_glue |
80 | 79 |
81 #endif // WEBKIT_GLUE_RESOURCE_REQUEST_BODY_H_ | 80 #endif // WEBKIT_GLUE_RESOURCE_REQUEST_BODY_H_ |
OLD | NEW |