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

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

Issue 14134007: NetworkPortalDetector/NetworkStateInformer: Switch over to use NetworkStateHandler (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: rebase Created 7 years, 7 months 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 555 matching lines...) Expand 10 before | Expand all | Expand 10 after
566 VLOG(1) << "OnNetworkChanged: " 566 VLOG(1) << "OnNetworkChanged: "
567 << (network->name().empty() ? network->service_path() : 567 << (network->name().empty() ? network->service_path() :
568 network->name()) 568 network->name())
569 << ", use-shared-proxies=" << GetUseSharedProxies(); 569 << ", use-shared-proxies=" << GetUseSharedProxies();
570 // We only care about active network. 570 // We only care about active network.
571 if (network == network_lib->active_network()) 571 if (network == network_lib->active_network())
572 OnActiveNetworkChanged(network_lib, network); 572 OnActiveNetworkChanged(network_lib, network);
573 } 573 }
574 574
575 // static 575 // static
576 bool ProxyConfigServiceImpl::ParseProxyConfig(const Network* network, 576 bool ProxyConfigServiceImpl::ParseProxyConfig(
577 net::ProxyConfig* proxy_config) { 577 const std::string& proxy_config_string, net::ProxyConfig* proxy_config) {
stevenjb 2013/05/14 15:46:16 args on separate lines
gauravsh 2013/05/14 21:51:15 Done.
578 if (!network || !proxy_config) 578 if (!proxy_config)
579 return false; 579 return false;
580 JSONStringValueSerializer serializer(network->proxy_config()); 580 JSONStringValueSerializer serializer(proxy_config_string);
581 scoped_ptr<Value> value(serializer.Deserialize(NULL, NULL)); 581 scoped_ptr<Value> value(serializer.Deserialize(NULL, NULL));
582 if (!value.get() || value->GetType() != Value::TYPE_DICTIONARY) 582 if (!value.get() || value->GetType() != Value::TYPE_DICTIONARY)
583 return false; 583 return false;
584 ProxyConfigDictionary proxy_dict(static_cast<DictionaryValue*>(value.get())); 584 ProxyConfigDictionary proxy_dict(static_cast<DictionaryValue*>(value.get()));
585 return PrefProxyConfigTrackerImpl::PrefConfigToNetConfig(proxy_dict, 585 return PrefProxyConfigTrackerImpl::PrefConfigToNetConfig(proxy_dict,
586 proxy_config); 586 proxy_config);
587 } 587 }
588 588
589 // static 589 // static
590 void ProxyConfigServiceImpl::RegisterPrefs(PrefRegistrySimple* registry) { 590 void ProxyConfigServiceImpl::RegisterPrefs(PrefRegistrySimple* registry) {
(...skipping 160 matching lines...) Expand 10 before | Expand all | Expand 10 after
751 if (network) { 751 if (network) {
752 // If we're activating proxy, ignore proxy if necessary; 752 // If we're activating proxy, ignore proxy if necessary;
753 // otherwise, for ui, get actual proxy to show user. 753 // otherwise, for ui, get actual proxy to show user.
754 ignore_proxy = activate ? IgnoreProxy(network) : false; 754 ignore_proxy = activate ? IgnoreProxy(network) : false;
755 // If network is shared but use-shared-proxies is off, use direct mode. 755 // If network is shared but use-shared-proxies is off, use direct mode.
756 if (ignore_proxy) { 756 if (ignore_proxy) {
757 VLOG(1) << "Shared network && !use-shared-proxies, use direct"; 757 VLOG(1) << "Shared network && !use-shared-proxies, use direct";
758 network_availability = net::ProxyConfigService::CONFIG_VALID; 758 network_availability = net::ProxyConfigService::CONFIG_VALID;
759 } else if (!network->proxy_config().empty()) { 759 } else if (!network->proxy_config().empty()) {
760 // Network is private or shared with user using shared proxies. 760 // Network is private or shared with user using shared proxies.
761 if (ParseProxyConfig(network, &network_config)) { 761 if (ParseProxyConfig(network->proxy_config(), &network_config)) {
762 VLOG(1) << this << ": using network proxy: " 762 VLOG(1) << this << ": using network proxy: "
763 << network->proxy_config(); 763 << network->proxy_config();
764 network_availability = net::ProxyConfigService::CONFIG_VALID; 764 network_availability = net::ProxyConfigService::CONFIG_VALID;
765 } 765 }
766 } 766 }
767 } 767 }
768 768
769 // Determine effective proxy config, either from prefs or network. 769 // Determine effective proxy config, either from prefs or network.
770 ProxyPrefs::ConfigState effective_config_state; 770 ProxyPrefs::ConfigState effective_config_state;
771 net::ProxyConfig effective_config; 771 net::ProxyConfig effective_config;
(...skipping 103 matching lines...) Expand 10 before | Expand all | Expand 10 after
875 device_config_.clear(); 875 device_config_.clear();
876 return; 876 return;
877 } 877 }
878 if (!active_network_.empty()) { 878 if (!active_network_.empty()) {
879 VLOG(1) << "Try migrating device config to " << active_network_; 879 VLOG(1) << "Try migrating device config to " << active_network_;
880 SetProxyConfigForNetwork(active_network_, device_config_, true); 880 SetProxyConfigForNetwork(active_network_, device_config_, true);
881 } 881 }
882 } 882 }
883 883
884 } // namespace chromeos 884 } // namespace chromeos
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698