| Index: content/child/web_url_request_util.cc
|
| diff --git a/content/child/web_url_request_util.cc b/content/child/web_url_request_util.cc
|
| index 145537e300d8e5409f5c8157686812f5f3e9cacb..6737307c744b5af3a2d255c3d3a82234da880c55 100644
|
| --- a/content/child/web_url_request_util.cc
|
| +++ b/content/child/web_url_request_util.cc
|
| @@ -7,8 +7,11 @@
|
| #include "base/logging.h"
|
| #include "base/strings/string_util.h"
|
| #include "net/base/load_flags.h"
|
| +#include "net/base/net_errors.h"
|
| #include "third_party/WebKit/public/platform/WebHTTPHeaderVisitor.h"
|
| #include "third_party/WebKit/public/platform/WebString.h"
|
| +#include "third_party/WebKit/public/platform/WebURL.h"
|
| +#include "third_party/WebKit/public/platform/WebURLError.h"
|
| #include "third_party/WebKit/public/platform/WebURLRequest.h"
|
|
|
| using blink::WebHTTPBody;
|
| @@ -19,6 +22,10 @@ namespace content {
|
|
|
| namespace {
|
|
|
| +const char kThrottledErrorDescription[] =
|
| + "Request throttled. Visit http://dev.chromium.org/throttling for more "
|
| + "information.";
|
| +
|
| class HeaderFlattener : public blink::WebHTTPHeaderVisitor {
|
| public:
|
| HeaderFlattener() : has_accept_header_(false) {}
|
| @@ -272,4 +279,24 @@ scoped_refptr<ResourceRequestBody> GetRequestBodyForWebURLRequest(
|
| return request_body;
|
| }
|
|
|
| +blink::WebURLError CreateWebURLError(const blink::WebURL& unreachable_url,
|
| + bool stale_copy_in_cache,
|
| + int reason) {
|
| + blink::WebURLError error;
|
| + error.domain = WebString::fromUTF8(net::kErrorDomain);
|
| + error.reason = reason;
|
| + error.unreachableURL = unreachable_url;
|
| + error.staleCopyInCache = stale_copy_in_cache;
|
| + if (reason == net::ERR_ABORTED) {
|
| + error.isCancellation = true;
|
| + } else if (reason == net::ERR_TEMPORARILY_THROTTLED) {
|
| + error.localizedDescription =
|
| + WebString::fromUTF8(kThrottledErrorDescription);
|
| + } else {
|
| + error.localizedDescription =
|
| + WebString::fromUTF8(net::ErrorToString(reason));
|
| + }
|
| + return error;
|
| +}
|
| +
|
| } // namespace content
|
|
|