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 CHROME_BROWSER_CHROMEOS_PROXY_CONFIG_SERVICE_IMPL_H_ |
6 #define CHROME_BROWSER_CHROMEOS_PROXY_CONFIG_SERVICE_IMPL_H_ | 6 #define CHROME_BROWSER_CHROMEOS_PROXY_CONFIG_SERVICE_IMPL_H_ |
7 | 7 |
8 #include <string> | 8 #include <string> |
9 #include <vector> | 9 #include <vector> |
10 | 10 |
11 #include "base/basictypes.h" | 11 #include "base/basictypes.h" |
12 #include "base/prefs/pref_member.h" | 12 #include "base/prefs/pref_member.h" |
13 #include "base/values.h" | 13 #include "base/values.h" |
14 #include "chrome/browser/chromeos/cros/network_library.h" | 14 #include "chrome/browser/chromeos/cros/network_library.h" |
15 #include "chrome/browser/net/pref_proxy_config_tracker_impl.h" | 15 #include "chrome/browser/net/pref_proxy_config_tracker_impl.h" |
16 | 16 |
17 class PrefRegistrySimple; | 17 class PrefRegistrySimple; |
18 | |
19 namespace user_prefs { | |
18 class PrefRegistrySyncable; | 20 class PrefRegistrySyncable; |
21 } | |
19 | 22 |
20 namespace chromeos { | 23 namespace chromeos { |
21 | 24 |
22 // Implementation of proxy config service for chromeos that: | 25 // Implementation of proxy config service for chromeos that: |
23 // - extends PrefProxyConfigTrackerImpl (and so lives and runs entirely on UI | 26 // - extends PrefProxyConfigTrackerImpl (and so lives and runs entirely on UI |
24 // thread) to handle proxy from prefs (via PrefProxyConfigTrackerImpl) and | 27 // thread) to handle proxy from prefs (via PrefProxyConfigTrackerImpl) and |
25 // system i.e. network (via shill notifications) | 28 // system i.e. network (via shill notifications) |
26 // - exists one per profile and one per local state | 29 // - exists one per profile and one per local state |
27 // - retrieves initial system proxy configuration from cros settings persisted | 30 // - retrieves initial system proxy configuration from cros settings persisted |
28 // on chromeos device from chromeos revisions before migration to shill, | 31 // on chromeos device from chromeos revisions before migration to shill, |
29 // - persists proxy setting per network in flimflim | 32 // - persists proxy setting per network in flimflim |
30 // - provides network stack with latest effective proxy configuration for | 33 // - provides network stack with latest effective proxy configuration for |
31 // currently active network via PrefProxyConfigTrackerImpl's mechanism of | 34 // currently active network via PrefProxyConfigTrackerImpl's mechanism of |
32 // pushing config to ChromeProxyConfigService | 35 // pushing config to ChromeProxyConfigService |
33 // - provides UI with methods to retrieve and modify proxy configuration for | 36 // - provides UI with methods to retrieve and modify proxy configuration for |
34 // any remembered network (either currently active or non-active) of current | 37 // any remembered network (either currently active or non-active) of current |
35 // user profile | 38 // user profile |
36 class ProxyConfigServiceImpl | 39 class ProxyConfigServiceImpl: public PrefProxyConfigTrackerImpl, |
Jói
2013/05/04 21:31:47
space before :
tfarina
2013/05/05 00:45:59
Done.
| |
37 : public PrefProxyConfigTrackerImpl, | 40 public NetworkLibrary::NetworkManagerObserver, |
38 public NetworkLibrary::NetworkManagerObserver, | 41 public NetworkLibrary::NetworkObserver { |
39 public NetworkLibrary::NetworkObserver { | |
40 public: | 42 public: |
41 // ProxyConfigServiceImpl is created in ProxyServiceFactory:: | 43 // ProxyConfigServiceImpl is created in ProxyServiceFactory:: |
42 // CreatePrefProxyConfigTrackerImpl via Profile::GetProxyConfigTracker() for | 44 // CreatePrefProxyConfigTrackerImpl via Profile::GetProxyConfigTracker() for |
43 // profile or IOThread constructor for local state and is owned by the | 45 // profile or IOThread constructor for local state and is owned by the |
44 // respective classes. | 46 // respective classes. |
45 // | 47 // |
46 // From the UI, it is accessed via Profile::GetProxyConfigTracker to allow | 48 // From the UI, it is accessed via Profile::GetProxyConfigTracker to allow |
47 // user to read or modify the proxy configuration via UIGetProxyConfig or | 49 // user to read or modify the proxy configuration via UIGetProxyConfig or |
48 // UISetProxyConfigTo* respectively. | 50 // UISetProxyConfigTo* respectively. |
49 // The new modified proxy config, together with proxy from prefs if available, | 51 // The new modified proxy config, together with proxy from prefs if available, |
(...skipping 146 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
196 virtual void OnNetworkChanged(NetworkLibrary* cros, | 198 virtual void OnNetworkChanged(NetworkLibrary* cros, |
197 const Network* network) OVERRIDE; | 199 const Network* network) OVERRIDE; |
198 | 200 |
199 // Parse |network| proxy config and store result in |proxy_config|. | 201 // Parse |network| proxy config and store result in |proxy_config|. |
200 // Returns true if proxy config was successfully parsed. | 202 // Returns true if proxy config was successfully parsed. |
201 static bool ParseProxyConfig(const Network* network, | 203 static bool ParseProxyConfig(const Network* network, |
202 net::ProxyConfig* proxy_config); | 204 net::ProxyConfig* proxy_config); |
203 | 205 |
204 // Register UseShardProxies preference. | 206 // Register UseShardProxies preference. |
205 static void RegisterPrefs(PrefRegistrySimple* registry); | 207 static void RegisterPrefs(PrefRegistrySimple* registry); |
206 static void RegisterUserPrefs(PrefRegistrySyncable* registry); | 208 static void RegisterUserPrefs(user_prefs::PrefRegistrySyncable* registry); |
207 | 209 |
208 #if defined(UNIT_TEST) | 210 #if defined(UNIT_TEST) |
209 void SetTesting(ProxyConfig* test_config) { | 211 void SetTesting(ProxyConfig* test_config) { |
210 UIMakeActiveNetworkCurrent(); | 212 UIMakeActiveNetworkCurrent(); |
211 if (test_config) { | 213 if (test_config) { |
212 std::string value; | 214 std::string value; |
213 test_config->SerializeForNetwork(&value); | 215 test_config->SerializeForNetwork(&value); |
214 SetProxyConfigForNetwork(active_network_, value, false); | 216 SetProxyConfigForNetwork(active_network_, value, false); |
215 } | 217 } |
216 } | 218 } |
(...skipping 79 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
296 std::vector<base::Closure> callbacks_; | 298 std::vector<base::Closure> callbacks_; |
297 | 299 |
298 base::WeakPtrFactory<ProxyConfigServiceImpl> pointer_factory_; | 300 base::WeakPtrFactory<ProxyConfigServiceImpl> pointer_factory_; |
299 | 301 |
300 DISALLOW_COPY_AND_ASSIGN(ProxyConfigServiceImpl); | 302 DISALLOW_COPY_AND_ASSIGN(ProxyConfigServiceImpl); |
301 }; | 303 }; |
302 | 304 |
303 } // namespace chromeos | 305 } // namespace chromeos |
304 | 306 |
305 #endif // CHROME_BROWSER_CHROMEOS_PROXY_CONFIG_SERVICE_IMPL_H_ | 307 #endif // CHROME_BROWSER_CHROMEOS_PROXY_CONFIG_SERVICE_IMPL_H_ |
OLD | NEW |