| 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 COMPONENTS_DATA_REDUCTION_PROXY_BROWSER_DATA_REDUCTION_PROXY_CONFIG_SERV
ICE_H_ | 5 #ifndef COMPONENTS_DATA_REDUCTION_PROXY_BROWSER_DATA_REDUCTION_PROXY_CONFIG_SERV
ICE_H_ |
| 6 #define COMPONENTS_DATA_REDUCTION_PROXY_BROWSER_DATA_REDUCTION_PROXY_CONFIG_SERV
ICE_H_ | 6 #define COMPONENTS_DATA_REDUCTION_PROXY_BROWSER_DATA_REDUCTION_PROXY_CONFIG_SERV
ICE_H_ |
| 7 | 7 |
| 8 #include <vector> | 8 #include <vector> |
| 9 | 9 |
| 10 #include "base/basictypes.h" | 10 #include "base/basictypes.h" |
| (...skipping 22 matching lines...) Expand all Loading... |
| 33 : public net::ProxyConfigService, | 33 : public net::ProxyConfigService, |
| 34 public net::ProxyConfigService::Observer { | 34 public net::ProxyConfigService::Observer { |
| 35 public: | 35 public: |
| 36 // Takes ownership of the passed |base_service|. | 36 // Takes ownership of the passed |base_service|. |
| 37 DataReductionProxyConfigService( | 37 DataReductionProxyConfigService( |
| 38 scoped_ptr<net::ProxyConfigService> base_service); | 38 scoped_ptr<net::ProxyConfigService> base_service); |
| 39 virtual ~DataReductionProxyConfigService(); | 39 virtual ~DataReductionProxyConfigService(); |
| 40 | 40 |
| 41 // ProxyConfigService implementation: | 41 // ProxyConfigService implementation: |
| 42 virtual void AddObserver( | 42 virtual void AddObserver( |
| 43 net::ProxyConfigService::Observer* observer) OVERRIDE; | 43 net::ProxyConfigService::Observer* observer) override; |
| 44 virtual void RemoveObserver( | 44 virtual void RemoveObserver( |
| 45 net::ProxyConfigService::Observer* observer) OVERRIDE; | 45 net::ProxyConfigService::Observer* observer) override; |
| 46 virtual ConfigAvailability GetLatestProxyConfig( | 46 virtual ConfigAvailability GetLatestProxyConfig( |
| 47 net::ProxyConfig* config) OVERRIDE; | 47 net::ProxyConfig* config) override; |
| 48 virtual void OnLazyPoll() OVERRIDE; | 48 virtual void OnLazyPoll() override; |
| 49 | 49 |
| 50 // Method on IO thread that receives the data reduction proxy settings pushed | 50 // Method on IO thread that receives the data reduction proxy settings pushed |
| 51 // from DataReductionProxyConfiguratorImpl. | 51 // from DataReductionProxyConfiguratorImpl. |
| 52 void UpdateProxyConfig(bool enabled, | 52 void UpdateProxyConfig(bool enabled, |
| 53 const net::ProxyConfig& config); | 53 const net::ProxyConfig& config); |
| 54 | 54 |
| 55 private: | 55 private: |
| 56 friend class DataReductionProxyConfigServiceTest; | 56 friend class DataReductionProxyConfigServiceTest; |
| 57 | 57 |
| 58 // ProxyConfigService::Observer implementation: | 58 // ProxyConfigService::Observer implementation: |
| 59 virtual void OnProxyConfigChanged(const net::ProxyConfig& config, | 59 virtual void OnProxyConfigChanged(const net::ProxyConfig& config, |
| 60 ConfigAvailability availability) OVERRIDE; | 60 ConfigAvailability availability) override; |
| 61 | 61 |
| 62 // Makes sure that the observer registration with the base service is set up. | 62 // Makes sure that the observer registration with the base service is set up. |
| 63 void RegisterObserver(); | 63 void RegisterObserver(); |
| 64 | 64 |
| 65 scoped_ptr<net::ProxyConfigService> base_service_; | 65 scoped_ptr<net::ProxyConfigService> base_service_; |
| 66 ObserverList<net::ProxyConfigService::Observer, true> observers_; | 66 ObserverList<net::ProxyConfigService::Observer, true> observers_; |
| 67 | 67 |
| 68 // Configuration as defined by the data reduction proxy. | 68 // Configuration as defined by the data reduction proxy. |
| 69 net::ProxyConfig config_; | 69 net::ProxyConfig config_; |
| 70 | 70 |
| (...skipping 22 matching lines...) Expand all Loading... |
| 93 public: | 93 public: |
| 94 DataReductionProxyConfigTracker( | 94 DataReductionProxyConfigTracker( |
| 95 base::Callback<void(bool, const net::ProxyConfig&)> update_proxy_config, | 95 base::Callback<void(bool, const net::ProxyConfig&)> update_proxy_config, |
| 96 base::TaskRunner* task_runner); | 96 base::TaskRunner* task_runner); |
| 97 virtual ~DataReductionProxyConfigTracker(); | 97 virtual ~DataReductionProxyConfigTracker(); |
| 98 | 98 |
| 99 virtual void Enable(bool primary_restricted, | 99 virtual void Enable(bool primary_restricted, |
| 100 bool fallback_restricted, | 100 bool fallback_restricted, |
| 101 const std::string& primary_origin, | 101 const std::string& primary_origin, |
| 102 const std::string& fallback_origin, | 102 const std::string& fallback_origin, |
| 103 const std::string& ssl_origin) OVERRIDE; | 103 const std::string& ssl_origin) override; |
| 104 virtual void Disable() OVERRIDE; | 104 virtual void Disable() override; |
| 105 virtual void AddHostPatternToBypass(const std::string& pattern) OVERRIDE; | 105 virtual void AddHostPatternToBypass(const std::string& pattern) override; |
| 106 virtual void AddURLPatternToBypass(const std::string& pattern) OVERRIDE; | 106 virtual void AddURLPatternToBypass(const std::string& pattern) override; |
| 107 | 107 |
| 108 private: | 108 private: |
| 109 FRIEND_TEST_ALL_PREFIXES(DataReductionProxyConfigServiceTest, | 109 FRIEND_TEST_ALL_PREFIXES(DataReductionProxyConfigServiceTest, |
| 110 TrackerEnable); | 110 TrackerEnable); |
| 111 FRIEND_TEST_ALL_PREFIXES(DataReductionProxyConfigServiceTest, | 111 FRIEND_TEST_ALL_PREFIXES(DataReductionProxyConfigServiceTest, |
| 112 TrackerRestricted); | 112 TrackerRestricted); |
| 113 FRIEND_TEST_ALL_PREFIXES(DataReductionProxyConfigServiceTest, | 113 FRIEND_TEST_ALL_PREFIXES(DataReductionProxyConfigServiceTest, |
| 114 TrackerBypassList); | 114 TrackerBypassList); |
| 115 | 115 |
| 116 void UpdateProxyConfigOnIOThread(bool enabled, | 116 void UpdateProxyConfigOnIOThread(bool enabled, |
| 117 const net::ProxyConfig& config); | 117 const net::ProxyConfig& config); |
| 118 | 118 |
| 119 base::Callback<void(bool, const net::ProxyConfig&)> update_proxy_config_; | 119 base::Callback<void(bool, const net::ProxyConfig&)> update_proxy_config_; |
| 120 std::vector<std::string> bypass_rules_; | 120 std::vector<std::string> bypass_rules_; |
| 121 scoped_refptr<base::TaskRunner> task_runner_; | 121 scoped_refptr<base::TaskRunner> task_runner_; |
| 122 | 122 |
| 123 DISALLOW_COPY_AND_ASSIGN(DataReductionProxyConfigTracker); | 123 DISALLOW_COPY_AND_ASSIGN(DataReductionProxyConfigTracker); |
| 124 }; | 124 }; |
| 125 | 125 |
| 126 } // namespace data_reduction_proxy | 126 } // namespace data_reduction_proxy |
| 127 | 127 |
| 128 #endif // COMPONENTS_DATA_REDUCTION_PROXY_BROWSER_DATA_REDUCTION_PROXY_CONFIG_S
ERVICE_H_ | 128 #endif // COMPONENTS_DATA_REDUCTION_PROXY_BROWSER_DATA_REDUCTION_PROXY_CONFIG_S
ERVICE_H_ |
| OLD | NEW |