Disable view source for Developer Tools.
[chromium-blink-merge.git] / chrome / browser / net / firefox_proxy_settings.h
blob34ea9ff2cdd20abdfe255c9966b59bed103a66f5
1 // Copyright 2013 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.
5 #ifndef CHROME_BROWSER_NET_FIREFOX_PROXY_SETTINGS_H_
6 #define CHROME_BROWSER_NET_FIREFOX_PROXY_SETTINGS_H_
8 #include <string>
9 #include <vector>
11 #include "base/basictypes.h"
13 namespace base {
14 class FilePath;
17 namespace net {
18 class ProxyConfig;
21 class FirefoxProxySettings {
22 public:
23 enum ProxyConfig {
24 NO_PROXY = 0, // No proxy are used.
25 AUTO_DETECT, // Automatically detected.
26 SYSTEM, // Using system proxy settings.
27 AUTO_FROM_URL, // Automatically configured from a URL.
28 MANUAL // User specified settings.
31 enum SOCKSVersion {
32 UNKNONW = 0,
33 V4,
37 FirefoxProxySettings();
38 ~FirefoxProxySettings();
40 // Sets |settings| to the proxy settings for the current installed version of
41 // Firefox and returns true if successful.
42 // Returns false if Firefox is not installed or if the settings could not be
43 // retrieved.
44 static bool GetSettings(FirefoxProxySettings* settings);
46 // Resets all the states of this FirefoxProxySettings to no proxy.
47 void Reset();
49 ProxyConfig config_type() const { return config_type_; }
51 std::string http_proxy() const { return http_proxy_; }
52 int http_proxy_port() const { return http_proxy_port_; }
54 std::string ssl_proxy() const { return ssl_proxy_; }
55 int ssl_proxy_port() const { return ssl_proxy_port_; }
57 std::string ftp_proxy() const { return ftp_proxy_; }
58 int ftp_proxy_port() const { return ftp_proxy_port_; }
60 std::string gopher_proxy() const { return gopher_proxy_; }
61 int gopher_proxy_port() const { return gopher_proxy_port_; }
63 std::string socks_host() const { return socks_host_; }
64 int socks_port() const { return socks_port_; }
65 SOCKSVersion socks_version() const { return socks_version_; }
67 std::vector<std::string> proxy_bypass_list() const {
68 return proxy_bypass_list_;
71 const std::string autoconfig_url() const {
72 return autoconfig_url_;
75 // Converts a FirefoxProxySettings object to a net::ProxyConfig.
76 // On success returns true and fills |config| with the result.
77 bool ToProxyConfig(net::ProxyConfig* config);
79 protected:
80 // Gets the settings from the passed prefs.js file and returns true if
81 // successful.
82 // Protected for tests.
83 static bool GetSettingsFromFile(const base::FilePath& pref_file,
84 FirefoxProxySettings* settings);
86 private:
87 ProxyConfig config_type_;
89 std::string http_proxy_;
90 int http_proxy_port_;
92 std::string ssl_proxy_;
93 int ssl_proxy_port_;
95 std::string ftp_proxy_;
96 int ftp_proxy_port_;
98 std::string gopher_proxy_;
99 int gopher_proxy_port_;
101 std::string socks_host_;
102 int socks_port_;
103 SOCKSVersion socks_version_;
105 std::vector<std::string> proxy_bypass_list_;
107 std::string autoconfig_url_;
109 DISALLOW_COPY_AND_ASSIGN(FirefoxProxySettings);
112 #endif // CHROME_BROWSER_NET_FIREFOX_PROXY_SETTINGS_H_