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

Side by Side Diff: ios/web/public/user_agent.h

Issue 2705293014: Created web::UserAgentType. (Closed)
Patch Set: self review 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 unified diff | Download patch
OLDNEW
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.
liaoyuke 2017/02/25 01:28:19 Is it intentional to have multiple white spaces be
kkhorimoto 2017/02/25 01:35:05 Yes. It's a common practice to increase readabili
18 MOBILE,
19
20 // Used when requesting the desktop version of a page.
liaoyuke 2017/02/25 01:28:19 Can we make the comments consistent between MOBILE
kkhorimoto 2017/02/25 01:35:05 Done.
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_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698