OLD | NEW |
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/format_macros.h" | 11 #include "base/format_macros.h" |
12 #include "base/json/json_writer.h" | 12 #include "base/json/json_writer.h" |
13 #include "base/logging.h" | 13 #include "base/logging.h" |
14 #include "base/memory/ref_counted.h" | 14 #include "base/memory/ref_counted.h" |
15 #include "base/memory/scoped_ptr.h" | 15 #include "base/memory/scoped_ptr.h" |
16 #include "base/stl_util.h" | 16 #include "base/stl_util.h" |
17 #include "base/strings/stringprintf.h" | 17 #include "base/strings/stringprintf.h" |
18 #include "base/values.h" | 18 #include "base/values.h" |
19 #include "chromeos/dbus/dbus_thread_manager.h" | 19 #include "chromeos/dbus/dbus_thread_manager.h" |
20 #include "chromeos/dbus/shill_manager_client.h" | 20 #include "chromeos/dbus/shill_manager_client.h" |
21 #include "chromeos/dbus/shill_profile_client.h" | 21 #include "chromeos/dbus/shill_profile_client.h" |
22 #include "chromeos/dbus/shill_service_client.h" | 22 #include "chromeos/dbus/shill_service_client.h" |
23 #include "chromeos/network/network_event_log.h" | 23 #include "chromeos/network/network_event_log.h" |
| 24 #include "chromeos/network/network_state.h" |
24 #include "chromeos/network/network_state_handler.h" | 25 #include "chromeos/network/network_state_handler.h" |
25 #include "chromeos/network/shill_property_util.h" | 26 #include "chromeos/network/shill_property_util.h" |
26 #include "dbus/object_path.h" | 27 #include "dbus/object_path.h" |
27 #include "third_party/cros_system_api/dbus/service_constants.h" | 28 #include "third_party/cros_system_api/dbus/service_constants.h" |
28 | 29 |
29 namespace chromeos { | 30 namespace chromeos { |
30 | 31 |
31 namespace { | 32 namespace { |
32 | 33 |
33 // Strip surrounding "" from keys (if present). | 34 // Strip surrounding "" from keys (if present). |
(...skipping 262 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
296 "", | 297 "", |
297 error_callback)); | 298 error_callback)); |
298 } | 299 } |
299 | 300 |
300 void NetworkConfigurationHandler::RemoveConfiguration( | 301 void NetworkConfigurationHandler::RemoveConfiguration( |
301 const std::string& service_path, | 302 const std::string& service_path, |
302 const base::Closure& callback, | 303 const base::Closure& callback, |
303 const network_handler::ErrorCallback& error_callback) { | 304 const network_handler::ErrorCallback& error_callback) { |
304 // Service.Remove is not reliable. Instead, request the profile entries | 305 // Service.Remove is not reliable. Instead, request the profile entries |
305 // for the service and remove each entry. | 306 // for the service and remove each entry. |
306 if (ContainsKey(profile_entry_deleters_,service_path)) { | 307 if (ContainsKey(profile_entry_deleters_, service_path)) { |
307 InvokeErrorCallback( | 308 InvokeErrorCallback( |
308 service_path, error_callback, "RemoveConfigurationInProgress"); | 309 service_path, error_callback, "RemoveConfigurationInProgress"); |
309 return; | 310 return; |
310 } | 311 } |
| 312 |
311 NET_LOG_USER("Remove Configuration", service_path); | 313 NET_LOG_USER("Remove Configuration", service_path); |
312 ProfileEntryDeleter* deleter = | 314 ProfileEntryDeleter* deleter = |
313 new ProfileEntryDeleter(this, service_path, callback, error_callback); | 315 new ProfileEntryDeleter(this, service_path, callback, error_callback); |
314 profile_entry_deleters_[service_path] = deleter; | 316 profile_entry_deleters_[service_path] = deleter; |
315 deleter->Run(); | 317 deleter->Run(); |
316 } | 318 } |
317 | 319 |
318 void NetworkConfigurationHandler::SetNetworkProfile( | 320 void NetworkConfigurationHandler::SetNetworkProfile( |
319 const std::string& service_path, | 321 const std::string& service_path, |
320 const std::string& profile_path, | 322 const std::string& profile_path, |
(...skipping 107 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
428 | 430 |
429 // static | 431 // static |
430 NetworkConfigurationHandler* NetworkConfigurationHandler::InitializeForTest( | 432 NetworkConfigurationHandler* NetworkConfigurationHandler::InitializeForTest( |
431 NetworkStateHandler* network_state_handler) { | 433 NetworkStateHandler* network_state_handler) { |
432 NetworkConfigurationHandler* handler = new NetworkConfigurationHandler(); | 434 NetworkConfigurationHandler* handler = new NetworkConfigurationHandler(); |
433 handler->Init(network_state_handler); | 435 handler->Init(network_state_handler); |
434 return handler; | 436 return handler; |
435 } | 437 } |
436 | 438 |
437 } // namespace chromeos | 439 } // namespace chromeos |
OLD | NEW |