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

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: 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..5e71a01c8dee90f4e63261b95b6714507dec136f 100644
--- a/ios/chrome/common/physical_web/physical_web_request.mm
+++ b/ios/chrome/common/physical_web/physical_web_request.mm
@@ -5,7 +5,6 @@
#import "ios/chrome/common/physical_web/physical_web_request.h"
#include "base/ios/weak_nsobject.h"
-#include "base/logging.h"
#include "base/mac/foundation_util.h"
#include "base/mac/scoped_block.h"
#include "base/mac/scoped_nsobject.h"
@@ -104,6 +103,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