Update V8 to version 4.7.42.
[chromium-blink-merge.git] / content / common / resource_request_body.h
blob60dcb2913bbddebbec6bc13628abf6e72b34a4dd
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.
5 #ifndef CONTENT_COMMON_RESOURCE_REQUEST_BODY_H_
6 #define CONTENT_COMMON_RESOURCE_REQUEST_BODY_H_
8 #include <vector>
10 #include "base/basictypes.h"
11 #include "base/memory/ref_counted.h"
12 #include "base/supports_user_data.h"
13 #include "content/common/content_export.h"
14 #include "storage/common/data_element.h"
15 #include "url/gurl.h"
17 namespace base {
18 class FilePath;
21 namespace content {
23 // A struct used to represent upload data. The data field is populated by
24 // WebURLLoader from the data given as WebHTTPBody.
25 class CONTENT_EXPORT ResourceRequestBody
26 : public base::RefCountedThreadSafe<ResourceRequestBody>,
27 public base::SupportsUserData {
28 public:
29 typedef storage::DataElement Element;
31 ResourceRequestBody();
33 void AppendBytes(const char* bytes, int bytes_len);
34 void AppendFileRange(const base::FilePath& file_path,
35 uint64 offset, uint64 length,
36 const base::Time& expected_modification_time);
37 void AppendBlob(const std::string& uuid);
38 void AppendFileSystemFileRange(const GURL& url, uint64 offset, uint64 length,
39 const base::Time& expected_modification_time);
41 const std::vector<Element>* elements() const { return &elements_; }
42 std::vector<Element>* elements_mutable() { return &elements_; }
43 void swap_elements(std::vector<Element>* elements) {
44 elements_.swap(*elements);
47 // Identifies a particular upload instance, which is used by the cache to
48 // formulate a cache key. This value should be unique across browser
49 // sessions. A value of 0 is used to indicate an unspecified identifier.
50 void set_identifier(int64 id) { identifier_ = id; }
51 int64 identifier() const { return identifier_; }
53 private:
54 friend class base::RefCountedThreadSafe<ResourceRequestBody>;
55 ~ResourceRequestBody() override;
57 std::vector<Element> elements_;
58 int64 identifier_;
60 DISALLOW_COPY_AND_ASSIGN(ResourceRequestBody);
63 } // namespace content
65 #endif // CONTENT_COMMON_RESOURCE_REQUEST_BODY_H_