summaryrefslogtreecommitdiffstats
path: root/net/base/upload_data.h
diff options
context:
space:
mode:
authorjianli@chromium.org <jianli@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2010-08-27 18:29:24 +0000
committerjianli@chromium.org <jianli@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2010-08-27 18:29:24 +0000
commit22339b123c68805c7c293c67f6f47ea45f0fd1a1 (patch)
treebb05e2e3eb0362338e921a4dce9d5c350437326e /net/base/upload_data.h
parente840afdedd33728491639312a268fbf37a48f078 (diff)
downloadchromium_src-22339b123c68805c7c293c67f6f47ea45f0fd1a1.zip
chromium_src-22339b123c68805c7c293c67f6f47ea45f0fd1a1.tar.gz
chromium_src-22339b123c68805c7c293c67f6f47ea45f0fd1a1.tar.bz2
Support sending BlobData to browser process. Also support sending UploadData
with the blob info to browser process. BUG=none TEST=none Review URL: http://codereview.chromium.org/3108042 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@57707 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'net/base/upload_data.h')
-rw-r--r--net/base/upload_data.h18
1 files changed, 17 insertions, 1 deletions
diff --git a/net/base/upload_data.h b/net/base/upload_data.h
index 01ca0da..ffb668a 100644
--- a/net/base/upload_data.h
+++ b/net/base/upload_data.h
@@ -13,6 +13,7 @@
#include "base/gtest_prod_util.h"
#include "base/logging.h"
#include "base/ref_counted.h"
+#include "googleurl/src/gurl.h"
#include "net/base/file_stream.h"
#include "base/time.h"
@@ -24,7 +25,8 @@ class UploadData : public base::RefCounted<UploadData> {
enum Type {
TYPE_BYTES,
- TYPE_FILE
+ TYPE_FILE,
+ TYPE_BLOB
};
class Element {
@@ -50,6 +52,7 @@ class UploadData : public base::RefCounted<UploadData> {
const base::Time& expected_file_modification_time() const {
return expected_file_modification_time_;
}
+ const GURL& blob_url() const { return blob_url_; }
void SetToBytes(const char* bytes, int bytes_len) {
type_ = TYPE_BYTES;
@@ -73,6 +76,13 @@ class UploadData : public base::RefCounted<UploadData> {
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;
+ }
+
// Returns the byte-length of the element. For files that do not exist, 0
// is returned. This is done for consistency with Mozilla.
// Once called, this function will always return the same value.
@@ -97,6 +107,7 @@ class UploadData : public base::RefCounted<UploadData> {
uint64 file_range_offset_;
uint64 file_range_length_;
base::Time expected_file_modification_time_;
+ GURL blob_url_;
bool override_content_length_;
bool content_length_computed_;
uint64 content_length_;
@@ -127,6 +138,11 @@ class UploadData : public base::RefCounted<UploadData> {
expected_modification_time);
}
+ void AppendBlob(const GURL& blob_url) {
+ elements_.push_back(Element());
+ elements_.back().SetToBlobUrl(blob_url);
+ }
+
// Returns the total size in bytes of the data to upload.
uint64 GetContentLength();