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 184 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
206 UIMakeActiveNetworkCurrent(); | 207 UIMakeActiveNetworkCurrent(); |
207 if (test_config) { | 208 if (test_config) { |
208 std::string value; | 209 std::string value; |
209 test_config->SerializeForNetwork(&value); | 210 test_config->SerializeForNetwork(&value); |
210 SetProxyConfigForNetwork(active_network_, value, false); | 211 SetProxyConfigForNetwork(active_network_, value, false); |
211 } | 212 } |
212 } | 213 } |
213 #endif // defined(UNIT_TEST) | 214 #endif // defined(UNIT_TEST) |
214 | 215 |
215 private: | 216 private: |
216 // content::NotificationObserver implementation. | 217 // PrefObserver implementation. |
217 virtual void Observe(int type, | 218 virtual void OnPreferenceChanged(PrefServiceBase* service, |
218 const content::NotificationSource& source, | 219 const std::string& pref_name) OVERRIDE; |
219 const content::NotificationDetails& details) OVERRIDE; | |
220 | 220 |
221 // Called from the various UISetProxyConfigTo*. | 221 // Called from the various UISetProxyConfigTo*. |
222 void OnUISetProxyConfig(); | 222 void OnUISetProxyConfig(); |
223 | 223 |
224 // Called from OnNetworkManagerChanged and OnNetworkChanged for currently | 224 // Called from OnNetworkManagerChanged and OnNetworkChanged for currently |
225 // active network, to handle previously active network, new active network, | 225 // active network, to handle previously active network, new active network, |
226 // and if necessary, migrates device settings to shill and/or activates | 226 // and if necessary, migrates device settings to shill and/or activates |
227 // proxy setting of new network. | 227 // proxy setting of new network. |
228 void OnActiveNetworkChanged(NetworkLibrary* cros, | 228 void OnActiveNetworkChanged(NetworkLibrary* cros, |
229 const Network* active_network); | 229 const Network* active_network); |
(...skipping 66 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
296 std::vector<base::Closure> callbacks_; | 296 std::vector<base::Closure> callbacks_; |
297 | 297 |
298 base::WeakPtrFactory<ProxyConfigServiceImpl> pointer_factory_; | 298 base::WeakPtrFactory<ProxyConfigServiceImpl> pointer_factory_; |
299 | 299 |
300 DISALLOW_COPY_AND_ASSIGN(ProxyConfigServiceImpl); | 300 DISALLOW_COPY_AND_ASSIGN(ProxyConfigServiceImpl); |
301 }; | 301 }; |
302 | 302 |
303 } // namespace chromeos | 303 } // namespace chromeos |
304 | 304 |
305 #endif // CHROME_BROWSER_CHROMEOS_PROXY_CONFIG_SERVICE_IMPL_H_ | 305 #endif // CHROME_BROWSER_CHROMEOS_PROXY_CONFIG_SERVICE_IMPL_H_ |
OLD | NEW |