| 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 #include "chrome/browser/chromeos/proxy_config_service_impl.h" | 5 #include "chrome/browser/chromeos/proxy_config_service_impl.h" |
| 6 | 6 |
| 7 #include <ostream> | 7 #include <ostream> |
| 8 | 8 |
| 9 #include "base/bind.h" | 9 #include "base/bind.h" |
| 10 #include "base/json/json_string_value_serializer.h" | 10 #include "base/json/json_string_value_serializer.h" |
| (...skipping 562 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 573 JSONStringValueSerializer serializer(network->proxy_config()); | 573 JSONStringValueSerializer serializer(network->proxy_config()); |
| 574 scoped_ptr<Value> value(serializer.Deserialize(NULL, NULL)); | 574 scoped_ptr<Value> value(serializer.Deserialize(NULL, NULL)); |
| 575 if (!value.get() || value->GetType() != Value::TYPE_DICTIONARY) | 575 if (!value.get() || value->GetType() != Value::TYPE_DICTIONARY) |
| 576 return false; | 576 return false; |
| 577 ProxyConfigDictionary proxy_dict(static_cast<DictionaryValue*>(value.get())); | 577 ProxyConfigDictionary proxy_dict(static_cast<DictionaryValue*>(value.get())); |
| 578 return PrefProxyConfigTrackerImpl::PrefConfigToNetConfig(proxy_dict, | 578 return PrefProxyConfigTrackerImpl::PrefConfigToNetConfig(proxy_dict, |
| 579 proxy_config); | 579 proxy_config); |
| 580 } | 580 } |
| 581 | 581 |
| 582 // static | 582 // static |
| 583 void ProxyConfigServiceImpl::RegisterPrefs(PrefService* pref_service) { | 583 void ProxyConfigServiceImpl::RegisterPrefs(PrefServiceSimple* pref_service) { |
| 584 // Use shared proxies default to off. GetUseSharedProxies will return the | 584 // Use shared proxies default to off. GetUseSharedProxies will return the |
| 585 // correct value based on pre-login and login. | 585 // correct value based on pre-login and login. |
| 586 pref_service->RegisterBooleanPref(prefs::kUseSharedProxies, true); |
| 587 } |
| 588 |
| 589 // static |
| 590 void ProxyConfigServiceImpl::RegisterUserPrefs( |
| 591 PrefServiceSyncable* pref_service) { |
| 586 pref_service->RegisterBooleanPref(prefs::kUseSharedProxies, | 592 pref_service->RegisterBooleanPref(prefs::kUseSharedProxies, |
| 587 true, | 593 true, |
| 588 PrefService::UNSYNCABLE_PREF); | 594 PrefServiceSyncable::UNSYNCABLE_PREF); |
| 589 } | 595 } |
| 590 | 596 |
| 591 //------------------ ProxyConfigServiceImpl: private methods ------------------- | 597 //------------------ ProxyConfigServiceImpl: private methods ------------------- |
| 592 | 598 |
| 593 void ProxyConfigServiceImpl::OnUseSharedProxiesChanged() { | 599 void ProxyConfigServiceImpl::OnUseSharedProxiesChanged() { |
| 594 VLOG(1) << "New use-shared-proxies = " << GetUseSharedProxies(); | 600 VLOG(1) << "New use-shared-proxies = " << GetUseSharedProxies(); |
| 595 | 601 |
| 596 // Determine new proxy config which may have changed because of new | 602 // Determine new proxy config which may have changed because of new |
| 597 // use-shared-proxies. If necessary, activate it. | 603 // use-shared-proxies. If necessary, activate it. |
| 598 Network* network = NULL; | 604 Network* network = NULL; |
| (...skipping 241 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 840 device_config_.clear(); | 846 device_config_.clear(); |
| 841 return; | 847 return; |
| 842 } | 848 } |
| 843 if (!active_network_.empty()) { | 849 if (!active_network_.empty()) { |
| 844 VLOG(1) << "Try migrating device config to " << active_network_; | 850 VLOG(1) << "Try migrating device config to " << active_network_; |
| 845 SetProxyConfigForNetwork(active_network_, device_config_, true); | 851 SetProxyConfigForNetwork(active_network_, device_config_, true); |
| 846 } | 852 } |
| 847 } | 853 } |
| 848 | 854 |
| 849 } // namespace chromeos | 855 } // namespace chromeos |
| OLD | NEW |