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