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 <stddef.h> | 9 #include <stddef.h> |
10 #include <stdint.h> | 10 #include <stdint.h> |
(...skipping 14 matching lines...) Expand all Loading... | |
25 const char* webkit_version_string; | 25 const char* webkit_version_string; |
26 }; | 26 }; |
27 | 27 |
28 struct OSVersionMap { | 28 struct OSVersionMap { |
29 int32_t major_os_version; | 29 int32_t major_os_version; |
30 int32_t minor_os_version; | 30 int32_t minor_os_version; |
31 UAVersions ua_versions; | 31 UAVersions ua_versions; |
32 }; | 32 }; |
33 | 33 |
34 const UAVersions& GetUAVersionsForCurrentOS() { | 34 const UAVersions& GetUAVersionsForCurrentOS() { |
35 // The WebKit version can be extracted dynamically from UIWebView, but the | 35 // The WebKit version can be extracted dynamically from UIWebView, but the |
justincohen
2016/09/01 11:53:55
eugenebut@ is this comment still true, especially
Eugene But (OOO till 7-30)
2016/09/01 15:56:54
I don't know how WebKit version extraction worked
| |
36 // Safari version can't be, so a lookup table is used instead (for both, since | 36 // Safari version can't be, so a lookup table is used instead (for both, since |
37 // the reported versions should stay in sync). | 37 // the reported versions should stay in sync). |
38 static const OSVersionMap version_map[] = { | 38 static const OSVersionMap version_map[] = { |
39 {10, 0, {"602.1", "602.1.50"}}, | |
39 {9, 0, {"601.1.46", "601.1"}}, | 40 {9, 0, {"601.1.46", "601.1"}}, |
40 {8, 0, {"600.1.4", "600.1.4"}}, | 41 {8, 0, {"600.1.4", "600.1.4"}}, |
41 {7, 1, {"9537.53", "537.51.2"}}, | 42 {7, 1, {"9537.53", "537.51.2"}}, |
42 {7, 0, {"9537.53", "537.51.1"}}, | 43 {7, 0, {"9537.53", "537.51.1"}}, |
43 }; | 44 }; |
44 | 45 |
45 int32_t os_major_version = 0; | 46 int32_t os_major_version = 0; |
46 int32_t os_minor_version = 0; | 47 int32_t os_minor_version = 0; |
47 int32_t os_bugfix_version = 0; | 48 int32_t os_bugfix_version = 0; |
48 base::SysInfo::OperatingSystemVersionNumbers(&os_major_version, | 49 base::SysInfo::OperatingSystemVersionNumbers(&os_major_version, |
(...skipping 75 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
124 BuildOSCpuInfo().c_str(), | 125 BuildOSCpuInfo().c_str(), |
125 ua_versions.webkit_version_string, | 126 ua_versions.webkit_version_string, |
126 product.c_str(), | 127 product.c_str(), |
127 kernel_version, | 128 kernel_version, |
128 ua_versions.safari_version_string); | 129 ua_versions.safari_version_string); |
129 | 130 |
130 return user_agent; | 131 return user_agent; |
131 } | 132 } |
132 | 133 |
133 } // namespace web | 134 } // namespace web |
OLD | NEW |