Chromium Code Reviews| Index: net/base/upload_data.h |
| diff --git a/net/base/upload_data.h b/net/base/upload_data.h |
| index ab6186b78a9194a24d3a85785ecf1a1903c08d8b..0394c762492fd3dd628c34039eba4040f42fcef4 100644 |
| --- a/net/base/upload_data.h |
| +++ b/net/base/upload_data.h |
| @@ -51,6 +51,9 @@ class NET_EXPORT UploadData |
| // A block of bytes to be sent in chunked encoding immediately, without |
| // waiting for rest of the data. |
| TYPE_CHUNK, |
| + |
| + // For a file specified as FileSystem URL. |
| + TYPE_FILE_FILESYSTEM, |
|
darin (slow to review)
2012/08/10 16:50:24
Can we avoid this? It seems unfortunate to make t
|
| }; |
| class NET_EXPORT Element { |
| @@ -73,7 +76,7 @@ class NET_EXPORT UploadData |
| const base::Time& expected_file_modification_time() const { |
| return expected_file_modification_time_; |
| } |
| - const GURL& blob_url() const { return blob_url_; } |
| + const GURL& url() const { return url_; } |
| void SetToBytes(const char* bytes, int bytes_len) { |
| type_ = TYPE_BYTES; |
| @@ -97,11 +100,22 @@ class NET_EXPORT UploadData |
| expected_file_modification_time_ = expected_modification_time; |
| } |
| + void SetToFileSystemURLRange( |
| + const GURL& url, |
| + uint64 offset, uint64 length, |
| + const base::Time& expected_modification_time) { |
| + type_ = TYPE_FILE_FILESYSTEM; |
| + url_ = url; |
| + file_range_offset_ = offset; |
| + file_range_length_ = length; |
| + expected_file_modification_time_ = expected_modification_time; |
| + } |
| + |
| // TODO(jianli): UploadData should not contain any blob reference. We need |
| // to define another structure to represent WebKit::WebHTTPBody. |
| void SetToBlobUrl(const GURL& blob_url) { |
| type_ = TYPE_BLOB; |
| - blob_url_ = blob_url; |
| + url_ = blob_url; |
| } |
| // Though similar to bytes, a chunk indicates that the element is sent via |
| @@ -157,7 +171,7 @@ class NET_EXPORT UploadData |
| uint64 file_range_offset_; |
| uint64 file_range_length_; |
| base::Time expected_file_modification_time_; |
| - GURL blob_url_; |
| + GURL url_; |
| bool is_last_chunk_; |
| bool override_content_length_; |
| bool content_length_computed_; |
| @@ -187,6 +201,10 @@ class NET_EXPORT UploadData |
| uint64 offset, uint64 length, |
| const base::Time& expected_modification_time); |
| + void AppendFileSystemFileRange(const GURL& url, |
| + uint64 offset, uint64 length, |
| + const base::Time& expected_modification_time); |
| + |
| void AppendBlob(const GURL& blob_url); |
| // Adds the given chunk of bytes to be sent immediately with chunked transfer |
| @@ -273,8 +291,9 @@ inline bool operator==(const UploadData::Element& a, |
| a.expected_file_modification_time() == |
| b.expected_file_modification_time(); |
| } |
| - if (a.type() == UploadData::TYPE_BLOB) |
| - return a.blob_url() == b.blob_url(); |
| + if (a.type() == UploadData::TYPE_BLOB || |
| + a.type() == UploadData::TYPE_FILE_FILESYSTEM) |
| + return a.url() == b.url(); |
| return false; |
| } |