Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(882)

Side by Side Diff: chrome/browser/chromeos/proxy_config_service_impl.cc

Issue 11345008: Remove content::NotificationObserver dependency from most Prefs code. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Fix PrefNotifierImpl Created 8 years, 1 month ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
OLDNEW
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 554 matching lines...) Expand 10 before | Expand all | Expand 10 after
565 void ProxyConfigServiceImpl::RegisterPrefs(PrefService* pref_service) { 565 void ProxyConfigServiceImpl::RegisterPrefs(PrefService* pref_service) {
566 // Use shared proxies default to off. GetUseSharedProxies will return the 566 // Use shared proxies default to off. GetUseSharedProxies will return the
567 // correct value based on pre-login and login. 567 // correct value based on pre-login and login.
568 pref_service->RegisterBooleanPref(prefs::kUseSharedProxies, 568 pref_service->RegisterBooleanPref(prefs::kUseSharedProxies,
569 true, 569 true,
570 PrefService::UNSYNCABLE_PREF); 570 PrefService::UNSYNCABLE_PREF);
571 } 571 }
572 572
573 //------------------ ProxyConfigServiceImpl: private methods ------------------- 573 //------------------ ProxyConfigServiceImpl: private methods -------------------
574 574
575 void ProxyConfigServiceImpl::Observe( 575 void ProxyConfigServiceImpl::OnPreferenceChanged(PrefServiceBase* service,
576 int type, 576 const std::string& pref_name) {
577 const content::NotificationSource& source, 577 DCHECK(service == prefs());
578 const content::NotificationDetails& details) { 578 DCHECK(pref_name == prefs::kUseSharedProxies);
579 if (type == chrome::NOTIFICATION_PREF_CHANGED && 579 VLOG(1) << "New use-shared-proxies = " << GetUseSharedProxies();
580 *(content::Details<std::string>(details).ptr()) == 580
581 prefs::kUseSharedProxies) { 581 // Determine new proxy config which may have changed because of new
582 if (content::Source<PrefService>(source).ptr() == prefs()) { 582 // use-shared-proxies. If necessary, activate it.
583 VLOG(1) << "New use-shared-proxies = " << GetUseSharedProxies(); 583 Network* network = NULL;
584 // Determine new proxy config which may have changed because of new 584 if (!active_network_.empty()) {
585 // use-shared-proxies. If necessary, activate it. 585 network = CrosLibrary::Get()->GetNetworkLibrary()->FindNetworkByPath(
586 Network* network = NULL; 586 active_network_);
587 if (!active_network_.empty()) { 587 if (!network)
588 network = CrosLibrary::Get()->GetNetworkLibrary()->FindNetworkByPath( 588 LOG(WARNING) << "Can't find requested network " << active_network_;
589 active_network_);
590 if (!network)
591 LOG(WARNING) << "Can't find requested network " << active_network_;
592 }
593 DetermineEffectiveConfig(network, true);
594 }
595 return;
596 } 589 }
597 PrefProxyConfigTrackerImpl::Observe(type, source, details); 590 DetermineEffectiveConfig(network, true);
Mattias Nissler (ping if slow) 2012/10/31 13:29:35 I think this breaks, the parent class also needs t
Jói 2012/10/31 14:56:26 You're right, this was caught by a tryjob and is f
598 } 591 }
599 592
600 void ProxyConfigServiceImpl::OnUISetProxyConfig() { 593 void ProxyConfigServiceImpl::OnUISetProxyConfig() {
601 if (current_ui_network_.empty()) 594 if (current_ui_network_.empty())
602 return; 595 return;
603 // Update config to shill. 596 // Update config to shill.
604 std::string value; 597 std::string value;
605 if (current_ui_config_.SerializeForNetwork(&value)) { 598 if (current_ui_config_.SerializeForNetwork(&value)) {
606 VLOG(1) << "Set proxy (mode=" << current_ui_config_.mode 599 VLOG(1) << "Set proxy (mode=" << current_ui_config_.mode
607 << ") for " << current_ui_network_; 600 << ") for " << current_ui_network_;
(...skipping 230 matching lines...) Expand 10 before | Expand all | Expand 10 after
838 device_config_.clear(); 831 device_config_.clear();
839 return; 832 return;
840 } 833 }
841 if (!active_network_.empty()) { 834 if (!active_network_.empty()) {
842 VLOG(1) << "Try migrating device config to " << active_network_; 835 VLOG(1) << "Try migrating device config to " << active_network_;
843 SetProxyConfigForNetwork(active_network_, device_config_, true); 836 SetProxyConfigForNetwork(active_network_, device_config_, true);
844 } 837 }
845 } 838 }
846 839
847 } // namespace chromeos 840 } // namespace chromeos
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698