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

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

Issue 2954343005: Merge ResourceRequestBodyImpl and ResourceRequestBody. (Closed)
Patch Set: Remove comment Created 3 years, 5 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
« no previous file with comments | « content/common/resource_request.h ('k') | content/common/resource_request_body_impl.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
(Empty)
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
3 // found in the LICENSE file.
4
5 #ifndef CONTENT_COMMON_RESOURCE_REQUEST_BODY_IMPL_H_
6 #define CONTENT_COMMON_RESOURCE_REQUEST_BODY_IMPL_H_
7
8 #include <stdint.h>
9
10 #include <vector>
11
12 #include "base/macros.h"
13 #include "base/memory/ref_counted.h"
14 #include "content/common/content_export.h"
15 #include "content/public/common/resource_request_body.h"
16 #include "storage/common/data_element.h"
17 #include "url/gurl.h"
18
19 namespace base {
20 class FilePath;
21 }
22
23 namespace content {
24
25 // A struct used to represent upload data. The data field is populated by
26 // WebURLLoader from the data given as WebHTTPBody.
27 class CONTENT_EXPORT ResourceRequestBodyImpl : public ResourceRequestBody {
28 public:
29 typedef storage::DataElement Element;
30
31 ResourceRequestBodyImpl();
32
33 void AppendBytes(const char* bytes, int bytes_len);
34 void AppendFileRange(const base::FilePath& file_path,
35 uint64_t offset,
36 uint64_t length,
37 const base::Time& expected_modification_time);
38 void AppendBlob(const std::string& uuid);
39 void AppendFileSystemFileRange(const GURL& url,
40 uint64_t offset,
41 uint64_t length,
42 const base::Time& expected_modification_time);
43
44 const std::vector<Element>* elements() const { return &elements_; }
45 std::vector<Element>* elements_mutable() { return &elements_; }
46 void swap_elements(std::vector<Element>* elements) {
47 elements_.swap(*elements);
48 }
49
50 // Identifies a particular upload instance, which is used by the cache to
51 // formulate a cache key. This value should be unique across browser
52 // sessions. A value of 0 is used to indicate an unspecified identifier.
53 void set_identifier(int64_t id) { identifier_ = id; }
54 int64_t identifier() const { return identifier_; }
55
56 // Returns paths referred to by |elements| of type Element::TYPE_FILE.
57 std::vector<base::FilePath> GetReferencedFiles() const;
58
59 // Sets the flag which indicates whether the post data contains sensitive
60 // information like passwords.
61 void set_contains_sensitive_info(bool contains_sensitive_info) {
62 contains_sensitive_info_ = contains_sensitive_info;
63 }
64 bool contains_sensitive_info() const { return contains_sensitive_info_; }
65
66 private:
67 ~ResourceRequestBodyImpl() override;
68
69 std::vector<Element> elements_;
70 int64_t identifier_;
71
72 bool contains_sensitive_info_;
73
74 DISALLOW_COPY_AND_ASSIGN(ResourceRequestBodyImpl);
75 };
76
77 } // namespace content
78
79 #endif // CONTENT_COMMON_RESOURCE_REQUEST_BODY_IMPL_H_
OLDNEW
« no previous file with comments | « content/common/resource_request.h ('k') | content/common/resource_request_body_impl.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698