| 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 "base/logging.h" | 7 #include "base/logging.h" |
| 8 #include "base/strings/string_util.h" | 8 #include "base/strings/string_util.h" |
| 9 #include "base/strings/stringprintf.h" | 9 #include "base/strings/stringprintf.h" |
| 10 #include "base/sys_info.h" | 10 #include "base/sys_info.h" |
| 11 #include "build/build_config.h" | 11 #include "build/build_config.h" |
| 12 | 12 |
| 13 #if defined(OS_POSIX) && !defined(OS_MACOSX) | 13 #if defined(OS_POSIX) && !defined(OS_MACOSX) |
| 14 #include <sys/utsname.h> | 14 #include <sys/utsname.h> |
| 15 #endif | 15 #endif |
| 16 | 16 |
| 17 #if defined(OS_WIN) | 17 #if defined(OS_WIN) |
| 18 #include "base/win/windows_version.h" | 18 #include "base/win/windows_version.h" |
| 19 #endif | 19 #endif |
| 20 | 20 |
| 21 // Generated | 21 // Generated |
| 22 #include "webkit_version.h" // NOLINT | 22 #include "webkit_version.h" // NOLINT |
| 23 | 23 |
| 24 namespace content { | 24 namespace content { |
| 25 | 25 |
| 26 namespace { | |
| 27 | |
| 28 #if defined(OS_ANDROID) | |
| 29 std::string GetAndroidDeviceName() { | |
| 30 return base::SysInfo::GetDeviceName(); | |
| 31 } | |
| 32 #endif | |
| 33 | |
| 34 } // namespace | |
| 35 | |
| 36 std::string GetWebKitVersion() { | 26 std::string GetWebKitVersion() { |
| 37 return base::StringPrintf("%d.%d (%s)", | 27 return base::StringPrintf("%d.%d (%s)", |
| 38 WEBKIT_VERSION_MAJOR, | 28 WEBKIT_VERSION_MAJOR, |
| 39 WEBKIT_VERSION_MINOR, | 29 WEBKIT_VERSION_MINOR, |
| 40 WEBKIT_SVN_REVISION); | 30 WEBKIT_SVN_REVISION); |
| 41 } | 31 } |
| 42 | 32 |
| 43 int GetWebKitMajorVersion() { | 33 int GetWebKitMajorVersion() { |
| 44 return WEBKIT_VERSION_MAJOR; | 34 return WEBKIT_VERSION_MAJOR; |
| 45 } | 35 } |
| (...skipping 54 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 100 base::StringAppendF( | 90 base::StringAppendF( |
| 101 &android_version_str, "%d.%d", os_major_version, os_minor_version); | 91 &android_version_str, "%d.%d", os_major_version, os_minor_version); |
| 102 if (os_bugfix_version != 0) | 92 if (os_bugfix_version != 0) |
| 103 base::StringAppendF(&android_version_str, ".%d", os_bugfix_version); | 93 base::StringAppendF(&android_version_str, ".%d", os_bugfix_version); |
| 104 | 94 |
| 105 std::string android_info_str; | 95 std::string android_info_str; |
| 106 | 96 |
| 107 // Send information about the device. | 97 // Send information about the device. |
| 108 bool semicolon_inserted = false; | 98 bool semicolon_inserted = false; |
| 109 std::string android_build_codename = base::SysInfo::GetAndroidBuildCodename(); | 99 std::string android_build_codename = base::SysInfo::GetAndroidBuildCodename(); |
| 110 std::string android_device_name = GetAndroidDeviceName(); | 100 std::string android_device_name = base::SysInfo::HardwareModelName(); |
| 111 if ("REL" == android_build_codename && android_device_name.size() > 0) { | 101 if ("REL" == android_build_codename && android_device_name.size() > 0) { |
| 112 android_info_str += "; " + android_device_name; | 102 android_info_str += "; " + android_device_name; |
| 113 semicolon_inserted = true; | 103 semicolon_inserted = true; |
| 114 } | 104 } |
| 115 | 105 |
| 116 // Append the build ID. | 106 // Append the build ID. |
| 117 std::string android_build_id = base::SysInfo::GetAndroidBuildID(); | 107 std::string android_build_id = base::SysInfo::GetAndroidBuildID(); |
| 118 if (android_build_id.size() > 0) { | 108 if (android_build_id.size() > 0) { |
| 119 if (!semicolon_inserted) { | 109 if (!semicolon_inserted) { |
| 120 android_info_str += ";"; | 110 android_info_str += ";"; |
| (...skipping 85 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 206 os_info.c_str(), | 196 os_info.c_str(), |
| 207 WEBKIT_VERSION_MAJOR, | 197 WEBKIT_VERSION_MAJOR, |
| 208 WEBKIT_VERSION_MINOR, | 198 WEBKIT_VERSION_MINOR, |
| 209 product.c_str(), | 199 product.c_str(), |
| 210 WEBKIT_VERSION_MAJOR, | 200 WEBKIT_VERSION_MAJOR, |
| 211 WEBKIT_VERSION_MINOR); | 201 WEBKIT_VERSION_MINOR); |
| 212 return user_agent; | 202 return user_agent; |
| 213 } | 203 } |
| 214 | 204 |
| 215 } // namespace content | 205 } // namespace content |
| OLD | NEW |