| 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 298 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 309 | 309 |
| 310 void ShillManagerClientStub::RemoveDevice(const std::string& device_path) { | 310 void ShillManagerClientStub::RemoveDevice(const std::string& device_path) { |
| 311 base::StringValue device_path_value(device_path); | 311 base::StringValue device_path_value(device_path); |
| 312 if (GetListProperty(flimflam::kDevicesProperty)->Remove( | 312 if (GetListProperty(flimflam::kDevicesProperty)->Remove( |
| 313 device_path_value, NULL)) { | 313 device_path_value, NULL)) { |
| 314 CallNotifyObserversPropertyChanged(flimflam::kDevicesProperty, 0); | 314 CallNotifyObserversPropertyChanged(flimflam::kDevicesProperty, 0); |
| 315 } | 315 } |
| 316 } | 316 } |
| 317 | 317 |
| 318 void ShillManagerClientStub::ClearDevices() { | 318 void ShillManagerClientStub::ClearDevices() { |
| 319 stub_properties_.Remove(flimflam::kDevicesProperty, NULL); | 319 GetListProperty(flimflam::kDevicesProperty)->Clear(); |
| 320 CallNotifyObserversPropertyChanged(flimflam::kDevicesProperty, 0); |
| 320 } | 321 } |
| 321 | 322 |
| 322 void ShillManagerClientStub::ClearServices() { | 323 void ShillManagerClientStub::ClearServices() { |
| 323 stub_properties_.Remove(flimflam::kServicesProperty, NULL); | 324 GetListProperty(flimflam::kServicesProperty)->Clear(); |
| 324 stub_properties_.Remove(flimflam::kServiceWatchListProperty, NULL); | 325 GetListProperty(flimflam::kServiceWatchListProperty)->Clear(); |
| 326 CallNotifyObserversPropertyChanged(flimflam::kServicesProperty, 0); |
| 327 CallNotifyObserversPropertyChanged(flimflam::kServiceWatchListProperty, 0); |
| 325 } | 328 } |
| 326 | 329 |
| 327 void ShillManagerClientStub::AddService(const std::string& service_path, | 330 void ShillManagerClientStub::AddService(const std::string& service_path, |
| 328 bool add_to_watch_list) { | 331 bool add_to_watch_list) { |
| 329 if (GetListProperty(flimflam::kServicesProperty)->AppendIfNotPresent( | 332 if (GetListProperty(flimflam::kServicesProperty)->AppendIfNotPresent( |
| 330 base::Value::CreateStringValue(service_path))) { | 333 base::Value::CreateStringValue(service_path))) { |
| 331 CallNotifyObserversPropertyChanged(flimflam::kServicesProperty, 0); | 334 CallNotifyObserversPropertyChanged(flimflam::kServicesProperty, 0); |
| 332 } | 335 } |
| 333 if (add_to_watch_list) | 336 if (add_to_watch_list) |
| 334 AddServiceToWatchList(service_path); | 337 AddServiceToWatchList(service_path); |
| (...skipping 84 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 419 const base::DictionaryValue& network) { | 422 const base::DictionaryValue& network) { |
| 420 base::ListValue* list_value = NULL; | 423 base::ListValue* list_value = NULL; |
| 421 if (!stub_geo_networks_.GetListWithoutPathExpansion( | 424 if (!stub_geo_networks_.GetListWithoutPathExpansion( |
| 422 technology, &list_value)) { | 425 technology, &list_value)) { |
| 423 list_value = new base::ListValue; | 426 list_value = new base::ListValue; |
| 424 stub_geo_networks_.SetWithoutPathExpansion(technology, list_value); | 427 stub_geo_networks_.SetWithoutPathExpansion(technology, list_value); |
| 425 } | 428 } |
| 426 list_value->Append(network.DeepCopy()); | 429 list_value->Append(network.DeepCopy()); |
| 427 } | 430 } |
| 428 | 431 |
| 432 void ShillManagerClientStub::AddProfile(const std::string& profile_path) { |
| 433 const char* key = flimflam::kProfilesProperty; |
| 434 if (GetListProperty(key)->AppendIfNotPresent( |
| 435 new base::StringValue(profile_path))) { |
| 436 CallNotifyObserversPropertyChanged(key, 0); |
| 437 } |
| 438 } |
| 439 |
| 429 void ShillManagerClientStub::AddServiceToWatchList( | 440 void ShillManagerClientStub::AddServiceToWatchList( |
| 430 const std::string& service_path) { | 441 const std::string& service_path) { |
| 431 if (GetListProperty( | 442 if (GetListProperty( |
| 432 flimflam::kServiceWatchListProperty)->AppendIfNotPresent( | 443 flimflam::kServiceWatchListProperty)->AppendIfNotPresent( |
| 433 base::Value::CreateStringValue(service_path))) { | 444 base::Value::CreateStringValue(service_path))) { |
| 434 CallNotifyObserversPropertyChanged( | 445 CallNotifyObserversPropertyChanged( |
| 435 flimflam::kServiceWatchListProperty, 0); | 446 flimflam::kServiceWatchListProperty, 0); |
| 436 } | 447 } |
| 437 } | 448 } |
| 438 | 449 |
| (...skipping 155 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 594 base::FundamentalValue(false)); | 605 base::FundamentalValue(false)); |
| 595 } | 606 } |
| 596 CallNotifyObserversPropertyChanged(flimflam::kServicesProperty, 0); | 607 CallNotifyObserversPropertyChanged(flimflam::kServicesProperty, 0); |
| 597 CallNotifyObserversPropertyChanged(flimflam::kServiceWatchListProperty, | 608 CallNotifyObserversPropertyChanged(flimflam::kServiceWatchListProperty, |
| 598 0); | 609 0); |
| 599 if (!callback.is_null()) | 610 if (!callback.is_null()) |
| 600 MessageLoop::current()->PostTask(FROM_HERE, callback); | 611 MessageLoop::current()->PostTask(FROM_HERE, callback); |
| 601 } | 612 } |
| 602 | 613 |
| 603 } // namespace chromeos | 614 } // namespace chromeos |
| OLD | NEW |