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

Unified Diff: ios/web/public/user_agent.mm

Issue 2705293014: Created web::UserAgentType. (Closed)
Patch Set: rebase + compile fix Created 3 years, 10 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « ios/web/public/user_agent.h ('k') | ios/web/public/user_agent_unittest.mm » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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;
« no previous file with comments | « ios/web/public/user_agent.h ('k') | ios/web/public/user_agent_unittest.mm » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698