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

Unified Diff: chromeos/dbus/nfc_property_set.cc

Issue 99903003: nfc: Various fixes to the NFC D-Bus client in chromeos/dbus. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 7 years 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
Index: chromeos/dbus/nfc_property_set.cc
diff --git a/chromeos/dbus/nfc_property_set.cc b/chromeos/dbus/nfc_property_set.cc
index 2814bcf8d8f2191518796822ffa3b09f4e27e9de..6683eba34f973969913c2102d497e267b6e6be7a 100644
--- a/chromeos/dbus/nfc_property_set.cc
+++ b/chromeos/dbus/nfc_property_set.cc
@@ -23,6 +23,11 @@ void NfcPropertySet::ConnectSignals() {
base::Bind(&dbus::PropertySet::ChangedConnected, GetWeakPtr()));
}
+void NfcPropertySet::SetAllPropertiesReceivedCallback(
+ const base::Closure& callback) {
+ on_get_all_callback_ = callback;
+}
+
void NfcPropertySet::Get(dbus::PropertyBase* property,
GetCallback callback) {
NOTREACHED() << "neard does not implement Get for properties.";
@@ -37,10 +42,28 @@ void NfcPropertySet::GetAll() {
GetWeakPtr()));
}
+void NfcPropertySet::OnGetAll(dbus::Response* response) {
+ // First invoke the superclass implementation. If the call to GetAll was
+ // successful, this will invoke the PropertyChangedCallback passed to the
+ // constructor for each individual property received through the call and
+ // make sure that the values of the properties have been cached. This way,
+ // all received properties will be available when |on_get_all_callback_| is
+ // run.
+ dbus::PropertySet::OnGetAll(response);
+ if (response) {
+ VLOG(2) << "NfcPropertySet::GetAll returned successfully.";
+ if (!on_get_all_callback_.is_null())
+ on_get_all_callback_.Run();
+ }
+}
+
void NfcPropertySet::Set(dbus::PropertyBase* property,
SetCallback callback) {
dbus::MethodCall method_call(
interface(), nfc_common::kSetProperty);
+ dbus::MessageWriter writer(&method_call);
+ writer.AppendString(property->name());
+ property->AppendSetValueToWriter(&writer);
object_proxy()->CallMethod(&method_call,
dbus::ObjectProxy::TIMEOUT_USE_DEFAULT,
base::Bind(&dbus::PropertySet::OnSet,

Powered by Google App Engine
This is Rietveld 408576698