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

Side by Side 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 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 unified diff | Download patch | Annotate | Revision Log
OLDNEW
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #ifndef DEVICE_BLUETOOTH_BLUETOOTH_ADAPTER_FACTORY_H_ 5 #ifndef DEVICE_BLUETOOTH_BLUETOOTH_ADAPTER_FACTORY_H_
6 #define DEVICE_BLUETOOTH_BLUETOOTH_ADAPTER_FACTORY_H_ 6 #define DEVICE_BLUETOOTH_BLUETOOTH_ADAPTER_FACTORY_H_
7 7
8 #include <string> 8 #include <string>
9 9
10 #include "base/callback.h"
10 #include "base/memory/ref_counted.h" 11 #include "base/memory/ref_counted.h"
11 12
12 namespace device { 13 namespace device {
13 14
14 class BluetoothAdapter; 15 class BluetoothAdapter;
15 16
16 // BluetoothAdapterFactory is a class that contains static methods, which 17 // BluetoothAdapterFactory is a class that contains static methods, which
17 // instantiate either a specific bluetooth adapter, or the generic "default 18 // instantiate either a specific bluetooth adapter, or the generic "default
18 // adapter" which may change depending on availability. 19 // adapter" which may change depending on availability.
19 class BluetoothAdapterFactory { 20 class BluetoothAdapterFactory {
20 public: 21 public:
21 // Returns the shared instance for the default adapter, whichever that may 22 typedef base::Callback<bool(scoped_refptr<device::BluetoothAdapter> adapter)>
22 // be at the time. Check the returned scoped_refptr does not point to NULL and 23 AdapterCallback;
23 // use IsPresent() and the AdapterPresentChanged() observer method to 24
24 // determine whether an adapter is actually available or not. 25 // Returns true if the bluetooth is supported in the current platform.
bryeung 2013/01/08 22:24:27 s/if the bluetooth/if Bluetooth/
youngki 2013/01/09 15:12:03 Done.
25 static scoped_refptr<BluetoothAdapter> DefaultAdapter(); 26 static bool IsBluetoothSupported();
27
28 // Runs the callback with the shared instance for the default adapter when the
29 // adapter is available to be used.
30 static void RunCallbackOnAdapterReady(const AdapterCallback& callback);
31
32 // Returns the shared instance of the adapter that has already been created.
33 // It returns NULL if no adapter has been created at the time.
34 static scoped_refptr<BluetoothAdapter> GetAdapter();
26 35
27 // Creates an instance for a specific adapter at address |address|. 36 // Creates an instance for a specific adapter at address |address|.
28 static BluetoothAdapter* Create(const std::string& address); 37 static BluetoothAdapter* Create(const std::string& address);
29 }; 38 };
30 39
31 } // namespace device 40 } // namespace device
32 41
33 #endif // DEVICE_BLUETOOTH_BLUETOOTH_ADAPTER_FACTORY_H_ 42 #endif // DEVICE_BLUETOOTH_BLUETOOTH_ADAPTER_FACTORY_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698