Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(821)

Side by Side Diff: chromeos/network/network_configuration_handler.cc

Issue 12676017: Adding policy support to the new network configuration stack. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Fixed clang errors. Created 7 years, 8 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
OLDNEW
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2012 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/network_configuration_handler.h" 5 #include "chromeos/network/network_configuration_handler.h"
6 6
7 #include <string> 7 #include <string>
8 #include <vector> 8 #include <vector>
9 9
10 #include "base/bind.h" 10 #include "base/bind.h"
11 #include "base/logging.h" 11 #include "base/logging.h"
12 #include "base/memory/ref_counted.h" 12 #include "base/memory/ref_counted.h"
13 #include "base/memory/scoped_ptr.h" 13 #include "base/memory/scoped_ptr.h"
14 #include "base/values.h" 14 #include "base/values.h"
15 #include "chromeos/dbus/dbus_method_call_status.h" 15 #include "chromeos/dbus/dbus_method_call_status.h"
16 #include "chromeos/dbus/dbus_thread_manager.h" 16 #include "chromeos/dbus/dbus_thread_manager.h"
17 #include "chromeos/dbus/shill_manager_client.h" 17 #include "chromeos/dbus/shill_manager_client.h"
18 #include "chromeos/dbus/shill_service_client.h" 18 #include "chromeos/dbus/shill_service_client.h"
19 #include "dbus/object_path.h" 19 #include "dbus/object_path.h"
20 #include "third_party/cros_system_api/dbus/service_constants.h"
20 21
21 namespace chromeos { 22 namespace chromeos {
22 23
23 namespace { 24 namespace {
24 25
25 const char kLogModule[] = "NetworkConfigurationHandler"; 26 const char kLogModule[] = "NetworkConfigurationHandler";
26 27
27 NetworkConfigurationHandler* g_configuration_handler_instance = NULL; 28 NetworkConfigurationHandler* g_configuration_handler_instance = NULL;
28 29
29 // None of these error messages are user-facing: they should only appear in 30 // None of these error messages are user-facing: they should only appear in
(...skipping 156 matching lines...) Expand 10 before | Expand all | Expand 10 after
186 dbus::ObjectPath(service_path), 187 dbus::ObjectPath(service_path),
187 callback, 188 callback,
188 base::Bind(&network_handler::ShillErrorCallbackFunction, 189 base::Bind(&network_handler::ShillErrorCallbackFunction,
189 kLogModule, service_path, error_callback)); 190 kLogModule, service_path, error_callback));
190 } 191 }
191 192
192 void NetworkConfigurationHandler::CreateConfiguration( 193 void NetworkConfigurationHandler::CreateConfiguration(
193 const base::DictionaryValue& properties, 194 const base::DictionaryValue& properties,
194 const network_handler::StringResultCallback& callback, 195 const network_handler::StringResultCallback& callback,
195 const network_handler::ErrorCallback& error_callback) const { 196 const network_handler::ErrorCallback& error_callback) const {
196 DBusThreadManager::Get()->GetShillManagerClient()->GetService( 197 ShillManagerClient* manager =
197 properties, 198 DBusThreadManager::Get()->GetShillManagerClient();
198 base::Bind(&RunCreateNetworkCallback, callback), 199
199 base::Bind(&network_handler::ShillErrorCallbackFunction, 200 std::string type;
200 kLogModule, "", error_callback)); 201 properties.GetStringWithoutPathExpansion(flimflam::kTypeProperty, &type);
202 // Shill supports ConfigureServiceForProfile only for network type WiFi. In
203 // all other cases, we have to rely on GetService for now. This is
204 // unproblematic for VPN (user profile only), but will lead to inconsistencies
205 // with WiMax, for example.
206 if (type == flimflam::kTypeWifi) {
207 std::string profile;
208 properties.GetStringWithoutPathExpansion(flimflam::kProfileProperty,
209 &profile);
210 manager->ConfigureServiceForProfile(
211 dbus::ObjectPath(profile),
212 properties,
213 base::Bind(&RunCreateNetworkCallback, callback),
214 base::Bind(&network_handler::ShillErrorCallbackFunction,
215 kLogModule, "", error_callback));
216 } else {
217 manager->GetService(
218 properties,
219 base::Bind(&RunCreateNetworkCallback, callback),
220 base::Bind(&network_handler::ShillErrorCallbackFunction,
221 kLogModule, "", error_callback));
222 }
201 } 223 }
202 224
203 void NetworkConfigurationHandler::RemoveConfiguration( 225 void NetworkConfigurationHandler::RemoveConfiguration(
204 const std::string& service_path, 226 const std::string& service_path,
205 const base::Closure& callback, 227 const base::Closure& callback,
206 const network_handler::ErrorCallback& error_callback) const { 228 const network_handler::ErrorCallback& error_callback) const {
207 DBusThreadManager::Get()->GetShillServiceClient()->Remove( 229 DBusThreadManager::Get()->GetShillServiceClient()->Remove(
208 dbus::ObjectPath(service_path), 230 dbus::ObjectPath(service_path),
209 callback, 231 callback,
210 base::Bind(&network_handler::ShillErrorCallbackFunction, 232 base::Bind(&network_handler::ShillErrorCallbackFunction,
211 kLogModule, service_path, error_callback)); 233 kLogModule, service_path, error_callback));
212 } 234 }
213 235
214 NetworkConfigurationHandler::NetworkConfigurationHandler() { 236 NetworkConfigurationHandler::NetworkConfigurationHandler() {
215 } 237 }
216 238
217 NetworkConfigurationHandler::~NetworkConfigurationHandler() { 239 NetworkConfigurationHandler::~NetworkConfigurationHandler() {
218 } 240 }
219 241
220 } // namespace chromeos 242 } // namespace chromeos
OLDNEW
« no previous file with comments | « chromeos/network/managed_network_configuration_handler_unittest.cc ('k') | chromeos/network/network_state.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698