Skip to content

Commit bdf9580

Browse files
author
Santosh Mahto
committed
Prepend starboard OS name in user-agent string
The current OS name in user-agent string is fetched using chromium code which just return "Linux". This misses the real OS name for starboard platform and result in YTS test failure. So OS name in user-agent string should include the starboard platform OS name. Bug: 475670748
1 parent 22ae31c commit bdf9580

File tree

3 files changed

+21
-2
lines changed

3 files changed

+21
-2
lines changed

base/system/sys_info_starboard.cc

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -78,6 +78,11 @@ std::string SbSysInfo::Brand() {
7878
__system_property_get("ro.product.brand", brand_str);
7979
return std::string(brand_str);
8080
}
81+
82+
std::string SbSysInfo::OSFriendlyName() {
83+
return "AOSP";
84+
}
85+
8186
#elif BUILDFLAG(IS_STARBOARD)
8287
std::string SbSysInfo::OriginalDesignManufacturer() {
8388
return GetSystemPropertyString(kSbSystemPropertySystemIntegratorName);
@@ -95,6 +100,10 @@ std::string SbSysInfo::Brand() {
95100
return GetSystemPropertyString(kSbSystemPropertyBrandName);
96101
}
97102

103+
std::string SbSysInfo::OSFriendlyName() {
104+
return GetSystemPropertyString(kSbSystemPropertyFriendlyName);
105+
}
106+
98107
#elif BUILDFLAG(IS_IOS_TVOS)
99108
std::string SbSysInfo::OriginalDesignManufacturer() {
100109
// Cobalt 25: https://github.com/youtube/cobalt/blob/62c2380b7eb0da5889a387c4b9be283656a8575d/starboard/shared/uikit/system_get_property.mm#L126
@@ -152,6 +161,10 @@ std::string SbSysInfo::Brand() {
152161
return "Apple";
153162
}
154163

164+
std::string SbSysInfo::OSFriendlyName() {
165+
SB_NOTIMPLEMENTED();
166+
}
167+
155168
#endif // BUILDFLAG(IS_ANDROID)
156169

157170
} // namespace starboard

base/system/sys_info_starboard.h

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -31,9 +31,11 @@ class BASE_EXPORT SbSysInfo {
3131
static std::string ModelYear();
3232

3333
static std::string Brand();
34+
35+
static std::string OSFriendlyName();
3436
};
3537

3638
} // namespace starboard
3739
} // namespace base
3840

39-
#endif // BASE_SYSTEM_SYS_INFO_STARBOARD_H_
41+
#endif // BASE_SYSTEM_SYS_INFO_STARBOARD_H_

cobalt/browser/user_agent/user_agent_platform_info.cc

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -190,7 +190,11 @@ void UserAgentPlatformInfo::InitializePlatformDependentFieldsAndroid() {
190190
}
191191
#elif BUILDFLAG(IS_STARBOARD)
192192
void UserAgentPlatformInfo::InitializePlatformDependentFieldsStarboard() {
193-
const std::string os_name = base::SysInfo::OperatingSystemName();
193+
std::string os_name = base::SysInfo::OperatingSystemName();
194+
std::string os_friendly_name = base::starboard::SbSysInfo::OSFriendlyName();
195+
if (!os_friendly_name.empty()) {
196+
os_name = os_friendly_name + "; " + os_name;
197+
}
194198
const std::string os_version = base::SysInfo::OperatingSystemVersion();
195199
set_os_name_and_version(
196200
base::StringPrintf("%s %s", os_name.c_str(), os_version.c_str()));

0 commit comments

Comments
 (0)