• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
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
3 // found in the LICENSE file.
4 
5 #ifndef DEVICE_NFC_NFC_ADAPTER_FACTORY_H_
6 #define DEVICE_NFC_NFC_ADAPTER_FACTORY_H_
7 
8 #include "base/callback.h"
9 #include "base/memory/ref_counted.h"
10 #include "device/nfc/nfc_adapter.h"
11 
12 namespace device {
13 
14 // NfcAdapterFactory is a class that contains static methods, which
15 // instantiate either a specific NFC adapter, or the generic "default
16 // adapter" which may change depending on availability.
17 class NfcAdapterFactory {
18  public:
19   typedef base::Callback<void(scoped_refptr<NfcAdapter>)> AdapterCallback;
20 
21   // Returns true if NFC is available for the current platform.
22   static bool IsNfcAvailable();
23 
24   // Returns the shared instance of the default adapter, creating and
25   // initializing it if necessary. |callback| is called with the adapter
26   // instance passed only once the adapter is fully initialized and ready to
27   // use.
28   static void GetAdapter(const AdapterCallback& callback);
29 };
30 
31 }  // namespace device
32 
33 #endif  // DEVICE_NFC_NFC_ADAPTER_FACTORY_H_
34