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 "content/public/common/user_agent.h" | 5 #include "content/public/common/user_agent.h" |
6 | 6 |
7 #include <stdint.h> | 7 #include <stdint.h> |
8 | 8 |
9 #include "base/logging.h" | 9 #include "base/logging.h" |
10 #include "base/strings/string_util.h" | 10 #include "base/strings/string_util.h" |
(...skipping 45 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
56 // special case for biarch systems | 56 // special case for biarch systems |
57 if (strcmp(unixinfo.machine, "x86_64") == 0 && | 57 if (strcmp(unixinfo.machine, "x86_64") == 0 && |
58 sizeof(void*) == sizeof(int32_t)) { // NOLINT | 58 sizeof(void*) == sizeof(int32_t)) { // NOLINT |
59 cputype.assign("i686 (x86_64)"); | 59 cputype.assign("i686 (x86_64)"); |
60 } else { | 60 } else { |
61 cputype.assign(unixinfo.machine); | 61 cputype.assign(unixinfo.machine); |
62 } | 62 } |
63 #endif | 63 #endif |
64 | 64 |
65 #if defined(OS_WIN) | 65 #if defined(OS_WIN) |
66 std::string windows_version_str; | |
67 if (os_major_version >= 10) { | |
68 base::StringAppendF(&windows_version_str, "%d.%d.%d", | |
69 os_major_version, os_minor_version, os_bugfix_version); | |
70 } else { | |
71 base::StringAppendF( | |
72 &windows_version_str, "%d.%d", os_major_version, os_minor_version); | |
73 } | |
74 | |
75 std::string architecture_token; | 66 std::string architecture_token; |
76 base::win::OSInfo* os_info = base::win::OSInfo::GetInstance(); | 67 base::win::OSInfo* os_info = base::win::OSInfo::GetInstance(); |
77 if (os_info->wow64_status() == base::win::OSInfo::WOW64_ENABLED) { | 68 if (os_info->wow64_status() == base::win::OSInfo::WOW64_ENABLED) { |
78 architecture_token = "; WOW64"; | 69 architecture_token = "; WOW64"; |
79 } else { | 70 } else { |
80 base::win::OSInfo::WindowsArchitecture windows_architecture = | 71 base::win::OSInfo::WindowsArchitecture windows_architecture = |
81 os_info->architecture(); | 72 os_info->architecture(); |
82 if (windows_architecture == base::win::OSInfo::X64_ARCHITECTURE) | 73 if (windows_architecture == base::win::OSInfo::X64_ARCHITECTURE) |
83 architecture_token = "; Win64; x64"; | 74 architecture_token = "; Win64; x64"; |
84 else if (windows_architecture == base::win::OSInfo::IA64_ARCHITECTURE) | 75 else if (windows_architecture == base::win::OSInfo::IA64_ARCHITECTURE) |
(...skipping 25 matching lines...) Expand all Loading... |
110 if (!semicolon_inserted) { | 101 if (!semicolon_inserted) { |
111 android_info_str += ";"; | 102 android_info_str += ";"; |
112 } | 103 } |
113 android_info_str += " Build/" + android_build_id; | 104 android_info_str += " Build/" + android_build_id; |
114 } | 105 } |
115 #endif | 106 #endif |
116 | 107 |
117 base::StringAppendF( | 108 base::StringAppendF( |
118 &os_cpu, | 109 &os_cpu, |
119 #if defined(OS_WIN) | 110 #if defined(OS_WIN) |
120 "Windows NT %s%s", | 111 "Windows NT %d.%d%s", |
121 windows_version_str.c_str(), | 112 os_major_version, |
| 113 os_minor_version, |
122 architecture_token.c_str() | 114 architecture_token.c_str() |
123 #elif defined(OS_MACOSX) | 115 #elif defined(OS_MACOSX) |
124 "Intel Mac OS X %d_%d_%d", | 116 "Intel Mac OS X %d_%d_%d", |
125 os_major_version, | 117 os_major_version, |
126 os_minor_version, | 118 os_minor_version, |
127 os_bugfix_version | 119 os_bugfix_version |
128 #elif defined(OS_CHROMEOS) | 120 #elif defined(OS_CHROMEOS) |
129 "CrOS " | 121 "CrOS " |
130 "%s %d.%d.%d", | 122 "%s %d.%d.%d", |
131 cputype.c_str(), // e.g. i686 | 123 cputype.c_str(), // e.g. i686 |
(...skipping 64 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
196 os_info.c_str(), | 188 os_info.c_str(), |
197 WEBKIT_VERSION_MAJOR, | 189 WEBKIT_VERSION_MAJOR, |
198 WEBKIT_VERSION_MINOR, | 190 WEBKIT_VERSION_MINOR, |
199 product.c_str(), | 191 product.c_str(), |
200 WEBKIT_VERSION_MAJOR, | 192 WEBKIT_VERSION_MAJOR, |
201 WEBKIT_VERSION_MINOR); | 193 WEBKIT_VERSION_MINOR); |
202 return user_agent; | 194 return user_agent; |
203 } | 195 } |
204 | 196 |
205 } // namespace content | 197 } // namespace content |
OLD | NEW |