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

Unified Diff: content/renderer/render_frame_impl.cc

Issue 313313002: Set the default accept header for main resources in RenderFrame (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 6 years, 6 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 | « no previous file | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: content/renderer/render_frame_impl.cc
diff --git a/content/renderer/render_frame_impl.cc b/content/renderer/render_frame_impl.cc
index cfce1ee9392a594905860c1e3c5027f6c39cb55e..6c41d1ae3485d55de6c98b0d1dfd3e09afdd44a8 100644
--- a/content/renderer/render_frame_impl.cc
+++ b/content/renderer/render_frame_impl.cc
@@ -169,6 +169,11 @@ namespace content {
namespace {
+const char kDefaultAcceptHeader[] =
+ "text/html,application/xhtml+xml,application/xml;q=0.9,image/webp,*/"
+ "*;q=0.8";
+const char kAcceptHeader[] = "Accept";
+
const size_t kExtraCharsBeforeAndAfterSelection = 100;
typedef std::map<int, RenderFrameImpl*> RoutingIDFrameMap;
@@ -2404,6 +2409,15 @@ void RenderFrameImpl::willSendRequest(
}
}
+ // Add the default accept header for frame request if it has not been set
+ // already.
ppi 2014/06/05 15:10:10 In which circumstances it will be already set?
clamy 2014/06/05 15:22:01 This function is also called on redirects. If the
+ if ((request.targetType() == blink::WebURLRequest::TargetIsMainFrame ||
+ request.targetType() == blink::WebURLRequest::TargetIsSubframe) &&
+ request.httpHeaderField(WebString::fromUTF8(kAcceptHeader)).isEmpty()) {
+ request.setHTTPHeaderField(WebString::fromUTF8(kAcceptHeader),
+ WebString::fromUTF8(kDefaultAcceptHeader));
+ }
+
// Attach |should_replace_current_entry| state to requests so that, should
// this navigation later require a request transfer, all state is preserved
// when it is re-created in the new process.
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698