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

Side by Side Diff: content/child/web_url_loader_impl.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 unified diff | Download patch
OLDNEW
1 // Copyright 2014 The Chromium Authors. All rights reserved. 1 // Copyright 2014 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #include "content/child/web_url_loader_impl.h" 5 #include "content/child/web_url_loader_impl.h"
6 6
7 #include <stdint.h> 7 #include <stdint.h>
8 8
9 #include <algorithm> 9 #include <algorithm>
10 #include <memory> 10 #include <memory>
(...skipping 478 matching lines...) Expand 10 before | Expand all | Expand 10 after
489 // Check credentials flag is set when credentials mode is include. 489 // Check credentials flag is set when credentials mode is include.
490 490
491 RequestInfo request_info; 491 RequestInfo request_info;
492 request_info.method = method; 492 request_info.method = method;
493 request_info.url = url; 493 request_info.url = url;
494 request_info.first_party_for_cookies = request.firstPartyForCookies(); 494 request_info.first_party_for_cookies = request.firstPartyForCookies();
495 request_info.request_initiator = request.requestorOrigin(); 495 request_info.request_initiator = request.requestorOrigin();
496 referrer_policy_ = request.referrerPolicy(); 496 referrer_policy_ = request.referrerPolicy();
497 request_info.referrer = Referrer(referrer_url, referrer_policy_); 497 request_info.referrer = Referrer(referrer_url, referrer_policy_);
498 request_info.headers = GetWebURLRequestHeaders(request); 498 request_info.headers = GetWebURLRequestHeaders(request);
499 request_info.default_user_agent = request.defaultHTTPUserAgent().latin1();
499 request_info.load_flags = GetLoadFlagsForWebURLRequest(request); 500 request_info.load_flags = GetLoadFlagsForWebURLRequest(request);
500 request_info.enable_load_timing = true; 501 request_info.enable_load_timing = true;
501 request_info.enable_upload_progress = request.reportUploadProgress(); 502 request_info.enable_upload_progress = request.reportUploadProgress();
502 if (request.getRequestContext() == 503 if (request.getRequestContext() ==
503 WebURLRequest::RequestContextXMLHttpRequest && 504 WebURLRequest::RequestContextXMLHttpRequest &&
504 (url.has_username() || url.has_password())) { 505 (url.has_username() || url.has_password())) {
505 request_info.do_not_prompt_for_login = true; 506 request_info.do_not_prompt_for_login = true;
506 } 507 }
507 // requestor_pid only needs to be non-zero if the request originates outside 508 // requestor_pid only needs to be non-zero if the request originates outside
508 // the render process, so we can use requestorProcessID even for requests 509 // the render process, so we can use requestorProcessID even for requests
(...skipping 704 matching lines...) Expand 10 before | Expand all | Expand 10 after
1213 response->clearHTTPHeaderField(webStringName); 1214 response->clearHTTPHeaderField(webStringName);
1214 while (response_headers->EnumerateHeader(&iterator, name, &value)) { 1215 while (response_headers->EnumerateHeader(&iterator, name, &value)) {
1215 response->addHTTPHeaderField(webStringName, 1216 response->addHTTPHeaderField(webStringName,
1216 WebString::fromLatin1(value)); 1217 WebString::fromLatin1(value));
1217 } 1218 }
1218 } 1219 }
1219 return true; 1220 return true;
1220 } 1221 }
1221 1222
1222 } // namespace content 1223 } // namespace content
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698