diff options
Diffstat (limited to 'chromeos/dbus/nfc_client_helpers.h')
-rw-r--r-- | chromeos/dbus/nfc_client_helpers.h | 22 |
1 files changed, 16 insertions, 6 deletions
diff --git a/chromeos/dbus/nfc_client_helpers.h b/chromeos/dbus/nfc_client_helpers.h index ed344db..2d579f2c 100644 --- a/chromeos/dbus/nfc_client_helpers.h +++ b/chromeos/dbus/nfc_client_helpers.h @@ -62,10 +62,15 @@ class CHROMEOS_EXPORT DBusObjectMap { // signals and update the properties. virtual NfcPropertySet* CreateProperties( dbus::ObjectProxy* object_proxy) = 0; - }; - typedef std::pair<dbus::ObjectProxy*, NfcPropertySet*> ObjectPropertyPair; - typedef std::map<dbus::ObjectPath, ObjectPropertyPair> ObjectMap; + // Notifies the delegate that an object was added with object path + // |object_path|. + virtual void ObjectAdded(const dbus::ObjectPath& object_path) {} + + // Notifies the delegate that an object was removed with object path + // |object_path|. + virtual void ObjectRemoved(const dbus::ObjectPath& object_path) {} + }; // Constructor takes in the D-Bus service name the proxies belong to and // the delegate which will be used to construct properties structures. @@ -85,6 +90,11 @@ class CHROMEOS_EXPORT DBusObjectMap { // returns NULL. NfcPropertySet* GetObjectProperties(const dbus::ObjectPath& object_path); + // Updates the object proxies from the given list of object paths + // |object_paths|. It notifies the delegate of each added and removed object + // via |Delegate::ObjectAdded| and |Delegate::ObjectRemoved|. + void UpdateObjects(const std::vector<dbus::ObjectPath>& object_paths); + // Creates and stores an object proxy and properties structure for a remote // object with object path |object_path|. If an object proxy was already // created, this operation returns false; returns true otherwise. @@ -94,10 +104,10 @@ class CHROMEOS_EXPORT DBusObjectMap { // remote object with object path |object_path|. void RemoveObject(const dbus::ObjectPath& object_path); - // Returns the underlying map. - const ObjectMap& object_map() const { return object_map_; } - private: + typedef std::pair<dbus::ObjectProxy*, NfcPropertySet*> ObjectPropertyPair; + typedef std::map<dbus::ObjectPath, ObjectPropertyPair> ObjectMap; + // Returns an instance of ObjectPropertyPair by looking up |object_path| in // |object_map_|. If no entry is found, returns an instance that contains // NULL pointers. |