summaryrefslogtreecommitdiffstats
path: root/chromeos/dbus/nfc_tag_client.cc
diff options
context:
space:
mode:
authorarmansito@chromium.org <armansito@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2014-01-18 08:47:17 +0000
committerarmansito@chromium.org <armansito@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2014-01-18 08:47:17 +0000
commit20e38b8e9730ae28f077269d67e75a231bea7ca3 (patch)
tree24416175bfded4f8df6d13d99c8713df9caea7d3 /chromeos/dbus/nfc_tag_client.cc
parentb826fa8f5432ba0e02306d9901aa584653130e0d (diff)
downloadchromium_src-20e38b8e9730ae28f077269d67e75a231bea7ca3.zip
chromium_src-20e38b8e9730ae28f077269d67e75a231bea7ca3.tar.gz
chromium_src-20e38b8e9730ae28f077269d67e75a231bea7ca3.tar.bz2
nfc: Implement device::NfcTagChromeOS.
Implemented device::NfcTag for the Chrome OS platform. With this patch, Chrome can now interact with remote NFC tags. BUG=316471 TEST=device_unittests Review URL: https://codereview.chromium.org/116143009 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@245753 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'chromeos/dbus/nfc_tag_client.cc')
-rw-r--r--chromeos/dbus/nfc_tag_client.cc25
1 files changed, 24 insertions, 1 deletions
diff --git a/chromeos/dbus/nfc_tag_client.cc b/chromeos/dbus/nfc_tag_client.cc
index de7e1ef..6c439fa 100644
--- a/chromeos/dbus/nfc_tag_client.cc
+++ b/chromeos/dbus/nfc_tag_client.cc
@@ -63,6 +63,16 @@ class NfcTagClientImpl : public NfcTagClient,
}
// NfcTagClient override.
+ virtual std::vector<dbus::ObjectPath> GetTagsForAdapter(
+ const dbus::ObjectPath& adapter_path) OVERRIDE {
+ DBusObjectMap* object_map =
+ adapters_to_object_maps_.GetObjectMap(adapter_path);
+ if (!object_map)
+ return std::vector<dbus::ObjectPath>();
+ return object_map->GetObjectPaths();
+ }
+
+ // NfcTagClient override.
virtual Properties* GetProperties(
const dbus::ObjectPath& object_path) OVERRIDE {
return static_cast<Properties*>(
@@ -182,11 +192,16 @@ class NfcTagClientImpl : public NfcTagClient,
// nfc_client_helpers::DBusObjectMap::Delegate override.
virtual NfcPropertySet* CreateProperties(
dbus::ObjectProxy* object_proxy) OVERRIDE {
- return new Properties(
+ Properties* properties = new Properties(
object_proxy,
base::Bind(&NfcTagClientImpl::OnPropertyChanged,
weak_ptr_factory_.GetWeakPtr(),
object_proxy->object_path()));
+ properties->SetAllPropertiesReceivedCallback(
+ base::Bind(&NfcTagClientImpl::OnPropertiesReceived,
+ weak_ptr_factory_.GetWeakPtr(),
+ object_proxy->object_path()));
+ return properties;
}
// nfc_client_helpers::DBusObjectMap::Delegate override.
@@ -210,6 +225,14 @@ class NfcTagClientImpl : public NfcTagClient,
TagPropertyChanged(object_path, property_name));
}
+ // Called by NfcPropertySet when all properties have been processed as a
+ // result of a call to GetAll.
+ void OnPropertiesReceived(const dbus::ObjectPath& object_path) {
+ VLOG(1) << "All tag properties received; Path: " << object_path.value();
+ FOR_EACH_OBSERVER(NfcTagClient::Observer, observers_,
+ TagPropertiesReceived(object_path));
+ }
+
// We maintain a pointer to the bus to be able to request proxies for
// new NFC tags that appear.
dbus::Bus* bus_;