Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(250)

Side by Side Diff: webkit/user_agent/user_agent_util.cc

Issue 10952025: [Android] Make OS version reporting in the UA string legacy-compatible. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 8 years, 3 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « no previous file | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2012 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/user_agent/user_agent_util.h" 5 #include "webkit/user_agent/user_agent_util.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 59 matching lines...) Expand 10 before | Expand all | Expand 10 after
70 base::win::OSInfo::WindowsArchitecture windows_architecture = 70 base::win::OSInfo::WindowsArchitecture windows_architecture =
71 os_info->architecture(); 71 os_info->architecture();
72 if (windows_architecture == base::win::OSInfo::X64_ARCHITECTURE) 72 if (windows_architecture == base::win::OSInfo::X64_ARCHITECTURE)
73 architecture_token = "; Win64; x64"; 73 architecture_token = "; Win64; x64";
74 else if (windows_architecture == base::win::OSInfo::IA64_ARCHITECTURE) 74 else if (windows_architecture == base::win::OSInfo::IA64_ARCHITECTURE)
75 architecture_token = "; Win64; IA64"; 75 architecture_token = "; Win64; IA64";
76 } 76 }
77 #endif 77 #endif
78 78
79 #if defined(OS_ANDROID) 79 #if defined(OS_ANDROID)
80 std::string android_version_str;
81 base::StringAppendF(
82 &android_version_str, "%d.%d", os_major_version, os_minor_version);
83 if (os_bugfix_version != 0)
84 base::StringAppendF(&android_version_str, ".%d", os_bugfix_version);
85
80 std::string android_info_str; 86 std::string android_info_str;
81 87
82 // Send information about the device. 88 // Send information about the device.
83 bool semicolon_inserted = false; 89 bool semicolon_inserted = false;
84 std::string android_build_codename = base::SysInfo::GetAndroidBuildCodename(); 90 std::string android_build_codename = base::SysInfo::GetAndroidBuildCodename();
85 std::string android_device_name = base::SysInfo::GetDeviceName(); 91 std::string android_device_name = base::SysInfo::GetDeviceName();
86 if ("REL" == android_build_codename && android_device_name.size() > 0) { 92 if ("REL" == android_build_codename && android_device_name.size() > 0) {
87 android_info_str += "; " + android_device_name; 93 android_info_str += "; " + android_device_name;
88 semicolon_inserted = true; 94 semicolon_inserted = true;
89 } 95 }
(...skipping 21 matching lines...) Expand all
111 os_minor_version, 117 os_minor_version,
112 os_bugfix_version 118 os_bugfix_version
113 #elif defined(OS_CHROMEOS) 119 #elif defined(OS_CHROMEOS)
114 "CrOS " 120 "CrOS "
115 "%s %d.%d.%d", 121 "%s %d.%d.%d",
116 cputype.c_str(), // e.g. i686 122 cputype.c_str(), // e.g. i686
117 os_major_version, 123 os_major_version,
118 os_minor_version, 124 os_minor_version,
119 os_bugfix_version 125 os_bugfix_version
120 #elif defined(OS_ANDROID) 126 #elif defined(OS_ANDROID)
121 "Android %d.%d.%d%s", 127 "Android %s%s",
122 os_major_version, 128 android_version_str.c_str(),
123 os_minor_version,
124 os_bugfix_version,
125 android_info_str.c_str() 129 android_info_str.c_str()
126 #else 130 #else
127 "%s %s", 131 "%s %s",
128 unixinfo.sysname, // e.g. Linux 132 unixinfo.sysname, // e.g. Linux
129 cputype.c_str() // e.g. i686 133 cputype.c_str() // e.g. i686
130 #endif 134 #endif
131 ); // NOLINT 135 ); // NOLINT
132 136
133 return os_cpu; 137 return os_cpu;
134 } 138 }
(...skipping 38 matching lines...) Expand 10 before | Expand all | Expand 10 after
173 os_info.c_str(), 177 os_info.c_str(),
174 WEBKIT_VERSION_MAJOR, 178 WEBKIT_VERSION_MAJOR,
175 WEBKIT_VERSION_MINOR, 179 WEBKIT_VERSION_MINOR,
176 product.c_str(), 180 product.c_str(),
177 WEBKIT_VERSION_MAJOR, 181 WEBKIT_VERSION_MAJOR,
178 WEBKIT_VERSION_MINOR); 182 WEBKIT_VERSION_MINOR);
179 return user_agent; 183 return user_agent;
180 } 184 }
181 185
182 } // namespace webkit_glue 186 } // namespace webkit_glue
OLDNEW
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698