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

Unified Diff: content/renderer/render_view_impl.cc

Issue 10780019: PPAPI (Flash): Properly honor Pepper url requests with custom user agents. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: got rid of unneeded WebKit:: Created 8 years, 5 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/common/resource_dispatcher_unittest.cc ('k') | webkit/glue/weburlrequest_extradata_impl.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: content/renderer/render_view_impl.cc
diff --git a/content/renderer/render_view_impl.cc b/content/renderer/render_view_impl.cc
index d56d8f2030d2564924a26e742074c5031878f3cb..0157c5eb02e2c5c30b6664b2ffee4085443bbd20 100644
--- a/content/renderer/render_view_impl.cc
+++ b/content/renderer/render_view_impl.cc
@@ -3299,8 +3299,27 @@ void RenderViewImpl::willSendRequest(WebFrame* frame,
referrer_policy = frame->document().referrerPolicy();
}
+ // The request's extra data may indicate that we should set a custom user
+ // agent. This needs to be done here, after WebKit is through with setting the
+ // user agent on its own.
+ WebString custom_user_agent;
+ if (request.extraData()) {
+ webkit_glue::WebURLRequestExtraDataImpl* old_extra_data =
+ static_cast<webkit_glue::WebURLRequestExtraDataImpl*>(
+ request.extraData());
+ custom_user_agent = old_extra_data->custom_user_agent();
+
+ if (!custom_user_agent.isNull()) {
+ if (custom_user_agent.isEmpty())
+ request.clearHTTPHeaderField("User-Agent");
+ else
+ request.setHTTPHeaderField("User-Agent", custom_user_agent);
+ }
+ }
+
request.setExtraData(
new RequestExtraData(referrer_policy,
+ custom_user_agent,
(frame == top_frame),
frame->identifier(),
frame->parent() == top_frame,
« no previous file with comments | « content/common/resource_dispatcher_unittest.cc ('k') | webkit/glue/weburlrequest_extradata_impl.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698