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

Unified Diff: device/bluetooth/bluetooth_adapter_factory.cc

Issue 11075006: Moved bluetooth adapter files to device/bluetooth/. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Fix so that this CL compiles on Windows. Created 8 years, 2 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
Index: device/bluetooth/bluetooth_adapter_factory.cc
diff --git a/chrome/browser/chromeos/bluetooth/bluetooth_adapter_factory.cc b/device/bluetooth/bluetooth_adapter_factory.cc
similarity index 60%
rename from chrome/browser/chromeos/bluetooth/bluetooth_adapter_factory.cc
rename to device/bluetooth/bluetooth_adapter_factory.cc
index eb626220d779078ac039a8b627d2800bf9d8f730..c493e9cda2a11341347c162192639d10cfaa181a 100644
--- a/chrome/browser/chromeos/bluetooth/bluetooth_adapter_factory.cc
+++ b/device/bluetooth/bluetooth_adapter_factory.cc
@@ -1,14 +1,17 @@
// Copyright (c) 2012 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.
-//
-// TODO(youngki): Guard the ChromeOS specific part with "#ifdef CHROME_OS" block
-// once we move this code into common directory.
+
+#include "device/bluetooth/bluetooth_adapter_factory.h"
#include "base/lazy_instance.h"
#include "base/memory/ref_counted.h"
-#include "chrome/browser/chromeos/bluetooth/bluetooth_adapter_chromeos.h"
-#include "chrome/browser/chromeos/bluetooth/bluetooth_adapter_factory.h"
+#include "base/memory/weak_ptr.h"
+#include "device/bluetooth/bluetooth_adapter.h"
+
+#if defined(OS_CHROMEOS)
+#include "device/bluetooth/bluetooth_adapter_chromeos.h"
+#endif
namespace {
@@ -16,29 +19,37 @@ namespace {
// 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<chromeos::BluetoothAdapter> >::Leaky
+base::LazyInstance<base::WeakPtr<bluetooth::BluetoothAdapter> >::Leaky
default_adapter = LAZY_INSTANCE_INITIALIZER;
} // namespace
-namespace chromeos {
+namespace bluetooth {
// static
scoped_refptr<BluetoothAdapter> BluetoothAdapterFactory::DefaultAdapter() {
+ scoped_refptr<BluetoothAdapter> adapter;
if (!default_adapter.Get().get()) {
+#if defined(OS_CHROMEOS)
BluetoothAdapterChromeOs* new_adapter = new BluetoothAdapterChromeOs;
new_adapter->TrackDefaultAdapter();
default_adapter.Get() = new_adapter->weak_ptr_factory_.GetWeakPtr();
+ adapter = default_adapter.Get();
+#endif
}
- return scoped_refptr<BluetoothAdapter>(default_adapter.Get());
+ return adapter;
}
// static
BluetoothAdapter* BluetoothAdapterFactory::Create(const std::string& address) {
- BluetoothAdapterChromeOs* adapter = new BluetoothAdapterChromeOs;
- adapter->FindAdapter(address);
+ BluetoothAdapter* adapter = NULL;
+#if defined(OS_CHROMEOS)
+ BluetoothAdapterChromeOs* adapter_chromeos = new BluetoothAdapterChromeOs;
+ adapter_chromeos->FindAdapter(address);
+ adapter = adapter_chromeos;
+#endif
return adapter;
}
-} // namespace chromeos
+} // namespace bluetooth

Powered by Google App Engine
This is Rietveld 408576698