Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(52)

Unified Diff: chromeos/dbus/bluetooth_property.h

Issue 10698027: dbus: move logic from Property<> to PropertySet (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: add missing overrides for clang Created 8 years, 6 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « chromeos/dbus/bluetooth_node_client.h ('k') | chromeos/dbus/bluetooth_property.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: chromeos/dbus/bluetooth_property.h
diff --git a/chromeos/dbus/bluetooth_property.h b/chromeos/dbus/bluetooth_property.h
index 010b0f00aeb35c51fd1608f22bac458edce35c53..41be1c0cbcc0dbd1477d74215a8f421c223c48a8 100644
--- a/chromeos/dbus/bluetooth_property.h
+++ b/chromeos/dbus/bluetooth_property.h
@@ -19,8 +19,6 @@ namespace chromeos {
// BlueZ predates the common D-Bus Properties API (though it inspired it),
// override dbus::PropertySet to generate the correct method call to get
// all properties, conenect to the correct signal and parse it correctly.
-//
-// BluetoothPropertySet should be used with BluetoothProperty<>.
class BluetoothPropertySet : public dbus::PropertySet {
public:
BluetoothPropertySet(dbus::ObjectProxy* object_proxy,
@@ -36,63 +34,29 @@ class BluetoothPropertySet : public dbus::PropertySet {
// dbus::PropertySet override.
//
+ // Requests an updated value from the remote object incurring a round-trip.
+ virtual void Get(dbus::PropertyBase* property,
+ GetCallback callback) OVERRIDE;
+
+ // dbus::PropertySet override.
+ //
// Queries the remote object for values of all properties and updates
// initial values.
virtual void GetAll() OVERRIDE;
// dbus::PropertySet override.
//
+ // Requests that the remote object change the property to its new value.
+ virtual void Set(dbus::PropertyBase* property,
+ SetCallback callback) OVERRIDE;
+
+ // dbus::PropertySet override.
+ //
// Method connected by ConnectSignals() and called by dbus:: when
// a property is changed.
virtual void ChangedReceived(dbus::Signal* signal) OVERRIDE;
};
-// BlueZ predates the common D-Bus Properties API (though it inspired it),
-// override dbus::Property<> to generate the correct method call to set a
-// new property value.
-template <class T>
-class BluetoothProperty : public dbus::Property<T> {
- public:
- // Import the callbacks into our namespace (this is a template derived from
- // a template, the C++ standard gets a bit wibbly and doesn't do it for us).
- //
- // |success| indicates whether or not the value could be retrived, or new
- // value set. For Get, if true the new value can be obtained by calling
- // value() on the property; for Set() a Get() call may be necessary.
- typedef typename dbus::Property<T>::GetCallback GetCallback;
- typedef typename dbus::Property<T>::SetCallback SetCallback;
-
- // dbus::Property<> override.
- //
- // Requests an updated value from the remote object incurring a
- // round-trip. |callback| will be called when the new value is available.
- virtual void Get(GetCallback callback) OVERRIDE {
- NOTREACHED() << "BlueZ does not implement Get for properties";
- }
-
- // dbus::Property<> override.
- //
- // Requests that the remote object change the property value to |value|,
- // |callback| will be called to indicate the success or failure of the
- // request, however the new value may not be available depending on the
- // remote object.
- virtual void Set(const T& value, SetCallback callback) OVERRIDE {
- dbus::MethodCall method_call(this->property_set()->interface(),
- bluetooth_common::kSetProperty);
- dbus::MessageWriter writer(&method_call);
- writer.AppendString(this->name());
- this->AppendToWriter(&writer, value);
-
- dbus::ObjectProxy *object_proxy = this->property_set()->object_proxy();
- DCHECK(object_proxy);
- object_proxy->CallMethod(&method_call,
- dbus::ObjectProxy::TIMEOUT_USE_DEFAULT,
- base::Bind(&dbus::Property<T>::OnSet,
- this->GetWeakPtr(),
- callback));
- }
-};
-
} // namespace chromeos
#endif // CHROMEOS_DBUS_BLUETOOTH_PROPERTY_H_
« no previous file with comments | « chromeos/dbus/bluetooth_node_client.h ('k') | chromeos/dbus/bluetooth_property.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698