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
3 // found in the LICENSE file.
5 #include "chromeos/dbus/shill_profile_client_stub.h"
8 #include "base/message_loop.h"
9 #include "base/stl_util.h"
10 #include "base/values.h"
11 #include "chromeos/dbus/shill_property_changed_observer.h"
13 #include "dbus/message.h"
14 #include "dbus/object_path.h"
15 #include "dbus/values_util.h"
16 #include "third_party/cros_system_api/dbus/service_constants.h"
20 ShillProfileClientStub::ShillProfileClientStub() : weak_ptr_factory_(this) {
23 ShillProfileClientStub::~ShillProfileClientStub() {
26 void ShillProfileClientStub::AddPropertyChangedObserver(
27 const dbus::ObjectPath
& profile_path
,
28 ShillPropertyChangedObserver
* observer
) {
31 void ShillProfileClientStub::RemovePropertyChangedObserver(
32 const dbus::ObjectPath
& profile_path
,
33 ShillPropertyChangedObserver
* observer
) {
36 void ShillProfileClientStub::GetProperties(
37 const dbus::ObjectPath
& profile_path
,
38 const DictionaryValueCallbackWithoutStatus
& callback
,
39 const ErrorCallback
& error_callback
) {
40 if (callback
.is_null())
42 MessageLoop::current()->PostTask(
44 base::Bind(&ShillProfileClientStub::PassEmptyDictionaryValue
,
45 weak_ptr_factory_
.GetWeakPtr(),
49 void ShillProfileClientStub::GetEntry(
50 const dbus::ObjectPath
& profile_path
,
51 const std::string
& entry_path
,
52 const DictionaryValueCallbackWithoutStatus
& callback
,
53 const ErrorCallback
& error_callback
) {
54 if (callback
.is_null())
56 MessageLoop::current()->PostTask(
58 base::Bind(&ShillProfileClientStub::PassEmptyDictionaryValue
,
59 weak_ptr_factory_
.GetWeakPtr(),
63 void ShillProfileClientStub::DeleteEntry(const dbus::ObjectPath
& profile_path
,
64 const std::string
& entry_path
,
65 const base::Closure
& callback
,
66 const ErrorCallback
& error_callback
) {
67 if (callback
.is_null())
69 MessageLoop::current()->PostTask(FROM_HERE
, callback
);
72 void ShillProfileClientStub::PassEmptyDictionaryValue(
73 const DictionaryValueCallbackWithoutStatus
& callback
) const {
74 base::DictionaryValue dictionary
;
75 callback
.Run(dictionary
);
78 } // namespace chromeos