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_
11 #include "base/basictypes.h"
21 class FirefoxProxySettings
{
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.
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
44 static bool GetSettings(FirefoxProxySettings
* settings
);
46 // Resets all the states of this FirefoxProxySettings to no proxy.
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 { return autoconfig_url_
; }
73 // Converts a FirefoxProxySettings object to a net::ProxyConfig.
74 // On success returns true and fills |config| with the result.
75 bool ToProxyConfig(net::ProxyConfig
* config
);
78 // Gets the settings from the passed prefs.js file and returns true if
80 // Protected for tests.
81 static bool GetSettingsFromFile(const base::FilePath
& pref_file
,
82 FirefoxProxySettings
* settings
);
85 ProxyConfig config_type_
;
87 std::string http_proxy_
;
90 std::string ssl_proxy_
;
93 std::string ftp_proxy_
;
96 std::string gopher_proxy_
;
97 int gopher_proxy_port_
;
99 std::string socks_host_
;
101 SOCKSVersion socks_version_
;
103 std::vector
<std::string
> proxy_bypass_list_
;
105 std::string autoconfig_url_
;
107 DISALLOW_COPY_AND_ASSIGN(FirefoxProxySettings
);
110 #endif // CHROME_BROWSER_NET_FIREFOX_PROXY_SETTINGS_H_