OLD | NEW |
1 // Copyright 2014 The Chromium Authors. All rights reserved. | 1 // Copyright 2014 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 #ifndef IOS_WEB_PUBLIC_USER_AGENT_H_ | 5 #ifndef IOS_WEB_PUBLIC_USER_AGENT_H_ |
6 #define IOS_WEB_PUBLIC_USER_AGENT_H_ | 6 #define IOS_WEB_PUBLIC_USER_AGENT_H_ |
7 | 7 |
8 #include <string> | 8 #include <string> |
9 | 9 |
10 namespace web { | 10 namespace web { |
11 | 11 |
| 12 // Enum type specifying a user agent's type. |
| 13 enum class UserAgentType : short { |
| 14 // Used for pages that are generated for app-specific URLs. |
| 15 NONE = 0, |
| 16 |
| 17 // The default user agent type. Used to specify a mobile browser user agent. |
| 18 MOBILE, |
| 19 |
| 20 // Used to specify a desktop browser user agent. |
| 21 DESKTOP |
| 22 }; |
| 23 |
| 24 // Returns a string representation of |type|. |
| 25 std::string GetUserAgentTypeDescription(UserAgentType type); |
| 26 |
| 27 // Returns a UserAgentType with the given description. If |description| doesn't |
| 28 // correspond with a UserAgentType, UserAgentType::NONE will be returned. |
| 29 UserAgentType GetUserAgentTypeWithDescription(const std::string& description); |
| 30 |
12 // Returns the os cpu info portion for a user agent. | 31 // Returns the os cpu info portion for a user agent. |
13 std::string BuildOSCpuInfo(); | 32 std::string BuildOSCpuInfo(); |
14 | 33 |
15 // Returns the user agent to use for the given product name. | 34 // Returns the user agent to use for the given product name. |
16 // The returned user agent is very similar to that used by Mobile Safari, for | 35 // The returned user agent is very similar to that used by Mobile Safari, for |
17 // web page compatibility. | 36 // web page compatibility. |
18 std::string BuildUserAgentFromProduct(const std::string& product); | 37 std::string BuildUserAgentFromProduct(const std::string& product); |
19 | 38 |
20 } // namespace web | 39 } // namespace web |
21 | 40 |
22 #endif // IOS_WEB_PUBLIC_USER_AGENT_H_ | 41 #endif // IOS_WEB_PUBLIC_USER_AGENT_H_ |
OLD | NEW |