| 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> |
| 11 | 11 |
| 12 #include "base/logging.h" | 12 #include "base/logging.h" |
| 13 #include "base/strings/string_util.h" | 13 #include "base/strings/string_util.h" |
| 14 #include "content/child/request_extra_data.h" | 14 #include "content/child/request_extra_data.h" |
| 15 #include "net/base/load_flags.h" | 15 #include "net/base/load_flags.h" |
| 16 #include "net/base/net_errors.h" | 16 #include "net/base/net_errors.h" |
| 17 #include "third_party/WebKit/public/platform/FilePathConversion.h" | 17 #include "third_party/WebKit/public/platform/FilePathConversion.h" |
| 18 #include "third_party/WebKit/public/platform/WebCachePolicy.h" | 18 #include "third_party/WebKit/public/platform/WebCachePolicy.h" |
| 19 #include "third_party/WebKit/public/platform/WebData.h" | 19 #include "third_party/WebKit/public/platform/WebData.h" |
| 20 #include "third_party/WebKit/public/platform/WebHTTPHeaderVisitor.h" | 20 #include "third_party/WebKit/public/platform/WebHTTPHeaderVisitor.h" |
| 21 #include "third_party/WebKit/public/platform/WebMixedContent.h" |
| 22 #include "third_party/WebKit/public/platform/WebMixedContentContextType.h" |
| 21 #include "third_party/WebKit/public/platform/WebString.h" | 23 #include "third_party/WebKit/public/platform/WebString.h" |
| 22 #include "third_party/WebKit/public/platform/WebURL.h" | 24 #include "third_party/WebKit/public/platform/WebURL.h" |
| 23 #include "third_party/WebKit/public/platform/WebURLError.h" | 25 #include "third_party/WebKit/public/platform/WebURLError.h" |
| 24 #include "third_party/WebKit/public/platform/WebURLRequest.h" | 26 #include "third_party/WebKit/public/platform/WebURLRequest.h" |
| 25 | 27 |
| 26 using blink::WebCachePolicy; | 28 using blink::WebCachePolicy; |
| 27 using blink::WebData; | 29 using blink::WebData; |
| 28 using blink::WebHTTPBody; | 30 using blink::WebHTTPBody; |
| 29 using blink::WebString; | 31 using blink::WebString; |
| 30 using blink::WebURLRequest; | 32 using blink::WebURLRequest; |
| (...skipping 433 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 464 STATIC_ASSERT_ENUM(REQUEST_CONTEXT_TYPE_XML_HTTP_REQUEST, | 466 STATIC_ASSERT_ENUM(REQUEST_CONTEXT_TYPE_XML_HTTP_REQUEST, |
| 465 WebURLRequest::RequestContextXMLHttpRequest); | 467 WebURLRequest::RequestContextXMLHttpRequest); |
| 466 STATIC_ASSERT_ENUM(REQUEST_CONTEXT_TYPE_XSLT, | 468 STATIC_ASSERT_ENUM(REQUEST_CONTEXT_TYPE_XSLT, |
| 467 WebURLRequest::RequestContextXSLT); | 469 WebURLRequest::RequestContextXSLT); |
| 468 | 470 |
| 469 RequestContextType GetRequestContextTypeForWebURLRequest( | 471 RequestContextType GetRequestContextTypeForWebURLRequest( |
| 470 const blink::WebURLRequest& request) { | 472 const blink::WebURLRequest& request) { |
| 471 return static_cast<RequestContextType>(request.getRequestContext()); | 473 return static_cast<RequestContextType>(request.getRequestContext()); |
| 472 } | 474 } |
| 473 | 475 |
| 476 blink::WebMixedContentContextType GetMixedContentContextTypeForWebURLRequest( |
| 477 const blink::WebURLRequest& request) { |
| 478 bool block_mixed_plugin_content = false; |
| 479 if (request.getExtraData()) { |
| 480 RequestExtraData* extra_data = |
| 481 static_cast<RequestExtraData*>(request.getExtraData()); |
| 482 block_mixed_plugin_content = extra_data->block_mixed_plugin_content(); |
| 483 } |
| 484 |
| 485 return blink::WebMixedContent::contextTypeFromRequestContext( |
| 486 request.getRequestContext(), block_mixed_plugin_content); |
| 487 } |
| 488 |
| 474 STATIC_ASSERT_ENUM(SkipServiceWorker::NONE, | 489 STATIC_ASSERT_ENUM(SkipServiceWorker::NONE, |
| 475 WebURLRequest::SkipServiceWorker::None); | 490 WebURLRequest::SkipServiceWorker::None); |
| 476 STATIC_ASSERT_ENUM(SkipServiceWorker::CONTROLLING, | 491 STATIC_ASSERT_ENUM(SkipServiceWorker::CONTROLLING, |
| 477 WebURLRequest::SkipServiceWorker::Controlling); | 492 WebURLRequest::SkipServiceWorker::Controlling); |
| 478 STATIC_ASSERT_ENUM(SkipServiceWorker::ALL, | 493 STATIC_ASSERT_ENUM(SkipServiceWorker::ALL, |
| 479 WebURLRequest::SkipServiceWorker::All); | 494 WebURLRequest::SkipServiceWorker::All); |
| 480 | 495 |
| 481 SkipServiceWorker GetSkipServiceWorkerForWebURLRequest( | 496 SkipServiceWorker GetSkipServiceWorkerForWebURLRequest( |
| 482 const blink::WebURLRequest& request) { | 497 const blink::WebURLRequest& request) { |
| 483 return static_cast<SkipServiceWorker>(request.skipServiceWorker()); | 498 return static_cast<SkipServiceWorker>(request.skipServiceWorker()); |
| (...skipping 25 matching lines...) Expand all Loading... |
| 509 bool stale_copy_in_cache, | 524 bool stale_copy_in_cache, |
| 510 int reason, | 525 int reason, |
| 511 bool was_ignored_by_handler) { | 526 bool was_ignored_by_handler) { |
| 512 blink::WebURLError error = | 527 blink::WebURLError error = |
| 513 CreateWebURLError(unreachable_url, stale_copy_in_cache, reason); | 528 CreateWebURLError(unreachable_url, stale_copy_in_cache, reason); |
| 514 error.wasIgnoredByHandler = was_ignored_by_handler; | 529 error.wasIgnoredByHandler = was_ignored_by_handler; |
| 515 return error; | 530 return error; |
| 516 } | 531 } |
| 517 | 532 |
| 518 } // namespace content | 533 } // namespace content |
| OLD | NEW |