| OLD | NEW |
| 1 // Copyright (c) 2013 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 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/dbus/shill_manager_client_stub.h" | 5 #include "chromeos/dbus/shill_manager_client_stub.h" |
| 6 | 6 |
| 7 #include "base/bind.h" | 7 #include "base/bind.h" |
| 8 #include "base/chromeos/chromeos_version.h" | 8 #include "base/chromeos/chromeos_version.h" |
| 9 #include "base/command_line.h" | 9 #include "base/command_line.h" |
| 10 #include "base/message_loop.h" | 10 #include "base/message_loop.h" |
| (...skipping 311 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 322 | 322 |
| 323 void ShillManagerClientStub::RemoveDevice(const std::string& device_path) { | 323 void ShillManagerClientStub::RemoveDevice(const std::string& device_path) { |
| 324 base::StringValue device_path_value(device_path); | 324 base::StringValue device_path_value(device_path); |
| 325 if (GetListProperty(flimflam::kDevicesProperty)->Remove( | 325 if (GetListProperty(flimflam::kDevicesProperty)->Remove( |
| 326 device_path_value, NULL)) { | 326 device_path_value, NULL)) { |
| 327 CallNotifyObserversPropertyChanged(flimflam::kDevicesProperty, 0); | 327 CallNotifyObserversPropertyChanged(flimflam::kDevicesProperty, 0); |
| 328 } | 328 } |
| 329 } | 329 } |
| 330 | 330 |
| 331 void ShillManagerClientStub::ClearDevices() { | 331 void ShillManagerClientStub::ClearDevices() { |
| 332 stub_properties_.Remove(flimflam::kDevicesProperty, NULL); | 332 GetListProperty(flimflam::kDevicesProperty)->Clear(); |
| 333 CallNotifyObserversPropertyChanged(flimflam::kDevicesProperty, 0); |
| 333 } | 334 } |
| 334 | 335 |
| 335 void ShillManagerClientStub::ClearServices() { | 336 void ShillManagerClientStub::ClearServices() { |
| 336 stub_properties_.Remove(flimflam::kServicesProperty, NULL); | 337 GetListProperty(flimflam::kServicesProperty)->Clear(); |
| 337 stub_properties_.Remove(flimflam::kServiceWatchListProperty, NULL); | 338 GetListProperty(flimflam::kServiceWatchListProperty)->Clear(); |
| 339 CallNotifyObserversPropertyChanged(flimflam::kServicesProperty, 0); |
| 340 CallNotifyObserversPropertyChanged(flimflam::kServiceWatchListProperty, 0); |
| 338 } | 341 } |
| 339 | 342 |
| 340 void ShillManagerClientStub::AddService(const std::string& service_path, | 343 void ShillManagerClientStub::AddService(const std::string& service_path, |
| 341 bool add_to_watch_list) { | 344 bool add_to_watch_list) { |
| 342 if (GetListProperty(flimflam::kServicesProperty)->AppendIfNotPresent( | 345 if (GetListProperty(flimflam::kServicesProperty)->AppendIfNotPresent( |
| 343 base::Value::CreateStringValue(service_path))) { | 346 base::Value::CreateStringValue(service_path))) { |
| 344 CallNotifyObserversPropertyChanged(flimflam::kServicesProperty, 0); | 347 CallNotifyObserversPropertyChanged(flimflam::kServicesProperty, 0); |
| 345 } | 348 } |
| 346 if (add_to_watch_list) | 349 if (add_to_watch_list) |
| 347 AddServiceToWatchList(service_path); | 350 AddServiceToWatchList(service_path); |
| (...skipping 84 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 432 const base::DictionaryValue& network) { | 435 const base::DictionaryValue& network) { |
| 433 base::ListValue* list_value = NULL; | 436 base::ListValue* list_value = NULL; |
| 434 if (!stub_geo_networks_.GetListWithoutPathExpansion( | 437 if (!stub_geo_networks_.GetListWithoutPathExpansion( |
| 435 technology, &list_value)) { | 438 technology, &list_value)) { |
| 436 list_value = new base::ListValue; | 439 list_value = new base::ListValue; |
| 437 stub_geo_networks_.SetWithoutPathExpansion(technology, list_value); | 440 stub_geo_networks_.SetWithoutPathExpansion(technology, list_value); |
| 438 } | 441 } |
| 439 list_value->Append(network.DeepCopy()); | 442 list_value->Append(network.DeepCopy()); |
| 440 } | 443 } |
| 441 | 444 |
| 445 void ShillManagerClientStub::AddProfile(const std::string& profile_path) { |
| 446 const char* key = flimflam::kProfilesProperty; |
| 447 if (GetListProperty(key)->AppendIfNotPresent( |
| 448 new base::StringValue(profile_path))) { |
| 449 CallNotifyObserversPropertyChanged(key, 0); |
| 450 } |
| 451 } |
| 452 |
| 442 void ShillManagerClientStub::AddServiceToWatchList( | 453 void ShillManagerClientStub::AddServiceToWatchList( |
| 443 const std::string& service_path) { | 454 const std::string& service_path) { |
| 444 if (GetListProperty( | 455 if (GetListProperty( |
| 445 flimflam::kServiceWatchListProperty)->AppendIfNotPresent( | 456 flimflam::kServiceWatchListProperty)->AppendIfNotPresent( |
| 446 base::Value::CreateStringValue(service_path))) { | 457 base::Value::CreateStringValue(service_path))) { |
| 447 CallNotifyObserversPropertyChanged( | 458 CallNotifyObserversPropertyChanged( |
| 448 flimflam::kServiceWatchListProperty, 0); | 459 flimflam::kServiceWatchListProperty, 0); |
| 449 } | 460 } |
| 450 } | 461 } |
| 451 | 462 |
| (...skipping 155 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 607 base::FundamentalValue(false)); | 618 base::FundamentalValue(false)); |
| 608 } | 619 } |
| 609 CallNotifyObserversPropertyChanged(flimflam::kServicesProperty, 0); | 620 CallNotifyObserversPropertyChanged(flimflam::kServicesProperty, 0); |
| 610 CallNotifyObserversPropertyChanged(flimflam::kServiceWatchListProperty, | 621 CallNotifyObserversPropertyChanged(flimflam::kServiceWatchListProperty, |
| 611 0); | 622 0); |
| 612 if (!callback.is_null()) | 623 if (!callback.is_null()) |
| 613 MessageLoop::current()->PostTask(FROM_HERE, callback); | 624 MessageLoop::current()->PostTask(FROM_HERE, callback); |
| 614 } | 625 } |
| 615 | 626 |
| 616 } // namespace chromeos | 627 } // namespace chromeos |
| OLD | NEW |