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

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

Issue 8091002: PART2: Make SignedSettings use proper Value types instead of string all around the place. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Fixed some memory leaks in tests. Created 9 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) 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/json/json_value_serializer.h" 9 #include "base/json/json_value_serializer.h"
10 #include "base/logging.h" 10 #include "base/logging.h"
(...skipping 638 matching lines...) Expand 10 before | Expand all | Expand 10 after
649 CheckCurrentlyOnIOThread(); 649 CheckCurrentlyOnIOThread();
650 if (config_availability_ == net::ProxyConfigService::CONFIG_VALID) { 650 if (config_availability_ == net::ProxyConfigService::CONFIG_VALID) {
651 VLOG(1) << "returning proxy mode=" << cached_config_.mode; 651 VLOG(1) << "returning proxy mode=" << cached_config_.mode;
652 cached_config_.ToNetProxyConfig(net_config); 652 cached_config_.ToNetProxyConfig(net_config);
653 } 653 }
654 return config_availability_; 654 return config_availability_;
655 } 655 }
656 656
657 void ProxyConfigServiceImpl::OnSettingsOpCompleted( 657 void ProxyConfigServiceImpl::OnSettingsOpCompleted(
658 SignedSettings::ReturnCode code, 658 SignedSettings::ReturnCode code,
659 std::string value) { 659 const base::Value* value) {
660 // We assume ownership here to make sure this gets deleted no matter where
661 // this function ends.
662 scoped_ptr<const base::Value> own_value(value);
663
660 retrieve_property_op_ = NULL; 664 retrieve_property_op_ = NULL;
661 if (code != SignedSettings::SUCCESS) { 665 if (code != SignedSettings::SUCCESS) {
662 LOG(WARNING) << "Error retrieving proxy setting from device"; 666 LOG(WARNING) << "Error retrieving proxy setting from device";
663 device_config_.clear(); 667 device_config_.clear();
664 return; 668 return;
665 } 669 }
666 VLOG(1) << "Retrieved proxy setting from device, value=[" << value << "]"; 670 std::string policy_value;
671 value->GetAsString(&policy_value);
672 VLOG(1) << "Retrieved proxy setting from device, value=["
673 << policy_value << "]";
667 ProxyConfig device_config; 674 ProxyConfig device_config;
668 if (!device_config.DeserializeForDevice(value) || 675 if (!device_config.DeserializeForDevice(policy_value) ||
669 !device_config.SerializeForNetwork(&device_config_)) { 676 !device_config.SerializeForNetwork(&device_config_)) {
670 LOG(WARNING) << "Can't deserialize device setting or serialize for network"; 677 LOG(WARNING) << "Can't deserialize device setting or serialize for network";
671 device_config_.clear(); 678 device_config_.clear();
672 return; 679 return;
673 } 680 }
674 if (!active_network_.empty()) { 681 if (!active_network_.empty()) {
675 VLOG(1) << "try migrating device config to " << active_network_; 682 VLOG(1) << "try migrating device config to " << active_network_;
676 SetProxyConfigForNetwork(active_network_, device_config_, true); 683 SetProxyConfigForNetwork(active_network_, device_config_, true);
677 } 684 }
678 } 685 }
(...skipping 170 matching lines...) Expand 10 before | Expand all | Expand 10 after
849 856
850 void ProxyConfigServiceImpl::CheckCurrentlyOnIOThread() { 857 void ProxyConfigServiceImpl::CheckCurrentlyOnIOThread() {
851 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::IO)); 858 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::IO));
852 } 859 }
853 860
854 void ProxyConfigServiceImpl::CheckCurrentlyOnUIThread() { 861 void ProxyConfigServiceImpl::CheckCurrentlyOnUIThread() {
855 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI)); 862 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI));
856 } 863 }
857 864
858 } // namespace chromeos 865 } // namespace chromeos
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698