| OLD | NEW |
| 1 // Copyright 2013 The Chromium Authors. All rights reserved. | 1 // Copyright 2013 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 "chromeos/network/managed_network_configuration_handler_impl.h" | 5 #include "chromeos/network/managed_network_configuration_handler_impl.h" |
| 6 | 6 |
| 7 #include <vector> | 7 #include <vector> |
| 8 | 8 |
| 9 #include "base/bind.h" | 9 #include "base/bind.h" |
| 10 #include "base/guid.h" | 10 #include "base/guid.h" |
| (...skipping 16 matching lines...) Expand all Loading... |
| 27 #include "chromeos/network/network_state.h" | 27 #include "chromeos/network/network_state.h" |
| 28 #include "chromeos/network/network_state_handler.h" | 28 #include "chromeos/network/network_state_handler.h" |
| 29 #include "chromeos/network/network_ui_data.h" | 29 #include "chromeos/network/network_ui_data.h" |
| 30 #include "chromeos/network/network_util.h" | 30 #include "chromeos/network/network_util.h" |
| 31 #include "chromeos/network/onc/onc_merger.h" | 31 #include "chromeos/network/onc/onc_merger.h" |
| 32 #include "chromeos/network/onc/onc_signature.h" | 32 #include "chromeos/network/onc/onc_signature.h" |
| 33 #include "chromeos/network/onc/onc_translator.h" | 33 #include "chromeos/network/onc/onc_translator.h" |
| 34 #include "chromeos/network/onc/onc_utils.h" | 34 #include "chromeos/network/onc/onc_utils.h" |
| 35 #include "chromeos/network/onc/onc_validator.h" | 35 #include "chromeos/network/onc/onc_validator.h" |
| 36 #include "chromeos/network/policy_util.h" | 36 #include "chromeos/network/policy_util.h" |
| 37 #include "chromeos/network/prohibited_technologies_handler.h" |
| 37 #include "chromeos/network/shill_property_util.h" | 38 #include "chromeos/network/shill_property_util.h" |
| 38 #include "components/onc/onc_constants.h" | 39 #include "components/onc/onc_constants.h" |
| 39 #include "third_party/cros_system_api/dbus/service_constants.h" | 40 #include "third_party/cros_system_api/dbus/service_constants.h" |
| 40 | 41 |
| 41 namespace chromeos { | 42 namespace chromeos { |
| 42 | 43 |
| 43 namespace { | 44 namespace { |
| 44 | 45 |
| 45 using GuidToPolicyMap = ManagedNetworkConfigurationHandler::GuidToPolicyMap; | 46 using GuidToPolicyMap = ManagedNetworkConfigurationHandler::GuidToPolicyMap; |
| 46 | 47 |
| (...skipping 372 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 419 Policies* policies = NULL; | 420 Policies* policies = NULL; |
| 420 if (ContainsKey(policies_by_user_, userhash)) { | 421 if (ContainsKey(policies_by_user_, userhash)) { |
| 421 policies = policies_by_user_[userhash].get(); | 422 policies = policies_by_user_[userhash].get(); |
| 422 } else { | 423 } else { |
| 423 policies = new Policies; | 424 policies = new Policies; |
| 424 policies_by_user_[userhash] = make_linked_ptr(policies); | 425 policies_by_user_[userhash] = make_linked_ptr(policies); |
| 425 } | 426 } |
| 426 | 427 |
| 427 policies->global_network_config.MergeDictionary(&global_network_config); | 428 policies->global_network_config.MergeDictionary(&global_network_config); |
| 428 | 429 |
| 430 // Update prohibited technologies. |
| 431 const base::ListValue* prohibited_list = nullptr; |
| 432 if (policies->global_network_config.GetListWithoutPathExpansion( |
| 433 ::onc::global_network_config::kDisableNetworkTypes, |
| 434 &prohibited_list) && |
| 435 prohibited_technologies_handler_) { |
| 436 // Prohobited technologies are only allowed in user policy. |
| 437 DCHECK_EQ(::onc::ONC_SOURCE_DEVICE_POLICY, onc_source); |
| 438 |
| 439 prohibited_technologies_handler_->SetProhibitedTechnologies( |
| 440 prohibited_list); |
| 441 } |
| 442 |
| 429 GuidToPolicyMap old_per_network_config; | 443 GuidToPolicyMap old_per_network_config; |
| 430 policies->per_network_config.swap(old_per_network_config); | 444 policies->per_network_config.swap(old_per_network_config); |
| 431 | 445 |
| 432 // This stores all GUIDs of policies that have changed or are new. | 446 // This stores all GUIDs of policies that have changed or are new. |
| 433 std::set<std::string> modified_policies; | 447 std::set<std::string> modified_policies; |
| 434 | 448 |
| 435 for (base::ListValue::const_iterator it = network_configs_onc.begin(); | 449 for (base::ListValue::const_iterator it = network_configs_onc.begin(); |
| 436 it != network_configs_onc.end(); ++it) { | 450 it != network_configs_onc.end(); ++it) { |
| 437 const base::DictionaryValue* network = NULL; | 451 const base::DictionaryValue* network = NULL; |
| 438 (*it)->GetAsDictionary(&network); | 452 (*it)->GetAsDictionary(&network); |
| (...skipping 263 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 702 ManagedNetworkConfigurationHandlerImpl:: | 716 ManagedNetworkConfigurationHandlerImpl:: |
| 703 ~ManagedNetworkConfigurationHandlerImpl() { | 717 ~ManagedNetworkConfigurationHandlerImpl() { |
| 704 if (network_profile_handler_) | 718 if (network_profile_handler_) |
| 705 network_profile_handler_->RemoveObserver(this); | 719 network_profile_handler_->RemoveObserver(this); |
| 706 } | 720 } |
| 707 | 721 |
| 708 void ManagedNetworkConfigurationHandlerImpl::Init( | 722 void ManagedNetworkConfigurationHandlerImpl::Init( |
| 709 NetworkStateHandler* network_state_handler, | 723 NetworkStateHandler* network_state_handler, |
| 710 NetworkProfileHandler* network_profile_handler, | 724 NetworkProfileHandler* network_profile_handler, |
| 711 NetworkConfigurationHandler* network_configuration_handler, | 725 NetworkConfigurationHandler* network_configuration_handler, |
| 712 NetworkDeviceHandler* network_device_handler) { | 726 NetworkDeviceHandler* network_device_handler, |
| 727 ProhibitedTechnologiesHandler* prohibited_technologies_handler) { |
| 713 network_state_handler_ = network_state_handler; | 728 network_state_handler_ = network_state_handler; |
| 714 network_profile_handler_ = network_profile_handler; | 729 network_profile_handler_ = network_profile_handler; |
| 715 network_configuration_handler_ = network_configuration_handler; | 730 network_configuration_handler_ = network_configuration_handler; |
| 716 network_device_handler_ = network_device_handler; | 731 network_device_handler_ = network_device_handler; |
| 717 network_profile_handler_->AddObserver(this); | 732 network_profile_handler_->AddObserver(this); |
| 733 prohibited_technologies_handler_ = prohibited_technologies_handler; |
| 718 } | 734 } |
| 719 | 735 |
| 720 void ManagedNetworkConfigurationHandlerImpl::OnPolicyAppliedToNetwork( | 736 void ManagedNetworkConfigurationHandlerImpl::OnPolicyAppliedToNetwork( |
| 721 const std::string& service_path) { | 737 const std::string& service_path) { |
| 722 if (service_path.empty()) | 738 if (service_path.empty()) |
| 723 return; | 739 return; |
| 724 FOR_EACH_OBSERVER( | 740 FOR_EACH_OBSERVER( |
| 725 NetworkPolicyObserver, observers_, PolicyAppliedToNetwork(service_path)); | 741 NetworkPolicyObserver, observers_, PolicyAppliedToNetwork(service_path)); |
| 726 } | 742 } |
| 727 | 743 |
| (...skipping 115 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 843 scoped_ptr<base::DictionaryValue> network_properties, | 859 scoped_ptr<base::DictionaryValue> network_properties, |
| 844 GetDevicePropertiesCallback send_callback, | 860 GetDevicePropertiesCallback send_callback, |
| 845 const std::string& error_name, | 861 const std::string& error_name, |
| 846 scoped_ptr<base::DictionaryValue> error_data) { | 862 scoped_ptr<base::DictionaryValue> error_data) { |
| 847 NET_LOG_ERROR("Error getting device properties", service_path); | 863 NET_LOG_ERROR("Error getting device properties", service_path); |
| 848 send_callback.Run(service_path, network_properties.Pass()); | 864 send_callback.Run(service_path, network_properties.Pass()); |
| 849 } | 865 } |
| 850 | 866 |
| 851 | 867 |
| 852 } // namespace chromeos | 868 } // namespace chromeos |
| OLD | NEW |