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

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 again 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,
578 if (!network || !proxy_config) 578 net::ProxyConfig* proxy_config) {
579 if (!proxy_config)
579 return false; 580 return false;
580 JSONStringValueSerializer serializer(network->proxy_config()); 581 JSONStringValueSerializer serializer(proxy_config_string);
581 scoped_ptr<Value> value(serializer.Deserialize(NULL, NULL)); 582 scoped_ptr<Value> value(serializer.Deserialize(NULL, NULL));
582 if (!value.get() || value->GetType() != Value::TYPE_DICTIONARY) 583 if (!value.get() || value->GetType() != Value::TYPE_DICTIONARY)
583 return false; 584 return false;
584 ProxyConfigDictionary proxy_dict(static_cast<DictionaryValue*>(value.get())); 585 ProxyConfigDictionary proxy_dict(static_cast<DictionaryValue*>(value.get()));
585 return PrefProxyConfigTrackerImpl::PrefConfigToNetConfig(proxy_dict, 586 return PrefProxyConfigTrackerImpl::PrefConfigToNetConfig(proxy_dict,
586 proxy_config); 587 proxy_config);
587 } 588 }
588 589
589 // static 590 // static
590 void ProxyConfigServiceImpl::RegisterPrefs(PrefRegistrySimple* registry) { 591 void ProxyConfigServiceImpl::RegisterPrefs(PrefRegistrySimple* registry) {
(...skipping 160 matching lines...) Expand 10 before | Expand all | Expand 10 after
751 if (network) { 752 if (network) {
752 // If we're activating proxy, ignore proxy if necessary; 753 // If we're activating proxy, ignore proxy if necessary;
753 // otherwise, for ui, get actual proxy to show user. 754 // otherwise, for ui, get actual proxy to show user.
754 ignore_proxy = activate ? IgnoreProxy(network) : false; 755 ignore_proxy = activate ? IgnoreProxy(network) : false;
755 // If network is shared but use-shared-proxies is off, use direct mode. 756 // If network is shared but use-shared-proxies is off, use direct mode.
756 if (ignore_proxy) { 757 if (ignore_proxy) {
757 VLOG(1) << "Shared network && !use-shared-proxies, use direct"; 758 VLOG(1) << "Shared network && !use-shared-proxies, use direct";
758 network_availability = net::ProxyConfigService::CONFIG_VALID; 759 network_availability = net::ProxyConfigService::CONFIG_VALID;
759 } else if (!network->proxy_config().empty()) { 760 } else if (!network->proxy_config().empty()) {
760 // Network is private or shared with user using shared proxies. 761 // Network is private or shared with user using shared proxies.
761 if (ParseProxyConfig(network, &network_config)) { 762 if (ParseProxyConfig(network->proxy_config(), &network_config)) {
762 VLOG(1) << this << ": using network proxy: " 763 VLOG(1) << this << ": using network proxy: "
763 << network->proxy_config(); 764 << network->proxy_config();
764 network_availability = net::ProxyConfigService::CONFIG_VALID; 765 network_availability = net::ProxyConfigService::CONFIG_VALID;
765 } 766 }
766 } 767 }
767 } 768 }
768 769
769 // Determine effective proxy config, either from prefs or network. 770 // Determine effective proxy config, either from prefs or network.
770 ProxyPrefs::ConfigState effective_config_state; 771 ProxyPrefs::ConfigState effective_config_state;
771 net::ProxyConfig effective_config; 772 net::ProxyConfig effective_config;
(...skipping 103 matching lines...) Expand 10 before | Expand all | Expand 10 after
875 device_config_.clear(); 876 device_config_.clear();
876 return; 877 return;
877 } 878 }
878 if (!active_network_.empty()) { 879 if (!active_network_.empty()) {
879 VLOG(1) << "Try migrating device config to " << active_network_; 880 VLOG(1) << "Try migrating device config to " << active_network_;
880 SetProxyConfigForNetwork(active_network_, device_config_, true); 881 SetProxyConfigForNetwork(active_network_, device_config_, true);
881 } 882 }
882 } 883 }
883 884
884 } // namespace chromeos 885 } // namespace chromeos
OLDNEW
« no previous file with comments | « chrome/browser/chromeos/proxy_config_service_impl.h ('k') | chrome/browser/resources/chromeos/login/network_dropdown.js » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698