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