Chromium Code Reviews| 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 #ifndef CHROMEOS_NETWORK_MANAGED_NETWORK_CONFIGURATION_HANDLER_IMPL_H_ | 5 #ifndef CHROMEOS_NETWORK_MANAGED_NETWORK_CONFIGURATION_HANDLER_IMPL_H_ |
| 6 #define CHROMEOS_NETWORK_MANAGED_NETWORK_CONFIGURATION_HANDLER_IMPL_H_ | 6 #define CHROMEOS_NETWORK_MANAGED_NETWORK_CONFIGURATION_HANDLER_IMPL_H_ |
| 7 | 7 |
| 8 #include <map> | 8 #include <map> |
| 9 #include <string> | 9 #include <string> |
| 10 | 10 |
| 11 #include "base/basictypes.h" | 11 #include "base/basictypes.h" |
| 12 #include "base/compiler_specific.h" | 12 #include "base/compiler_specific.h" |
| 13 #include "base/memory/linked_ptr.h" | |
| 13 #include "base/memory/weak_ptr.h" | 14 #include "base/memory/weak_ptr.h" |
| 14 #include "chromeos/chromeos_export.h" | 15 #include "chromeos/chromeos_export.h" |
| 15 #include "chromeos/network/managed_network_configuration_handler.h" | 16 #include "chromeos/network/managed_network_configuration_handler.h" |
| 16 #include "chromeos/network/network_handler_callbacks.h" | 17 #include "chromeos/network/network_handler_callbacks.h" |
| 17 #include "chromeos/network/network_profile_observer.h" | 18 #include "chromeos/network/network_profile_observer.h" |
| 18 #include "chromeos/network/policy_applicator.h" | 19 #include "chromeos/network/policy_applicator.h" |
| 19 | 20 |
| 20 namespace base { | 21 namespace base { |
| 21 class DictionaryValue; | 22 class DictionaryValue; |
|
bartfab (slow)
2013/10/16 12:40:31
Nit: This forward-declaration is no longer needed.
pneubeck (no reviews)
2013/10/17 10:22:26
used at least in line 116, which is not an OVERRID
| |
| 22 } | 23 } |
| 23 | 24 |
| 24 namespace chromeos { | 25 namespace chromeos { |
| 25 | 26 |
| 26 class NetworkConfigurationHandler; | 27 class NetworkConfigurationHandler; |
| 27 struct NetworkProfile; | 28 struct NetworkProfile; |
| 28 class NetworkProfileHandler; | 29 class NetworkProfileHandler; |
| 29 class NetworkStateHandler; | 30 class NetworkStateHandler; |
| 30 | 31 |
| 31 class CHROMEOS_EXPORT ManagedNetworkConfigurationHandlerImpl | 32 class CHROMEOS_EXPORT ManagedNetworkConfigurationHandlerImpl |
| 32 : public ManagedNetworkConfigurationHandler, | 33 : public ManagedNetworkConfigurationHandler, |
| 33 public NetworkProfileObserver, | 34 public NetworkProfileObserver, |
| 34 public PolicyApplicator::ConfigurationHandler { | 35 public PolicyApplicator::ConfigurationHandler { |
| 35 public: | 36 public: |
| 36 typedef std::map<std::string, const base::DictionaryValue*> GuidToPolicyMap; | |
| 37 typedef std::map<std::string, GuidToPolicyMap> UserToPoliciesMap; | |
| 38 | |
| 39 virtual ~ManagedNetworkConfigurationHandlerImpl(); | 37 virtual ~ManagedNetworkConfigurationHandlerImpl(); |
| 40 | 38 |
| 41 // ManagedNetworkConfigurationHandler overrides | 39 // ManagedNetworkConfigurationHandler overrides |
| 42 virtual void AddObserver(NetworkPolicyObserver* observer) OVERRIDE; | 40 virtual void AddObserver(NetworkPolicyObserver* observer) OVERRIDE; |
| 43 virtual void RemoveObserver(NetworkPolicyObserver* observer) OVERRIDE; | 41 virtual void RemoveObserver(NetworkPolicyObserver* observer) OVERRIDE; |
| 44 | 42 |
| 45 virtual void GetProperties( | 43 virtual void GetProperties( |
| 46 const std::string& service_path, | 44 const std::string& service_path, |
| 47 const network_handler::DictionaryResultCallback& callback, | 45 const network_handler::DictionaryResultCallback& callback, |
| 48 const network_handler::ErrorCallback& error_callback) const OVERRIDE; | 46 const network_handler::ErrorCallback& error_callback) const OVERRIDE; |
| (...skipping 14 matching lines...) Expand all Loading... | |
| 63 const std::string& userhash, | 61 const std::string& userhash, |
| 64 const base::DictionaryValue& properties, | 62 const base::DictionaryValue& properties, |
| 65 const network_handler::StringResultCallback& callback, | 63 const network_handler::StringResultCallback& callback, |
| 66 const network_handler::ErrorCallback& error_callback) const OVERRIDE; | 64 const network_handler::ErrorCallback& error_callback) const OVERRIDE; |
| 67 | 65 |
| 68 virtual void RemoveConfiguration( | 66 virtual void RemoveConfiguration( |
| 69 const std::string& service_path, | 67 const std::string& service_path, |
| 70 const base::Closure& callback, | 68 const base::Closure& callback, |
| 71 const network_handler::ErrorCallback& error_callback) const OVERRIDE; | 69 const network_handler::ErrorCallback& error_callback) const OVERRIDE; |
| 72 | 70 |
| 73 virtual void SetPolicy(onc::ONCSource onc_source, | 71 virtual void SetPolicy( |
| 74 const std::string& userhash, | 72 onc::ONCSource onc_source, |
| 75 const base::ListValue& network_configs_onc) OVERRIDE; | 73 const std::string& userhash, |
| 74 const base::ListValue& network_configs_onc, | |
| 75 const base::DictionaryValue& global_network_config) OVERRIDE; | |
| 76 | 76 |
| 77 virtual const base::DictionaryValue* FindPolicyByGUID( | 77 virtual const base::DictionaryValue* FindPolicyByGUID( |
| 78 const std::string userhash, | 78 const std::string userhash, |
| 79 const std::string& guid, | 79 const std::string& guid, |
| 80 onc::ONCSource* onc_source) const OVERRIDE; | 80 onc::ONCSource* onc_source) const OVERRIDE; |
| 81 | 81 |
| 82 virtual const base::DictionaryValue* FindPolicyByGuidAndProfile( | 82 virtual const base::DictionaryValue* FindPolicyByGuidAndProfile( |
| 83 const std::string& guid, | 83 const std::string& guid, |
| 84 const std::string& profile_path) const OVERRIDE; | 84 const std::string& profile_path) const OVERRIDE; |
| 85 | 85 |
| 86 // NetworkProfileObserver overrides | 86 // NetworkProfileObserver overrides |
| 87 virtual void OnProfileAdded(const NetworkProfile& profile) OVERRIDE; | 87 virtual void OnProfileAdded(const NetworkProfile& profile) OVERRIDE; |
| 88 virtual void OnProfileRemoved(const NetworkProfile& profile) OVERRIDE; | 88 virtual void OnProfileRemoved(const NetworkProfile& profile) OVERRIDE; |
| 89 | 89 |
| 90 // PolicyApplicator::ConfigurationHandler overrides | 90 // PolicyApplicator::ConfigurationHandler overrides |
| 91 virtual void CreateConfigurationFromPolicy( | 91 virtual void CreateConfigurationFromPolicy( |
| 92 const base::DictionaryValue& shill_properties) OVERRIDE; | 92 const base::DictionaryValue& shill_properties) OVERRIDE; |
| 93 | 93 |
| 94 virtual void UpdateExistingConfigurationWithPropertiesFromPolicy( | |
| 95 const base::DictionaryValue& existing_properties, | |
| 96 const base::DictionaryValue& new_properties) OVERRIDE; | |
| 97 | |
| 94 private: | 98 private: |
| 95 friend class ClientCertResolverTest; | 99 friend class ClientCertResolverTest; |
| 96 friend class NetworkHandler; | 100 friend class NetworkHandler; |
| 97 friend class ManagedNetworkConfigurationHandlerTest; | 101 friend class ManagedNetworkConfigurationHandlerTest; |
| 98 | 102 |
| 103 struct Policies; | |
| 104 typedef std::map<std::string, linked_ptr<Policies> > UserToPoliciesMap; | |
| 105 | |
| 99 ManagedNetworkConfigurationHandlerImpl(); | 106 ManagedNetworkConfigurationHandlerImpl(); |
| 100 | 107 |
| 101 void Init(NetworkStateHandler* network_state_handler, | 108 void Init(NetworkStateHandler* network_state_handler, |
| 102 NetworkProfileHandler* network_profile_handler, | 109 NetworkProfileHandler* network_profile_handler, |
| 103 NetworkConfigurationHandler* network_configuration_handler); | 110 NetworkConfigurationHandler* network_configuration_handler); |
| 104 | 111 |
| 105 void GetManagedPropertiesCallback( | 112 void GetManagedPropertiesCallback( |
| 106 const network_handler::DictionaryResultCallback& callback, | 113 const network_handler::DictionaryResultCallback& callback, |
| 107 const network_handler::ErrorCallback& error_callback, | 114 const network_handler::ErrorCallback& error_callback, |
| 108 const std::string& service_path, | 115 const std::string& service_path, |
| 109 const base::DictionaryValue& shill_properties); | 116 const base::DictionaryValue& shill_properties); |
| 110 | 117 |
| 111 const GuidToPolicyMap* GetPoliciesForUser(const std::string& userhash) const; | 118 const Policies* GetPoliciesForUser(const std::string& userhash) const; |
| 112 const GuidToPolicyMap* GetPoliciesForProfile( | 119 const Policies* GetPoliciesForProfile(const NetworkProfile& profile) const; |
| 113 const NetworkProfile& profile) const; | |
| 114 | 120 |
| 115 void OnPolicyApplied(const std::string& service_path); | 121 void OnPolicyApplied(const std::string& service_path); |
| 116 | 122 |
| 117 // The DictionaryValues of the nested maps are owned by this class and are | 123 // The DictionaryValues of the nested maps are owned by this class and are |
| 118 // explicitly deleted where necessary. If present, the empty string maps to | 124 // explicitly deleted where necessary. If present, the empty string maps to |
| 119 // the device policy. | 125 // the device policy. |
| 120 UserToPoliciesMap policies_by_user_; | 126 UserToPoliciesMap policies_by_user_; |
| 121 | 127 |
| 122 // Local references to the associated handler instances. | 128 // Local references to the associated handler instances. |
| 123 NetworkStateHandler* network_state_handler_; | 129 NetworkStateHandler* network_state_handler_; |
| 124 NetworkProfileHandler* network_profile_handler_; | 130 NetworkProfileHandler* network_profile_handler_; |
| 125 NetworkConfigurationHandler* network_configuration_handler_; | 131 NetworkConfigurationHandler* network_configuration_handler_; |
| 126 | 132 |
| 127 ObserverList<NetworkPolicyObserver> observers_; | 133 ObserverList<NetworkPolicyObserver> observers_; |
| 128 | 134 |
| 129 // For Shill client callbacks | 135 // For Shill client callbacks |
| 130 base::WeakPtrFactory<ManagedNetworkConfigurationHandlerImpl> | 136 base::WeakPtrFactory<ManagedNetworkConfigurationHandlerImpl> |
| 131 weak_ptr_factory_; | 137 weak_ptr_factory_; |
| 132 | 138 |
| 133 DISALLOW_COPY_AND_ASSIGN(ManagedNetworkConfigurationHandlerImpl); | 139 DISALLOW_COPY_AND_ASSIGN(ManagedNetworkConfigurationHandlerImpl); |
| 134 }; | 140 }; |
| 135 | 141 |
| 136 } // namespace chromeos | 142 } // namespace chromeos |
| 137 | 143 |
| 138 #endif // CHROMEOS_NETWORK_MANAGED_NETWORK_CONFIGURATION_HANDLER_IMPL_H_ | 144 #endif // CHROMEOS_NETWORK_MANAGED_NETWORK_CONFIGURATION_HANDLER_IMPL_H_ |
| OLD | NEW |