Add DumpAccessibilityTree tests for modal dialogs.
[chromium-blink-merge.git] / chromeos / dbus / nfc_device_client.h
blob7f27cf8135068fc300e8d21a8d70189749547747
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
3 // found in the LICENSE file.
5 #ifndef CHROMEOS_DBUS_NFC_DEVICE_CLIENT_H_
6 #define CHROMEOS_DBUS_NFC_DEVICE_CLIENT_H_
8 #include <map>
9 #include <string>
10 #include <vector>
12 #include "chromeos/chromeos_export.h"
13 #include "chromeos/dbus/dbus_client.h"
14 #include "chromeos/dbus/dbus_client_implementation_type.h"
15 #include "chromeos/dbus/nfc_client_helpers.h"
16 #include "chromeos/dbus/nfc_property_set.h"
17 #include "chromeos/dbus/nfc_record_client.h"
18 #include "dbus/object_path.h"
19 #include "dbus/object_proxy.h"
20 #include "dbus/property.h"
22 namespace chromeos {
24 class NfcAdapterClient;
26 // NfcDeviceClient is used to communicate with objects representing remote NFC
27 // devices that can be communicated with.
28 class CHROMEOS_EXPORT NfcDeviceClient : public DBusClient {
29 public:
30 // Structure of properties associated with an NFC device.
31 struct Properties : public NfcPropertySet {
32 // List of object paths for NDEF records associated with the NFC device.
33 // Read-only.
34 dbus::Property<std::vector<dbus::ObjectPath> > records;
36 Properties(dbus::ObjectProxy* object_proxy,
37 const PropertyChangedCallback& callback);
38 virtual ~Properties();
41 // Interface for observing changes from a remote NFC device.
42 class Observer {
43 public:
44 virtual ~Observer() {}
46 // Called when a remote NFC device with the object |object_path| is added
47 // to the set of known devices.
48 virtual void DeviceAdded(const dbus::ObjectPath& object_path) {}
50 // Called when a remote NFC device with the object path |object_path| is
51 // removed from the set of known devices.
52 virtual void DeviceRemoved(const dbus::ObjectPath& object_path) {}
54 // Called when the device property with the name |property_name| on device
55 // with object path |object_path| has acquired a new value.
56 virtual void DevicePropertyChanged(const dbus::ObjectPath& object_path,
57 const std::string& property_name) {}
60 virtual ~NfcDeviceClient();
62 // Adds and removes observers for events on all remote NFC devices. Check the
63 // |object_path| parameter of observer methods to determine which device is
64 // issuing the event.
65 virtual void AddObserver(Observer* observer) = 0;
66 virtual void RemoveObserver(Observer* observer) = 0;
68 // Obtain the properties for the NFC device with object path |object_path|;
69 // any values should be copied if needed.
70 virtual Properties* GetProperties(const dbus::ObjectPath& object_path) = 0;
72 // Creates an NDEF record for the NFC device with object path |object_path|
73 // using the parameters in |attributes|. |attributes| is a dictionary,
74 // containing the NFC Record properties which will be assigned to the
75 // resulting record object and pushed to the device. The properties are
76 // defined by the NFC Record interface (see namespace "nfc_record" in
77 // third_party/cros_system_api/dbus/service_constants.h and
78 // NfcRecordClient::Properties). |attributes| should at least contain a
79 // "Type" plus any other properties associated with that type. For example:
81 // {
82 // "Type": "Text",
83 // "Encoding": "UTF-8",
84 // "Language": "en",
85 // "Representation": "Chrome OS rulez!"
86 // },
87 // {
88 // "Type": "URI",
89 // "URI": "http://www.chromium.org"
90 // },
91 // etc.
92 virtual void Push(
93 const dbus::ObjectPath& object_path,
94 const NfcRecordClient::Attributes& attributes,
95 const base::Closure& callback,
96 const nfc_client_helpers::ErrorCallback& error_callback) = 0;
98 // Creates the instance.
99 static NfcDeviceClient* Create(DBusClientImplementationType type,
100 NfcAdapterClient* adapter_client);
102 protected:
103 friend class NfcClientTest;
105 NfcDeviceClient();
107 private:
108 DISALLOW_COPY_AND_ASSIGN(NfcDeviceClient);
111 } // namespace chromeos
113 #endif // CHROMEOS_DBUS_NFC_DEVICE_CLIENT_H_