| 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/fake_nfc_adapter_client.h" | 5 #include "chromeos/dbus/fake_nfc_adapter_client.h" |
| 6 | 6 |
| 7 #include "base/logging.h" | 7 #include "base/logging.h" |
| 8 #include "chromeos/dbus/dbus_thread_manager.h" | 8 #include "chromeos/dbus/dbus_thread_manager.h" |
| 9 #include "chromeos/dbus/fake_nfc_device_client.h" | 9 #include "chromeos/dbus/fake_nfc_device_client.h" |
| 10 #include "chromeos/dbus/fake_nfc_tag_client.h" | 10 #include "chromeos/dbus/fake_nfc_tag_client.h" |
| (...skipping 279 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 290 // Mark as polling. | 290 // Mark as polling. |
| 291 DCHECK(!properties_->polling.value()); | 291 DCHECK(!properties_->polling.value()); |
| 292 properties_->polling.ReplaceValue(true); | 292 properties_->polling.ReplaceValue(true); |
| 293 return; | 293 return; |
| 294 } | 294 } |
| 295 } | 295 } |
| 296 LOG(WARNING) << "Device path not in list of devices."; | 296 LOG(WARNING) << "Device path not in list of devices."; |
| 297 } | 297 } |
| 298 | 298 |
| 299 void FakeNfcAdapterClient::UnsetTag(const dbus::ObjectPath& tag_path) { | 299 void FakeNfcAdapterClient::UnsetTag(const dbus::ObjectPath& tag_path) { |
| 300 LOG(INFO) << "Add tag path to the fake adapter: " << tag_path.value(); | 300 LOG(INFO) << "Remove tag path from the fake adapter: " << tag_path.value(); |
| 301 ObjectPathVector new_tags = properties_->tags.value(); | 301 ObjectPathVector new_tags = properties_->tags.value(); |
| 302 for (ObjectPathVector::iterator iter = new_tags.begin(); | 302 for (ObjectPathVector::iterator iter = new_tags.begin(); |
| 303 iter != new_tags.end(); ++iter) { | 303 iter != new_tags.end(); ++iter) { |
| 304 if (*iter == tag_path) { | 304 if (*iter == tag_path) { |
| 305 new_tags.erase(iter); | 305 new_tags.erase(iter); |
| 306 properties_->tags.ReplaceValue(new_tags); | 306 properties_->tags.ReplaceValue(new_tags); |
| 307 | 307 |
| 308 // Mark as polling. | 308 // Mark as polling. |
| 309 DCHECK(!properties_->polling.value()); | 309 DCHECK(!properties_->polling.value()); |
| 310 properties_->polling.ReplaceValue(true); | 310 properties_->polling.ReplaceValue(true); |
| 311 return; | 311 return; |
| 312 } | 312 } |
| 313 } | 313 } |
| 314 LOG(WARNING) << "Tag path not in list of tags."; | 314 LOG(WARNING) << "Tag path not in list of tags."; |
| 315 } | 315 } |
| 316 | 316 |
| 317 void FakeNfcAdapterClient::EnablePairingOnPoll(bool enabled) { | 317 void FakeNfcAdapterClient::EnablePairingOnPoll(bool enabled) { |
| 318 start_pairing_on_poll_ = enabled; | 318 start_pairing_on_poll_ = enabled; |
| 319 } | 319 } |
| 320 | 320 |
| 321 void FakeNfcAdapterClient::OnPropertyChanged( | 321 void FakeNfcAdapterClient::OnPropertyChanged( |
| 322 const dbus::ObjectPath& object_path, | 322 const dbus::ObjectPath& object_path, |
| 323 const std::string& property_name) { | 323 const std::string& property_name) { |
| 324 FOR_EACH_OBSERVER(NfcAdapterClient::Observer, observers_, | 324 FOR_EACH_OBSERVER(NfcAdapterClient::Observer, observers_, |
| 325 AdapterPropertyChanged(object_path, property_name)); | 325 AdapterPropertyChanged(object_path, property_name)); |
| 326 } | 326 } |
| 327 | 327 |
| 328 } // namespace chromeos | 328 } // namespace chromeos |
| OLD | NEW |