| 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 CHROME_BROWSER_CHROMEOS_PROXY_CONFIG_SERVICE_IMPL_H_ | 5 #ifndef CHROMEOS_NETWORK_PROXY_PROXY_CONFIG_SERVICE_IMPL_H_ |
| 6 #define CHROME_BROWSER_CHROMEOS_PROXY_CONFIG_SERVICE_IMPL_H_ | 6 #define CHROMEOS_NETWORK_PROXY_PROXY_CONFIG_SERVICE_IMPL_H_ |
| 7 | 7 |
| 8 #include <string> | 8 #include <string> |
| 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 "chromeos/chromeos_export.h" |
| 12 #include "chromeos/network/network_state_handler_observer.h" | 13 #include "chromeos/network/network_state_handler_observer.h" |
| 13 #include "components/onc/onc_constants.h" | 14 #include "components/onc/onc_constants.h" |
| 14 #include "components/prefs/pref_change_registrar.h" | 15 #include "components/prefs/pref_change_registrar.h" |
| 15 #include "components/proxy_config/pref_proxy_config_tracker_impl.h" | 16 #include "components/proxy_config/pref_proxy_config_tracker_impl.h" |
| 16 | 17 |
| 17 namespace chromeos { | 18 namespace chromeos { |
| 18 | 19 |
| 19 class NetworkState; | 20 class NetworkState; |
| 20 | 21 |
| 21 // Implementation of proxy config service for chromeos that: | 22 // Implementation of proxy config service for chromeos that: |
| 22 // - extends PrefProxyConfigTrackerImpl (and so lives and runs entirely on UI | 23 // - extends PrefProxyConfigTrackerImpl (and so lives and runs entirely on UI |
| 23 // thread) to handle proxy from prefs (via PrefProxyConfigTrackerImpl) and | 24 // thread) to handle proxy from prefs (via PrefProxyConfigTrackerImpl) and |
| 24 // system i.e. network (via shill notifications) | 25 // system i.e. network (via shill notifications) |
| 25 // - exists one per profile and one per local state | 26 // - exists one per profile and one per local state |
| 26 // - persists proxy setting per network in flimflim | 27 // - persists proxy setting per network in flimflim |
| 27 // - provides network stack with latest effective proxy configuration for | 28 // - provides network stack with latest effective proxy configuration for |
| 28 // currently active network via PrefProxyConfigTrackerImpl's mechanism of | 29 // currently active network via PrefProxyConfigTrackerImpl's mechanism of |
| 29 // pushing config to ChromeProxyConfigService | 30 // pushing config to ChromeProxyConfigService |
| 30 class ProxyConfigServiceImpl : public PrefProxyConfigTrackerImpl, | 31 class CHROMEOS_EXPORT ProxyConfigServiceImpl |
| 31 public NetworkStateHandlerObserver { | 32 : public PrefProxyConfigTrackerImpl, |
| 33 public NetworkStateHandlerObserver { |
| 32 public: | 34 public: |
| 33 // ProxyConfigServiceImpl is created in ProxyServiceFactory:: | 35 // ProxyConfigServiceImpl is created in ProxyServiceFactory:: |
| 34 // CreatePrefProxyConfigTrackerImpl via Profile::GetProxyConfigTracker() for | 36 // CreatePrefProxyConfigTrackerImpl via Profile::GetProxyConfigTracker() for |
| 35 // profile or via IOThread constructor for local state and is owned by the | 37 // profile or via IOThread constructor for local state and is owned by the |
| 36 // respective classes. | 38 // respective classes. |
| 37 // | 39 // |
| 38 // The user's proxy config, proxy policies and proxy from prefs, are used to | 40 // The user's proxy config, proxy policies and proxy from prefs, are used to |
| 39 // determine the effective proxy config, which is then pushed through | 41 // determine the effective proxy config, which is then pushed through |
| 40 // PrefProxyConfigTrackerImpl to ChromeProxyConfigService to the | 42 // PrefProxyConfigTrackerImpl to ChromeProxyConfigService to the |
| 41 // network stack. | 43 // network stack. |
| 42 // | 44 // |
| 43 // |profile_prefs| can be NULL if this object should only track prefs from | 45 // |profile_prefs| can be NULL if this object should only track prefs from |
| 44 // local state (e.g., for system request context or sigin-in screen). | 46 // local state (e.g., for system request context or sigin-in screen). |
| 45 explicit ProxyConfigServiceImpl(PrefService* profile_prefs, | 47 ProxyConfigServiceImpl( |
| 46 PrefService* local_state_prefs); | 48 PrefService* profile_prefs, |
| 49 PrefService* local_state_prefs, |
| 50 scoped_refptr<base::SingleThreadTaskRunner> io_task_runner); |
| 47 ~ProxyConfigServiceImpl() override; | 51 ~ProxyConfigServiceImpl() override; |
| 48 | 52 |
| 49 // PrefProxyConfigTrackerImpl implementation. | 53 // PrefProxyConfigTrackerImpl implementation. |
| 50 void OnProxyConfigChanged(ProxyPrefs::ConfigState config_state, | 54 void OnProxyConfigChanged(ProxyPrefs::ConfigState config_state, |
| 51 const net::ProxyConfig& config) override; | 55 const net::ProxyConfig& config) override; |
| 52 | 56 |
| 53 // NetworkStateHandlerObserver implementation. | 57 // NetworkStateHandlerObserver implementation. |
| 54 void DefaultNetworkChanged(const NetworkState* network) override; | 58 void DefaultNetworkChanged(const NetworkState* network) override; |
| 55 void OnShuttingDown() override; | 59 void OnShuttingDown() override; |
| 56 | 60 |
| (...skipping 43 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 100 // Not owned. | 104 // Not owned. |
| 101 PrefService* local_state_prefs_; | 105 PrefService* local_state_prefs_; |
| 102 | 106 |
| 103 base::WeakPtrFactory<ProxyConfigServiceImpl> pointer_factory_; | 107 base::WeakPtrFactory<ProxyConfigServiceImpl> pointer_factory_; |
| 104 | 108 |
| 105 DISALLOW_COPY_AND_ASSIGN(ProxyConfigServiceImpl); | 109 DISALLOW_COPY_AND_ASSIGN(ProxyConfigServiceImpl); |
| 106 }; | 110 }; |
| 107 | 111 |
| 108 } // namespace chromeos | 112 } // namespace chromeos |
| 109 | 113 |
| 110 #endif // CHROME_BROWSER_CHROMEOS_PROXY_CONFIG_SERVICE_IMPL_H_ | 114 #endif // CHROMEOS_NETWORK_PROXY_PROXY_CONFIG_SERVICE_IMPL_H_ |
| OLD | NEW |