Update iOS UA generation for iOS 7

Also removes iOS 4.3 handling, as 4.3 is no longer supported.

BUG=None

Review URL: https://chromiumcodereview.appspot.com/21513008

git-svn-id: svn://svn.chromium.org/chrome/trunk/src@215962 0039d316-1c4b-4281-b951-d872f2087c98
parent 21e2490f
...@@ -33,10 +33,12 @@ const UAVersions& GetUAVersionsForCurrentOS() { ...@@ -33,10 +33,12 @@ const UAVersions& GetUAVersionsForCurrentOS() {
// Safari version can't be, so a lookup table is used instead (for both, since // Safari version can't be, so a lookup table is used instead (for both, since
// the reported versions should stay in sync). // the reported versions should stay in sync).
static const OSVersionMap version_map[] = { static const OSVersionMap version_map[] = {
{ 6, 0, { "8536.25", "536.26" } }, // TODO(ios): Update for 6.0 final. // TODO(stuartmorgan): Update for 7.0 final if necessary.
{ 7, 0, { "8536.25", "537.51.1" } },
// 6.1 has the same values as 6.0.
{ 6, 0, { "8536.25", "536.26" } },
// 5.1 has the same values as 5.0. // 5.1 has the same values as 5.0.
{ 5, 0, { "7534.48.3", "534.46" } }, { 5, 0, { "7534.48.3", "534.46" } },
{ 4, 3, { "6533.18.5", "533.17.9" } },
}; };
int32 os_major_version = 0; int32 os_major_version = 0;
...@@ -100,53 +102,6 @@ std::string BuildOSCpuInfo() { ...@@ -100,53 +102,6 @@ std::string BuildOSCpuInfo() {
(platform == "iPad") ? "" : "iPhone ", // iPad has an empty string here. (platform == "iPad") ? "" : "iPhone ", // iPad has an empty string here.
os_version.c_str()); os_version.c_str());
// Up until iOS 5, the locale was included at the end of the Safari UA.
// TODO(stuartmorgan): Remove this once iOS 4.3 is no longer supported.
if (os_major_version < 5) {
// The locale string is not easy to set correctly. Safari uses a language
// code and a dialect code. However, there is no setting allowing the user
// to set the dialect code, and no API to retrieve it.
// Note: The NSLocale methods (currentIdentifier:,
// objectForKey:NSLocaleLanguageCode and objectForKey:NSLocaleCountryCode)
// are not useful here because they return information related to the
// "Region Format" setting, which is different from the "Language" setting.
base::scoped_nsobject<NSDictionary> dialects([[NSDictionary alloc]
initWithObjectsAndKeys:
@"ar", @"ar", // No dialect code in Safari.
@"ca-es", @"ca",
@"cs-cz", @"cs",
@"da-dk", @"da",
@"el-gr", @"el",
@"en-gb", @"en-GB",
@"en-us", @"en",
@"he-il", @"he",
@"id", @"id", // No dialect code in Safari.
@"ja-jp", @"ja",
@"ko-kr", @"ko",
@"nb-no", @"nb",
@"pt-br", @"pt",
@"pt-pt", @"pt-PT",
@"sv-se", @"sv",
@"uk-ua", @"uk",
@"vi-vn", @"vi",
@"zh-cn", @"zh-Hans",
@"zh-tw", @"zh-Hant",
nil]);
NSArray* preferredLanguages = [NSLocale preferredLanguages];
NSString* language = ([preferredLanguages count] > 0) ?
[preferredLanguages objectAtIndex:0] : @"en";
NSString* localeIdentifier = [dialects objectForKey:language];
if (!localeIdentifier) {
// No entry in the dictionary, so duplicate the language string.
localeIdentifier =
[NSString stringWithFormat:@"%@-%@", language, language];
}
base::StringAppendF(&os_cpu, "; %s",
base::SysNSStringToUTF8(localeIdentifier).c_str());
}
return os_cpu; return os_cpu;
} }
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment