OLD | NEW |
| (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 #include "content/common/resource_request_body_impl.h" | |
6 | |
7 #include "base/strings/utf_string_conversions.h" | |
8 #include "content/common/page_state_serialization.h" | |
9 | |
10 using blink::WebHTTPBody; | |
11 using blink::WebString; | |
12 | |
13 namespace content { | |
14 | |
15 ResourceRequestBodyImpl::ResourceRequestBodyImpl() | |
16 : identifier_(0), | |
17 contains_sensitive_info_(false) {} | |
18 | |
19 void ResourceRequestBodyImpl::AppendBytes(const char* bytes, int bytes_len) { | |
20 if (bytes_len > 0) { | |
21 elements_.push_back(Element()); | |
22 elements_.back().SetToBytes(bytes, bytes_len); | |
23 } | |
24 } | |
25 | |
26 void ResourceRequestBodyImpl::AppendFileRange( | |
27 const base::FilePath& file_path, | |
28 uint64_t offset, | |
29 uint64_t length, | |
30 const base::Time& expected_modification_time) { | |
31 elements_.push_back(Element()); | |
32 elements_.back().SetToFilePathRange(file_path, offset, length, | |
33 expected_modification_time); | |
34 } | |
35 | |
36 void ResourceRequestBodyImpl::AppendBlob(const std::string& uuid) { | |
37 elements_.push_back(Element()); | |
38 elements_.back().SetToBlob(uuid); | |
39 } | |
40 | |
41 void ResourceRequestBodyImpl::AppendFileSystemFileRange( | |
42 const GURL& url, | |
43 uint64_t offset, | |
44 uint64_t length, | |
45 const base::Time& expected_modification_time) { | |
46 elements_.push_back(Element()); | |
47 elements_.back().SetToFileSystemUrlRange(url, offset, length, | |
48 expected_modification_time); | |
49 } | |
50 | |
51 std::vector<base::FilePath> ResourceRequestBodyImpl::GetReferencedFiles() | |
52 const { | |
53 std::vector<base::FilePath> result; | |
54 for (const auto& element : *elements()) { | |
55 if (element.type() == Element::TYPE_FILE) | |
56 result.push_back(element.path()); | |
57 } | |
58 return result; | |
59 } | |
60 | |
61 ResourceRequestBodyImpl::~ResourceRequestBodyImpl() {} | |
62 | |
63 } // namespace content | |
OLD | NEW |