| 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 474 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 485 blink::WebURLError error; | 485 blink::WebURLError error; |
| 486 error.domain = WebString::fromUTF8(net::kErrorDomain); | 486 error.domain = WebString::fromUTF8(net::kErrorDomain); |
| 487 error.reason = reason; | 487 error.reason = reason; |
| 488 error.unreachableURL = unreachable_url; | 488 error.unreachableURL = unreachable_url; |
| 489 error.staleCopyInCache = stale_copy_in_cache; | 489 error.staleCopyInCache = stale_copy_in_cache; |
| 490 if (reason == net::ERR_ABORTED) { | 490 if (reason == net::ERR_ABORTED) { |
| 491 error.isCancellation = true; | 491 error.isCancellation = true; |
| 492 } else if (reason == net::ERR_TEMPORARILY_THROTTLED) { | 492 } else if (reason == net::ERR_TEMPORARILY_THROTTLED) { |
| 493 error.localizedDescription = | 493 error.localizedDescription = |
| 494 WebString::fromUTF8(kThrottledErrorDescription); | 494 WebString::fromUTF8(kThrottledErrorDescription); |
| 495 } else if (reason == net::ERR_CACHE_MISS) { |
| 496 error.isCacheMiss = true; |
| 495 } else { | 497 } else { |
| 496 error.localizedDescription = | 498 error.localizedDescription = |
| 497 WebString::fromUTF8(net::ErrorToString(reason)); | 499 WebString::fromUTF8(net::ErrorToString(reason)); |
| 498 } | 500 } |
| 499 return error; | 501 return error; |
| 500 } | 502 } |
| 501 | 503 |
| 502 blink::WebURLError CreateWebURLError(const blink::WebURL& unreachable_url, | 504 blink::WebURLError CreateWebURLError(const blink::WebURL& unreachable_url, |
| 503 bool stale_copy_in_cache, | 505 bool stale_copy_in_cache, |
| 504 int reason, | 506 int reason, |
| 505 bool was_ignored_by_handler) { | 507 bool was_ignored_by_handler) { |
| 506 blink::WebURLError error = | 508 blink::WebURLError error = |
| 507 CreateWebURLError(unreachable_url, stale_copy_in_cache, reason); | 509 CreateWebURLError(unreachable_url, stale_copy_in_cache, reason); |
| 508 error.wasIgnoredByHandler = was_ignored_by_handler; | 510 error.wasIgnoredByHandler = was_ignored_by_handler; |
| 509 return error; | 511 return error; |
| 510 } | 512 } |
| 511 | 513 |
| 512 } // namespace content | 514 } // namespace content |
| OLD | NEW |