| 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_device_client.h" | 5 #include "chromeos/dbus/nfc_device_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 186 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 197 << " Property: " << property_name; | 197 << " Property: " << property_name; |
| 198 FOR_EACH_OBSERVER(NfcDeviceClient::Observer, observers_, | 198 FOR_EACH_OBSERVER(NfcDeviceClient::Observer, observers_, |
| 199 DevicePropertyChanged(object_path, property_name)); | 199 DevicePropertyChanged(object_path, property_name)); |
| 200 } | 200 } |
| 201 | 201 |
| 202 // We maintain a pointer to the bus to be able to request proxies for | 202 // We maintain a pointer to the bus to be able to request proxies for |
| 203 // new NFC devices that appear. | 203 // new NFC devices that appear. |
| 204 dbus::Bus* bus_; | 204 dbus::Bus* bus_; |
| 205 | 205 |
| 206 // List of observers interested in event notifications. | 206 // List of observers interested in event notifications. |
| 207 ObserverList<NfcDeviceClient::Observer> observers_; | 207 base::ObserverList<NfcDeviceClient::Observer> observers_; |
| 208 | 208 |
| 209 // Mapping from object paths to object proxies and properties structures that | 209 // Mapping from object paths to object proxies and properties structures that |
| 210 // were already created by us. This stucture stores a different DBusObjectMap | 210 // were already created by us. This stucture stores a different DBusObjectMap |
| 211 // for each known NFC adapter object path. | 211 // for each known NFC adapter object path. |
| 212 ObjectProxyTree adapters_to_object_maps_; | 212 ObjectProxyTree adapters_to_object_maps_; |
| 213 | 213 |
| 214 // The adapter client that we listen to events notifications from. | 214 // The adapter client that we listen to events notifications from. |
| 215 NfcAdapterClient* adapter_client_; | 215 NfcAdapterClient* adapter_client_; |
| 216 | 216 |
| 217 // Weak pointer factory for generating 'this' pointers that might live longer | 217 // Weak pointer factory for generating 'this' pointers that might live longer |
| 218 // than we do. | 218 // than we do. |
| 219 // Note: This should remain the last member so it'll be destroyed and | 219 // Note: This should remain the last member so it'll be destroyed and |
| 220 // invalidate its weak pointers before any other members are destroyed. | 220 // invalidate its weak pointers before any other members are destroyed. |
| 221 base::WeakPtrFactory<NfcDeviceClientImpl> weak_ptr_factory_; | 221 base::WeakPtrFactory<NfcDeviceClientImpl> weak_ptr_factory_; |
| 222 | 222 |
| 223 DISALLOW_COPY_AND_ASSIGN(NfcDeviceClientImpl); | 223 DISALLOW_COPY_AND_ASSIGN(NfcDeviceClientImpl); |
| 224 }; | 224 }; |
| 225 | 225 |
| 226 NfcDeviceClient::NfcDeviceClient() { | 226 NfcDeviceClient::NfcDeviceClient() { |
| 227 } | 227 } |
| 228 | 228 |
| 229 NfcDeviceClient::~NfcDeviceClient() { | 229 NfcDeviceClient::~NfcDeviceClient() { |
| 230 } | 230 } |
| 231 | 231 |
| 232 NfcDeviceClient* NfcDeviceClient::Create(NfcAdapterClient* adapter_client) { | 232 NfcDeviceClient* NfcDeviceClient::Create(NfcAdapterClient* adapter_client) { |
| 233 return new NfcDeviceClientImpl(adapter_client); | 233 return new NfcDeviceClientImpl(adapter_client); |
| 234 } | 234 } |
| 235 | 235 |
| 236 } // namespace chromeos | 236 } // namespace chromeos |
| OLD | NEW |