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

Side by Side Diff: content/common/resource_request_body.h

Issue 1907443006: PlzNavigate: store POST data in the FrameNavigationEntry (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 4 years, 8 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 unified diff | Download patch
OLDNEW
1 // Copyright 2014 The Chromium Authors. All rights reserved. 1 // Copyright 2014 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 CONTENT_COMMON_RESOURCE_REQUEST_BODY_H_ 5 #ifndef CONTENT_COMMON_RESOURCE_REQUEST_BODY_H_
6 #define CONTENT_COMMON_RESOURCE_REQUEST_BODY_H_ 6 #define CONTENT_COMMON_RESOURCE_REQUEST_BODY_H_
7 7
8 #include <stdint.h> 8 #include <stdint.h>
9 9
10 #include <vector> 10 #include <vector>
11 11
12 #include "base/macros.h" 12 #include "base/macros.h"
13 #include "base/memory/ref_counted.h" 13 #include "base/memory/ref_counted.h"
14 #include "base/supports_user_data.h" 14 #include "base/supports_user_data.h"
15 #include "content/common/content_export.h" 15 #include "content/common/content_export.h"
16 #include "storage/common/data_element.h" 16 #include "storage/common/data_element.h"
17 #include "url/gurl.h" 17 #include "url/gurl.h"
18 18
19 namespace base { 19 namespace base {
20 class FilePath; 20 class FilePath;
21 } 21 }
22 22
23 namespace content { 23 namespace content {
24 24
25 struct ExplodedHttpBodyElement;
26
25 // A struct used to represent upload data. The data field is populated by 27 // A struct used to represent upload data. The data field is populated by
26 // WebURLLoader from the data given as WebHTTPBody. 28 // WebURLLoader from the data given as WebHTTPBody.
27 class CONTENT_EXPORT ResourceRequestBody 29 class CONTENT_EXPORT ResourceRequestBody
28 : public base::RefCountedThreadSafe<ResourceRequestBody>, 30 : public base::RefCountedThreadSafe<ResourceRequestBody>,
29 public base::SupportsUserData { 31 public base::SupportsUserData {
30 public: 32 public:
31 typedef storage::DataElement Element; 33 typedef storage::DataElement Element;
32 34
33 ResourceRequestBody(); 35 ResourceRequestBody();
34 36
37 void AppendExplodedHTTPBodyElement(const ExplodedHttpBodyElement& element);
38
35 void AppendBytes(const char* bytes, int bytes_len); 39 void AppendBytes(const char* bytes, int bytes_len);
36 void AppendFileRange(const base::FilePath& file_path, 40 void AppendFileRange(const base::FilePath& file_path,
37 uint64_t offset, 41 uint64_t offset,
38 uint64_t length, 42 uint64_t length,
39 const base::Time& expected_modification_time); 43 const base::Time& expected_modification_time);
40 void AppendBlob(const std::string& uuid); 44 void AppendBlob(const std::string& uuid);
41 void AppendFileSystemFileRange(const GURL& url, 45 void AppendFileSystemFileRange(const GURL& url,
42 uint64_t offset, 46 uint64_t offset,
43 uint64_t length, 47 uint64_t length,
44 const base::Time& expected_modification_time); 48 const base::Time& expected_modification_time);
45 49
46 const std::vector<Element>* elements() const { return &elements_; } 50 const std::vector<Element>* elements() const { return &elements_; }
47 std::vector<Element>* elements_mutable() { return &elements_; } 51 std::vector<Element>* elements_mutable() { return &elements_; }
48 void swap_elements(std::vector<Element>* elements) { 52 void swap_elements(std::vector<Element>* elements) {
49 elements_.swap(*elements); 53 elements_.swap(*elements);
50 } 54 }
51 55
52 // 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
53 // formulate a cache key. This value should be unique across browser 57 // formulate a cache key. This value should be unique across browser
54 // sessions. A value of 0 is used to indicate an unspecified identifier. 58 // sessions. A value of 0 is used to indicate an unspecified identifier.
55 void set_identifier(int64_t id) { identifier_ = id; } 59 void set_identifier(int64_t id) { identifier_ = id; }
56 int64_t identifier() const { return identifier_; } 60 int64_t identifier() const { return identifier_; }
57 61
62 // Returns a copy of this ResourceRequestBody.
63 scoped_refptr<ResourceRequestBody> MakeCopy();
64
58 private: 65 private:
59 friend class base::RefCountedThreadSafe<ResourceRequestBody>; 66 friend class base::RefCountedThreadSafe<ResourceRequestBody>;
60 ~ResourceRequestBody() override; 67 ~ResourceRequestBody() override;
61 68
62 std::vector<Element> elements_; 69 std::vector<Element> elements_;
63 int64_t identifier_; 70 int64_t identifier_;
64 71
65 DISALLOW_COPY_AND_ASSIGN(ResourceRequestBody); 72 DISALLOW_COPY_AND_ASSIGN(ResourceRequestBody);
66 }; 73 };
67 74
68 } // namespace content 75 } // namespace content
69 76
70 #endif // CONTENT_COMMON_RESOURCE_REQUEST_BODY_H_ 77 #endif // CONTENT_COMMON_RESOURCE_REQUEST_BODY_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698