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

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: add proxy_config 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) {
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 158 matching lines...) Expand 10 before | Expand all | Expand 10 after
749 if (network) { 749 if (network) {
750 // If we're activating proxy, ignore proxy if necessary; 750 // If we're activating proxy, ignore proxy if necessary;
751 // otherwise, for ui, get actual proxy to show user. 751 // otherwise, for ui, get actual proxy to show user.
752 ignore_proxy = activate ? IgnoreProxy(network) : false; 752 ignore_proxy = activate ? IgnoreProxy(network) : false;
753 // If network is shared but use-shared-proxies is off, use direct mode. 753 // If network is shared but use-shared-proxies is off, use direct mode.
754 if (ignore_proxy) { 754 if (ignore_proxy) {
755 VLOG(1) << "Shared network && !use-shared-proxies, use direct"; 755 VLOG(1) << "Shared network && !use-shared-proxies, use direct";
756 network_availability = net::ProxyConfigService::CONFIG_VALID; 756 network_availability = net::ProxyConfigService::CONFIG_VALID;
757 } else if (!network->proxy_config().empty()) { 757 } else if (!network->proxy_config().empty()) {
758 // Network is private or shared with user using shared proxies. 758 // Network is private or shared with user using shared proxies.
759 if (ParseProxyConfig(network, &network_config)) { 759 if (ParseProxyConfig(network->proxy_config(), &network_config)) {
760 VLOG(1) << this << ": using network proxy: " 760 VLOG(1) << this << ": using network proxy: "
761 << network->proxy_config(); 761 << network->proxy_config();
762 network_availability = net::ProxyConfigService::CONFIG_VALID; 762 network_availability = net::ProxyConfigService::CONFIG_VALID;
763 } 763 }
764 } 764 }
765 } 765 }
766 766
767 // Determine effective proxy config, either from prefs or network. 767 // Determine effective proxy config, either from prefs or network.
768 ProxyPrefs::ConfigState effective_config_state; 768 ProxyPrefs::ConfigState effective_config_state;
769 net::ProxyConfig effective_config; 769 net::ProxyConfig effective_config;
(...skipping 103 matching lines...) Expand 10 before | Expand all | Expand 10 after
873 device_config_.clear(); 873 device_config_.clear();
874 return; 874 return;
875 } 875 }
876 if (!active_network_.empty()) { 876 if (!active_network_.empty()) {
877 VLOG(1) << "Try migrating device config to " << active_network_; 877 VLOG(1) << "Try migrating device config to " << active_network_;
878 SetProxyConfigForNetwork(active_network_, device_config_, true); 878 SetProxyConfigForNetwork(active_network_, device_config_, true);
879 } 879 }
880 } 880 }
881 881
882 } // namespace chromeos 882 } // namespace chromeos
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698