OLD | NEW |
1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2011 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_value_serializer.h" | 10 #include "base/json/json_value_serializer.h" |
(...skipping 524 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
535 // We only care about active network. | 535 // We only care about active network. |
536 if (network == network_lib->active_network()) | 536 if (network == network_lib->active_network()) |
537 OnActiveNetworkChanged(network_lib, network); | 537 OnActiveNetworkChanged(network_lib, network); |
538 } | 538 } |
539 | 539 |
540 // static | 540 // static |
541 void ProxyConfigServiceImpl::RegisterPrefs(PrefService* pref_service) { | 541 void ProxyConfigServiceImpl::RegisterPrefs(PrefService* pref_service) { |
542 // Use shared proxies default to off. GetUseSharedProxies will return the | 542 // Use shared proxies default to off. GetUseSharedProxies will return the |
543 // correct value based on pre-login and login. | 543 // correct value based on pre-login and login. |
544 pref_service->RegisterBooleanPref(prefs::kUseSharedProxies, | 544 pref_service->RegisterBooleanPref(prefs::kUseSharedProxies, |
545 false, | 545 true, |
546 PrefService::UNSYNCABLE_PREF); | 546 PrefService::UNSYNCABLE_PREF); |
547 } | 547 } |
548 | 548 |
549 //------------------ ProxyConfigServiceImpl: private methods ------------------- | 549 //------------------ ProxyConfigServiceImpl: private methods ------------------- |
550 | 550 |
551 void ProxyConfigServiceImpl::Observe( | 551 void ProxyConfigServiceImpl::Observe( |
552 int type, | 552 int type, |
553 const content::NotificationSource& source, | 553 const content::NotificationSource& source, |
554 const content::NotificationDetails& details) { | 554 const content::NotificationDetails& details) { |
555 if (type == chrome::NOTIFICATION_PREF_CHANGED && | 555 if (type == chrome::NOTIFICATION_PREF_CHANGED && |
(...skipping 101 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
657 network_path : network->name()) | 657 network_path : network->name()) |
658 << ", value=" << value; | 658 << ", value=" << value; |
659 if (network_path == active_network_) | 659 if (network_path == active_network_) |
660 DetermineEffectiveConfig(network, true); | 660 DetermineEffectiveConfig(network, true); |
661 } | 661 } |
662 } | 662 } |
663 | 663 |
664 bool ProxyConfigServiceImpl::GetUseSharedProxies() { | 664 bool ProxyConfigServiceImpl::GetUseSharedProxies() { |
665 const PrefService::Preference* use_shared_proxies_pref = | 665 const PrefService::Preference* use_shared_proxies_pref = |
666 prefs()->FindPreference(prefs::kUseSharedProxies); | 666 prefs()->FindPreference(prefs::kUseSharedProxies); |
667 if (!use_shared_proxies_pref || use_shared_proxies_pref->IsDefaultValue()) | 667 if (!use_shared_proxies_pref) |
668 return !UserManager::Get()->user_is_logged_in(); | 668 return !UserManager::Get()->user_is_logged_in(); |
669 return use_shared_proxies_.GetValue(); | 669 return use_shared_proxies_.GetValue(); |
670 } | 670 } |
671 | 671 |
672 void ProxyConfigServiceImpl::DetermineEffectiveConfig(const Network* network, | 672 void ProxyConfigServiceImpl::DetermineEffectiveConfig(const Network* network, |
673 bool activate) { | 673 bool activate) { |
674 // Get prefs proxy config if available. | 674 // Get prefs proxy config if available. |
675 net::ProxyConfig pref_config; | 675 net::ProxyConfig pref_config; |
676 ProxyPrefs::ConfigState pref_state = GetProxyConfig(&pref_config); | 676 ProxyPrefs::ConfigState pref_state = GetProxyConfig(&pref_config); |
677 | 677 |
(...skipping 123 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
801 device_config_.clear(); | 801 device_config_.clear(); |
802 return; | 802 return; |
803 } | 803 } |
804 if (!active_network_.empty()) { | 804 if (!active_network_.empty()) { |
805 VLOG(1) << this << ": try migrating device config to " << active_network_; | 805 VLOG(1) << this << ": try migrating device config to " << active_network_; |
806 SetProxyConfigForNetwork(active_network_, device_config_, true); | 806 SetProxyConfigForNetwork(active_network_, device_config_, true); |
807 } | 807 } |
808 } | 808 } |
809 | 809 |
810 } // namespace chromeos | 810 } // namespace chromeos |
OLD | NEW |