OLD | NEW |
1 // Copyright (c) 2013 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2013 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 #include "content/public/common/page_state.h" | 5 #include "content/public/common/page_state.h" |
6 | 6 |
7 #include <stddef.h> | 7 #include <stddef.h> |
8 | 8 |
9 #include "base/files/file_path.h" | 9 #include "base/files/file_path.h" |
10 #include "base/strings/nullable_string16.h" | 10 #include "base/strings/nullable_string16.h" |
(...skipping 69 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
80 bool body_contains_password_data, | 80 bool body_contains_password_data, |
81 const char* optional_body_data, | 81 const char* optional_body_data, |
82 const base::FilePath* optional_body_file_path) { | 82 const base::FilePath* optional_body_file_path) { |
83 ExplodedPageState state; | 83 ExplodedPageState state; |
84 | 84 |
85 state.top.url_string = ToNullableString16(url.possibly_invalid_spec()); | 85 state.top.url_string = ToNullableString16(url.possibly_invalid_spec()); |
86 | 86 |
87 if (optional_body_data || optional_body_file_path) { | 87 if (optional_body_data || optional_body_file_path) { |
88 if (optional_body_data) { | 88 if (optional_body_data) { |
89 std::string body_data(optional_body_data); | 89 std::string body_data(optional_body_data); |
90 state.top.http_body.request_body = new ResourceRequestBody(); | 90 state.top.http_body.request_body = new ResourceRequestBodyImpl(); |
91 state.top.http_body.request_body->AppendBytes(body_data.data(), | 91 state.top.http_body.request_body->AppendBytes(body_data.data(), |
92 body_data.size()); | 92 body_data.size()); |
93 } | 93 } |
94 if (optional_body_file_path) { | 94 if (optional_body_file_path) { |
95 state.top.http_body.request_body = new ResourceRequestBody(); | 95 state.top.http_body.request_body = new ResourceRequestBodyImpl(); |
96 state.top.http_body.request_body->AppendFileRange( | 96 state.top.http_body.request_body->AppendFileRange( |
97 *optional_body_file_path, | 97 *optional_body_file_path, |
98 0, std::numeric_limits<uint64_t>::max(), | 98 0, std::numeric_limits<uint64_t>::max(), |
99 base::Time()); | 99 base::Time()); |
100 state.referenced_files.push_back(base::NullableString16( | 100 state.referenced_files.push_back(base::NullableString16( |
101 optional_body_file_path->AsUTF16Unsafe(), false)); | 101 optional_body_file_path->AsUTF16Unsafe(), false)); |
102 } | 102 } |
103 state.top.http_body.contains_passwords = | 103 state.top.http_body.contains_passwords = |
104 body_contains_password_data; | 104 body_contains_password_data; |
105 } | 105 } |
(...skipping 60 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
166 } | 166 } |
167 | 167 |
168 PageState::PageState(const std::string& data) | 168 PageState::PageState(const std::string& data) |
169 : data_(data) { | 169 : data_(data) { |
170 // TODO(darin): Enable this DCHECK once tests have been fixed up to not pass | 170 // TODO(darin): Enable this DCHECK once tests have been fixed up to not pass |
171 // bogus encoded data to CreateFromEncodedData. | 171 // bogus encoded data to CreateFromEncodedData. |
172 //DCHECK(IsValid()); | 172 //DCHECK(IsValid()); |
173 } | 173 } |
174 | 174 |
175 } // namespace content | 175 } // namespace content |
OLD | NEW |