Index: ios/web/public/user_agent.mm |
diff --git a/ios/web/public/user_agent.mm b/ios/web/public/user_agent.mm |
index c3342aaddfa27fb186cbada936c82ef78fe3f00a..7993453b6711b9f7e281687b2386ef71ba20a707 100644 |
--- a/ios/web/public/user_agent.mm |
+++ b/ios/web/public/user_agent.mm |
@@ -24,6 +24,11 @@ |
namespace { |
+// UserAgentType description strings. |
+const char kUserAgentTypeNoneDescription[] = "NONE"; |
+const char kUserAgentTypeMobileDescription[] = "MOBILE"; |
+const char kUserAgentTypeDesktopDescription[] = "DESKTOP"; |
+ |
struct UAVersions { |
const char* safari_version_string; |
const char* webkit_version_string; |
@@ -70,6 +75,27 @@ |
namespace web { |
+std::string GetUserAgentTypeDescription(UserAgentType type) { |
+ switch (type) { |
+ case UserAgentType::NONE: |
+ return std::string(kUserAgentTypeNoneDescription); |
+ break; |
+ case UserAgentType::MOBILE: |
+ return std::string(kUserAgentTypeMobileDescription); |
+ break; |
+ case UserAgentType::DESKTOP: |
+ return std::string(kUserAgentTypeDesktopDescription); |
+ } |
+} |
+ |
+UserAgentType GetUserAgentTypeWithDescription(const std::string& description) { |
+ if (description == std::string(kUserAgentTypeMobileDescription)) |
+ return UserAgentType::MOBILE; |
+ if (description == std::string(kUserAgentTypeDesktopDescription)) |
+ return UserAgentType::DESKTOP; |
+ return UserAgentType::NONE; |
+} |
+ |
std::string BuildOSCpuInfo() { |
int32_t os_major_version = 0; |
int32_t os_minor_version = 0; |