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> |
| 8 #include <stdint.h> |
| 9 |
7 #include "base/bind.h" | 10 #include "base/bind.h" |
8 #include "base/location.h" | 11 #include "base/location.h" |
9 #include "base/single_thread_task_runner.h" | 12 #include "base/single_thread_task_runner.h" |
10 #include "base/strings/stringprintf.h" | 13 #include "base/strings/stringprintf.h" |
11 #include "base/thread_task_runner_handle.h" | 14 #include "base/thread_task_runner_handle.h" |
12 #include "base/time/time.h" | 15 #include "base/time/time.h" |
13 #include "base/values.h" | 16 #include "base/values.h" |
14 #include "chromeos/dbus/dbus_thread_manager.h" | 17 #include "chromeos/dbus/dbus_thread_manager.h" |
15 #include "chromeos/dbus/shill_device_client.h" | 18 #include "chromeos/dbus/shill_device_client.h" |
16 #include "chromeos/dbus/shill_ipconfig_client.h" | 19 #include "chromeos/dbus/shill_ipconfig_client.h" |
(...skipping 147 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
164 if (!result.empty()) | 167 if (!result.empty()) |
165 event_desc += ": " + result; | 168 event_desc += ": " + result; |
166 NET_LOG(EVENT) << event_desc << ": " << device_path; | 169 NET_LOG(EVENT) << event_desc << ": " << device_path; |
167 | 170 |
168 if (params.operation != shill::kTDLSStatusOperation && !result.empty()) { | 171 if (params.operation != shill::kTDLSStatusOperation && !result.empty()) { |
169 NET_LOG(ERROR) << "Unexpected TDLS result: " + result << ": " | 172 NET_LOG(ERROR) << "Unexpected TDLS result: " + result << ": " |
170 << device_path; | 173 << device_path; |
171 } | 174 } |
172 | 175 |
173 TDLSOperationParams new_params; | 176 TDLSOperationParams new_params; |
174 const int64 kRequestStatusDelayMs = 500; | 177 const int64_t kRequestStatusDelayMs = 500; |
175 int64 request_delay_ms = 0; | 178 int64_t request_delay_ms = 0; |
176 if (params.operation == shill::kTDLSStatusOperation) { | 179 if (params.operation == shill::kTDLSStatusOperation) { |
177 // If this is the last operation, or the result is 'Nonexistent', | 180 // If this is the last operation, or the result is 'Nonexistent', |
178 // return the result. | 181 // return the result. |
179 if (params.next_operation.empty() || | 182 if (params.next_operation.empty() || |
180 result == shill::kTDLSNonexistentState) { | 183 result == shill::kTDLSNonexistentState) { |
181 if (!callback.is_null()) | 184 if (!callback.is_null()) |
182 callback.Run(result); | 185 callback.Run(result); |
183 return; | 186 return; |
184 } | 187 } |
185 // Otherwise start the next operation. | 188 // Otherwise start the next operation. |
(...skipping 35 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
221 // If a Setup operation receives an InProgress error, retry. | 224 // If a Setup operation receives an InProgress error, retry. |
222 const int kMaxRetries = 5; | 225 const int kMaxRetries = 5; |
223 if ((params.operation == shill::kTDLSDiscoverOperation || | 226 if ((params.operation == shill::kTDLSDiscoverOperation || |
224 params.operation == shill::kTDLSSetupOperation) && | 227 params.operation == shill::kTDLSSetupOperation) && |
225 dbus_error_name == shill::kErrorResultInProgress && | 228 dbus_error_name == shill::kErrorResultInProgress && |
226 params.retry_count < kMaxRetries) { | 229 params.retry_count < kMaxRetries) { |
227 TDLSOperationParams retry_params = params; | 230 TDLSOperationParams retry_params = params; |
228 ++retry_params.retry_count; | 231 ++retry_params.retry_count; |
229 NET_LOG(EVENT) << "TDLS Retry: " << params.retry_count << ": " | 232 NET_LOG(EVENT) << "TDLS Retry: " << params.retry_count << ": " |
230 << device_path; | 233 << device_path; |
231 const int64 kReRequestDelayMs = 1000; | 234 const int64_t kReRequestDelayMs = 1000; |
232 base::TimeDelta request_delay; | 235 base::TimeDelta request_delay; |
233 if (!DBusThreadManager::Get()->GetShillDeviceClient()->GetTestInterface()) | 236 if (!DBusThreadManager::Get()->GetShillDeviceClient()->GetTestInterface()) |
234 request_delay = base::TimeDelta::FromMilliseconds(kReRequestDelayMs); | 237 request_delay = base::TimeDelta::FromMilliseconds(kReRequestDelayMs); |
235 | 238 |
236 base::ThreadTaskRunnerHandle::Get()->PostDelayedTask( | 239 base::ThreadTaskRunnerHandle::Get()->PostDelayedTask( |
237 FROM_HERE, base::Bind(&CallPerformTDLSOperation, device_path, | 240 FROM_HERE, base::Bind(&CallPerformTDLSOperation, device_path, |
238 retry_params, callback, error_callback), | 241 retry_params, callback, error_callback), |
239 request_delay); | 242 request_delay); |
240 return; | 243 return; |
241 } | 244 } |
(...skipping 328 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
570 scoped_ptr<base::DictionaryValue> error_data(new base::DictionaryValue); | 573 scoped_ptr<base::DictionaryValue> error_data(new base::DictionaryValue); |
571 error_data->SetString(network_handler::kErrorName, kErrorDeviceMissing); | 574 error_data->SetString(network_handler::kErrorName, kErrorDeviceMissing); |
572 error_callback.Run(kErrorDeviceMissing, error_data.Pass()); | 575 error_callback.Run(kErrorDeviceMissing, error_data.Pass()); |
573 return NULL; | 576 return NULL; |
574 } | 577 } |
575 | 578 |
576 return device_state; | 579 return device_state; |
577 } | 580 } |
578 | 581 |
579 } // namespace chromeos | 582 } // namespace chromeos |
OLD | NEW |