OLD | NEW |
1 // Copyright 2013 The Chromium Authors. All rights reserved. | 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 | 2 // Use of this source code is governed by a BSD-style license that can be |
3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
4 | 4 |
5 #include "chromeos/dbus/nfc_tag_client.h" | 5 #include "chromeos/dbus/nfc_tag_client.h" |
6 | 6 |
7 #include "base/bind.h" | 7 #include "base/bind.h" |
8 #include "base/memory/weak_ptr.h" | 8 #include "base/memory/weak_ptr.h" |
9 #include "base/observer_list.h" | 9 #include "base/observer_list.h" |
10 #include "base/strings/stringprintf.h" | 10 #include "base/strings/stringprintf.h" |
(...skipping 206 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
217 VLOG(1) << "All tag properties received; Path: " << object_path.value(); | 217 VLOG(1) << "All tag properties received; Path: " << object_path.value(); |
218 FOR_EACH_OBSERVER(NfcTagClient::Observer, observers_, | 218 FOR_EACH_OBSERVER(NfcTagClient::Observer, observers_, |
219 TagPropertiesReceived(object_path)); | 219 TagPropertiesReceived(object_path)); |
220 } | 220 } |
221 | 221 |
222 // We maintain a pointer to the bus to be able to request proxies for | 222 // We maintain a pointer to the bus to be able to request proxies for |
223 // new NFC tags that appear. | 223 // new NFC tags that appear. |
224 dbus::Bus* bus_; | 224 dbus::Bus* bus_; |
225 | 225 |
226 // List of observers interested in event notifications. | 226 // List of observers interested in event notifications. |
227 ObserverList<NfcTagClient::Observer> observers_; | 227 base::ObserverList<NfcTagClient::Observer> observers_; |
228 | 228 |
229 // Mapping from object paths to object proxies and properties structures that | 229 // Mapping from object paths to object proxies and properties structures that |
230 // were already created by us. This stucture stores a different DBusObjectMap | 230 // were already created by us. This stucture stores a different DBusObjectMap |
231 // for each known NFC adapter object path. | 231 // for each known NFC adapter object path. |
232 ObjectProxyTree adapters_to_object_maps_; | 232 ObjectProxyTree adapters_to_object_maps_; |
233 | 233 |
234 // The adapter client that we listen to events notifications from. | 234 // The adapter client that we listen to events notifications from. |
235 NfcAdapterClient* adapter_client_; | 235 NfcAdapterClient* adapter_client_; |
236 | 236 |
237 // Weak pointer factory for generating 'this' pointers that might live longer | 237 // Weak pointer factory for generating 'this' pointers that might live longer |
238 // than we do. | 238 // than we do. |
239 // Note: This should remain the last member so it'll be destroyed and | 239 // Note: This should remain the last member so it'll be destroyed and |
240 // invalidate its weak pointers before any other members are destroyed. | 240 // invalidate its weak pointers before any other members are destroyed. |
241 base::WeakPtrFactory<NfcTagClientImpl> weak_ptr_factory_; | 241 base::WeakPtrFactory<NfcTagClientImpl> weak_ptr_factory_; |
242 | 242 |
243 DISALLOW_COPY_AND_ASSIGN(NfcTagClientImpl); | 243 DISALLOW_COPY_AND_ASSIGN(NfcTagClientImpl); |
244 }; | 244 }; |
245 | 245 |
246 NfcTagClient::NfcTagClient() { | 246 NfcTagClient::NfcTagClient() { |
247 } | 247 } |
248 | 248 |
249 NfcTagClient::~NfcTagClient() { | 249 NfcTagClient::~NfcTagClient() { |
250 } | 250 } |
251 | 251 |
252 NfcTagClient* NfcTagClient::Create(NfcAdapterClient* adapter_client) { | 252 NfcTagClient* NfcTagClient::Create(NfcAdapterClient* adapter_client) { |
253 return new NfcTagClientImpl(adapter_client); | 253 return new NfcTagClientImpl(adapter_client); |
254 } | 254 } |
255 | 255 |
256 } // namespace chromeos | 256 } // namespace chromeos |
OLD | NEW |