Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(1506)

Side by Side Diff: chrome/browser/chromeos/cros/cros_network_functions.cc

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

Powered by Google App Engine
This is Rietveld 408576698