Pin Chrome's shortcut to the Win10 Start menu on install and OS upgrade.
[chromium-blink-merge.git] / chrome / browser / net / firefox_proxy_settings.h
blob94dfe56b1b6ae35859e36d51fe561c0d7d670138
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 { 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);
77 protected:
78 // Gets the settings from the passed prefs.js file and returns true if
79 // successful.
80 // Protected for tests.
81 static bool GetSettingsFromFile(const base::FilePath& pref_file,
82 FirefoxProxySettings* settings);
84 private:
85 ProxyConfig config_type_;
87 std::string http_proxy_;
88 int http_proxy_port_;
90 std::string ssl_proxy_;
91 int ssl_proxy_port_;
93 std::string ftp_proxy_;
94 int ftp_proxy_port_;
96 std::string gopher_proxy_;
97 int gopher_proxy_port_;
99 std::string socks_host_;
100 int socks_port_;
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_