OLD | NEW |
1 // Copyright (c) 2010 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2010 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 "webkit/glue/user_agent.h" | 5 #include "webkit/glue/user_agent.h" |
6 | 6 |
7 #if defined(OS_POSIX) && !defined(OS_MACOSX) | 7 #if defined(OS_POSIX) && !defined(OS_MACOSX) |
8 #include <sys/utsname.h> | 8 #include <sys/utsname.h> |
9 #endif | 9 #endif |
10 | 10 |
(...skipping 34 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
45 std::string cputype; | 45 std::string cputype; |
46 // special case for biarch systems | 46 // special case for biarch systems |
47 if (strcmp(unixinfo.machine, "x86_64") == 0 && | 47 if (strcmp(unixinfo.machine, "x86_64") == 0 && |
48 sizeof(void*) == sizeof(int32)) { // NOLINT | 48 sizeof(void*) == sizeof(int32)) { // NOLINT |
49 cputype.assign("i686 (x86_64)"); | 49 cputype.assign("i686 (x86_64)"); |
50 } else { | 50 } else { |
51 cputype.assign(unixinfo.machine); | 51 cputype.assign(unixinfo.machine); |
52 } | 52 } |
53 #endif | 53 #endif |
54 | 54 |
55 StringAppendF( | 55 base::StringAppendF( |
56 &os_cpu, | 56 &os_cpu, |
57 #if defined(OS_WIN) | 57 #if defined(OS_WIN) |
58 "Windows NT %d.%d", | 58 "Windows NT %d.%d", |
59 os_major_version, | 59 os_major_version, |
60 os_minor_version | 60 os_minor_version |
61 #elif defined(OS_MACOSX) | 61 #elif defined(OS_MACOSX) |
62 "Intel Mac OS X %d_%d_%d", | 62 "Intel Mac OS X %d_%d_%d", |
63 os_major_version, | 63 os_major_version, |
64 os_minor_version, | 64 os_minor_version, |
65 os_bugfix_version | 65 os_bugfix_version |
(...skipping 29 matching lines...) Expand all Loading... |
95 | 95 |
96 // TODO(port): figure out correct locale | 96 // TODO(port): figure out correct locale |
97 const char kUserAgentLocale[] = "en-US"; | 97 const char kUserAgentLocale[] = "en-US"; |
98 | 98 |
99 // Get the product name and version, and replace Safari's Version/X string | 99 // Get the product name and version, and replace Safari's Version/X string |
100 // with it. This is done to expose our product name in a manner that is | 100 // with it. This is done to expose our product name in a manner that is |
101 // maximally compatible with Safari, we hope!! | 101 // maximally compatible with Safari, we hope!! |
102 std::string product = GetProductVersion(); | 102 std::string product = GetProductVersion(); |
103 | 103 |
104 // Derived from Safari's UA string. | 104 // Derived from Safari's UA string. |
105 StringAppendF( | 105 base::StringAppendF( |
106 result, | 106 result, |
107 "Mozilla/5.0 (%s; %c; %s; %s) AppleWebKit/%d.%d" | 107 "Mozilla/5.0 (%s; %c; %s; %s) AppleWebKit/%d.%d" |
108 " (KHTML, like Gecko) %s Safari/%d.%d", | 108 " (KHTML, like Gecko) %s Safari/%d.%d", |
109 mimic_windows ? "Windows" : kUserAgentPlatform, | 109 mimic_windows ? "Windows" : kUserAgentPlatform, |
110 kUserAgentSecurity, | 110 kUserAgentSecurity, |
111 ((mimic_windows ? "Windows " : "") + BuildOSCpuInfo()).c_str(), | 111 ((mimic_windows ? "Windows " : "") + BuildOSCpuInfo()).c_str(), |
112 kUserAgentLocale, | 112 kUserAgentLocale, |
113 WEBKIT_VERSION_MAJOR, | 113 WEBKIT_VERSION_MAJOR, |
114 WEBKIT_VERSION_MINOR, | 114 WEBKIT_VERSION_MINOR, |
115 product.c_str(), | 115 product.c_str(), |
116 WEBKIT_VERSION_MAJOR, | 116 WEBKIT_VERSION_MAJOR, |
117 WEBKIT_VERSION_MINOR); | 117 WEBKIT_VERSION_MINOR); |
118 } | 118 } |
119 | 119 |
120 } // namespace webkit_glue | 120 } // namespace webkit_glue |
121 | 121 |
OLD | NEW |