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/public/pref_member.h" | 12 #include "base/prefs/public/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; |
| 18 class PrefRegistrySyncable; |
| 19 |
17 namespace chromeos { | 20 namespace chromeos { |
18 | 21 |
19 // Implementation of proxy config service for chromeos that: | 22 // Implementation of proxy config service for chromeos that: |
20 // - extends PrefProxyConfigTrackerImpl (and so lives and runs entirely on UI | 23 // - extends PrefProxyConfigTrackerImpl (and so lives and runs entirely on UI |
21 // thread) to handle proxy from prefs (via PrefProxyConfigTrackerImpl) and | 24 // thread) to handle proxy from prefs (via PrefProxyConfigTrackerImpl) and |
22 // system i.e. network (via shill notifications) | 25 // system i.e. network (via shill notifications) |
23 // - exists one per profile and one per local state | 26 // - exists one per profile and one per local state |
24 // - retrieves initial system proxy configuration from cros settings persisted | 27 // - retrieves initial system proxy configuration from cros settings persisted |
25 // on chromeos device from chromeos revisions before migration to shill, | 28 // on chromeos device from chromeos revisions before migration to shill, |
26 // - persists proxy setting per network in flimflim | 29 // - persists proxy setting per network in flimflim |
(...skipping 166 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
193 virtual void OnNetworkChanged(NetworkLibrary* cros, | 196 virtual void OnNetworkChanged(NetworkLibrary* cros, |
194 const Network* network) OVERRIDE; | 197 const Network* network) OVERRIDE; |
195 | 198 |
196 // Parse |network| proxy config and store result in |proxy_config|. | 199 // Parse |network| proxy config and store result in |proxy_config|. |
197 // Returns true if proxy config was successfully parsed. | 200 // Returns true if proxy config was successfully parsed. |
198 static bool ParseProxyConfig(const Network* network, | 201 static bool ParseProxyConfig(const Network* network, |
199 net::ProxyConfig* proxy_config); | 202 net::ProxyConfig* proxy_config); |
200 | 203 |
201 // Register UseShardProxies preference. | 204 // Register UseShardProxies preference. |
202 static void RegisterPrefs(PrefRegistrySimple* registry); | 205 static void RegisterPrefs(PrefRegistrySimple* registry); |
203 static void RegisterUserPrefs(PrefServiceSyncable* pref_service); | 206 static void RegisterUserPrefs(PrefRegistrySyncable* registry); |
204 | 207 |
205 #if defined(UNIT_TEST) | 208 #if defined(UNIT_TEST) |
206 void SetTesting(ProxyConfig* test_config) { | 209 void SetTesting(ProxyConfig* test_config) { |
207 UIMakeActiveNetworkCurrent(); | 210 UIMakeActiveNetworkCurrent(); |
208 if (test_config) { | 211 if (test_config) { |
209 std::string value; | 212 std::string value; |
210 test_config->SerializeForNetwork(&value); | 213 test_config->SerializeForNetwork(&value); |
211 SetProxyConfigForNetwork(active_network_, value, false); | 214 SetProxyConfigForNetwork(active_network_, value, false); |
212 } | 215 } |
213 } | 216 } |
(...skipping 81 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
295 std::vector<base::Closure> callbacks_; | 298 std::vector<base::Closure> callbacks_; |
296 | 299 |
297 base::WeakPtrFactory<ProxyConfigServiceImpl> pointer_factory_; | 300 base::WeakPtrFactory<ProxyConfigServiceImpl> pointer_factory_; |
298 | 301 |
299 DISALLOW_COPY_AND_ASSIGN(ProxyConfigServiceImpl); | 302 DISALLOW_COPY_AND_ASSIGN(ProxyConfigServiceImpl); |
300 }; | 303 }; |
301 | 304 |
302 } // namespace chromeos | 305 } // namespace chromeos |
303 | 306 |
304 #endif // CHROME_BROWSER_CHROMEOS_PROXY_CONFIG_SERVICE_IMPL_H_ | 307 #endif // CHROME_BROWSER_CHROMEOS_PROXY_CONFIG_SERVICE_IMPL_H_ |
OLD | NEW |