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

Unified Diff: device/nfc/nfc_adapter_factory.cc

Issue 2292703002: chromeos: Remove unused NFC D-Bus client library (Closed)
Patch Set: rebase Created 4 years, 4 months 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « device/nfc/nfc_adapter_factory.h ('k') | device/nfc/nfc_chromeos_unittest.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: device/nfc/nfc_adapter_factory.cc
diff --git a/device/nfc/nfc_adapter_factory.cc b/device/nfc/nfc_adapter_factory.cc
deleted file mode 100644
index 785925e2bebdaef3c72ffd14063ff58bcf58bdf0..0000000000000000000000000000000000000000
--- a/device/nfc/nfc_adapter_factory.cc
+++ /dev/null
@@ -1,55 +0,0 @@
-// Copyright 2013 The Chromium Authors. All rights reserved.
-// Use of this source code is governed by a BSD-style license that can be
-// found in the LICENSE file.
-
-#include "device/nfc/nfc_adapter_factory.h"
-
-#include "base/lazy_instance.h"
-#include "base/logging.h"
-#include "base/memory/weak_ptr.h"
-#include "build/build_config.h"
-
-#if defined(OS_CHROMEOS)
-#include "device/nfc/nfc_adapter_chromeos.h"
-#endif
-
-namespace device {
-
-namespace {
-
-// Shared default adapter instance, we don't want to keep this class around
-// if nobody is using it so use a WeakPtr and create the object when needed;
-// since Google C++ Style (and clang's static analyzer) forbids us having
-// exit-time destructors we use a leaky lazy instance for it.
-base::LazyInstance<base::WeakPtr<device::NfcAdapter> >::Leaky
- default_adapter = LAZY_INSTANCE_INITIALIZER;
-
-} // namespace
-
-// static
-bool NfcAdapterFactory::IsNfcAvailable() {
-#if defined(OS_CHROMEOS)
- return true;
-#else
- return false;
-#endif
-}
-
-// static
-void NfcAdapterFactory::GetAdapter(const AdapterCallback& callback) {
- if (!IsNfcAvailable()) {
- LOG(WARNING) << "NFC is not available on the current platform.";
- return;
- }
- if (!default_adapter.Get().get()) {
-#if defined(OS_CHROMEOS)
- chromeos::NfcAdapterChromeOS* new_adapter =
- new chromeos::NfcAdapterChromeOS();
- default_adapter.Get() = new_adapter->weak_ptr_factory_.GetWeakPtr();
-#endif
- }
- if (default_adapter.Get()->IsInitialized())
- callback.Run(scoped_refptr<NfcAdapter>(default_adapter.Get().get()));
-}
-
-} // namespace device
« no previous file with comments | « device/nfc/nfc_adapter_factory.h ('k') | device/nfc/nfc_chromeos_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698