Updating trunk VERSION from 2139.0 to 2140.0
[chromium-blink-merge.git] / chromeos / dbus / nfc_property_set.h
blob203f2355215fe36d50b6356954b8889ef9bb7c7b
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_PROPERTY_SET_H_
6 #define CHROMEOS_DBUS_NFC_PROPERTY_SET_H_
8 #include <string>
10 #include "base/callback.h"
11 #include "dbus/message.h"
12 #include "dbus/object_proxy.h"
13 #include "dbus/property.h"
15 namespace chromeos {
17 // neard doesn't use the standard D-Bus interfaces for property access and
18 // instead defines property accessor methods in each D-Bus interface. This
19 // class customizes dbus::PropertySet to generate the correct method call to
20 // get all properties, connect to the correct signal and parse it correctly.
21 class NfcPropertySet : public dbus::PropertySet {
22 public:
23 NfcPropertySet(dbus::ObjectProxy* object_proxy,
24 const std::string& interface,
25 const PropertyChangedCallback& callback);
27 // Destructor; we don't hold on to any references or memory that needs
28 // explicit clean-up, but clang thinks we might.
29 virtual ~NfcPropertySet();
31 // Caches |callback| so that it will be invoked after a call to GetAll()
32 // has successfully received all existing properties from the remote object.
33 void SetAllPropertiesReceivedCallback(const base::Closure& callback);
35 // dbus::PropertySet overrides
36 virtual void ConnectSignals() OVERRIDE;
37 virtual void Get(dbus::PropertyBase* property,
38 GetCallback callback) OVERRIDE;
39 virtual void GetAll() OVERRIDE;
40 virtual void OnGetAll(dbus::Response* response) OVERRIDE;
41 virtual void Set(dbus::PropertyBase* property,
42 SetCallback callback) OVERRIDE;
43 virtual void ChangedReceived(dbus::Signal* signal) OVERRIDE;
45 protected:
46 const base::Closure& on_get_all_callback() { return on_get_all_callback_; }
48 private:
49 // Optional callback used to notify clients when all properties were received
50 // after a call to GetAll.
51 base::Closure on_get_all_callback_;
53 DISALLOW_COPY_AND_ASSIGN(NfcPropertySet);
56 } // namespace chromeos
58 #endif // CHROMEOS_DBUS_NFC_PROPERTY_SET_H_