| 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_H_ | 5 #ifndef DEVICE_NFC_NFC_ADAPTER_H_ |
| 6 #define DEVICE_NFC_NFC_ADAPTER_H_ | 6 #define DEVICE_NFC_NFC_ADAPTER_H_ |
| 7 | 7 |
| 8 #include <map> | 8 #include <map> |
| 9 #include <string> | 9 #include <string> |
| 10 #include <vector> | 10 #include <vector> |
| (...skipping 67 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 78 // this call, its life-time cannot be guaranteed once this call returns, as | 78 // this call, its life-time cannot be guaranteed once this call returns, as |
| 79 // the object may get destroyed if the connection with the peer is lost. | 79 // the object may get destroyed if the connection with the peer is lost. |
| 80 // Instead of caching the pointer directly, observers should store the | 80 // Instead of caching the pointer directly, observers should store the |
| 81 // peer's assigned unique identifier instead, which can be used to obtain a | 81 // peer's assigned unique identifier instead, which can be used to obtain a |
| 82 // pointer to the peer, as long as it exists. | 82 // pointer to the peer, as long as it exists. |
| 83 virtual void PeerFound(NfcAdapter* adaper, NfcPeer* peer) {} | 83 virtual void PeerFound(NfcAdapter* adaper, NfcPeer* peer) {} |
| 84 | 84 |
| 85 // Called when the remote NFC adapter |peer| is no longer known by the | 85 // Called when the remote NFC adapter |peer| is no longer known by the |
| 86 // adapter |adapter|. |peer| should not be cached. | 86 // adapter |adapter|. |peer| should not be cached. |
| 87 virtual void PeerLost(NfcAdapter* adapter, NfcPeer* peer) {} | 87 virtual void PeerLost(NfcAdapter* adapter, NfcPeer* peer) {} |
| 88 |
| 89 protected: |
| 90 Observer() = default; |
| 88 }; | 91 }; |
| 89 | 92 |
| 90 // The ErrorCallback is used by methods to asynchronously report errors. | 93 // The ErrorCallback is used by methods to asynchronously report errors. |
| 91 typedef base::Closure ErrorCallback; | 94 typedef base::Closure ErrorCallback; |
| 92 | 95 |
| 93 // Typedefs for lists of NFC peer and NFC tag objects. | 96 // Typedefs for lists of NFC peer and NFC tag objects. |
| 94 typedef std::vector<NfcPeer*> PeerList; | 97 typedef std::vector<NfcPeer*> PeerList; |
| 95 typedef std::vector<NfcTag*> TagList; | 98 typedef std::vector<NfcTag*> TagList; |
| 96 | 99 |
| 97 // Adds and removes observers for events on this NFC adapter. If monitoring | 100 // Adds and removes observers for events on this NFC adapter. If monitoring |
| (...skipping 103 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 201 // Peers and tags that are managed by this adapter. | 204 // Peers and tags that are managed by this adapter. |
| 202 PeersMap peers_; | 205 PeersMap peers_; |
| 203 TagsMap tags_; | 206 TagsMap tags_; |
| 204 | 207 |
| 205 DISALLOW_COPY_AND_ASSIGN(NfcAdapter); | 208 DISALLOW_COPY_AND_ASSIGN(NfcAdapter); |
| 206 }; | 209 }; |
| 207 | 210 |
| 208 } // namespace device | 211 } // namespace device |
| 209 | 212 |
| 210 #endif // DEVICE_NFC_NFC_ADAPTER_H_ | 213 #endif // DEVICE_NFC_NFC_ADAPTER_H_ |
| OLD | NEW |