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 <map> |
9 #include <string> | 9 #include <string> |
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 "base/memory/weak_ptr.h" |
15 #include "chromeos/chromeos_export.h" | 15 #include "chromeos/chromeos_export.h" |
16 #include "chromeos/network/network_handler_callbacks.h" | 16 #include "chromeos/network/network_handler_callbacks.h" |
17 #include "chromeos/network/onc/onc_constants.h" | 17 #include "chromeos/network/onc/onc_constants.h" |
18 | 18 |
19 namespace base { | 19 namespace base { |
20 class DictionaryValue; | 20 class DictionaryValue; |
| 21 class ListValue; |
21 } | 22 } |
22 | 23 |
23 namespace chromeos { | 24 namespace chromeos { |
24 | 25 |
25 // The ManagedNetworkConfigurationHandler class is used to create and configure | 26 // The ManagedNetworkConfigurationHandler class is used to create and configure |
26 // networks in ChromeOS using ONC and takes care of network policies. | 27 // networks in ChromeOS using ONC and takes care of network policies. |
27 // | 28 // |
28 // Its interface exposes only ONC and should decouple users from Shill. | 29 // Its interface exposes only ONC and should decouple users from Shill. |
29 // Internally it translates ONC to Shill dictionaries and calls through to the | 30 // Internally it translates ONC to Shill dictionaries and calls through to the |
30 // NetworkConfigurationHandler. | 31 // NetworkConfigurationHandler. |
(...skipping 80 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
111 const network_handler::ErrorCallback& error_callback) const; | 112 const network_handler::ErrorCallback& error_callback) const; |
112 | 113 |
113 // Removes the user's configuration from the network with |service_path|. The | 114 // Removes the user's configuration from the network with |service_path|. The |
114 // network may still show up in the visible networks after this, but no user | 115 // network may still show up in the visible networks after this, but no user |
115 // configuration will remain. If it was managed, it will still be configured. | 116 // configuration will remain. If it was managed, it will still be configured. |
116 void RemoveConfiguration( | 117 void RemoveConfiguration( |
117 const std::string& service_path, | 118 const std::string& service_path, |
118 const base::Closure& callback, | 119 const base::Closure& callback, |
119 const network_handler::ErrorCallback& error_callback) const; | 120 const network_handler::ErrorCallback& error_callback) const; |
120 | 121 |
121 // Only to be called by NetworkConfigurationUpdater or from tests. | 122 // Only to be called by NetworkConfigurationUpdater or from tests. Sets |
122 // Sets |toplevel_onc| as the current policy of |onc_source|. The network | 123 // |network_configs_onc| as the current policy of |onc_source|. The network |
123 // configurations of the policy will be applied (not necessarily immediately) | 124 // configurations of the policy will be applied (not necessarily immediately) |
124 // to Shill's profiles and enforced in future configurations until the policy | 125 // to Shill's profiles and enforced in future configurations until the policy |
125 // associated with |onc_source| is changed again with this function. | 126 // associated with |onc_source| is changed again with this function. |
| 127 // This function doesn't validate the policy. The caller must ensure validity. |
126 void SetPolicy(onc::ONCSource onc_source, | 128 void SetPolicy(onc::ONCSource onc_source, |
127 const base::DictionaryValue& toplevel_onc); | 129 const base::ListValue& network_configs_onc); |
128 | 130 |
129 private: | 131 private: |
130 class PolicyApplicator; | 132 class PolicyApplicator; |
131 | 133 |
132 ManagedNetworkConfigurationHandler(); | 134 ManagedNetworkConfigurationHandler(); |
133 ~ManagedNetworkConfigurationHandler(); | 135 ~ManagedNetworkConfigurationHandler(); |
134 | 136 |
135 void GetManagedPropertiesCallback( | 137 void GetManagedPropertiesCallback( |
136 const network_handler::DictionaryResultCallback& callback, | 138 const network_handler::DictionaryResultCallback& callback, |
137 const network_handler::ErrorCallback& error_callback, | 139 const network_handler::ErrorCallback& error_callback, |
(...skipping 11 matching lines...) Expand all Loading... |
149 | 151 |
150 // For Shill client callbacks | 152 // For Shill client callbacks |
151 base::WeakPtrFactory<ManagedNetworkConfigurationHandler> weak_ptr_factory_; | 153 base::WeakPtrFactory<ManagedNetworkConfigurationHandler> weak_ptr_factory_; |
152 | 154 |
153 DISALLOW_COPY_AND_ASSIGN(ManagedNetworkConfigurationHandler); | 155 DISALLOW_COPY_AND_ASSIGN(ManagedNetworkConfigurationHandler); |
154 }; | 156 }; |
155 | 157 |
156 } // namespace chromeos | 158 } // namespace chromeos |
157 | 159 |
158 #endif // CHROMEOS_NETWORK_MANAGED_NETWORK_CONFIGURATION_HANDLER_H_ | 160 #endif // CHROMEOS_NETWORK_MANAGED_NETWORK_CONFIGURATION_HANDLER_H_ |
OLD | NEW |