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

Unified Diff: ios/chrome/common/physical_web/physical_web_request.mm

Issue 2042863002: Set the Accept-Language header in Physical Web requests (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: re-add logging include Created 4 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: ios/chrome/common/physical_web/physical_web_request.mm
diff --git a/ios/chrome/common/physical_web/physical_web_request.mm b/ios/chrome/common/physical_web/physical_web_request.mm
index bbc0bd4b070f4601ff9d85839819049d6edd3623..878fcd6201cb96975916a1c2dcc30cc17f0178dc 100644
--- a/ios/chrome/common/physical_web/physical_web_request.mm
+++ b/ios/chrome/common/physical_web/physical_web_request.mm
@@ -104,6 +104,14 @@ std::string GetUserAgent() {
[request_ setValue:base::SysUTF8ToNSString(GetUserAgent())
forHTTPHeaderField:@"User-Agent"];
+ // Set the Accept-Language header from the locale language code. This may
+ // cause us to fetch metadata for the wrong region in languages such as
+ // Chinese that vary significantly between regions.
+ // TODO(mattreynolds): Use the same Accept-Language string as WKWebView.
+ NSString* acceptLanguage =
+ [[NSLocale currentLocale] objectForKey:NSLocaleLanguageCode];
+ [request_ setValue:acceptLanguage forHTTPHeaderField:@"Acccept-Language"];
+
startDate_.reset([[NSDate date] retain]);
// Starts the request.
NSURLSession* session =
« 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