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