OLD | NEW |
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 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 WEBKIT_GLUE_USER_AGENT_H_ | 5 #ifndef WEBKIT_GLUE_USER_AGENT_H_ |
6 #define WEBKIT_GLUE_USER_AGENT_H_ | 6 #define WEBKIT_GLUE_USER_AGENT_H_ |
7 | 7 |
8 #include <string> | 8 #include <string> |
9 | 9 |
10 #include "base/basictypes.h" | 10 #include "base/basictypes.h" |
| 11 #include "webkit/glue/webkit_glue_export.h" |
| 12 |
| 13 class GURL; |
11 | 14 |
12 namespace webkit_glue { | 15 namespace webkit_glue { |
13 | 16 |
| 17 // Sets the user agent. Pass true for overriding if this is a custom |
| 18 // user agent instead of the default one (in order to turn off any browser |
| 19 // sniffing workarounds). This must be called before GetUserAgent() can |
| 20 // be called. |
| 21 WEBKIT_GLUE_EXPORT void SetUserAgent(const std::string& user_agent, |
| 22 bool overriding); |
| 23 |
| 24 // Returns the user agent to use for the given URL. SetUserAgent() must |
| 25 // be called prior to calling this function. |
| 26 WEBKIT_GLUE_EXPORT const std::string& GetUserAgent(const GURL& url); |
| 27 |
14 // Builds a User-agent compatible string that describes the OS and CPU type. | 28 // Builds a User-agent compatible string that describes the OS and CPU type. |
15 std::string BuildOSCpuInfo(); | 29 std::string BuildOSCpuInfo(); |
16 | 30 |
17 // Returns the WebKit version, in the form "major.minor (branch@revision)". | 31 // Returns the WebKit version, in the form "major.minor (branch@revision)". |
18 std::string GetWebKitVersion(); | 32 std::string GetWebKitVersion(); |
19 | 33 |
20 // The following 2 functions return the major and minor webkit versions. | 34 // The following 2 functions return the major and minor webkit versions. |
21 int GetWebKitMajorVersion(); | 35 int GetWebKitMajorVersion(); |
22 int GetWebKitMinorVersion(); | 36 int GetWebKitMinorVersion(); |
23 | 37 |
24 // Helper function to generate a full user agent string from a short | 38 // Helper function to generate a full user agent string from a short |
25 // product name. | 39 // product name. |
26 std::string BuildUserAgentFromProduct(const std::string& product); | 40 std::string BuildUserAgentFromProduct(const std::string& product); |
27 | 41 |
28 } // namespace webkit_glue | 42 } // namespace webkit_glue |
29 | 43 |
30 #endif // WEBKIT_GLUE_USER_AGENT_H_ | 44 #endif // WEBKIT_GLUE_USER_AGENT_H_ |
OLD | NEW |