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 19 matching lines...) Expand all Loading... | |
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 // Takes ownership of the passed |base_service|. | 39 // Takes ownership of the passed |base_service|. |
40 // GetLatestProxyConfig returns ConfigAvailability::CONFIG_PENDING until | 40 explicit ProxyConfigServiceImpl(net::ProxyConfigService* base_service, |
41 // UpdateProxyConfig has been called. | 41 ProxyPrefs::ConfigState initial_config_state, |
42 explicit ProxyConfigServiceImpl(net::ProxyConfigService* base_service); | 42 const net::ProxyConfig& initial_config); |
stevenjb
2017/05/10 18:46:16
No longer explicit
s/initial_config/initial_pref_c
mmenke
2017/05/10 18:59:20
Done.
| |
43 ~ProxyConfigServiceImpl() override; | 43 ~ProxyConfigServiceImpl() override; |
44 | 44 |
45 // ProxyConfigService implementation: | 45 // ProxyConfigService implementation: |
46 void AddObserver(net::ProxyConfigService::Observer* observer) override; | 46 void AddObserver(net::ProxyConfigService::Observer* observer) override; |
47 void RemoveObserver(net::ProxyConfigService::Observer* observer) override; | 47 void RemoveObserver(net::ProxyConfigService::Observer* observer) override; |
48 ConfigAvailability GetLatestProxyConfig(net::ProxyConfig* config) override; | 48 ConfigAvailability GetLatestProxyConfig(net::ProxyConfig* config) override; |
49 void OnLazyPoll() override; | 49 void OnLazyPoll() override; |
50 | 50 |
51 // 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 |
52 // PrefProxyConfigTrackerImpl. | 52 // PrefProxyConfigTrackerImpl. |
(...skipping 11 matching lines...) Expand all Loading... | |
64 std::unique_ptr<net::ProxyConfigService> base_service_; | 64 std::unique_ptr<net::ProxyConfigService> base_service_; |
65 base::ObserverList<net::ProxyConfigService::Observer, true> observers_; | 65 base::ObserverList<net::ProxyConfigService::Observer, true> observers_; |
66 | 66 |
67 // Tracks configuration state of |pref_config_|. |pref_config_| is valid only | 67 // Tracks configuration state of |pref_config_|. |pref_config_| is valid only |
68 // if |pref_config_state_| is not CONFIG_UNSET. | 68 // if |pref_config_state_| is not CONFIG_UNSET. |
69 ProxyPrefs::ConfigState pref_config_state_; | 69 ProxyPrefs::ConfigState pref_config_state_; |
70 | 70 |
71 // Configuration as defined by prefs. | 71 // Configuration as defined by prefs. |
72 net::ProxyConfig pref_config_; | 72 net::ProxyConfig pref_config_; |
73 | 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 | |
78 // Indicates whether the base service registration is done. | 74 // Indicates whether the base service registration is done. |
79 bool registered_observer_; | 75 bool registered_observer_; |
80 | 76 |
81 base::ThreadChecker thread_checker_; | 77 base::ThreadChecker thread_checker_; |
82 | 78 |
83 DISALLOW_COPY_AND_ASSIGN(ProxyConfigServiceImpl); | 79 DISALLOW_COPY_AND_ASSIGN(ProxyConfigServiceImpl); |
84 }; | 80 }; |
85 | 81 |
86 // A class that tracks proxy preferences. It translates the configuration | 82 // A class that tracks proxy preferences. It translates the configuration |
87 // to net::ProxyConfig and pushes the result over to the IO thread for | 83 // 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... | |
170 PrefChangeRegistrar proxy_prefs_; | 166 PrefChangeRegistrar proxy_prefs_; |
171 | 167 |
172 scoped_refptr<base::SingleThreadTaskRunner> io_task_runner_; | 168 scoped_refptr<base::SingleThreadTaskRunner> io_task_runner_; |
173 | 169 |
174 base::ThreadChecker thread_checker_; | 170 base::ThreadChecker thread_checker_; |
175 | 171 |
176 DISALLOW_COPY_AND_ASSIGN(PrefProxyConfigTrackerImpl); | 172 DISALLOW_COPY_AND_ASSIGN(PrefProxyConfigTrackerImpl); |
177 }; | 173 }; |
178 | 174 |
179 #endif // COMPONENTS_PROXY_CONFIG_PREF_PROXY_CONFIG_TRACKER_IMPL_H_ | 175 #endif // COMPONENTS_PROXY_CONFIG_PREF_PROXY_CONFIG_TRACKER_IMPL_H_ |
OLD | NEW |