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_service_client_stub.h" | 5 #include "chromeos/dbus/shill_service_client_stub.h" |
6 | 6 |
7 #include "base/bind.h" | 7 #include "base/bind.h" |
8 #include "base/command_line.h" | 8 #include "base/command_line.h" |
9 #include "base/message_loop/message_loop.h" | 9 #include "base/message_loop/message_loop.h" |
10 #include "base/stl_util.h" | 10 #include "base/stl_util.h" |
(...skipping 348 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
359 // the list in the manager client. | 359 // the list in the manager client. |
360 // TODO(gauravsh): Generalize to sort services properly to allow for testing | 360 // TODO(gauravsh): Generalize to sort services properly to allow for testing |
361 // more complex scenarios. | 361 // more complex scenarios. |
362 std::string state; | 362 std::string state; |
363 if (value.GetAsString(&state) && (state == flimflam::kStateOnline || | 363 if (value.GetAsString(&state) && (state == flimflam::kStateOnline || |
364 state == flimflam::kStatePortal)) { | 364 state == flimflam::kStatePortal)) { |
365 DBusThreadManager::Get()->GetShillManagerClient()->GetTestInterface()-> | 365 DBusThreadManager::Get()->GetShillManagerClient()->GetTestInterface()-> |
366 MoveServiceToIndex(service_path, 0, true); | 366 MoveServiceToIndex(service_path, 0, true); |
367 } | 367 } |
368 } | 368 } |
369 dict->SetWithoutPathExpansion(property, value.DeepCopy()); | 369 base::DictionaryValue new_properties; |
370 std::string changed_property; | |
371 if (property == flimflam::kOpenVPNCaCertNSSProperty || | |
372 property == flimflam::kOpenVPNCaCertNSSProperty) { | |
stevenjb
2013/07/29 17:53:03
Same property twice? I assume one should be kL2tpI
pneubeck (no reviews)
2013/08/05 08:51:22
Done.
| |
373 // These properties are only nested within the Provider dictionary if read | |
374 // from Shill. | |
375 base::DictionaryValue* provider = new base::DictionaryValue; | |
376 provider->SetWithoutPathExpansion(property, value.DeepCopy()); | |
377 new_properties.SetWithoutPathExpansion(flimflam::kProviderProperty, | |
378 provider); | |
379 changed_property = flimflam::kProviderProperty; | |
380 } else { | |
381 new_properties.SetWithoutPathExpansion(property, value.DeepCopy()); | |
382 changed_property = property; | |
383 } | |
384 | |
385 dict->MergeDictionary(&new_properties); | |
370 base::MessageLoop::current()->PostTask( | 386 base::MessageLoop::current()->PostTask( |
371 FROM_HERE, | 387 FROM_HERE, |
372 base::Bind(&ShillServiceClientStub::NotifyObserversPropertyChanged, | 388 base::Bind(&ShillServiceClientStub::NotifyObserversPropertyChanged, |
373 weak_ptr_factory_.GetWeakPtr(), | 389 weak_ptr_factory_.GetWeakPtr(), |
374 dbus::ObjectPath(service_path), property)); | 390 dbus::ObjectPath(service_path), changed_property)); |
375 return true; | 391 return true; |
376 } | 392 } |
377 | 393 |
378 const base::DictionaryValue* ShillServiceClientStub::GetServiceProperties( | 394 const base::DictionaryValue* ShillServiceClientStub::GetServiceProperties( |
379 const std::string& service_path) const { | 395 const std::string& service_path) const { |
380 const base::DictionaryValue* properties = NULL; | 396 const base::DictionaryValue* properties = NULL; |
381 stub_services_.GetDictionaryWithoutPathExpansion(service_path, &properties); | 397 stub_services_.GetDictionaryWithoutPathExpansion(service_path, &properties); |
382 return properties; | 398 return properties; |
383 } | 399 } |
384 | 400 |
(...skipping 98 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
483 std::map<dbus::ObjectPath, PropertyObserverList*>::iterator iter = | 499 std::map<dbus::ObjectPath, PropertyObserverList*>::iterator iter = |
484 observer_list_.find(device_path); | 500 observer_list_.find(device_path); |
485 if (iter != observer_list_.end()) | 501 if (iter != observer_list_.end()) |
486 return *(iter->second); | 502 return *(iter->second); |
487 PropertyObserverList* observer_list = new PropertyObserverList(); | 503 PropertyObserverList* observer_list = new PropertyObserverList(); |
488 observer_list_[device_path] = observer_list; | 504 observer_list_[device_path] = observer_list; |
489 return *observer_list; | 505 return *observer_list; |
490 } | 506 } |
491 | 507 |
492 } // namespace chromeos | 508 } // namespace chromeos |
OLD | NEW |