Chromium Code Reviews| OLD | NEW |
|---|---|
| 1 // Copyright (c) 2013 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 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_H_ | 5 #ifndef CHROMEOS_NETWORK_MANAGED_NETWORK_CONFIGURATION_HANDLER_H_ |
| 6 #define CHROMEOS_NETWORK_MANAGED_NETWORK_CONFIGURATION_HANDLER_H_ | 6 #define CHROMEOS_NETWORK_MANAGED_NETWORK_CONFIGURATION_HANDLER_H_ |
| 7 | 7 |
| 8 #include <map> | |
| 8 #include <string> | 9 #include <string> |
| 9 #include <vector> | |
| 10 | 10 |
| 11 #include "base/basictypes.h" | 11 #include "base/basictypes.h" |
| 12 #include "base/callback.h" | 12 #include "base/callback.h" |
| 13 #include "base/gtest_prod_util.h" | 13 #include "base/gtest_prod_util.h" |
| 14 #include "base/memory/weak_ptr.h" | |
| 14 #include "chromeos/chromeos_export.h" | 15 #include "chromeos/chromeos_export.h" |
| 15 #include "chromeos/network/network_handler_callbacks.h" | 16 #include "chromeos/network/network_handler_callbacks.h" |
| 17 #include "chromeos/network/onc/onc_constants.h" | |
| 16 | 18 |
| 17 namespace base { | 19 namespace base { |
| 18 class DictionaryValue; | 20 class DictionaryValue; |
| 19 } | 21 } |
| 20 | 22 |
| 21 namespace chromeos { | 23 namespace chromeos { |
| 22 | 24 |
| 23 // The ManagedNetworkConfigurationHandler class is used to create and configure | 25 // The ManagedNetworkConfigurationHandler class is used to create and configure |
| 24 // networks in ChromeOS using ONC. | 26 // networks in ChromeOS using ONC. |
| 25 // | 27 // |
| (...skipping 34 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 60 | 62 |
| 61 // Initialize() must be called before this. | 63 // Initialize() must be called before this. |
| 62 static ManagedNetworkConfigurationHandler* Get(); | 64 static ManagedNetworkConfigurationHandler* Get(); |
| 63 | 65 |
| 64 // Provides the properties of the network with |service_path| to |callback|. | 66 // Provides the properties of the network with |service_path| to |callback|. |
| 65 void GetProperties( | 67 void GetProperties( |
| 66 const std::string& service_path, | 68 const std::string& service_path, |
| 67 const network_handler::DictionaryResultCallback& callback, | 69 const network_handler::DictionaryResultCallback& callback, |
| 68 const network_handler::ErrorCallback& error_callback) const; | 70 const network_handler::ErrorCallback& error_callback) const; |
| 69 | 71 |
| 72 // Provides the managed properties of the network with |service_path| to | |
| 73 // |callback|. | |
| 74 void GetManagedProperties( | |
| 75 const std::string& service_path, | |
| 76 const network_handler::DictionaryResultCallback& callback, | |
| 77 const network_handler::ErrorCallback& error_callback); | |
| 78 | |
| 70 // Sets the user's settings of an already configured network with | 79 // Sets the user's settings of an already configured network with |
| 71 // |service_path|. A network can be initially configured by calling | 80 // |service_path|. A network can be initially configured by calling |
| 72 // CreateConfiguration or if it is managed by a policy. The given properties | 81 // CreateConfiguration or if it is managed by a policy. The given properties |
| 73 // will be merged with the existing settings, and it won't clear any existing | 82 // will be merged with the existing settings, and it won't clear any existing |
| 74 // properties. | 83 // properties. |
| 75 void SetProperties( | 84 void SetProperties( |
| 76 const std::string& service_path, | 85 const std::string& service_path, |
| 77 const base::DictionaryValue& properties, | 86 const base::DictionaryValue& user_settings, |
| 78 const base::Closure& callback, | 87 const base::Closure& callback, |
| 79 const network_handler::ErrorCallback& error_callback) const; | 88 const network_handler::ErrorCallback& error_callback) const; |
| 80 | 89 |
| 81 // Initiates a connection with network that has |service_path|. |callback| is | 90 // Initiates a connection with network that has |service_path|. |callback| is |
| 82 // called if the connection request was successfully handled. That doesn't | 91 // called if the connection request was successfully handled. That doesn't |
| 83 // mean that the connection was successfully established. | 92 // mean that the connection was successfully established. |
| 84 void Connect(const std::string& service_path, | 93 void Connect(const std::string& service_path, |
| 85 const base::Closure& callback, | 94 const base::Closure& callback, |
| 86 const network_handler::ErrorCallback& error_callback) const; | 95 const network_handler::ErrorCallback& error_callback) const; |
| 87 | 96 |
| (...skipping 14 matching lines...) Expand all Loading... | |
| 102 const network_handler::ErrorCallback& error_callback) const; | 111 const network_handler::ErrorCallback& error_callback) const; |
| 103 | 112 |
| 104 // Removes the user's configuration from the network with |service_path|. The | 113 // Removes the user's configuration from the network with |service_path|. The |
| 105 // network may still show up in the visible networks after this, but no user | 114 // network may still show up in the visible networks after this, but no user |
| 106 // configuration will remain. If it was managed, it will still be configured. | 115 // configuration will remain. If it was managed, it will still be configured. |
| 107 void RemoveConfiguration( | 116 void RemoveConfiguration( |
| 108 const std::string& service_path, | 117 const std::string& service_path, |
| 109 const base::Closure& callback, | 118 const base::Closure& callback, |
| 110 const network_handler::ErrorCallback& error_callback) const; | 119 const network_handler::ErrorCallback& error_callback) const; |
| 111 | 120 |
| 121 // Only to be called by NetworkConfigurationUpdater. | |
|
stevenjb
2013/04/11 18:20:08
Also describe what the method does.
pneubeck (no reviews)
2013/04/15 12:16:24
Done.
| |
| 122 void SetPolicy(onc::ONCSource onc_source, | |
| 123 const base::DictionaryValue& onc_dict); | |
| 124 | |
| 112 private: | 125 private: |
| 126 typedef std::map<std::string, const base::DictionaryValue*> PolicyMap; | |
| 127 | |
| 128 class PolicyApplicator; | |
| 129 | |
| 113 ManagedNetworkConfigurationHandler(); | 130 ManagedNetworkConfigurationHandler(); |
| 114 ~ManagedNetworkConfigurationHandler(); | 131 ~ManagedNetworkConfigurationHandler(); |
| 115 | 132 |
| 133 void GetManagedPropertiesCallback( | |
| 134 const network_handler::DictionaryResultCallback& callback, | |
| 135 const network_handler::ErrorCallback& error_callback, | |
| 136 const std::string& service_path, | |
| 137 const base::DictionaryValue& shill_properties); | |
| 138 | |
| 139 const PolicyMap* GetPoliciesForProfile(const std::string& profile) const; | |
| 140 | |
| 141 scoped_ptr<PolicyMap> user_policies_by_guid_; | |
| 142 scoped_ptr<PolicyMap> device_policies_by_guid_; | |
|
stevenjb
2013/04/11 18:20:08
This is pretty confusing; it's a pointer to a map
pneubeck (no reviews)
2013/04/15 12:16:24
Yes, that must be differentiated.
In the previous
stevenjb
2013/04/15 17:38:54
How about raw *'s here then, instead of scoped_ptr
| |
| 143 | |
| 144 // For Shill client callbacks | |
| 145 base::WeakPtrFactory<ManagedNetworkConfigurationHandler> weak_ptr_factory_; | |
| 146 | |
| 116 DISALLOW_COPY_AND_ASSIGN(ManagedNetworkConfigurationHandler); | 147 DISALLOW_COPY_AND_ASSIGN(ManagedNetworkConfigurationHandler); |
| 117 }; | 148 }; |
| 118 | 149 |
| 119 } // namespace chromeos | 150 } // namespace chromeos |
| 120 | 151 |
| 121 #endif // CHROMEOS_NETWORK_MANAGED_NETWORK_CONFIGURATION_HANDLER_H_ | 152 #endif // CHROMEOS_NETWORK_MANAGED_NETWORK_CONFIGURATION_HANDLER_H_ |
| OLD | NEW |