Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(231)

Unified Diff: content/child/web_url_request_util.cc

Issue 958083002: PlzNavigate: Show error pages when the navigation failed before commit (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@support-data-urls
Patch Set: Updated test Created 5 years, 8 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « content/child/web_url_request_util.h ('k') | content/common/frame_messages.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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
« no previous file with comments | « content/child/web_url_request_util.h ('k') | content/common/frame_messages.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698