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 #ifndef DEVICE_NFC_NFC_ADAPTER_CHROMEOS_H_ | 5 #ifndef DEVICE_NFC_NFC_ADAPTER_CHROMEOS_H_ |
6 #define DEVICE_NFC_NFC_ADAPTER_CHROMEOS_H_ | 6 #define DEVICE_NFC_NFC_ADAPTER_CHROMEOS_H_ |
7 | 7 |
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 "chromeos/dbus/nfc_adapter_client.h" | 10 #include "chromeos/dbus/nfc_adapter_client.h" |
(...skipping 11 matching lines...) Expand all Loading... |
22 namespace chromeos { | 22 namespace chromeos { |
23 | 23 |
24 // The NfcAdapterChromeOS class implements NfcAdapter for the Chrome OS | 24 // The NfcAdapterChromeOS class implements NfcAdapter for the Chrome OS |
25 // platform. | 25 // platform. |
26 class NfcAdapterChromeOS : public device::NfcAdapter, | 26 class NfcAdapterChromeOS : public device::NfcAdapter, |
27 public chromeos::NfcAdapterClient::Observer, | 27 public chromeos::NfcAdapterClient::Observer, |
28 public chromeos::NfcDeviceClient::Observer, | 28 public chromeos::NfcDeviceClient::Observer, |
29 public chromeos::NfcTagClient::Observer { | 29 public chromeos::NfcTagClient::Observer { |
30 public: | 30 public: |
31 // NfcAdapter overrides. | 31 // NfcAdapter overrides. |
32 virtual void AddObserver(NfcAdapter::Observer* observer) OVERRIDE; | 32 virtual void AddObserver(NfcAdapter::Observer* observer) override; |
33 virtual void RemoveObserver(NfcAdapter::Observer* observer) OVERRIDE; | 33 virtual void RemoveObserver(NfcAdapter::Observer* observer) override; |
34 virtual bool IsPresent() const OVERRIDE; | 34 virtual bool IsPresent() const override; |
35 virtual bool IsPowered() const OVERRIDE; | 35 virtual bool IsPowered() const override; |
36 virtual bool IsPolling() const OVERRIDE; | 36 virtual bool IsPolling() const override; |
37 virtual bool IsInitialized() const OVERRIDE; | 37 virtual bool IsInitialized() const override; |
38 virtual void SetPowered(bool powered, | 38 virtual void SetPowered(bool powered, |
39 const base::Closure& callback, | 39 const base::Closure& callback, |
40 const ErrorCallback& error_callback) OVERRIDE; | 40 const ErrorCallback& error_callback) override; |
41 virtual void StartPolling(const base::Closure& callback, | 41 virtual void StartPolling(const base::Closure& callback, |
42 const ErrorCallback& error_callback) OVERRIDE; | 42 const ErrorCallback& error_callback) override; |
43 virtual void StopPolling(const base::Closure& callback, | 43 virtual void StopPolling(const base::Closure& callback, |
44 const ErrorCallback& error_callback) OVERRIDE; | 44 const ErrorCallback& error_callback) override; |
45 | 45 |
46 private: | 46 private: |
47 friend class device::NfcAdapterFactory; | 47 friend class device::NfcAdapterFactory; |
48 friend class NfcChromeOSTest; | 48 friend class NfcChromeOSTest; |
49 | 49 |
50 NfcAdapterChromeOS(); | 50 NfcAdapterChromeOS(); |
51 virtual ~NfcAdapterChromeOS(); | 51 virtual ~NfcAdapterChromeOS(); |
52 | 52 |
53 // NfcAdapterClient::Observer overrides. | 53 // NfcAdapterClient::Observer overrides. |
54 virtual void AdapterAdded(const dbus::ObjectPath& object_path) OVERRIDE; | 54 virtual void AdapterAdded(const dbus::ObjectPath& object_path) override; |
55 virtual void AdapterRemoved(const dbus::ObjectPath& object_path) OVERRIDE; | 55 virtual void AdapterRemoved(const dbus::ObjectPath& object_path) override; |
56 virtual void AdapterPropertyChanged( | 56 virtual void AdapterPropertyChanged( |
57 const dbus::ObjectPath& object_path, | 57 const dbus::ObjectPath& object_path, |
58 const std::string& property_name) OVERRIDE; | 58 const std::string& property_name) override; |
59 | 59 |
60 // NfcDeviceClient::Observer overrides. | 60 // NfcDeviceClient::Observer overrides. |
61 virtual void DeviceAdded(const dbus::ObjectPath& object_path) OVERRIDE; | 61 virtual void DeviceAdded(const dbus::ObjectPath& object_path) override; |
62 virtual void DeviceRemoved(const dbus::ObjectPath& object_path) OVERRIDE; | 62 virtual void DeviceRemoved(const dbus::ObjectPath& object_path) override; |
63 | 63 |
64 // NfcTagClient::Observer overrides. | 64 // NfcTagClient::Observer overrides. |
65 virtual void TagAdded(const dbus::ObjectPath& object_path) OVERRIDE; | 65 virtual void TagAdded(const dbus::ObjectPath& object_path) override; |
66 virtual void TagRemoved(const dbus::ObjectPath& object_path) OVERRIDE; | 66 virtual void TagRemoved(const dbus::ObjectPath& object_path) override; |
67 | 67 |
68 // Set the tracked adapter to the one in |object_path|, this object will | 68 // Set the tracked adapter to the one in |object_path|, this object will |
69 // subsequently operate on that adapter until it is removed. | 69 // subsequently operate on that adapter until it is removed. |
70 void SetAdapter(const dbus::ObjectPath& object_path); | 70 void SetAdapter(const dbus::ObjectPath& object_path); |
71 | 71 |
72 // Remove the currently tracked adapter. IsPresent() will return false after | 72 // Remove the currently tracked adapter. IsPresent() will return false after |
73 // this is called. | 73 // this is called. |
74 void RemoveAdapter(); | 74 void RemoveAdapter(); |
75 | 75 |
76 // Announce to observers a change in the adapter state. | 76 // Announce to observers a change in the adapter state. |
(...skipping 27 matching lines...) Expand all Loading... |
104 // Note: This should remain the last member so it'll be destroyed and | 104 // Note: This should remain the last member so it'll be destroyed and |
105 // invalidate its weak pointers before any other members are destroyed. | 105 // invalidate its weak pointers before any other members are destroyed. |
106 base::WeakPtrFactory<NfcAdapterChromeOS> weak_ptr_factory_; | 106 base::WeakPtrFactory<NfcAdapterChromeOS> weak_ptr_factory_; |
107 | 107 |
108 DISALLOW_COPY_AND_ASSIGN(NfcAdapterChromeOS); | 108 DISALLOW_COPY_AND_ASSIGN(NfcAdapterChromeOS); |
109 }; | 109 }; |
110 | 110 |
111 } // namespace chromeos | 111 } // namespace chromeos |
112 | 112 |
113 #endif // DEVICE_NFC_NFC_ADAPTER_CHROMEOS_H_ | 113 #endif // DEVICE_NFC_NFC_ADAPTER_CHROMEOS_H_ |
OLD | NEW |