| 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 438 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 449 STATIC_ASSERT_ENUM(REQUEST_CONTEXT_TYPE_XML_HTTP_REQUEST, | 449 STATIC_ASSERT_ENUM(REQUEST_CONTEXT_TYPE_XML_HTTP_REQUEST, |
| 450 WebURLRequest::RequestContextXMLHttpRequest); | 450 WebURLRequest::RequestContextXMLHttpRequest); |
| 451 STATIC_ASSERT_ENUM(REQUEST_CONTEXT_TYPE_XSLT, | 451 STATIC_ASSERT_ENUM(REQUEST_CONTEXT_TYPE_XSLT, |
| 452 WebURLRequest::RequestContextXSLT); | 452 WebURLRequest::RequestContextXSLT); |
| 453 | 453 |
| 454 RequestContextType GetRequestContextTypeForWebURLRequest( | 454 RequestContextType GetRequestContextTypeForWebURLRequest( |
| 455 const blink::WebURLRequest& request) { | 455 const blink::WebURLRequest& request) { |
| 456 return static_cast<RequestContextType>(request.getRequestContext()); | 456 return static_cast<RequestContextType>(request.getRequestContext()); |
| 457 } | 457 } |
| 458 | 458 |
| 459 STATIC_ASSERT_ENUM(SkipServiceWorker::NONE, |
| 460 WebURLRequest::SkipServiceWorker::None); |
| 461 STATIC_ASSERT_ENUM(SkipServiceWorker::CONTROLLING, |
| 462 WebURLRequest::SkipServiceWorker::Controlling); |
| 463 STATIC_ASSERT_ENUM(SkipServiceWorker::ALL, |
| 464 WebURLRequest::SkipServiceWorker::All); |
| 465 |
| 466 SkipServiceWorker GetSkipServiceWorkerForWebURLRequest( |
| 467 const blink::WebURLRequest& request) { |
| 468 return static_cast<SkipServiceWorker>(request.skipServiceWorker()); |
| 469 } |
| 470 |
| 459 blink::WebURLError CreateWebURLError(const blink::WebURL& unreachable_url, | 471 blink::WebURLError CreateWebURLError(const blink::WebURL& unreachable_url, |
| 460 bool stale_copy_in_cache, | 472 bool stale_copy_in_cache, |
| 461 int reason) { | 473 int reason) { |
| 462 blink::WebURLError error; | 474 blink::WebURLError error; |
| 463 error.domain = WebString::fromUTF8(net::kErrorDomain); | 475 error.domain = WebString::fromUTF8(net::kErrorDomain); |
| 464 error.reason = reason; | 476 error.reason = reason; |
| 465 error.unreachableURL = unreachable_url; | 477 error.unreachableURL = unreachable_url; |
| 466 error.staleCopyInCache = stale_copy_in_cache; | 478 error.staleCopyInCache = stale_copy_in_cache; |
| 467 if (reason == net::ERR_ABORTED) { | 479 if (reason == net::ERR_ABORTED) { |
| 468 error.isCancellation = true; | 480 error.isCancellation = true; |
| (...skipping 11 matching lines...) Expand all Loading... |
| 480 bool stale_copy_in_cache, | 492 bool stale_copy_in_cache, |
| 481 int reason, | 493 int reason, |
| 482 bool was_ignored_by_handler) { | 494 bool was_ignored_by_handler) { |
| 483 blink::WebURLError error = | 495 blink::WebURLError error = |
| 484 CreateWebURLError(unreachable_url, stale_copy_in_cache, reason); | 496 CreateWebURLError(unreachable_url, stale_copy_in_cache, reason); |
| 485 error.wasIgnoredByHandler = was_ignored_by_handler; | 497 error.wasIgnoredByHandler = was_ignored_by_handler; |
| 486 return error; | 498 return error; |
| 487 } | 499 } |
| 488 | 500 |
| 489 } // namespace content | 501 } // namespace content |
| OLD | NEW |