| 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> |
| 9 |
| 8 #include "base/macros.h" | 10 #include "base/macros.h" |
| 9 #include "base/memory/ref_counted.h" | 11 #include "base/memory/ref_counted.h" |
| 10 #include "base/memory/scoped_ptr.h" | |
| 11 #include "base/observer_list.h" | 12 #include "base/observer_list.h" |
| 12 #include "base/threading/thread_checker.h" | 13 #include "base/threading/thread_checker.h" |
| 13 #include "components/prefs/pref_change_registrar.h" | 14 #include "components/prefs/pref_change_registrar.h" |
| 14 #include "components/proxy_config/pref_proxy_config_tracker.h" | 15 #include "components/proxy_config/pref_proxy_config_tracker.h" |
| 15 #include "components/proxy_config/proxy_config_dictionary.h" | 16 #include "components/proxy_config/proxy_config_dictionary.h" |
| 16 #include "net/proxy/proxy_config.h" | 17 #include "net/proxy/proxy_config.h" |
| 17 #include "net/proxy/proxy_config_service.h" | 18 #include "net/proxy/proxy_config_service.h" |
| 18 | 19 |
| 19 class PrefService; | 20 class PrefService; |
| 20 class PrefRegistrySimple; | 21 class PrefRegistrySimple; |
| (...skipping 32 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 53 const net::ProxyConfig& config); | 54 const net::ProxyConfig& config); |
| 54 | 55 |
| 55 private: | 56 private: |
| 56 // ProxyConfigService::Observer implementation: | 57 // ProxyConfigService::Observer implementation: |
| 57 void OnProxyConfigChanged(const net::ProxyConfig& config, | 58 void OnProxyConfigChanged(const net::ProxyConfig& config, |
| 58 ConfigAvailability availability) override; | 59 ConfigAvailability availability) override; |
| 59 | 60 |
| 60 // Makes sure that the observer registration with the base service is set up. | 61 // Makes sure that the observer registration with the base service is set up. |
| 61 void RegisterObserver(); | 62 void RegisterObserver(); |
| 62 | 63 |
| 63 scoped_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 |
| 73 // Flag that indicates that a PrefProxyConfigTracker needs to inform us | 74 // Flag that indicates that a PrefProxyConfigTracker needs to inform us |
| (...skipping 13 matching lines...) Expand all Loading... |
| 87 // ProxyConfigServiceImpl::UpdateProxyConfig to use. | 88 // ProxyConfigServiceImpl::UpdateProxyConfig to use. |
| 88 class PROXY_CONFIG_EXPORT PrefProxyConfigTrackerImpl | 89 class PROXY_CONFIG_EXPORT PrefProxyConfigTrackerImpl |
| 89 : public PrefProxyConfigTracker { | 90 : public PrefProxyConfigTracker { |
| 90 public: | 91 public: |
| 91 PrefProxyConfigTrackerImpl( | 92 PrefProxyConfigTrackerImpl( |
| 92 PrefService* pref_service, | 93 PrefService* pref_service, |
| 93 scoped_refptr<base::SingleThreadTaskRunner> io_task_runner); | 94 scoped_refptr<base::SingleThreadTaskRunner> io_task_runner); |
| 94 ~PrefProxyConfigTrackerImpl() override; | 95 ~PrefProxyConfigTrackerImpl() override; |
| 95 | 96 |
| 96 // PrefProxyConfigTracker implementation: | 97 // PrefProxyConfigTracker implementation: |
| 97 scoped_ptr<net::ProxyConfigService> CreateTrackingProxyConfigService( | 98 std::unique_ptr<net::ProxyConfigService> CreateTrackingProxyConfigService( |
| 98 scoped_ptr<net::ProxyConfigService> base_service) override; | 99 std::unique_ptr<net::ProxyConfigService> base_service) override; |
| 99 | 100 |
| 100 // Notifies the tracker that the pref service passed upon construction is | 101 // Notifies the tracker that the pref service passed upon construction is |
| 101 // about to go away. This must be called from the UI thread. | 102 // about to go away. This must be called from the UI thread. |
| 102 void DetachFromPrefService() override; | 103 void DetachFromPrefService() override; |
| 103 | 104 |
| 104 // Determines if |config_state| takes precedence regardless, which happens if | 105 // Determines if |config_state| takes precedence regardless, which happens if |
| 105 // config is from policy or extension or other-precede. | 106 // config is from policy or extension or other-precede. |
| 106 static bool PrefPrecedes(ProxyPrefs::ConfigState config_state); | 107 static bool PrefPrecedes(ProxyPrefs::ConfigState config_state); |
| 107 | 108 |
| 108 // Determines the proxy configuration that should take effect in the network | 109 // Determines the proxy configuration that should take effect in the network |
| (...skipping 60 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 169 PrefChangeRegistrar proxy_prefs_; | 170 PrefChangeRegistrar proxy_prefs_; |
| 170 | 171 |
| 171 scoped_refptr<base::SingleThreadTaskRunner> io_task_runner_; | 172 scoped_refptr<base::SingleThreadTaskRunner> io_task_runner_; |
| 172 | 173 |
| 173 base::ThreadChecker thread_checker_; | 174 base::ThreadChecker thread_checker_; |
| 174 | 175 |
| 175 DISALLOW_COPY_AND_ASSIGN(PrefProxyConfigTrackerImpl); | 176 DISALLOW_COPY_AND_ASSIGN(PrefProxyConfigTrackerImpl); |
| 176 }; | 177 }; |
| 177 | 178 |
| 178 #endif // COMPONENTS_PROXY_CONFIG_PREF_PROXY_CONFIG_TRACKER_IMPL_H_ | 179 #endif // COMPONENTS_PROXY_CONFIG_PREF_PROXY_CONFIG_TRACKER_IMPL_H_ |
| OLD | NEW |