Index: content/public/common/resource_request_body.cc |
diff --git a/content/public/common/resource_request_body.cc b/content/public/common/resource_request_body.cc |
index e273b9e2a4fc9743e2419452ba31507917d7078e..3e0a8c8e3e9ef3cc02be8ca703e06cb758192e04 100644 |
--- a/content/public/common/resource_request_body.cc |
+++ b/content/public/common/resource_request_body.cc |
@@ -4,23 +4,20 @@ |
#include "content/public/common/resource_request_body.h" |
-#include "content/common/resource_request_body_impl.h" |
- |
#if defined(OS_ANDROID) |
#include "content/common/android/resource_request_body_android.h" |
#endif |
namespace content { |
-ResourceRequestBody::ResourceRequestBody() {} |
- |
-ResourceRequestBody::~ResourceRequestBody() {} |
+ResourceRequestBody::ResourceRequestBody() |
+ : identifier_(0), contains_sensitive_info_(false) {} |
// static |
scoped_refptr<ResourceRequestBody> ResourceRequestBody::CreateFromBytes( |
const char* bytes, |
size_t length) { |
- scoped_refptr<ResourceRequestBodyImpl> result = new ResourceRequestBodyImpl(); |
+ scoped_refptr<ResourceRequestBody> result = new ResourceRequestBody(); |
result->AppendBytes(bytes, length); |
return result; |
} |
@@ -29,7 +26,7 @@ scoped_refptr<ResourceRequestBody> ResourceRequestBody::CreateFromBytes( |
base::android::ScopedJavaLocalRef<jobject> ResourceRequestBody::ToJavaObject( |
JNIEnv* env) { |
return ConvertResourceRequestBodyToJavaObject( |
- env, static_cast<ResourceRequestBodyImpl*>(this)); |
+ env, static_cast<ResourceRequestBody*>(this)); |
} |
// static |
@@ -40,4 +37,47 @@ scoped_refptr<ResourceRequestBody> ResourceRequestBody::FromJavaObject( |
} |
#endif |
+void ResourceRequestBody::AppendBytes(const char* bytes, int bytes_len) { |
+ if (bytes_len > 0) { |
+ elements_.push_back(Element()); |
+ elements_.back().SetToBytes(bytes, bytes_len); |
+ } |
+} |
+ |
+void ResourceRequestBody::AppendFileRange( |
+ const base::FilePath& file_path, |
+ uint64_t offset, |
+ uint64_t length, |
+ const base::Time& expected_modification_time) { |
+ elements_.push_back(Element()); |
+ elements_.back().SetToFilePathRange(file_path, offset, length, |
+ expected_modification_time); |
+} |
+ |
+void ResourceRequestBody::AppendBlob(const std::string& uuid) { |
+ elements_.push_back(Element()); |
+ elements_.back().SetToBlob(uuid); |
+} |
+ |
+void ResourceRequestBody::AppendFileSystemFileRange( |
+ const GURL& url, |
+ uint64_t offset, |
+ uint64_t length, |
+ const base::Time& expected_modification_time) { |
+ elements_.push_back(Element()); |
+ elements_.back().SetToFileSystemUrlRange(url, offset, length, |
+ expected_modification_time); |
+} |
+ |
+std::vector<base::FilePath> ResourceRequestBody::GetReferencedFiles() const { |
+ std::vector<base::FilePath> result; |
+ for (const auto& element : *elements()) { |
+ if (element.type() == Element::TYPE_FILE) |
+ result.push_back(element.path()); |
+ } |
+ return result; |
+} |
+ |
+ResourceRequestBody::~ResourceRequestBody() {} |
+ |
} // namespace content |