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

Unified Diff: net/url_request/url_request.cc

Issue 2254693002: Delay generation of User-Agent header to URLRequestHttpJob and accept custom User-Agent from XHR/Fe… Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Changed Android test Created 4 years, 4 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
Index: net/url_request/url_request.cc
diff --git a/net/url_request/url_request.cc b/net/url_request/url_request.cc
index eac30aeb4157f9f54ea97f57c3ce1c6d2a91fbb6..324a5a1ed328a2adb9ebaafe5ceb260f29d7a2e8 100644
--- a/net/url_request/url_request.cc
+++ b/net/url_request/url_request.cc
@@ -222,6 +222,15 @@ void URLRequest::SetExtraRequestHeaders(
// for request headers are implemented.
}
+void URLRequest::set_default_user_agent(const std::string& default_user_agent) {
+ has_default_user_agent_ = true;
+ default_user_agent_ = default_user_agent;
+}
+
+bool URLRequest::has_default_user_agent() const {
+ return has_default_user_agent_;
+}
+
bool URLRequest::GetFullRequestHeaders(HttpRequestHeaders* headers) const {
if (!job_.get())
return false;
@@ -553,6 +562,7 @@ URLRequest::URLRequest(const GURL& url,
method_("GET"),
referrer_policy_(CLEAR_REFERRER_ON_TRANSITION_FROM_SECURE_TO_INSECURE),
first_party_url_policy_(NEVER_CHANGE_FIRST_PARTY_URL),
+ has_default_user_agent_(false),
load_flags_(LOAD_NORMAL),
delegate_(delegate),
is_pending_(false),

Powered by Google App Engine
This is Rietveld 408576698