Pin Chrome's shortcut to the Win10 Start menu on install and OS upgrade.
[chromium-blink-merge.git] / chromeos / dbus / nfc_property_set.h
blob7aae76636d3382e6fca7f35ace7d3160f21198ea
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 ~NfcPropertySet() override;
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 void ConnectSignals() override;
37 void Get(dbus::PropertyBase* property, GetCallback callback) override;
38 void GetAll() override;
39 void OnGetAll(dbus::Response* response) override;
40 void Set(dbus::PropertyBase* property, SetCallback callback) override;
41 void ChangedReceived(dbus::Signal* signal) override;
43 protected:
44 const base::Closure& on_get_all_callback() { return on_get_all_callback_; }
46 private:
47 // Optional callback used to notify clients when all properties were received
48 // after a call to GetAll.
49 base::Closure on_get_all_callback_;
51 DISALLOW_COPY_AND_ASSIGN(NfcPropertySet);
54 } // namespace chromeos
56 #endif // CHROMEOS_DBUS_NFC_PROPERTY_SET_H_