Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(503)

Unified Diff: content/public/common/resource_request_body.h

Issue 2954343005: Merge ResourceRequestBodyImpl and ResourceRequestBody. (Closed)
Patch Set: Remove comment Created 3 years, 6 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « content/public/common/page_state.cc ('k') | content/public/common/resource_request_body.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: content/public/common/resource_request_body.h
diff --git a/content/public/common/resource_request_body.h b/content/public/common/resource_request_body.h
index 606c31994c8d1affc189b147179a1a8c9a1f1a60..bf2bf5d508df3147b410fbb6bd596bfd0a9b2a70 100644
--- a/content/public/common/resource_request_body.h
+++ b/content/public/common/resource_request_body.h
@@ -14,6 +14,8 @@
#include "base/memory/ref_counted.h"
#include "build/build_config.h"
#include "content/common/content_export.h"
+#include "storage/common/data_element.h"
+#include "url/gurl.h"
#if defined(OS_ANDROID)
#include <jni.h>
@@ -23,22 +25,13 @@
namespace content {
// ResourceRequestBody represents body (i.e. upload data) of a HTTP request.
-//
-// This class is intentionally opaque:
-// *) Embedders cannot inspect the payload of ResourceRequestBody. Only the
-// //content layer can decompose ResourceRequestBody into references to file
-// ranges, byte vectors, blob uris, etc.
-// *) Embedders can get instances of ResourceRequestBody only by
-// - receiving an instance created inside //content layer (e.g. receiving it
-// via content::OpenURLParams),
-// - calling CreateFromBytes with a vector of bytes (e.g. to support
-// Android's WebView::postUrl API, to support DoSearchByImageInNewTab and
-// to support test code).
-// *) Embedders typically end up passing ResourceRequestBody back into the
-// //content layer via content::NavigationController::LoadUrlParams.
class CONTENT_EXPORT ResourceRequestBody
: public base::RefCountedThreadSafe<ResourceRequestBody> {
public:
+ typedef storage::DataElement Element;
+
+ ResourceRequestBody();
+
// Creates ResourceRequestBody that holds a copy of |bytes|.
static scoped_refptr<ResourceRequestBody> CreateFromBytes(const char* bytes,
size_t length);
@@ -55,12 +48,50 @@ class CONTENT_EXPORT ResourceRequestBody
const base::android::JavaParamRef<jobject>& java_object);
#endif
- protected:
- ResourceRequestBody();
- virtual ~ResourceRequestBody();
+ void AppendBytes(const char* bytes, int bytes_len);
+ void AppendFileRange(const base::FilePath& file_path,
+ uint64_t offset,
+ uint64_t length,
+ const base::Time& expected_modification_time);
+
+ void AppendBlob(const std::string& uuid);
+ void AppendFileSystemFileRange(const GURL& url,
+ uint64_t offset,
+ uint64_t length,
+ const base::Time& expected_modification_time);
+
+ const std::vector<Element>* elements() const { return &elements_; }
+ std::vector<Element>* elements_mutable() { return &elements_; }
+ void swap_elements(std::vector<Element>* elements) {
+ elements_.swap(*elements);
+ }
+
+ // Identifies a particular upload instance, which is used by the cache to
+ // formulate a cache key. This value should be unique across browser
+ // sessions. A value of 0 is used to indicate an unspecified identifier.
+ void set_identifier(int64_t id) { identifier_ = id; }
+ int64_t identifier() const { return identifier_; }
+
+ // Returns paths referred to by |elements| of type Element::TYPE_FILE.
+ std::vector<base::FilePath> GetReferencedFiles() const;
+
+ // Sets the flag which indicates whether the post data contains sensitive
+ // information like passwords.
+ void set_contains_sensitive_info(bool contains_sensitive_info) {
+ contains_sensitive_info_ = contains_sensitive_info;
+ }
+ bool contains_sensitive_info() const { return contains_sensitive_info_; }
private:
friend class base::RefCountedThreadSafe<ResourceRequestBody>;
+
+ ~ResourceRequestBody();
+
+ std::vector<Element> elements_;
+ int64_t identifier_;
+
+ bool contains_sensitive_info_;
+
DISALLOW_COPY_AND_ASSIGN(ResourceRequestBody);
};
« no previous file with comments | « content/public/common/page_state.cc ('k') | content/public/common/resource_request_body.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698