| 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 NET_PROXY_PROXY_CONFIG_SERVICE_MAC_H_ | 5 #ifndef NET_PROXY_PROXY_CONFIG_SERVICE_MAC_H_ |
| 6 #define NET_PROXY_PROXY_CONFIG_SERVICE_MAC_H_ | 6 #define NET_PROXY_PROXY_CONFIG_SERVICE_MAC_H_ |
| 7 | 7 |
| 8 #include <memory> | 8 #include <memory> |
| 9 | 9 |
| 10 #include "base/compiler_specific.h" | 10 #include "base/compiler_specific.h" |
| 11 #include "base/macros.h" | 11 #include "base/macros.h" |
| 12 #include "base/memory/ref_counted.h" | 12 #include "base/memory/ref_counted.h" |
| 13 #include "base/observer_list.h" | 13 #include "base/observer_list.h" |
| 14 #include "net/base/network_config_watcher_mac.h" | 14 #include "net/base/network_config_watcher_mac.h" |
| 15 #include "net/proxy/proxy_config.h" | 15 #include "net/proxy/proxy_config.h" |
| 16 #include "net/proxy/proxy_config_service.h" | 16 #include "net/proxy/proxy_config_service.h" |
| 17 | 17 |
| 18 namespace base { | 18 namespace base { |
| 19 class SingleThreadTaskRunner; | 19 class SequencedTaskRunner; |
| 20 } // namespace base | 20 } // namespace base |
| 21 | 21 |
| 22 namespace net { | 22 namespace net { |
| 23 | 23 |
| 24 class ProxyConfigServiceMac : public ProxyConfigService { | 24 class ProxyConfigServiceMac : public ProxyConfigService { |
| 25 public: | 25 public: |
| 26 // Constructs a ProxyConfigService that watches the Mac OS system settings. | 26 // Constructs a ProxyConfigService that watches the Mac OS system settings. |
| 27 // This instance is expected to be operated and deleted on the same thread | 27 // This instance is expected to be operated and deleted on the |
| 28 // (however it may be constructed from a different thread). | 28 // same sequenced task runner (however it may be constructed elsewhere). |
| 29 explicit ProxyConfigServiceMac( | 29 explicit ProxyConfigServiceMac( |
| 30 const scoped_refptr<base::SingleThreadTaskRunner>& io_thread_task_runner); | 30 const scoped_refptr<base::SequencedTaskRunner>& io_thread_task_runner); |
| 31 ~ProxyConfigServiceMac() override; | 31 ~ProxyConfigServiceMac() override; |
| 32 | 32 |
| 33 public: | 33 public: |
| 34 // ProxyConfigService implementation: | 34 // ProxyConfigService implementation: |
| 35 void AddObserver(Observer* observer) override; | 35 void AddObserver(Observer* observer) override; |
| 36 void RemoveObserver(Observer* observer) override; | 36 void RemoveObserver(Observer* observer) override; |
| 37 ConfigAvailability GetLatestProxyConfig(ProxyConfig* config) override; | 37 ConfigAvailability GetLatestProxyConfig(ProxyConfig* config) override; |
| 38 | 38 |
| 39 private: | 39 private: |
| 40 class Helper; | 40 class Helper; |
| (...skipping 26 matching lines...) Expand all Loading... |
| 67 std::unique_ptr<const NetworkConfigWatcherMac> config_watcher_; | 67 std::unique_ptr<const NetworkConfigWatcherMac> config_watcher_; |
| 68 | 68 |
| 69 base::ObserverList<Observer> observers_; | 69 base::ObserverList<Observer> observers_; |
| 70 | 70 |
| 71 // Holds the last system proxy settings that we fetched. | 71 // Holds the last system proxy settings that we fetched. |
| 72 bool has_fetched_config_; | 72 bool has_fetched_config_; |
| 73 ProxyConfig last_config_fetched_; | 73 ProxyConfig last_config_fetched_; |
| 74 | 74 |
| 75 scoped_refptr<Helper> helper_; | 75 scoped_refptr<Helper> helper_; |
| 76 | 76 |
| 77 // The thread that we expect to be operated on. | 77 // The task runner that |this| will be operated on. |
| 78 const scoped_refptr<base::SingleThreadTaskRunner> io_thread_task_runner_; | 78 const scoped_refptr<base::SequencedTaskRunner> io_thread_task_runner_; |
| 79 | 79 |
| 80 DISALLOW_COPY_AND_ASSIGN(ProxyConfigServiceMac); | 80 DISALLOW_COPY_AND_ASSIGN(ProxyConfigServiceMac); |
| 81 }; | 81 }; |
| 82 | 82 |
| 83 } // namespace net | 83 } // namespace net |
| 84 | 84 |
| 85 #endif // NET_PROXY_PROXY_CONFIG_SERVICE_MAC_H_ | 85 #endif // NET_PROXY_PROXY_CONFIG_SERVICE_MAC_H_ |
| OLD | NEW |