OLD | NEW |
---|---|
1 // Copyright 2014 The Chromium Authors. All rights reserved. | 1 // Copyright 2014 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_NET_SPDYPROXY_DATA_REDUCTION_PROXY_CHROME_CONFIGURATOR_H_ | 5 #ifndef CHROME_BROWSER_NET_SPDYPROXY_DATA_REDUCTION_PROXY_CHROME_CONFIGURATOR_H_ |
6 #define CHROME_BROWSER_NET_SPDYPROXY_DATA_REDUCTION_PROXY_CHROME_CONFIGURATOR_H_ | 6 #define CHROME_BROWSER_NET_SPDYPROXY_DATA_REDUCTION_PROXY_CHROME_CONFIGURATOR_H_ |
7 | 7 |
8 #include <string> | 8 #include <string> |
9 #include <vector> | 9 #include <vector> |
10 | 10 |
(...skipping 14 matching lines...) Expand all Loading... | |
25 class PrefService; | 25 class PrefService; |
26 | 26 |
27 class DataReductionProxyChromeConfigurator | 27 class DataReductionProxyChromeConfigurator |
28 : public data_reduction_proxy::DataReductionProxyConfigurator { | 28 : public data_reduction_proxy::DataReductionProxyConfigurator { |
29 public: | 29 public: |
30 explicit DataReductionProxyChromeConfigurator( | 30 explicit DataReductionProxyChromeConfigurator( |
31 PrefService* prefs, | 31 PrefService* prefs, |
32 scoped_refptr<base::SequencedTaskRunner> network_task_runner); | 32 scoped_refptr<base::SequencedTaskRunner> network_task_runner); |
33 ~DataReductionProxyChromeConfigurator() override; | 33 ~DataReductionProxyChromeConfigurator() override; |
34 | 34 |
35 static void Disable(PrefService* prefs); | |
bengr
2014/10/28 21:03:41
Don't overload the name. Maybe call this DisableIn
Not at Google. Contact bengr
2014/10/28 22:31:44
Done.
| |
36 | |
35 void Enable(bool primary_restricted, | 37 void Enable(bool primary_restricted, |
36 bool fallback_restricted, | 38 bool fallback_restricted, |
37 const std::string& primary_origin, | 39 const std::string& primary_origin, |
38 const std::string& fallback_origin, | 40 const std::string& fallback_origin, |
39 const std::string& ssl_origin) override; | 41 const std::string& ssl_origin) override; |
40 void Disable() override; | 42 void Disable() override; |
41 | 43 |
42 // Add a host pattern to bypass. This should follow the same syntax used | 44 // Add a host pattern to bypass. This should follow the same syntax used |
43 // in net::ProxyBypassRules; that is, a hostname pattern, a hostname suffix | 45 // in net::ProxyBypassRules; that is, a hostname pattern, a hostname suffix |
44 // pattern, an IP literal, a CIDR block, or the magic string '<local>'. | 46 // pattern, an IP literal, a CIDR block, or the magic string '<local>'. |
45 // Bypass settings persist for the life of this object and are applied | 47 // Bypass settings persist for the life of this object and are applied |
46 // each time the proxy is enabled, but are not updated while it is enabled. | 48 // each time the proxy is enabled, but are not updated while it is enabled. |
47 void AddHostPatternToBypass(const std::string& pattern) override; | 49 void AddHostPatternToBypass(const std::string& pattern) override; |
48 | 50 |
49 // Add a URL pattern to bypass the proxy. The base implementation strips | 51 // Add a URL pattern to bypass the proxy. The base implementation strips |
50 // everything in |pattern| after the first single slash and then treats it | 52 // everything in |pattern| after the first single slash and then treats it |
51 // as a hostname pattern. Subclasses may implement other semantics. | 53 // as a hostname pattern. Subclasses may implement other semantics. |
52 void AddURLPatternToBypass(const std::string& pattern) override; | 54 void AddURLPatternToBypass(const std::string& pattern) override; |
53 | 55 |
54 // Updates the config for use on the IO thread. | 56 // Updates the config for use on the IO thread. |
55 void UpdateProxyConfigOnIO(const net::ProxyConfig& config); | 57 void UpdateProxyConfigOnIO(const net::ProxyConfig& config); |
56 | 58 |
57 // Returns the current data reduction proxy config, even if it is not the | 59 // Returns the current data reduction proxy config, even if it is not the |
58 // effective configuration used by the proxy service. | 60 // effective configuration used by the proxy service. |
59 const net::ProxyConfig& GetProxyConfigOnIO() const; | 61 const net::ProxyConfig& GetProxyConfigOnIO() const; |
60 | 62 |
61 private: | 63 private: |
62 FRIEND_TEST_ALL_PREFIXES(DataReductionProxyConfigTest, TestBypassList); | 64 FRIEND_TEST_ALL_PREFIXES(DataReductionProxyConfigTest, TestBypassList); |
63 | 65 |
66 static bool ContainsDataReductionProxy(const std::string& server); | |
67 static bool HasProxy(const std::string& server, const GURL& proxy); | |
68 | |
64 PrefService* prefs_; | 69 PrefService* prefs_; |
65 scoped_refptr<base::SequencedTaskRunner> network_task_runner_; | 70 scoped_refptr<base::SequencedTaskRunner> network_task_runner_; |
66 | 71 |
67 std::vector<std::string> bypass_rules_; | 72 std::vector<std::string> bypass_rules_; |
68 net::ProxyConfig config_; | 73 net::ProxyConfig config_; |
69 | 74 |
70 DISALLOW_COPY_AND_ASSIGN(DataReductionProxyChromeConfigurator); | 75 DISALLOW_COPY_AND_ASSIGN(DataReductionProxyChromeConfigurator); |
71 }; | 76 }; |
72 | 77 |
73 #endif // CHROME_BROWSER_NET_SPDYPROXY_DATA_REDUCTION_PROXY_CHROME_CONFIGURATOR _H_ | 78 #endif // CHROME_BROWSER_NET_SPDYPROXY_DATA_REDUCTION_PROXY_CHROME_CONFIGURATOR _H_ |
OLD | NEW |