| OLD | NEW |
| 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 "ios/web/public/user_agent.h" | 5 #include "ios/web/public/user_agent.h" |
| 6 | 6 |
| 7 #import <UIKit/UIKit.h> | 7 #import <UIKit/UIKit.h> |
| 8 | 8 |
| 9 #include <sys/sysctl.h> | 9 #include <sys/sysctl.h> |
| 10 #include <string> | 10 #include <string> |
| (...skipping 15 matching lines...) Expand all Loading... |
| 26 int32 major_os_version; | 26 int32 major_os_version; |
| 27 int32 minor_os_version; | 27 int32 minor_os_version; |
| 28 UAVersions ua_versions; | 28 UAVersions ua_versions; |
| 29 }; | 29 }; |
| 30 | 30 |
| 31 const UAVersions& GetUAVersionsForCurrentOS() { | 31 const UAVersions& GetUAVersionsForCurrentOS() { |
| 32 // The WebKit version can be extracted dynamically from UIWebView, but the | 32 // The WebKit version can be extracted dynamically from UIWebView, but the |
| 33 // Safari version can't be, so a lookup table is used instead (for both, since | 33 // Safari version can't be, so a lookup table is used instead (for both, since |
| 34 // the reported versions should stay in sync). | 34 // the reported versions should stay in sync). |
| 35 static const OSVersionMap version_map[] = { | 35 static const OSVersionMap version_map[] = { |
| 36 { 8, 0, { "600.1.4", "600.1.4" } }, |
| 36 { 7, 1, { "9537.53", "537.51.2" } }, | 37 { 7, 1, { "9537.53", "537.51.2" } }, |
| 37 { 7, 0, { "9537.53", "537.51.1" } }, | 38 { 7, 0, { "9537.53", "537.51.1" } }, |
| 38 // 6.1 has the same values as 6.0. | 39 // 6.1 has the same values as 6.0. |
| 39 { 6, 0, { "8536.25", "536.26" } }, | 40 { 6, 0, { "8536.25", "536.26" } }, |
| 40 }; | 41 }; |
| 41 | 42 |
| 42 int32 os_major_version = 0; | 43 int32 os_major_version = 0; |
| 43 int32 os_minor_version = 0; | 44 int32 os_minor_version = 0; |
| 44 int32 os_bugfix_version = 0; | 45 int32 os_bugfix_version = 0; |
| 45 base::SysInfo::OperatingSystemVersionNumbers(&os_major_version, | 46 base::SysInfo::OperatingSystemVersionNumbers(&os_major_version, |
| (...skipping 75 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 121 BuildOSCpuInfo().c_str(), | 122 BuildOSCpuInfo().c_str(), |
| 122 ua_versions.webkit_version_string, | 123 ua_versions.webkit_version_string, |
| 123 product.c_str(), | 124 product.c_str(), |
| 124 kernel_version, | 125 kernel_version, |
| 125 ua_versions.safari_version_string); | 126 ua_versions.safari_version_string); |
| 126 | 127 |
| 127 return user_agent; | 128 return user_agent; |
| 128 } | 129 } |
| 129 | 130 |
| 130 } // namespace web | 131 } // namespace web |
| OLD | NEW |