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