| 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_impl.h" | 5 #include "chromeos/network/network_device_handler_impl.h" |
| 6 | 6 |
| 7 #include <stddef.h> | 7 #include <stddef.h> |
| 8 #include <stdint.h> | 8 #include <stdint.h> |
| 9 #include <utility> |
| 9 | 10 |
| 10 #include "base/bind.h" | 11 #include "base/bind.h" |
| 11 #include "base/location.h" | 12 #include "base/location.h" |
| 12 #include "base/single_thread_task_runner.h" | 13 #include "base/single_thread_task_runner.h" |
| 13 #include "base/strings/stringprintf.h" | 14 #include "base/strings/stringprintf.h" |
| 14 #include "base/thread_task_runner_handle.h" | 15 #include "base/thread_task_runner_handle.h" |
| 15 #include "base/time/time.h" | 16 #include "base/time/time.h" |
| 16 #include "base/values.h" | 17 #include "base/values.h" |
| 17 #include "chromeos/dbus/dbus_thread_manager.h" | 18 #include "chromeos/dbus/dbus_thread_manager.h" |
| 18 #include "chromeos/dbus/shill_device_client.h" | 19 #include "chromeos/dbus/shill_device_client.h" |
| (...skipping 231 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 250 return; | 251 return; |
| 251 | 252 |
| 252 const std::string error_name = | 253 const std::string error_name = |
| 253 dbus_error_name == shill::kErrorResultInProgress ? | 254 dbus_error_name == shill::kErrorResultInProgress ? |
| 254 NetworkDeviceHandler::kErrorTimeout : NetworkDeviceHandler::kErrorUnknown; | 255 NetworkDeviceHandler::kErrorTimeout : NetworkDeviceHandler::kErrorUnknown; |
| 255 const std::string& error_detail = params.ip_or_mac_address; | 256 const std::string& error_detail = params.ip_or_mac_address; |
| 256 scoped_ptr<base::DictionaryValue> error_data( | 257 scoped_ptr<base::DictionaryValue> error_data( |
| 257 network_handler::CreateDBusErrorData( | 258 network_handler::CreateDBusErrorData( |
| 258 device_path, error_name, error_detail, | 259 device_path, error_name, error_detail, |
| 259 dbus_error_name, dbus_error_message)); | 260 dbus_error_name, dbus_error_message)); |
| 260 error_callback.Run(error_name, error_data.Pass()); | 261 error_callback.Run(error_name, std::move(error_data)); |
| 261 } | 262 } |
| 262 | 263 |
| 263 void CallPerformTDLSOperation( | 264 void CallPerformTDLSOperation( |
| 264 const std::string& device_path, | 265 const std::string& device_path, |
| 265 const TDLSOperationParams& params, | 266 const TDLSOperationParams& params, |
| 266 const network_handler::StringResultCallback& callback, | 267 const network_handler::StringResultCallback& callback, |
| 267 const network_handler::ErrorCallback& error_callback) { | 268 const network_handler::ErrorCallback& error_callback) { |
| 268 LOG(ERROR) << "TDLS: " << params.operation; | 269 LOG(ERROR) << "TDLS: " << params.operation; |
| 269 NET_LOG(EVENT) << "CallPerformTDLSOperation: " << params.operation << ": " | 270 NET_LOG(EVENT) << "CallPerformTDLSOperation: " << params.operation << ": " |
| 270 << device_path; | 271 << device_path; |
| (...skipping 294 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 565 | 566 |
| 566 const DeviceState* NetworkDeviceHandlerImpl::GetWifiDeviceState( | 567 const DeviceState* NetworkDeviceHandlerImpl::GetWifiDeviceState( |
| 567 const network_handler::ErrorCallback& error_callback) { | 568 const network_handler::ErrorCallback& error_callback) { |
| 568 const DeviceState* device_state = | 569 const DeviceState* device_state = |
| 569 network_state_handler_->GetDeviceStateByType(NetworkTypePattern::WiFi()); | 570 network_state_handler_->GetDeviceStateByType(NetworkTypePattern::WiFi()); |
| 570 if (!device_state) { | 571 if (!device_state) { |
| 571 if (error_callback.is_null()) | 572 if (error_callback.is_null()) |
| 572 return NULL; | 573 return NULL; |
| 573 scoped_ptr<base::DictionaryValue> error_data(new base::DictionaryValue); | 574 scoped_ptr<base::DictionaryValue> error_data(new base::DictionaryValue); |
| 574 error_data->SetString(network_handler::kErrorName, kErrorDeviceMissing); | 575 error_data->SetString(network_handler::kErrorName, kErrorDeviceMissing); |
| 575 error_callback.Run(kErrorDeviceMissing, error_data.Pass()); | 576 error_callback.Run(kErrorDeviceMissing, std::move(error_data)); |
| 576 return NULL; | 577 return NULL; |
| 577 } | 578 } |
| 578 | 579 |
| 579 return device_state; | 580 return device_state; |
| 580 } | 581 } |
| 581 | 582 |
| 582 } // namespace chromeos | 583 } // namespace chromeos |
| OLD | NEW |