| OLD | NEW |
| 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 #include "content/child/web_url_request_util.h" | 5 #include "content/child/web_url_request_util.h" |
| 6 | 6 |
| 7 #include <stddef.h> | 7 #include <stddef.h> |
| 8 #include <stdint.h> | 8 #include <stdint.h> |
| 9 | 9 |
| 10 #include <limits> | 10 #include <limits> |
| (...skipping 215 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 226 } | 226 } |
| 227 | 227 |
| 228 return load_flags; | 228 return load_flags; |
| 229 } | 229 } |
| 230 | 230 |
| 231 WebHTTPBody GetWebHTTPBodyForRequestBody( | 231 WebHTTPBody GetWebHTTPBodyForRequestBody( |
| 232 const scoped_refptr<ResourceRequestBodyImpl>& input) { | 232 const scoped_refptr<ResourceRequestBodyImpl>& input) { |
| 233 WebHTTPBody http_body; | 233 WebHTTPBody http_body; |
| 234 http_body.initialize(); | 234 http_body.initialize(); |
| 235 http_body.setIdentifier(input->identifier()); | 235 http_body.setIdentifier(input->identifier()); |
| 236 http_body.setContainsPasswordData(input->contains_sensitive_info()); |
| 236 for (const auto& element : *input->elements()) { | 237 for (const auto& element : *input->elements()) { |
| 237 switch (element.type()) { | 238 switch (element.type()) { |
| 238 case ResourceRequestBodyImpl::Element::TYPE_BYTES: | 239 case ResourceRequestBodyImpl::Element::TYPE_BYTES: |
| 239 http_body.appendData(WebData(element.bytes(), element.length())); | 240 http_body.appendData(WebData(element.bytes(), element.length())); |
| 240 break; | 241 break; |
| 241 case ResourceRequestBodyImpl::Element::TYPE_FILE: | 242 case ResourceRequestBodyImpl::Element::TYPE_FILE: |
| 242 http_body.appendFileRange( | 243 http_body.appendFileRange( |
| 243 element.path().AsUTF16Unsafe(), element.offset(), | 244 element.path().AsUTF16Unsafe(), element.offset(), |
| 244 (element.length() != std::numeric_limits<uint64_t>::max()) | 245 (element.length() != std::numeric_limits<uint64_t>::max()) |
| 245 ? element.length() | 246 ? element.length() |
| (...skipping 75 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 321 break; | 322 break; |
| 322 } | 323 } |
| 323 case WebHTTPBody::Element::TypeBlob: | 324 case WebHTTPBody::Element::TypeBlob: |
| 324 request_body->AppendBlob(element.blobUUID.utf8()); | 325 request_body->AppendBlob(element.blobUUID.utf8()); |
| 325 break; | 326 break; |
| 326 default: | 327 default: |
| 327 NOTREACHED(); | 328 NOTREACHED(); |
| 328 } | 329 } |
| 329 } | 330 } |
| 330 request_body->set_identifier(httpBody.identifier()); | 331 request_body->set_identifier(httpBody.identifier()); |
| 332 request_body->set_contains_sensitive_info(httpBody.containsPasswordData()); |
| 331 return request_body; | 333 return request_body; |
| 332 } | 334 } |
| 333 | 335 |
| 334 #define STATIC_ASSERT_ENUM(a, b) \ | 336 #define STATIC_ASSERT_ENUM(a, b) \ |
| 335 static_assert(static_cast<int>(a) == static_cast<int>(b), \ | 337 static_assert(static_cast<int>(a) == static_cast<int>(b), \ |
| 336 "mismatching enums: " #a) | 338 "mismatching enums: " #a) |
| 337 | 339 |
| 338 STATIC_ASSERT_ENUM(FETCH_REQUEST_MODE_SAME_ORIGIN, | 340 STATIC_ASSERT_ENUM(FETCH_REQUEST_MODE_SAME_ORIGIN, |
| 339 WebURLRequest::FetchRequestModeSameOrigin); | 341 WebURLRequest::FetchRequestModeSameOrigin); |
| 340 STATIC_ASSERT_ENUM(FETCH_REQUEST_MODE_NO_CORS, | 342 STATIC_ASSERT_ENUM(FETCH_REQUEST_MODE_NO_CORS, |
| (...skipping 160 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 501 bool stale_copy_in_cache, | 503 bool stale_copy_in_cache, |
| 502 int reason, | 504 int reason, |
| 503 bool was_ignored_by_handler) { | 505 bool was_ignored_by_handler) { |
| 504 blink::WebURLError error = | 506 blink::WebURLError error = |
| 505 CreateWebURLError(unreachable_url, stale_copy_in_cache, reason); | 507 CreateWebURLError(unreachable_url, stale_copy_in_cache, reason); |
| 506 error.wasIgnoredByHandler = was_ignored_by_handler; | 508 error.wasIgnoredByHandler = was_ignored_by_handler; |
| 507 return error; | 509 return error; |
| 508 } | 510 } |
| 509 | 511 |
| 510 } // namespace content | 512 } // namespace content |
| OLD | NEW |