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 469 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
480 } | 480 } |
481 | 481 |
482 blink::WebURLError CreateWebURLError(const blink::WebURL& unreachable_url, | 482 blink::WebURLError CreateWebURLError(const blink::WebURL& unreachable_url, |
483 bool stale_copy_in_cache, | 483 bool stale_copy_in_cache, |
484 int reason) { | 484 int reason) { |
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 error.isCacheMiss = reason == net::ERR_CACHE_MISS; | |
kouhei (in TOK)
2016/10/20 10:43:07
Should this be moved to if branches below?
Or woul
Shao-Chuan Lee
2016/10/21 04:35:02
It's required to set the field here since WebURLEr
kouhei (in TOK)
2016/10/21 05:08:42
Blink should not know about net::ERR_CACHE_MISS, b
Shao-Chuan Lee
2016/10/21 05:22:17
This method should be in third_party/WebKit/public
Shao-Chuan Lee
2016/10/21 06:52:03
Now having utility methods under blink::NetworkUti
| |
490 if (reason == net::ERR_ABORTED) { | 491 if (reason == net::ERR_ABORTED) { |
491 error.isCancellation = true; | 492 error.isCancellation = true; |
492 } else if (reason == net::ERR_TEMPORARILY_THROTTLED) { | 493 } else if (reason == net::ERR_TEMPORARILY_THROTTLED) { |
493 error.localizedDescription = | 494 error.localizedDescription = |
494 WebString::fromUTF8(kThrottledErrorDescription); | 495 WebString::fromUTF8(kThrottledErrorDescription); |
495 } else { | 496 } else { |
496 error.localizedDescription = | 497 error.localizedDescription = |
497 WebString::fromUTF8(net::ErrorToString(reason)); | 498 WebString::fromUTF8(net::ErrorToString(reason)); |
498 } | 499 } |
499 return error; | 500 return error; |
500 } | 501 } |
501 | 502 |
502 blink::WebURLError CreateWebURLError(const blink::WebURL& unreachable_url, | 503 blink::WebURLError CreateWebURLError(const blink::WebURL& unreachable_url, |
503 bool stale_copy_in_cache, | 504 bool stale_copy_in_cache, |
504 int reason, | 505 int reason, |
505 bool was_ignored_by_handler) { | 506 bool was_ignored_by_handler) { |
506 blink::WebURLError error = | 507 blink::WebURLError error = |
507 CreateWebURLError(unreachable_url, stale_copy_in_cache, reason); | 508 CreateWebURLError(unreachable_url, stale_copy_in_cache, reason); |
508 error.wasIgnoredByHandler = was_ignored_by_handler; | 509 error.wasIgnoredByHandler = was_ignored_by_handler; |
509 return error; | 510 return error; |
510 } | 511 } |
511 | 512 |
512 } // namespace content | 513 } // namespace content |
OLD | NEW |