From 8ffd206ba2dc08c17578afeac15a17be8b21b099 Mon Sep 17 00:00:00 2001 From: "pneubeck@chromium.org" Date: Tue, 22 Oct 2013 01:43:11 +0000 Subject: Enforce autoconnect policy in the network dialogs. This disables autoconnect in the dialog for configuring new or existing networks in CrOS if the new Autoconnect policy is set. Depends on: https://codereview.chromium.org/23526016/ BUG=280146 Review URL: https://codereview.chromium.org/27273006 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@229998 0039d316-1c4b-4281-b951-d872f2087c98 --- chromeos/network/managed_network_configuration_handler.h | 5 +++++ chromeos/network/managed_network_configuration_handler_impl.cc | 9 +++++++++ chromeos/network/managed_network_configuration_handler_impl.h | 3 +++ chromeos/network/mock_managed_network_configuration_handler.h | 2 ++ 4 files changed, 19 insertions(+) (limited to 'chromeos') diff --git a/chromeos/network/managed_network_configuration_handler.h b/chromeos/network/managed_network_configuration_handler.h index ea7a446..bc58492 100644 --- a/chromeos/network/managed_network_configuration_handler.h +++ b/chromeos/network/managed_network_configuration_handler.h @@ -121,6 +121,11 @@ class CHROMEOS_EXPORT ManagedNetworkConfigurationHandler { const std::string& guid, ::onc::ONCSource* onc_source) const = 0; + // Returns the global configuration of the policy of user |userhash| or device + // policy if |userhash| is empty. + virtual const base::DictionaryValue* GetGlobalConfigFromPolicy( + const std::string userhash) const = 0; + // Returns the policy with |guid| for profile |profile_path|. If such // doesn't exist, returns NULL. virtual const base::DictionaryValue* FindPolicyByGuidAndProfile( diff --git a/chromeos/network/managed_network_configuration_handler_impl.cc b/chromeos/network/managed_network_configuration_handler_impl.cc index c3c3242..73e5e07 100644 --- a/chromeos/network/managed_network_configuration_handler_impl.cc +++ b/chromeos/network/managed_network_configuration_handler_impl.cc @@ -552,6 +552,15 @@ ManagedNetworkConfigurationHandlerImpl::FindPolicyByGUID( } const base::DictionaryValue* +ManagedNetworkConfigurationHandlerImpl::GetGlobalConfigFromPolicy( + const std::string userhash) const { + const Policies* policies = GetPoliciesForUser(userhash); + if (!policies) + return NULL; + + return &policies->global_network_config; +} +const base::DictionaryValue* ManagedNetworkConfigurationHandlerImpl::FindPolicyByGuidAndProfile( const std::string& guid, const std::string& profile_path) const { diff --git a/chromeos/network/managed_network_configuration_handler_impl.h b/chromeos/network/managed_network_configuration_handler_impl.h index 95593b3..19b8eb8 100644 --- a/chromeos/network/managed_network_configuration_handler_impl.h +++ b/chromeos/network/managed_network_configuration_handler_impl.h @@ -79,6 +79,9 @@ class CHROMEOS_EXPORT ManagedNetworkConfigurationHandlerImpl const std::string& guid, onc::ONCSource* onc_source) const OVERRIDE; + virtual const base::DictionaryValue* GetGlobalConfigFromPolicy( + const std::string userhash) const OVERRIDE; + virtual const base::DictionaryValue* FindPolicyByGuidAndProfile( const std::string& guid, const std::string& profile_path) const OVERRIDE; diff --git a/chromeos/network/mock_managed_network_configuration_handler.h b/chromeos/network/mock_managed_network_configuration_handler.h index e73e598..4bde68d 100644 --- a/chromeos/network/mock_managed_network_configuration_handler.h +++ b/chromeos/network/mock_managed_network_configuration_handler.h @@ -59,6 +59,8 @@ class CHROMEOS_EXPORT MockManagedNetworkConfigurationHandler const std::string userhash, const std::string& guid, ::onc::ONCSource* onc_source)); + MOCK_CONST_METHOD1(GetGlobalConfigFromPolicy, + const base::DictionaryValue*(const std::string userhash)); MOCK_CONST_METHOD2( FindPolicyByGuidAndProfile, const base::DictionaryValue*(const std::string& guid, -- cgit v1.1