summaryrefslogtreecommitdiffstats
path: root/dbus/property.h
diff options
context:
space:
mode:
authordtapuska <dtapuska@chromium.org>2015-02-09 08:02:55 -0800
committerCommit bot <commit-bot@chromium.org>2015-02-09 16:04:03 +0000
commit32d25453c4d04474d75a6db01cd1e006537bd3bf (patch)
treed8aaa2e5be36c1e568be6601d9faa308a9332a8d /dbus/property.h
parentb2e3ececdfdc5ce1037d1bb648a7ff0f1d38f508 (diff)
downloadchromium_src-32d25453c4d04474d75a6db01cd1e006537bd3bf.zip
chromium_src-32d25453c4d04474d75a6db01cd1e006537bd3bf.tar.gz
chromium_src-32d25453c4d04474d75a6db01cd1e006537bd3bf.tar.bz2
Enhance the DBus interface for peerd
Add ability to query properties of - Manager - Peer - Service Add Observer to peerd so we are told when things change. BUG=453873 Review URL: https://codereview.chromium.org/893663002 Cr-Commit-Position: refs/heads/master@{#315311}
Diffstat (limited to 'dbus/property.h')
-rw-r--r--dbus/property.h29
1 files changed, 26 insertions, 3 deletions
diff --git a/dbus/property.h b/dbus/property.h
index ea893dc..419da53 100644
--- a/dbus/property.h
+++ b/dbus/property.h
@@ -7,6 +7,8 @@
#include <map>
#include <string>
+#include <utility>
+#include <vector>
#include "base/basictypes.h"
#include "base/bind.h"
@@ -158,7 +160,7 @@ class PropertyBase {
// no knowledge of the contained type is required, this method returns
// true if its expected type was found, false if not.
// Implementation provided by specialization.
- virtual bool PopValueFromReader(MessageReader*) = 0;
+ virtual bool PopValueFromReader(MessageReader* reader) = 0;
// Method used by PropertySet to append the set value to a MessageWriter,
// no knowledge of the contained type is required.
@@ -229,7 +231,7 @@ class CHROME_DBUS_EXPORT PropertySet {
// Methods connected by ConnectSignals() and called by dbus:: when
// a property is changed. Sub-classes may override if the property
// changed signal provides different arguments.
- virtual void ChangedReceived(Signal*);
+ virtual void ChangedReceived(Signal* signal);
virtual void ChangedConnected(const std::string& interface_name,
const std::string& signal_name,
bool success);
@@ -376,7 +378,7 @@ class CHROME_DBUS_EXPORT Property : public PropertyBase {
// Method used by PropertySet to retrieve the value from a MessageReader,
// no knowledge of the contained type is required, this method returns
// true if its expected type was found, false if not.
- bool PopValueFromReader(MessageReader*) override;
+ bool PopValueFromReader(MessageReader* reader) override;
// Method used by PropertySet to append the set value to a MessageWriter,
// no knowledge of the contained type is required.
@@ -398,6 +400,10 @@ class CHROME_DBUS_EXPORT Property : public PropertyBase {
property_set()->NotifyPropertyChanged(name());
}
+ // Method used by test and stub implementations to directly set the
+ // |set_value_| of a property.
+ void ReplaceSetValueForTesting(const T& value) { set_value_ = value; }
+
private:
// Current cached value of the property.
T value_;
@@ -485,6 +491,23 @@ template <> void Property<std::vector<uint8> >::AppendSetValueToWriter(
MessageWriter* writer);
extern template class Property<std::vector<uint8> >;
+template <>
+bool Property<std::map<std::string, std::string>>::PopValueFromReader(
+ MessageReader* reader);
+template <>
+void Property<std::map<std::string, std::string>>::AppendSetValueToWriter(
+ MessageWriter* writer);
+extern template class Property<std::map<std::string, std::string>>;
+
+template <>
+bool Property<std::vector<std::pair<std::vector<uint8_t>, uint16_t>>>::
+ PopValueFromReader(MessageReader* reader);
+template <>
+void Property<std::vector<std::pair<std::vector<uint8_t>, uint16_t>>>::
+ AppendSetValueToWriter(MessageWriter* writer);
+extern template class Property<
+ std::vector<std::pair<std::vector<uint8_t>, uint16_t>>>;
+
} // namespace dbus
#endif // DBUS_PROPERTY_H_