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

Unified Diff: device/bluetooth/bluetooth_adapter_factory.h

Issue 11819007: Changed DefaultAdapter to RunCallbackOnAdapterReady function. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created IsBluetoothSupported in BluetoothEventRouter to fix browser_tests. Created 7 years, 11 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.h
diff --git a/device/bluetooth/bluetooth_adapter_factory.h b/device/bluetooth/bluetooth_adapter_factory.h
index 82e1e6f90eb4396d276fd2c7351183cd21ef0da7..6923f7a332b3bf8dcd87ff644e134a42e6407d94 100644
--- a/device/bluetooth/bluetooth_adapter_factory.h
+++ b/device/bluetooth/bluetooth_adapter_factory.h
@@ -7,6 +7,7 @@
#include <string>
+#include "base/callback.h"
#include "base/memory/ref_counted.h"
namespace device {
@@ -14,15 +15,24 @@ namespace device {
class BluetoothAdapter;
// BluetoothAdapterFactory is a class that contains static methods, which
-// instantiate either a specific bluetooth adapter, or the generic "default
+// instantiate either a specific Bluetooth adapter, or the generic "default
// adapter" which may change depending on availability.
class BluetoothAdapterFactory {
public:
- // Returns the shared instance for the default adapter, whichever that may
- // be at the time. Check the returned scoped_refptr does not point to NULL and
- // use IsPresent() and the AdapterPresentChanged() observer method to
- // determine whether an adapter is actually available or not.
- static scoped_refptr<BluetoothAdapter> DefaultAdapter();
+ typedef base::Callback<void(scoped_refptr<device::BluetoothAdapter> adapter)>
+ AdapterCallback;
+
+ // Returns true if the Bluetooth adapter is available for the current
+ // platform.
+ static bool IsBluetoothAdapterAvailable();
+
+ // Runs the callback with the shared instance for the default adapter when the
+ // adapter is available to be used.
+ static void RunCallbackOnAdapterReady(const AdapterCallback& callback);
+
+ // Returns the shared instance of the adapter that has already been created.
+ // It returns NULL if no adapter has been created at the time.
+ static scoped_refptr<BluetoothAdapter> GetAdapter();
// Creates an instance for a specific adapter at address |address|.
static BluetoothAdapter* Create(const std::string& address);
« no previous file with comments | « device/bluetooth/bluetooth_adapter_devices_chromeos_unittest.cc ('k') | device/bluetooth/bluetooth_adapter_factory.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698