OLD | NEW |
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 508 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
519 network = CrosLibrary::Get()->GetNetworkLibrary()->FindNetworkByPath( | 519 network = CrosLibrary::Get()->GetNetworkLibrary()->FindNetworkByPath( |
520 active_network_); | 520 active_network_); |
521 if (!network) | 521 if (!network) |
522 LOG(ERROR) << "can't find requested network " << active_network_; | 522 LOG(ERROR) << "can't find requested network " << active_network_; |
523 } | 523 } |
524 DetermineEffectiveConfig(network, true); | 524 DetermineEffectiveConfig(network, true); |
525 } | 525 } |
526 | 526 |
527 void ProxyConfigServiceImpl::OnSettingsOpCompleted( | 527 void ProxyConfigServiceImpl::OnSettingsOpCompleted( |
528 SignedSettings::ReturnCode code, | 528 SignedSettings::ReturnCode code, |
529 std::string value) { | 529 const base::Value* value) { |
| 530 // We assume ownership here to make sure this gets deleted no matter where |
| 531 // this function ends. |
| 532 scoped_ptr<const base::Value> own_value(value); |
| 533 |
530 retrieve_property_op_ = NULL; | 534 retrieve_property_op_ = NULL; |
531 if (code != SignedSettings::SUCCESS) { | 535 if (code != SignedSettings::SUCCESS) { |
532 LOG(WARNING) << this << ": Error retrieving proxy setting from device"; | 536 LOG(WARNING) << this << ": Error retrieving proxy setting from device"; |
533 device_config_.clear(); | 537 device_config_.clear(); |
534 return; | 538 return; |
535 } | 539 } |
536 VLOG(1) << this << ": Retrieved proxy setting from device, value=[" | 540 std::string policy_value; |
537 << value << "]"; | 541 value->GetAsString(&policy_value); |
| 542 VLOG(1) << "Retrieved proxy setting from device, value=[" |
| 543 << policy_value << "]"; |
538 ProxyConfig device_config; | 544 ProxyConfig device_config; |
539 if (!device_config.DeserializeForDevice(value) || | 545 if (!device_config.DeserializeForDevice(policy_value) || |
540 !device_config.SerializeForNetwork(&device_config_)) { | 546 !device_config.SerializeForNetwork(&device_config_)) { |
541 LOG(WARNING) << "Can't deserialize device setting or serialize for network"; | 547 LOG(WARNING) << "Can't deserialize device setting or serialize for network"; |
542 device_config_.clear(); | 548 device_config_.clear(); |
543 return; | 549 return; |
544 } | 550 } |
545 if (!active_network_.empty()) { | 551 if (!active_network_.empty()) { |
546 VLOG(1) << this << ": try migrating device config to " << active_network_; | 552 VLOG(1) << this << ": try migrating device config to " << active_network_; |
547 SetProxyConfigForNetwork(active_network_, device_config_, true); | 553 SetProxyConfigForNetwork(active_network_, device_config_, true); |
548 } | 554 } |
549 } | 555 } |
(...skipping 261 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
811 } | 817 } |
812 } | 818 } |
813 } | 819 } |
814 | 820 |
815 void ProxyConfigServiceImpl::ResetUICache() { | 821 void ProxyConfigServiceImpl::ResetUICache() { |
816 current_ui_network_.clear(); | 822 current_ui_network_.clear(); |
817 current_ui_config_ = ProxyConfig(); | 823 current_ui_config_ = ProxyConfig(); |
818 } | 824 } |
819 | 825 |
820 } // namespace chromeos | 826 } // namespace chromeos |
OLD | NEW |