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 #include "chromeos/network/network_device_handler.h" | 5 #include "chromeos/network/network_device_handler.h" |
6 | 6 |
7 #include "base/bind.h" | 7 #include "base/bind.h" |
8 #include "base/values.h" | 8 #include "base/values.h" |
9 #include "chromeos/dbus/dbus_thread_manager.h" | 9 #include "chromeos/dbus/dbus_thread_manager.h" |
10 #include "chromeos/dbus/shill_device_client.h" | 10 #include "chromeos/dbus/shill_device_client.h" |
(...skipping 15 matching lines...) Expand all Loading... |
26 const char kShillErrorNotSupported[] = | 26 const char kShillErrorNotSupported[] = |
27 "org.chromium.flimflam.Error.NotSupported"; | 27 "org.chromium.flimflam.Error.NotSupported"; |
28 | 28 |
29 std::string GetErrorNameForShillError(const std::string& shill_error_name) { | 29 std::string GetErrorNameForShillError(const std::string& shill_error_name) { |
30 // TODO(armansito): Use the new SIM error names once the ones below get | 30 // TODO(armansito): Use the new SIM error names once the ones below get |
31 // deprecated (crbug.com/256855) | 31 // deprecated (crbug.com/256855) |
32 if (shill_error_name == kShillErrorFailure) | 32 if (shill_error_name == kShillErrorFailure) |
33 return NetworkDeviceHandler::kErrorFailure; | 33 return NetworkDeviceHandler::kErrorFailure; |
34 if (shill_error_name == kShillErrorNotSupported) | 34 if (shill_error_name == kShillErrorNotSupported) |
35 return NetworkDeviceHandler::kErrorNotSupported; | 35 return NetworkDeviceHandler::kErrorNotSupported; |
36 if (shill_error_name == flimflam::kErrorIncorrectPinMsg) | 36 if (shill_error_name == shill::kErrorIncorrectPinMsg) |
37 return NetworkDeviceHandler::kErrorIncorrectPin; | 37 return NetworkDeviceHandler::kErrorIncorrectPin; |
38 if (shill_error_name == flimflam::kErrorPinBlockedMsg) | 38 if (shill_error_name == shill::kErrorPinBlockedMsg) |
39 return NetworkDeviceHandler::kErrorPinBlocked; | 39 return NetworkDeviceHandler::kErrorPinBlocked; |
40 if (shill_error_name == flimflam::kErrorPinRequiredMsg) | 40 if (shill_error_name == shill::kErrorPinRequiredMsg) |
41 return NetworkDeviceHandler::kErrorPinRequired; | 41 return NetworkDeviceHandler::kErrorPinRequired; |
42 return NetworkDeviceHandler::kErrorUnknown; | 42 return NetworkDeviceHandler::kErrorUnknown; |
43 } | 43 } |
44 | 44 |
45 void HandleShillCallFailure( | 45 void HandleShillCallFailure( |
46 const std::string& device_path, | 46 const std::string& device_path, |
47 const network_handler::ErrorCallback& error_callback, | 47 const network_handler::ErrorCallback& error_callback, |
48 const std::string& shill_error_name, | 48 const std::string& shill_error_name, |
49 const std::string& shill_error_message) { | 49 const std::string& shill_error_message) { |
50 network_handler::ShillErrorCallbackFunction( | 50 network_handler::ShillErrorCallbackFunction( |
(...skipping 15 matching lines...) Expand all Loading... |
66 } | 66 } |
67 } | 67 } |
68 | 68 |
69 void RefreshIPConfigsCallback( | 69 void RefreshIPConfigsCallback( |
70 const base::Closure& callback, | 70 const base::Closure& callback, |
71 const network_handler::ErrorCallback& error_callback, | 71 const network_handler::ErrorCallback& error_callback, |
72 const std::string& device_path, | 72 const std::string& device_path, |
73 const base::DictionaryValue& properties) { | 73 const base::DictionaryValue& properties) { |
74 const ListValue* ip_configs; | 74 const ListValue* ip_configs; |
75 if (!properties.GetListWithoutPathExpansion( | 75 if (!properties.GetListWithoutPathExpansion( |
76 flimflam::kIPConfigsProperty, &ip_configs)) { | 76 shill::kIPConfigsProperty, &ip_configs)) { |
77 NET_LOG_ERROR("RequestRefreshIPConfigs Failed", device_path); | 77 NET_LOG_ERROR("RequestRefreshIPConfigs Failed", device_path); |
78 network_handler::ShillErrorCallbackFunction( | 78 network_handler::ShillErrorCallbackFunction( |
79 "RequestRefreshIPConfigs Failed", | 79 "RequestRefreshIPConfigs Failed", |
80 device_path, | 80 device_path, |
81 error_callback, | 81 error_callback, |
82 std::string("Missing ") + flimflam::kIPConfigsProperty, ""); | 82 std::string("Missing ") + shill::kIPConfigsProperty, ""); |
83 return; | 83 return; |
84 } | 84 } |
85 | 85 |
86 for (size_t i = 0; i < ip_configs->GetSize(); i++) { | 86 for (size_t i = 0; i < ip_configs->GetSize(); i++) { |
87 std::string ipconfig_path; | 87 std::string ipconfig_path; |
88 if (!ip_configs->GetString(i, &ipconfig_path)) | 88 if (!ip_configs->GetString(i, &ipconfig_path)) |
89 continue; | 89 continue; |
90 DBusThreadManager::Get()->GetShillIPConfigClient()->Refresh( | 90 DBusThreadManager::Get()->GetShillIPConfigClient()->Refresh( |
91 dbus::ObjectPath(ipconfig_path), | 91 dbus::ObjectPath(ipconfig_path), |
92 base::Bind(&IPConfigRefreshCallback, ipconfig_path)); | 92 base::Bind(&IPConfigRefreshCallback, ipconfig_path)); |
(...skipping 166 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
259 void NetworkDeviceHandler::HandleShillCallFailureForTest( | 259 void NetworkDeviceHandler::HandleShillCallFailureForTest( |
260 const std::string& device_path, | 260 const std::string& device_path, |
261 const network_handler::ErrorCallback& error_callback, | 261 const network_handler::ErrorCallback& error_callback, |
262 const std::string& shill_error_name, | 262 const std::string& shill_error_name, |
263 const std::string& shill_error_message) { | 263 const std::string& shill_error_message) { |
264 HandleShillCallFailure( | 264 HandleShillCallFailure( |
265 device_path, error_callback, shill_error_name, shill_error_message); | 265 device_path, error_callback, shill_error_name, shill_error_message); |
266 } | 266 } |
267 | 267 |
268 } // namespace chromeos | 268 } // namespace chromeos |
OLD | NEW |