| 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_observer.h" |
| 12 #include "base/values.h" | 13 #include "base/values.h" |
| 13 #include "chrome/browser/api/prefs/pref_member.h" | 14 #include "chrome/browser/api/prefs/pref_member.h" |
| 14 #include "chrome/browser/chromeos/cros/network_library.h" | 15 #include "chrome/browser/chromeos/cros/network_library.h" |
| 15 #include "chrome/browser/net/pref_proxy_config_tracker_impl.h" | 16 #include "chrome/browser/net/pref_proxy_config_tracker_impl.h" |
| 16 | 17 |
| 17 namespace chromeos { | 18 namespace chromeos { |
| 18 | 19 |
| 19 // Implementation of proxy config service for chromeos that: | 20 // Implementation of proxy config service for chromeos that: |
| 20 // - extends PrefProxyConfigTrackerImpl (and so lives and runs entirely on UI | 21 // - extends PrefProxyConfigTrackerImpl (and so lives and runs entirely on UI |
| 21 // thread) to handle proxy from prefs (via PrefProxyConfigTrackerImpl) and | 22 // thread) to handle proxy from prefs (via PrefProxyConfigTrackerImpl) and |
| (...skipping 179 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 201 UIMakeActiveNetworkCurrent(); | 202 UIMakeActiveNetworkCurrent(); |
| 202 if (test_config) { | 203 if (test_config) { |
| 203 std::string value; | 204 std::string value; |
| 204 test_config->SerializeForNetwork(&value); | 205 test_config->SerializeForNetwork(&value); |
| 205 SetProxyConfigForNetwork(active_network_, value, false); | 206 SetProxyConfigForNetwork(active_network_, value, false); |
| 206 } | 207 } |
| 207 } | 208 } |
| 208 #endif // defined(UNIT_TEST) | 209 #endif // defined(UNIT_TEST) |
| 209 | 210 |
| 210 private: | 211 private: |
| 211 // content::NotificationObserver implementation. | 212 // PrefObserver implementation. |
| 212 virtual void Observe(int type, | 213 virtual void OnPreferenceChanged(PrefServiceBase* service, |
| 213 const content::NotificationSource& source, | 214 const std::string& pref_name) OVERRIDE; |
| 214 const content::NotificationDetails& details) OVERRIDE; | |
| 215 | 215 |
| 216 // Called from the various UISetProxyConfigTo*. | 216 // Called from the various UISetProxyConfigTo*. |
| 217 void OnUISetProxyConfig(); | 217 void OnUISetProxyConfig(); |
| 218 | 218 |
| 219 // Called from OnNetworkManagerChanged and OnNetworkChanged for currently | 219 // Called from OnNetworkManagerChanged and OnNetworkChanged for currently |
| 220 // active network, to handle previously active network, new active network, | 220 // active network, to handle previously active network, new active network, |
| 221 // and if necessary, migrates device settings to shill and/or activates | 221 // and if necessary, migrates device settings to shill and/or activates |
| 222 // proxy setting of new network. | 222 // proxy setting of new network. |
| 223 void OnActiveNetworkChanged(NetworkLibrary* cros, | 223 void OnActiveNetworkChanged(NetworkLibrary* cros, |
| 224 const Network* active_network); | 224 const Network* active_network); |
| (...skipping 66 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 291 std::vector<base::Closure> callbacks_; | 291 std::vector<base::Closure> callbacks_; |
| 292 | 292 |
| 293 base::WeakPtrFactory<ProxyConfigServiceImpl> pointer_factory_; | 293 base::WeakPtrFactory<ProxyConfigServiceImpl> pointer_factory_; |
| 294 | 294 |
| 295 DISALLOW_COPY_AND_ASSIGN(ProxyConfigServiceImpl); | 295 DISALLOW_COPY_AND_ASSIGN(ProxyConfigServiceImpl); |
| 296 }; | 296 }; |
| 297 | 297 |
| 298 } // namespace chromeos | 298 } // namespace chromeos |
| 299 | 299 |
| 300 #endif // CHROME_BROWSER_CHROMEOS_PROXY_CONFIG_SERVICE_IMPL_H_ | 300 #endif // CHROME_BROWSER_CHROMEOS_PROXY_CONFIG_SERVICE_IMPL_H_ |
| OLD | NEW |