| OLD | NEW |
| 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 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_PROXY_CONFIG_PREF_PROXY_CONFIG_TRACKER_IMPL_H_ | 5 #ifndef COMPONENTS_PROXY_CONFIG_PREF_PROXY_CONFIG_TRACKER_IMPL_H_ |
| 6 #define COMPONENTS_PROXY_CONFIG_PREF_PROXY_CONFIG_TRACKER_IMPL_H_ | 6 #define COMPONENTS_PROXY_CONFIG_PREF_PROXY_CONFIG_TRACKER_IMPL_H_ |
| 7 | 7 |
| 8 #include <memory> | 8 #include <memory> |
| 9 | 9 |
| 10 #include "base/macros.h" | 10 #include "base/macros.h" |
| (...skipping 18 matching lines...) Expand all Loading... |
| 29 } | 29 } |
| 30 | 30 |
| 31 // A net::ProxyConfigService implementation that applies preference proxy | 31 // A net::ProxyConfigService implementation that applies preference proxy |
| 32 // settings (pushed from PrefProxyConfigTrackerImpl) as overrides to the proxy | 32 // settings (pushed from PrefProxyConfigTrackerImpl) as overrides to the proxy |
| 33 // configuration determined by a baseline delegate ProxyConfigService on | 33 // configuration determined by a baseline delegate ProxyConfigService on |
| 34 // non-ChromeOS platforms. ChromeOS has its own implementation of overrides in | 34 // non-ChromeOS platforms. ChromeOS has its own implementation of overrides in |
| 35 // chromeos::ProxyConfigServiceImpl. | 35 // chromeos::ProxyConfigServiceImpl. |
| 36 class ProxyConfigServiceImpl : public net::ProxyConfigService, | 36 class ProxyConfigServiceImpl : public net::ProxyConfigService, |
| 37 public net::ProxyConfigService::Observer { | 37 public net::ProxyConfigService::Observer { |
| 38 public: | 38 public: |
| 39 ProxyConfigServiceImpl(std::unique_ptr<net::ProxyConfigService> base_service, | 39 // Takes ownership of the passed |base_service|. |
| 40 ProxyPrefs::ConfigState initial_config_state, | 40 // GetLatestProxyConfig returns ConfigAvailability::CONFIG_PENDING until |
| 41 const net::ProxyConfig& initial_config); | 41 // UpdateProxyConfig has been called. |
| 42 explicit ProxyConfigServiceImpl(net::ProxyConfigService* base_service); |
| 42 ~ProxyConfigServiceImpl() override; | 43 ~ProxyConfigServiceImpl() override; |
| 43 | 44 |
| 44 // ProxyConfigService implementation: | 45 // ProxyConfigService implementation: |
| 45 void AddObserver(net::ProxyConfigService::Observer* observer) override; | 46 void AddObserver(net::ProxyConfigService::Observer* observer) override; |
| 46 void RemoveObserver(net::ProxyConfigService::Observer* observer) override; | 47 void RemoveObserver(net::ProxyConfigService::Observer* observer) override; |
| 47 ConfigAvailability GetLatestProxyConfig(net::ProxyConfig* config) override; | 48 ConfigAvailability GetLatestProxyConfig(net::ProxyConfig* config) override; |
| 48 void OnLazyPoll() override; | 49 void OnLazyPoll() override; |
| 49 | 50 |
| 50 // Method on IO thread that receives the preference proxy settings pushed from | 51 // Method on IO thread that receives the preference proxy settings pushed from |
| 51 // PrefProxyConfigTrackerImpl. | 52 // PrefProxyConfigTrackerImpl. |
| (...skipping 11 matching lines...) Expand all Loading... |
| 63 std::unique_ptr<net::ProxyConfigService> base_service_; | 64 std::unique_ptr<net::ProxyConfigService> base_service_; |
| 64 base::ObserverList<net::ProxyConfigService::Observer, true> observers_; | 65 base::ObserverList<net::ProxyConfigService::Observer, true> observers_; |
| 65 | 66 |
| 66 // Tracks configuration state of |pref_config_|. |pref_config_| is valid only | 67 // Tracks configuration state of |pref_config_|. |pref_config_| is valid only |
| 67 // if |pref_config_state_| is not CONFIG_UNSET. | 68 // if |pref_config_state_| is not CONFIG_UNSET. |
| 68 ProxyPrefs::ConfigState pref_config_state_; | 69 ProxyPrefs::ConfigState pref_config_state_; |
| 69 | 70 |
| 70 // Configuration as defined by prefs. | 71 // Configuration as defined by prefs. |
| 71 net::ProxyConfig pref_config_; | 72 net::ProxyConfig pref_config_; |
| 72 | 73 |
| 74 // Flag that indicates that a PrefProxyConfigTracker needs to inform us |
| 75 // about a proxy configuration before we may return any configuration. |
| 76 bool pref_config_read_pending_; |
| 77 |
| 73 // Indicates whether the base service registration is done. | 78 // Indicates whether the base service registration is done. |
| 74 bool registered_observer_; | 79 bool registered_observer_; |
| 75 | 80 |
| 76 base::ThreadChecker thread_checker_; | 81 base::ThreadChecker thread_checker_; |
| 77 | 82 |
| 78 DISALLOW_COPY_AND_ASSIGN(ProxyConfigServiceImpl); | 83 DISALLOW_COPY_AND_ASSIGN(ProxyConfigServiceImpl); |
| 79 }; | 84 }; |
| 80 | 85 |
| 81 // A class that tracks proxy preferences. It translates the configuration | 86 // A class that tracks proxy preferences. It translates the configuration |
| 82 // to net::ProxyConfig and pushes the result over to the IO thread for | 87 // to net::ProxyConfig and pushes the result over to the IO thread for |
| (...skipping 82 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 165 PrefChangeRegistrar proxy_prefs_; | 170 PrefChangeRegistrar proxy_prefs_; |
| 166 | 171 |
| 167 scoped_refptr<base::SingleThreadTaskRunner> io_task_runner_; | 172 scoped_refptr<base::SingleThreadTaskRunner> io_task_runner_; |
| 168 | 173 |
| 169 base::ThreadChecker thread_checker_; | 174 base::ThreadChecker thread_checker_; |
| 170 | 175 |
| 171 DISALLOW_COPY_AND_ASSIGN(PrefProxyConfigTrackerImpl); | 176 DISALLOW_COPY_AND_ASSIGN(PrefProxyConfigTrackerImpl); |
| 172 }; | 177 }; |
| 173 | 178 |
| 174 #endif // COMPONENTS_PROXY_CONFIG_PREF_PROXY_CONFIG_TRACKER_IMPL_H_ | 179 #endif // COMPONENTS_PROXY_CONFIG_PREF_PROXY_CONFIG_TRACKER_IMPL_H_ |
| OLD | NEW |