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 "chrome/browser/chromeos/cros/cros_network_functions.h" | 5 #include "chrome/browser/chromeos/cros/cros_network_functions.h" |
6 | 6 |
7 #include "base/bind.h" | 7 #include "base/bind.h" |
8 #include "base/bind_helpers.h" | |
8 #include "base/memory/scoped_ptr.h" | 9 #include "base/memory/scoped_ptr.h" |
9 #include "base/string_tokenizer.h" | 10 #include "base/string_tokenizer.h" |
10 #include "base/stringprintf.h" | 11 #include "base/stringprintf.h" |
11 #include "base/values.h" | 12 #include "base/values.h" |
12 #include "chrome/browser/chromeos/cros/sms_watcher.h" | 13 #include "chrome/browser/chromeos/cros/sms_watcher.h" |
13 #include "chromeos/dbus/cashew_client.h" | 14 #include "chromeos/dbus/cashew_client.h" |
14 #include "chromeos/dbus/dbus_thread_manager.h" | 15 #include "chromeos/dbus/dbus_thread_manager.h" |
15 #include "chromeos/dbus/shill_device_client.h" | 16 #include "chromeos/dbus/shill_device_client.h" |
16 #include "chromeos/dbus/shill_ipconfig_client.h" | 17 #include "chromeos/dbus/shill_ipconfig_client.h" |
17 #include "chromeos/dbus/shill_manager_client.h" | 18 #include "chromeos/dbus/shill_manager_client.h" |
18 #include "chromeos/dbus/shill_network_client.h" | 19 #include "chromeos/dbus/shill_network_client.h" |
19 #include "chromeos/dbus/shill_profile_client.h" | 20 #include "chromeos/dbus/shill_profile_client.h" |
20 #include "chromeos/dbus/shill_service_client.h" | 21 #include "chromeos/dbus/shill_service_client.h" |
21 #include "dbus/object_path.h" | 22 #include "dbus/object_path.h" |
22 #include "third_party/cros_system_api/dbus/service_constants.h" | 23 #include "third_party/cros_system_api/dbus/service_constants.h" |
23 | 24 |
25 using base::DoNothing; | |
26 | |
24 namespace chromeos { | 27 namespace chromeos { |
25 | 28 |
26 namespace { | 29 namespace { |
27 | 30 |
28 // Class to watch network manager's properties without Libcros. | 31 // Class to watch network manager's properties without Libcros. |
29 class NetworkManagerPropertiesWatcher : public CrosNetworkWatcher { | 32 class NetworkManagerPropertiesWatcher : public CrosNetworkWatcher { |
30 public: | 33 public: |
31 NetworkManagerPropertiesWatcher( | 34 NetworkManagerPropertiesWatcher( |
32 const NetworkPropertiesWatcherCallback& callback) { | 35 const NetworkPropertiesWatcherCallback& callback) { |
33 DBusThreadManager::Get()->GetShillManagerClient()-> | 36 DBusThreadManager::Get()->GetShillManagerClient()-> |
(...skipping 139 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
173 &plan->data_bytes_used); | 176 &plan->data_bytes_used); |
174 data_plan_vector->push_back(plan); | 177 data_plan_vector->push_back(plan); |
175 } | 178 } |
176 callback_.Run(service, data_plan_vector); | 179 callback_.Run(service, data_plan_vector); |
177 } | 180 } |
178 | 181 |
179 DataPlanUpdateWatcherCallback callback_; | 182 DataPlanUpdateWatcherCallback callback_; |
180 }; | 183 }; |
181 | 184 |
182 // Does nothing. Used as a callback. | 185 // Does nothing. Used as a callback. |
183 void DoNothing(DBusMethodCallStatus call_status) {} | 186 void DoNothingWithCallStatus(DBusMethodCallStatus call_status) {} |
187 | |
188 // Ignores errors. | |
189 void IgnoreErrors(const std::string& error_name, | |
190 const std::string& error_message) {} | |
184 | 191 |
185 // A callback used to implement CrosRequest*Properties functions. | 192 // A callback used to implement CrosRequest*Properties functions. |
186 void RunCallbackWithDictionaryValue(const NetworkPropertiesCallback& callback, | 193 void RunCallbackWithDictionaryValue(const NetworkPropertiesCallback& callback, |
187 const std::string& path, | 194 const std::string& path, |
188 DBusMethodCallStatus call_status, | 195 DBusMethodCallStatus call_status, |
189 const base::DictionaryValue& value) { | 196 const base::DictionaryValue& value) { |
190 callback.Run(path, call_status == DBUS_METHOD_CALL_SUCCESS ? &value : NULL); | 197 callback.Run(path, call_status == DBUS_METHOD_CALL_SUCCESS ? &value : NULL); |
191 } | 198 } |
192 | 199 |
200 // A callback used to implement CrosRequest*Properties functions. | |
201 void RunCallbackWithDictionaryValueNoStatus( | |
202 const NetworkPropertiesCallback& callback, | |
203 const std::string& path, | |
204 const base::DictionaryValue& value) { | |
205 callback.Run(path, &value); | |
206 } | |
207 | |
208 // A callback used to implement the error callback for CrosRequest*Properties | |
209 // functions. | |
210 void RunCallbackWithDictionaryValueError( | |
211 const NetworkPropertiesCallback& callback, | |
212 const std::string& path, | |
213 const std::string& error_name, | |
214 const std::string& error_message) { | |
215 callback.Run(path, NULL); | |
216 } | |
217 | |
193 // Used as a callback for ShillManagerClient::GetService | 218 // Used as a callback for ShillManagerClient::GetService |
194 void OnGetService(const NetworkPropertiesCallback& callback, | 219 void OnGetService(const NetworkPropertiesCallback& callback, |
195 DBusMethodCallStatus call_status, | |
196 const dbus::ObjectPath& service_path) { | 220 const dbus::ObjectPath& service_path) { |
197 if (call_status == DBUS_METHOD_CALL_SUCCESS) { | 221 VLOG(1) << "OnGetServiceService: " << service_path.value(); |
198 VLOG(1) << "OnGetServiceService: " << service_path.value(); | 222 DBusThreadManager::Get()->GetShillServiceClient()->GetProperties( |
199 DBusThreadManager::Get()->GetShillServiceClient()->GetProperties( | 223 service_path, base::Bind(&RunCallbackWithDictionaryValue, |
200 service_path, base::Bind(&RunCallbackWithDictionaryValue, | 224 callback, |
201 callback, | 225 service_path.value())); |
202 service_path.value())); | |
203 } | |
204 } | 226 } |
205 | 227 |
206 // A callback used to call a NetworkOperationCallback on error. | 228 // A callback used to call a NetworkOperationCallback on error. |
207 void OnNetworkActionError(const NetworkOperationCallback& callback, | 229 void OnNetworkActionError(const NetworkOperationCallback& callback, |
208 const std::string& path, | 230 const std::string& path, |
209 const std::string& error_name, | 231 const std::string& error_name, |
210 const std::string& error_message) { | 232 const std::string& error_message) { |
211 if (error_name.empty()) | 233 if (error_name.empty()) |
212 callback.Run(path, NETWORK_METHOD_ERROR_LOCAL, ""); | 234 callback.Run(path, NETWORK_METHOD_ERROR_LOCAL, ""); |
213 else | 235 else |
(...skipping 95 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
309 return DBusThreadManager::Get()->GetShillServiceClient()-> | 331 return DBusThreadManager::Get()->GetShillServiceClient()-> |
310 CallActivateCellularModemAndBlock(dbus::ObjectPath(service_path), | 332 CallActivateCellularModemAndBlock(dbus::ObjectPath(service_path), |
311 carrier); | 333 carrier); |
312 } | 334 } |
313 | 335 |
314 void CrosSetNetworkServiceProperty(const std::string& service_path, | 336 void CrosSetNetworkServiceProperty(const std::string& service_path, |
315 const std::string& property, | 337 const std::string& property, |
316 const base::Value& value) { | 338 const base::Value& value) { |
317 DBusThreadManager::Get()->GetShillServiceClient()->SetProperty( | 339 DBusThreadManager::Get()->GetShillServiceClient()->SetProperty( |
318 dbus::ObjectPath(service_path), property, value, | 340 dbus::ObjectPath(service_path), property, value, |
319 base::Bind(&DoNothing)); | 341 base::Bind(&DoNothing), |
342 base::Bind(&IgnoreErrors)); | |
320 } | 343 } |
321 | 344 |
322 void CrosClearNetworkServiceProperty(const std::string& service_path, | 345 void CrosClearNetworkServiceProperty(const std::string& service_path, |
323 const std::string& property) { | 346 const std::string& property) { |
324 DBusThreadManager::Get()->GetShillServiceClient()->ClearProperty( | 347 DBusThreadManager::Get()->GetShillServiceClient()->ClearProperty( |
325 dbus::ObjectPath(service_path), property, base::Bind(&DoNothing)); | 348 dbus::ObjectPath(service_path), property, base::Bind(&DoNothing), |
349 base::Bind(&IgnoreErrors)); | |
satorux1
2012/09/25 21:58:41
nit: indentation is off
Greg Spencer (Chromium)
2012/09/26 23:36:33
Done.
| |
326 } | 350 } |
327 | 351 |
328 void CrosSetNetworkDeviceProperty(const std::string& device_path, | 352 void CrosSetNetworkDeviceProperty(const std::string& device_path, |
329 const std::string& property, | 353 const std::string& property, |
330 const base::Value& value) { | 354 const base::Value& value) { |
331 DBusThreadManager::Get()->GetShillDeviceClient()->SetProperty( | 355 DBusThreadManager::Get()->GetShillDeviceClient()->SetProperty( |
332 dbus::ObjectPath(device_path), property, value, base::Bind(&DoNothing)); | 356 dbus::ObjectPath(device_path), property, value, base::Bind(&DoNothing), |
357 base::Bind(&IgnoreErrors)); | |
333 } | 358 } |
334 | 359 |
335 void CrosSetNetworkIPConfigProperty(const std::string& ipconfig_path, | 360 void CrosSetNetworkIPConfigProperty(const std::string& ipconfig_path, |
336 const std::string& property, | 361 const std::string& property, |
337 const base::Value& value) { | 362 const base::Value& value) { |
338 DBusThreadManager::Get()->GetShillIPConfigClient()->SetProperty( | 363 DBusThreadManager::Get()->GetShillIPConfigClient()->SetProperty( |
339 dbus::ObjectPath(ipconfig_path), property, value, | 364 dbus::ObjectPath(ipconfig_path), property, value, |
340 base::Bind(&DoNothing)); | 365 base::Bind(&DoNothingWithCallStatus)); |
341 } | 366 } |
342 | 367 |
343 void CrosSetNetworkManagerProperty(const std::string& property, | 368 void CrosSetNetworkManagerProperty(const std::string& property, |
344 const base::Value& value) { | 369 const base::Value& value) { |
345 DBusThreadManager::Get()->GetShillManagerClient()->SetProperty( | 370 DBusThreadManager::Get()->GetShillManagerClient()->SetProperty( |
346 property, value, base::Bind(&DoNothing)); | 371 property, value, base::Bind(&DoNothing), |
372 base::Bind(&IgnoreErrors)); | |
347 } | 373 } |
348 | 374 |
349 void CrosDeleteServiceFromProfile(const std::string& profile_path, | 375 void CrosDeleteServiceFromProfile(const std::string& profile_path, |
350 const std::string& service_path) { | 376 const std::string& service_path) { |
351 DBusThreadManager::Get()->GetShillProfileClient()->DeleteEntry( | 377 DBusThreadManager::Get()->GetShillProfileClient()->DeleteEntry( |
352 dbus::ObjectPath(profile_path), service_path, base::Bind(&DoNothing)); | 378 dbus::ObjectPath(profile_path), |
379 service_path, | |
380 base::Bind(&DoNothing), | |
381 base::Bind(&IgnoreErrors)); | |
353 } | 382 } |
354 | 383 |
355 void CrosRequestCellularDataPlanUpdate(const std::string& modem_service_path) { | 384 void CrosRequestCellularDataPlanUpdate(const std::string& modem_service_path) { |
356 DBusThreadManager::Get()->GetCashewClient()->RequestDataPlansUpdate( | 385 DBusThreadManager::Get()->GetCashewClient()->RequestDataPlansUpdate( |
357 modem_service_path); | 386 modem_service_path); |
358 } | 387 } |
359 | 388 |
360 CrosNetworkWatcher* CrosMonitorNetworkManagerProperties( | 389 CrosNetworkWatcher* CrosMonitorNetworkManagerProperties( |
361 const NetworkPropertiesWatcherCallback& callback) { | 390 const NetworkPropertiesWatcherCallback& callback) { |
362 return new NetworkManagerPropertiesWatcher(callback); | 391 return new NetworkManagerPropertiesWatcher(callback); |
(...skipping 53 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
416 DBusThreadManager::Get()->GetShillDeviceClient()->GetProperties( | 445 DBusThreadManager::Get()->GetShillDeviceClient()->GetProperties( |
417 dbus::ObjectPath(device_path), | 446 dbus::ObjectPath(device_path), |
418 base::Bind(&RunCallbackWithDictionaryValue, callback, device_path)); | 447 base::Bind(&RunCallbackWithDictionaryValue, callback, device_path)); |
419 } | 448 } |
420 | 449 |
421 void CrosRequestNetworkProfileProperties( | 450 void CrosRequestNetworkProfileProperties( |
422 const std::string& profile_path, | 451 const std::string& profile_path, |
423 const NetworkPropertiesCallback& callback) { | 452 const NetworkPropertiesCallback& callback) { |
424 DBusThreadManager::Get()->GetShillProfileClient()->GetProperties( | 453 DBusThreadManager::Get()->GetShillProfileClient()->GetProperties( |
425 dbus::ObjectPath(profile_path), | 454 dbus::ObjectPath(profile_path), |
426 base::Bind(&RunCallbackWithDictionaryValue, callback, profile_path)); | 455 base::Bind(&RunCallbackWithDictionaryValueNoStatus, |
456 callback, profile_path), | |
457 base::Bind(&RunCallbackWithDictionaryValueError, callback, profile_path)); | |
427 } | 458 } |
428 | 459 |
429 void CrosRequestNetworkProfileEntryProperties( | 460 void CrosRequestNetworkProfileEntryProperties( |
430 const std::string& profile_path, | 461 const std::string& profile_path, |
431 const std::string& profile_entry_path, | 462 const std::string& profile_entry_path, |
432 const NetworkPropertiesCallback& callback) { | 463 const NetworkPropertiesCallback& callback) { |
433 DBusThreadManager::Get()->GetShillProfileClient()->GetEntry( | 464 DBusThreadManager::Get()->GetShillProfileClient()->GetEntry( |
434 dbus::ObjectPath(profile_path), | 465 dbus::ObjectPath(profile_path), |
435 profile_entry_path, | 466 profile_entry_path, |
436 base::Bind(&RunCallbackWithDictionaryValue, | 467 base::Bind(&RunCallbackWithDictionaryValueNoStatus, |
468 callback, | |
469 profile_entry_path), | |
470 base::Bind(&RunCallbackWithDictionaryValueError, | |
437 callback, | 471 callback, |
438 profile_entry_path)); | 472 profile_entry_path)); |
439 } | 473 } |
440 | 474 |
441 void CrosRequestHiddenWifiNetworkProperties( | 475 void CrosRequestHiddenWifiNetworkProperties( |
442 const std::string& ssid, | 476 const std::string& ssid, |
443 const std::string& security, | 477 const std::string& security, |
444 const NetworkPropertiesCallback& callback) { | 478 const NetworkPropertiesCallback& callback) { |
445 base::DictionaryValue properties; | 479 base::DictionaryValue properties; |
446 properties.SetWithoutPathExpansion( | 480 properties.SetWithoutPathExpansion( |
447 flimflam::kModeProperty, | 481 flimflam::kModeProperty, |
448 base::Value::CreateStringValue(flimflam::kModeManaged)); | 482 base::Value::CreateStringValue(flimflam::kModeManaged)); |
449 properties.SetWithoutPathExpansion( | 483 properties.SetWithoutPathExpansion( |
450 flimflam::kTypeProperty, | 484 flimflam::kTypeProperty, |
451 base::Value::CreateStringValue(flimflam::kTypeWifi)); | 485 base::Value::CreateStringValue(flimflam::kTypeWifi)); |
452 properties.SetWithoutPathExpansion( | 486 properties.SetWithoutPathExpansion( |
453 flimflam::kSSIDProperty, | 487 flimflam::kSSIDProperty, |
454 base::Value::CreateStringValue(ssid)); | 488 base::Value::CreateStringValue(ssid)); |
455 properties.SetWithoutPathExpansion( | 489 properties.SetWithoutPathExpansion( |
456 flimflam::kSecurityProperty, | 490 flimflam::kSecurityProperty, |
457 base::Value::CreateStringValue(security)); | 491 base::Value::CreateStringValue(security)); |
458 // shill.Manger.GetService() will apply the property changes in | 492 // shill.Manger.GetService() will apply the property changes in |
459 // |properties| and return a new or existing service to OnGetService(). | 493 // |properties| and return a new or existing service to OnGetService(). |
460 // OnGetService will then call GetProperties which will then call callback. | 494 // OnGetService will then call GetProperties which will then call callback. |
461 DBusThreadManager::Get()->GetShillManagerClient()->GetService( | 495 DBusThreadManager::Get()->GetShillManagerClient()->GetService( |
462 properties, base::Bind(&OnGetService, callback)); | 496 properties, base::Bind(&OnGetService, callback), |
497 base::Bind(&IgnoreErrors)); | |
463 } | 498 } |
464 | 499 |
465 void CrosRequestVirtualNetworkProperties( | 500 void CrosRequestVirtualNetworkProperties( |
466 const std::string& service_name, | 501 const std::string& service_name, |
467 const std::string& server_hostname, | 502 const std::string& server_hostname, |
468 const std::string& provider_type, | 503 const std::string& provider_type, |
469 const NetworkPropertiesCallback& callback) { | 504 const NetworkPropertiesCallback& callback) { |
470 base::DictionaryValue properties; | 505 base::DictionaryValue properties; |
471 properties.SetWithoutPathExpansion( | 506 properties.SetWithoutPathExpansion( |
472 flimflam::kTypeProperty, | 507 flimflam::kTypeProperty, |
473 base::Value::CreateStringValue(flimflam::kTypeVPN)); | 508 base::Value::CreateStringValue(flimflam::kTypeVPN)); |
474 properties.SetWithoutPathExpansion( | 509 properties.SetWithoutPathExpansion( |
475 flimflam::kProviderNameProperty, | 510 flimflam::kProviderNameProperty, |
476 base::Value::CreateStringValue(service_name)); | 511 base::Value::CreateStringValue(service_name)); |
477 properties.SetWithoutPathExpansion( | 512 properties.SetWithoutPathExpansion( |
478 flimflam::kProviderHostProperty, | 513 flimflam::kProviderHostProperty, |
479 base::Value::CreateStringValue(server_hostname)); | 514 base::Value::CreateStringValue(server_hostname)); |
480 properties.SetWithoutPathExpansion( | 515 properties.SetWithoutPathExpansion( |
481 flimflam::kProviderTypeProperty, | 516 flimflam::kProviderTypeProperty, |
482 base::Value::CreateStringValue(provider_type)); | 517 base::Value::CreateStringValue(provider_type)); |
483 // The actual value of Domain does not matter, so just use service_name. | 518 // The actual value of Domain does not matter, so just use service_name. |
484 properties.SetWithoutPathExpansion( | 519 properties.SetWithoutPathExpansion( |
485 flimflam::kVPNDomainProperty, | 520 flimflam::kVPNDomainProperty, |
486 base::Value::CreateStringValue(service_name)); | 521 base::Value::CreateStringValue(service_name)); |
487 | 522 |
488 // shill.Manger.GetService() will apply the property changes in | 523 // shill.Manger.GetService() will apply the property changes in |
489 // |properties| and pass a new or existing service to OnGetService(). | 524 // |properties| and pass a new or existing service to OnGetService(). |
490 // OnGetService will then call GetProperties which will then call callback. | 525 // OnGetService will then call GetProperties which will then call callback. |
491 DBusThreadManager::Get()->GetShillManagerClient()->GetService( | 526 DBusThreadManager::Get()->GetShillManagerClient()->GetService( |
492 properties, base::Bind(&OnGetService, callback)); | 527 properties, base::Bind(&OnGetService, callback), |
528 base::Bind(&IgnoreErrors)); | |
493 } | 529 } |
494 | 530 |
495 void CrosRequestNetworkServiceDisconnect(const std::string& service_path) { | 531 void CrosRequestNetworkServiceDisconnect(const std::string& service_path) { |
496 DBusThreadManager::Get()->GetShillServiceClient()->Disconnect( | 532 DBusThreadManager::Get()->GetShillServiceClient()->Disconnect( |
497 dbus::ObjectPath(service_path), base::Bind(&DoNothing)); | 533 dbus::ObjectPath(service_path), base::Bind(&DoNothing), |
534 base::Bind(&IgnoreErrors)); | |
498 } | 535 } |
499 | 536 |
500 void CrosRequestRemoveNetworkService(const std::string& service_path) { | 537 void CrosRequestRemoveNetworkService(const std::string& service_path) { |
501 DBusThreadManager::Get()->GetShillServiceClient()->Remove( | 538 DBusThreadManager::Get()->GetShillServiceClient()->Remove( |
502 dbus::ObjectPath(service_path), base::Bind(&DoNothing)); | 539 dbus::ObjectPath(service_path), base::Bind(&DoNothing), |
540 base::Bind(&IgnoreErrors)); | |
503 } | 541 } |
504 | 542 |
505 void CrosRequestNetworkScan(const std::string& network_type) { | 543 void CrosRequestNetworkScan(const std::string& network_type) { |
506 DBusThreadManager::Get()->GetShillManagerClient()->RequestScan( | 544 DBusThreadManager::Get()->GetShillManagerClient()->RequestScan( |
507 network_type, base::Bind(&DoNothing)); | 545 network_type, base::Bind(&DoNothing), |
546 base::Bind(&IgnoreErrors)); | |
508 } | 547 } |
509 | 548 |
510 void CrosRequestNetworkDeviceEnable(const std::string& network_type, | 549 void CrosRequestNetworkDeviceEnable(const std::string& network_type, |
511 bool enable) { | 550 bool enable) { |
512 if (enable) { | 551 if (enable) { |
513 DBusThreadManager::Get()->GetShillManagerClient()->EnableTechnology( | 552 DBusThreadManager::Get()->GetShillManagerClient()->EnableTechnology( |
514 network_type, base::Bind(&DoNothing)); | 553 network_type, base::Bind(&DoNothing), |
554 base::Bind(&IgnoreErrors)); | |
515 } else { | 555 } else { |
516 DBusThreadManager::Get()->GetShillManagerClient()->DisableTechnology( | 556 DBusThreadManager::Get()->GetShillManagerClient()->DisableTechnology( |
517 network_type, base::Bind(&DoNothing)); | 557 network_type, base::Bind(&DoNothing), |
558 base::Bind(&IgnoreErrors)); | |
518 } | 559 } |
519 } | 560 } |
520 | 561 |
521 void CrosRequestRequirePin(const std::string& device_path, | 562 void CrosRequestRequirePin(const std::string& device_path, |
522 const std::string& pin, | 563 const std::string& pin, |
523 bool enable, | 564 bool enable, |
524 const NetworkOperationCallback& callback) { | 565 const NetworkOperationCallback& callback) { |
525 DBusThreadManager::Get()->GetShillDeviceClient()->RequirePin( | 566 DBusThreadManager::Get()->GetShillDeviceClient()->RequirePin( |
526 dbus::ObjectPath(device_path), pin, enable, | 567 dbus::ObjectPath(device_path), pin, enable, |
527 base::Bind(callback, device_path, NETWORK_METHOD_ERROR_NONE, | 568 base::Bind(callback, device_path, NETWORK_METHOD_ERROR_NONE, |
(...skipping 28 matching lines...) Expand all Loading... | |
556 const NetworkOperationCallback& callback) { | 597 const NetworkOperationCallback& callback) { |
557 DBusThreadManager::Get()->GetShillDeviceClient()->ChangePin( | 598 DBusThreadManager::Get()->GetShillDeviceClient()->ChangePin( |
558 dbus::ObjectPath(device_path), old_pin, new_pin, | 599 dbus::ObjectPath(device_path), old_pin, new_pin, |
559 base::Bind(callback, device_path, NETWORK_METHOD_ERROR_NONE, | 600 base::Bind(callback, device_path, NETWORK_METHOD_ERROR_NONE, |
560 std::string()), | 601 std::string()), |
561 base::Bind(&OnNetworkActionError, callback, device_path)); | 602 base::Bind(&OnNetworkActionError, callback, device_path)); |
562 } | 603 } |
563 | 604 |
564 void CrosProposeScan(const std::string& device_path) { | 605 void CrosProposeScan(const std::string& device_path) { |
565 DBusThreadManager::Get()->GetShillDeviceClient()->ProposeScan( | 606 DBusThreadManager::Get()->GetShillDeviceClient()->ProposeScan( |
566 dbus::ObjectPath(device_path), base::Bind(&DoNothing)); | 607 dbus::ObjectPath(device_path), base::Bind(&DoNothingWithCallStatus)); |
567 } | 608 } |
568 | 609 |
569 void CrosRequestCellularRegister(const std::string& device_path, | 610 void CrosRequestCellularRegister(const std::string& device_path, |
570 const std::string& network_id, | 611 const std::string& network_id, |
571 const NetworkOperationCallback& callback) { | 612 const NetworkOperationCallback& callback) { |
572 DBusThreadManager::Get()->GetShillDeviceClient()->Register( | 613 DBusThreadManager::Get()->GetShillDeviceClient()->Register( |
573 dbus::ObjectPath(device_path), network_id, | 614 dbus::ObjectPath(device_path), network_id, |
574 base::Bind(callback, device_path, NETWORK_METHOD_ERROR_NONE, | 615 base::Bind(callback, device_path, NETWORK_METHOD_ERROR_NONE, |
575 std::string()), | 616 std::string()), |
576 base::Bind(&OnNetworkActionError, callback, device_path)); | 617 base::Bind(&OnNetworkActionError, callback, device_path)); |
577 } | 618 } |
578 | 619 |
579 bool CrosSetOfflineMode(bool offline) { | 620 bool CrosSetOfflineMode(bool offline) { |
580 base::FundamentalValue value(offline); | 621 base::FundamentalValue value(offline); |
581 DBusThreadManager::Get()->GetShillManagerClient()->SetProperty( | 622 DBusThreadManager::Get()->GetShillManagerClient()->SetProperty( |
582 flimflam::kOfflineModeProperty, value, base::Bind(&DoNothing)); | 623 flimflam::kOfflineModeProperty, value, base::Bind(&DoNothing), |
624 base::Bind(&IgnoreErrors)); | |
583 return true; | 625 return true; |
584 } | 626 } |
585 | 627 |
586 bool CrosListIPConfigs(const std::string& device_path, | 628 bool CrosListIPConfigs(const std::string& device_path, |
587 NetworkIPConfigVector* ipconfig_vector, | 629 NetworkIPConfigVector* ipconfig_vector, |
588 std::vector<std::string>* ipconfig_paths, | 630 std::vector<std::string>* ipconfig_paths, |
589 std::string* hardware_address) { | 631 std::string* hardware_address) { |
590 if (hardware_address) | 632 if (hardware_address) |
591 hardware_address->clear(); | 633 hardware_address->clear(); |
592 const dbus::ObjectPath device_object_path(device_path); | 634 const dbus::ObjectPath device_object_path(device_path); |
(...skipping 67 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
660 } | 702 } |
661 | 703 |
662 bool CrosRemoveIPConfig(const std::string& ipconfig_path) { | 704 bool CrosRemoveIPConfig(const std::string& ipconfig_path) { |
663 return DBusThreadManager::Get()->GetShillIPConfigClient()-> | 705 return DBusThreadManager::Get()->GetShillIPConfigClient()-> |
664 CallRemoveAndBlock(dbus::ObjectPath(ipconfig_path)); | 706 CallRemoveAndBlock(dbus::ObjectPath(ipconfig_path)); |
665 } | 707 } |
666 | 708 |
667 void CrosRequestIPConfigRefresh(const std::string& ipconfig_path) { | 709 void CrosRequestIPConfigRefresh(const std::string& ipconfig_path) { |
668 DBusThreadManager::Get()->GetShillIPConfigClient()->Refresh( | 710 DBusThreadManager::Get()->GetShillIPConfigClient()->Refresh( |
669 dbus::ObjectPath(ipconfig_path), | 711 dbus::ObjectPath(ipconfig_path), |
670 base::Bind(&DoNothing)); | 712 base::Bind(&DoNothingWithCallStatus)); |
671 } | 713 } |
672 | 714 |
673 bool CrosGetWifiAccessPoints(WifiAccessPointVector* result) { | 715 bool CrosGetWifiAccessPoints(WifiAccessPointVector* result) { |
674 scoped_ptr<base::DictionaryValue> manager_properties( | 716 scoped_ptr<base::DictionaryValue> manager_properties( |
675 DBusThreadManager::Get()->GetShillManagerClient()-> | 717 DBusThreadManager::Get()->GetShillManagerClient()-> |
676 CallGetPropertiesAndBlock()); | 718 CallGetPropertiesAndBlock()); |
677 if (!manager_properties.get()) { | 719 if (!manager_properties.get()) { |
678 LOG(WARNING) << "Couldn't read managers's properties"; | 720 LOG(WARNING) << "Couldn't read managers's properties"; |
679 return false; | 721 return false; |
680 } | 722 } |
(...skipping 70 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
751 result->push_back(ap); | 793 result->push_back(ap); |
752 } | 794 } |
753 } | 795 } |
754 if (!found_at_least_one_device) | 796 if (!found_at_least_one_device) |
755 return false; // No powered device found that has a 'Networks' array. | 797 return false; // No powered device found that has a 'Networks' array. |
756 return true; | 798 return true; |
757 } | 799 } |
758 | 800 |
759 void CrosConfigureService(const base::DictionaryValue& properties) { | 801 void CrosConfigureService(const base::DictionaryValue& properties) { |
760 DBusThreadManager::Get()->GetShillManagerClient()->ConfigureService( | 802 DBusThreadManager::Get()->GetShillManagerClient()->ConfigureService( |
761 properties, base::Bind(&DoNothing)); | 803 properties, base::Bind(&DoNothing), |
804 base::Bind(&IgnoreErrors)); | |
762 } | 805 } |
763 | 806 |
764 std::string CrosPrefixLengthToNetmask(int32 prefix_length) { | 807 std::string CrosPrefixLengthToNetmask(int32 prefix_length) { |
765 std::string netmask; | 808 std::string netmask; |
766 // Return the empty string for invalid inputs. | 809 // Return the empty string for invalid inputs. |
767 if (prefix_length < 0 || prefix_length > 32) | 810 if (prefix_length < 0 || prefix_length > 32) |
768 return netmask; | 811 return netmask; |
769 for (int i = 0; i < 4; i++) { | 812 for (int i = 0; i < 4; i++) { |
770 int remainder = 8; | 813 int remainder = 8; |
771 if (prefix_length >= 8) { | 814 if (prefix_length >= 8) { |
(...skipping 60 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
832 const std::string& carrier, | 875 const std::string& carrier, |
833 const NetworkOperationCallback& callback) { | 876 const NetworkOperationCallback& callback) { |
834 DBusThreadManager::Get()->GetShillDeviceClient()->SetCarrier( | 877 DBusThreadManager::Get()->GetShillDeviceClient()->SetCarrier( |
835 dbus::ObjectPath(device_path), carrier, | 878 dbus::ObjectPath(device_path), carrier, |
836 base::Bind(callback, device_path, NETWORK_METHOD_ERROR_NONE, | 879 base::Bind(callback, device_path, NETWORK_METHOD_ERROR_NONE, |
837 std::string()), | 880 std::string()), |
838 base::Bind(&OnNetworkActionError, callback, device_path)); | 881 base::Bind(&OnNetworkActionError, callback, device_path)); |
839 } | 882 } |
840 | 883 |
841 } // namespace chromeos | 884 } // namespace chromeos |
OLD | NEW |