OLD | NEW |
1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2011 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 CHROME_BROWSER_PREFS_PROXY_PREFS_H_ | 5 #ifndef COMPONENTS_PROXY_CONFIG_PROXY_PREFS_H_ |
6 #define CHROME_BROWSER_PREFS_PROXY_PREFS_H_ | 6 #define COMPONENTS_PROXY_CONFIG_PROXY_PREFS_H_ |
7 | 7 |
8 #include <string> | 8 #include <string> |
9 | 9 |
| 10 #include "components/proxy_config/proxy_config_export.h" |
| 11 |
10 namespace ProxyPrefs { | 12 namespace ProxyPrefs { |
11 | 13 |
12 // Possible types of specifying proxy settings. Do not change the order of | 14 // Possible types of specifying proxy settings. Do not change the order of |
13 // the constants, because numeric values are exposed to users. | 15 // the constants, because numeric values are exposed to users. |
14 // If you add an enum constant, you should also add a string to | 16 // If you add an enum constant, you should also add a string to |
15 // kProxyModeNames in the .cc file. | 17 // kProxyModeNames in the .cc file. |
16 enum ProxyMode { | 18 enum PROXY_CONFIG_EXPORT ProxyMode { |
17 // Direct connection to the network, other proxy preferences are ignored. | 19 // Direct connection to the network, other proxy preferences are ignored. |
18 MODE_DIRECT = 0, | 20 MODE_DIRECT = 0, |
19 | 21 |
20 // Try to retrieve a PAC script from http://wpad/wpad.dat or fall back to | 22 // Try to retrieve a PAC script from http://wpad/wpad.dat or fall back to |
21 // direct connection. | 23 // direct connection. |
22 MODE_AUTO_DETECT = 1, | 24 MODE_AUTO_DETECT = 1, |
23 | 25 |
24 // Try to retrieve a PAC script from kProxyPacURL or fall back to direct | 26 // Try to retrieve a PAC script from kProxyPacURL or fall back to direct |
25 // connection. | 27 // connection. |
26 MODE_PAC_SCRIPT = 2, | 28 MODE_PAC_SCRIPT = 2, |
27 | 29 |
28 // Use the settings specified in kProxyServer and kProxyBypassList. | 30 // Use the settings specified in kProxyServer and kProxyBypassList. |
29 MODE_FIXED_SERVERS = 3, | 31 MODE_FIXED_SERVERS = 3, |
30 | 32 |
31 // The system's proxy settings are used, other proxy preferences are | 33 // The system's proxy settings are used, other proxy preferences are |
32 // ignored. | 34 // ignored. |
33 MODE_SYSTEM = 4, | 35 MODE_SYSTEM = 4, |
34 | 36 |
35 kModeCount | 37 kModeCount |
36 }; | 38 }; |
37 | 39 |
38 // State of proxy configuration. | 40 // State of proxy configuration. |
39 enum ConfigState { | 41 enum PROXY_CONFIG_EXPORT ConfigState { |
40 // Configuration is from policy. | 42 // Configuration is from policy. |
41 CONFIG_POLICY, | 43 CONFIG_POLICY, |
42 // Configuration is from extension. | 44 // Configuration is from extension. |
43 CONFIG_EXTENSION, | 45 CONFIG_EXTENSION, |
44 // Configuration is not from policy or extension but still precedes others. | 46 // Configuration is not from policy or extension but still precedes others. |
45 CONFIG_OTHER_PRECEDE, | 47 CONFIG_OTHER_PRECEDE, |
46 // Configuration is from system. | 48 // Configuration is from system. |
47 CONFIG_SYSTEM, | 49 CONFIG_SYSTEM, |
48 // Configuration is recommended i.e there's a fallback configuration. | 50 // Configuration is recommended i.e there's a fallback configuration. |
49 CONFIG_FALLBACK, | 51 CONFIG_FALLBACK, |
50 // Configuration is known to be not set. | 52 // Configuration is known to be not set. |
51 CONFIG_UNSET, | 53 CONFIG_UNSET, |
52 }; | 54 }; |
53 | 55 |
54 // Constants for string values used to specify the proxy mode through externally | 56 // Constants for string values used to specify the proxy mode through externally |
55 // visible APIs, e.g. through policy or the proxy extension API. | 57 // visible APIs, e.g. through policy or the proxy extension API. |
56 extern const char kDirectProxyModeName[]; | 58 PROXY_CONFIG_EXPORT extern const char kDirectProxyModeName[]; |
57 extern const char kAutoDetectProxyModeName[]; | 59 PROXY_CONFIG_EXPORT extern const char kAutoDetectProxyModeName[]; |
58 extern const char kPacScriptProxyModeName[]; | 60 PROXY_CONFIG_EXPORT extern const char kPacScriptProxyModeName[]; |
59 extern const char kFixedServersProxyModeName[]; | 61 PROXY_CONFIG_EXPORT extern const char kFixedServersProxyModeName[]; |
60 extern const char kSystemProxyModeName[]; | 62 PROXY_CONFIG_EXPORT extern const char kSystemProxyModeName[]; |
61 | 63 |
62 bool IntToProxyMode(int in_value, ProxyMode* out_value); | 64 PROXY_CONFIG_EXPORT bool IntToProxyMode(int in_value, ProxyMode* out_value); |
63 bool StringToProxyMode(const std::string& in_value, ProxyMode* out_value); | 65 PROXY_CONFIG_EXPORT bool StringToProxyMode(const std::string& in_value, |
| 66 ProxyMode* out_value); |
64 // Ownership of the return value is NOT passed to the caller. | 67 // Ownership of the return value is NOT passed to the caller. |
65 const char* ProxyModeToString(ProxyMode mode); | 68 PROXY_CONFIG_EXPORT const char* ProxyModeToString(ProxyMode mode); |
66 std::string ConfigStateToDebugString(ConfigState state); | 69 PROXY_CONFIG_EXPORT std::string ConfigStateToDebugString(ConfigState state); |
67 | 70 |
68 } // namespace ProxyPrefs | 71 } // namespace ProxyPrefs |
69 | 72 |
70 #endif // CHROME_BROWSER_PREFS_PROXY_PREFS_H_ | 73 #endif // COMPONENTS_PROXY_CONFIG_PROXY_PREFS_H_ |
OLD | NEW |