Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(685)

Side by Side Diff: device/nfc/nfc_adapter.cc

Issue 77563002: nfc: Add native NFC API definitions. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Fixed clang error. Created 7 years ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « device/nfc/nfc_adapter.h ('k') | device/nfc/nfc_adapter_factory.h » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
(Empty)
1 // Copyright (c) 2013 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file.
4
5 #include "device/nfc/nfc_adapter.h"
6
7 #include "base/lazy_instance.h"
8 #include "base/memory/weak_ptr.h"
9 #include "base/stl_util.h"
10 #include "device/nfc/nfc_peer.h"
11 #include "device/nfc/nfc_tag.h"
12
13 namespace device {
14
15 NfcAdapter::NfcAdapter() {
16 }
17
18 NfcAdapter::~NfcAdapter() {
19 STLDeleteValues(&peers_);
20 STLDeleteValues(&tags_);
21 }
22
23 void NfcAdapter::GetPeers(PeerList* peer_list) const {
24 peer_list->clear();
25 for (PeersMap::const_iterator iter = peers_.begin();
26 iter != peers_.end(); ++iter) {
27 peer_list->push_back(iter->second);
28 }
29 }
30
31 void NfcAdapter::GetTags(TagList* tag_list) const {
32 tag_list->clear();
33 for (TagsMap::const_iterator iter = tags_.begin();
34 iter != tags_.end(); ++iter) {
35 tag_list->push_back(iter->second);
36 }
37 }
38
39 NfcPeer* NfcAdapter::GetPeer(const std::string& identifier) const {
40 PeersMap::const_iterator iter = peers_.find(identifier);
41 if (iter != peers_.end())
42 return iter->second;
43 return NULL;
44 }
45
46 NfcTag* NfcAdapter::GetTag(const std::string& identifier) const {
47 TagsMap::const_iterator iter = tags_.find(identifier);
48 if (iter != tags_.end())
49 return iter->second;
50 return NULL;
51 }
52
53 } // namespace device
OLDNEW
« no previous file with comments | « device/nfc/nfc_adapter.h ('k') | device/nfc/nfc_adapter_factory.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698