OLD | NEW |
1 // Copyright 2013 The Chromium Authors. All rights reserved. | 1 // Copyright 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 #ifndef CHROMEOS_DBUS_NFC_CLIENT_HELPERS_H_ | 5 #ifndef CHROMEOS_DBUS_NFC_CLIENT_HELPERS_H_ |
6 #define CHROMEOS_DBUS_NFC_CLIENT_HELPERS_H_ | 6 #define CHROMEOS_DBUS_NFC_CLIENT_HELPERS_H_ |
7 | 7 |
8 #include <map> | 8 #include <map> |
9 #include <string> | 9 #include <string> |
10 #include <utility> | 10 #include <utility> |
11 | 11 |
12 #include "base/basictypes.h" | 12 #include "base/basictypes.h" |
13 #include "base/callback.h" | 13 #include "base/callback.h" |
| 14 #include "base/values.h" |
14 #include "chromeos/chromeos_export.h" | 15 #include "chromeos/chromeos_export.h" |
15 #include "chromeos/dbus/nfc_property_set.h" | 16 #include "chromeos/dbus/nfc_property_set.h" |
16 #include "dbus/bus.h" | 17 #include "dbus/bus.h" |
17 #include "dbus/message.h" | 18 #include "dbus/message.h" |
18 #include "dbus/object_path.h" | 19 #include "dbus/object_path.h" |
19 #include "dbus/object_proxy.h" | 20 #include "dbus/object_proxy.h" |
20 | 21 |
21 namespace chromeos { | 22 namespace chromeos { |
22 namespace nfc_client_helpers { | 23 namespace nfc_client_helpers { |
23 | 24 |
(...skipping 13 matching lines...) Expand all Loading... |
37 | 38 |
38 // Called when a response for a successful method call is received. | 39 // Called when a response for a successful method call is received. |
39 CHROMEOS_EXPORT void OnSuccess(const base::Closure& callback, | 40 CHROMEOS_EXPORT void OnSuccess(const base::Closure& callback, |
40 dbus::Response* response); | 41 dbus::Response* response); |
41 | 42 |
42 // Extracts the error data from |response| and invokes |error_callback| with | 43 // Extracts the error data from |response| and invokes |error_callback| with |
43 // the resulting error name and error message. | 44 // the resulting error name and error message. |
44 CHROMEOS_EXPORT void OnError(const ErrorCallback& error_callback, | 45 CHROMEOS_EXPORT void OnError(const ErrorCallback& error_callback, |
45 dbus::ErrorResponse* response); | 46 dbus::ErrorResponse* response); |
46 | 47 |
| 48 // Appends any value (basic types and nested types) represented by |value| to |
| 49 // the writer |writer| as a variant type. |
| 50 // TODO(armansito): Consider moving this to dbus/values_util.h" |
| 51 CHROMEOS_EXPORT void AppendValueDataAsVariant(dbus::MessageWriter* writer, |
| 52 const base::Value& value); |
| 53 |
47 // DBusObjectMap is a simple data structure that facilitates keeping track of | 54 // DBusObjectMap is a simple data structure that facilitates keeping track of |
48 // D-Bus object proxies and properties. It maintains a mapping from object | 55 // D-Bus object proxies and properties. It maintains a mapping from object |
49 // paths to object proxy - property structure pairs. | 56 // paths to object proxy - property structure pairs. |
50 // TODO(armansito): This is only needed until neard implements the D-Bus | 57 // TODO(armansito): This is only needed until neard implements the D-Bus |
51 // org.freedesktop.DBus.ObjectManager interface. Remove this once we upgrade | 58 // org.freedesktop.DBus.ObjectManager interface. Remove this once we upgrade |
52 // to neard-0.14. | 59 // to neard-0.14. |
53 class CHROMEOS_EXPORT DBusObjectMap { | 60 class CHROMEOS_EXPORT DBusObjectMap { |
54 public: | 61 public: |
55 // DBusObjectMap::Delegate must be implemented by classes that use an | 62 // DBusObjectMap::Delegate must be implemented by classes that use an |
56 // instance of DBusObjectMap to manage object proxies. | 63 // instance of DBusObjectMap to manage object proxies. |
(...skipping 135 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
192 typedef std::map<dbus::ObjectPath, DBusObjectMap*> PathsToObjectMapsType; | 199 typedef std::map<dbus::ObjectPath, DBusObjectMap*> PathsToObjectMapsType; |
193 PathsToObjectMapsType paths_to_object_maps_; | 200 PathsToObjectMapsType paths_to_object_maps_; |
194 | 201 |
195 DISALLOW_COPY_AND_ASSIGN(ObjectProxyTree); | 202 DISALLOW_COPY_AND_ASSIGN(ObjectProxyTree); |
196 }; | 203 }; |
197 | 204 |
198 } // namespace nfc_client_helpers | 205 } // namespace nfc_client_helpers |
199 } // namespace chromeos | 206 } // namespace chromeos |
200 | 207 |
201 #endif // CHROMEOS_DBUS_NFC_CLIENT_HELPERS_H_ | 208 #endif // CHROMEOS_DBUS_NFC_CLIENT_HELPERS_H_ |
OLD | NEW |