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

Side by Side Diff: device/bluetooth/bluetooth_adapter_factory.h

Issue 12018024: Implemented Asynchronous Initialization of BluetoothAdapter. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Renamed RunCallbackOnAdapterReady to GetAdapter. 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/callback.h"
11 #include "base/memory/ref_counted.h" 11 #include "base/memory/ref_counted.h"
12 #include "device/bluetooth/bluetooth_adapter.h" 12 #include "device/bluetooth/bluetooth_adapter.h"
13 13
14 namespace device { 14 namespace device {
15 15
16 // BluetoothAdapterFactory is a class that contains static methods, which 16 // BluetoothAdapterFactory is a class that contains static methods, which
17 // instantiate either a specific Bluetooth adapter, or the generic "default 17 // instantiate either a specific Bluetooth adapter, or the generic "default
18 // adapter" which may change depending on availability. 18 // adapter" which may change depending on availability.
19 class BluetoothAdapterFactory { 19 class BluetoothAdapterFactory {
20 public: 20 public:
21 typedef base::Callback<void(scoped_refptr<BluetoothAdapter> adapter)>
22 AdapterCallback;
keybuk 2013/01/22 18:40:57 newline afer this?
youngki 2013/01/22 20:38:13 Done.
21 // Returns true if the Bluetooth adapter is available for the current 23 // Returns true if the Bluetooth adapter is available for the current
22 // platform. 24 // platform.
23 static bool IsBluetoothAdapterAvailable(); 25 static bool IsBluetoothAdapterAvailable();
24 26
25 // Runs the callback with the shared instance for the default adapter when the 27 // Runs the callback with the shared instance for the default adapter when the
26 // adapter is available to be used. 28 // adapter is available to be used.
27 static void RunCallbackOnAdapterReady( 29 // Use this method to get an adapter fully initialized.
28 const BluetoothAdapter::AdapterCallback& callback); 30 static void GetAdapter(const AdapterCallback& callback);
keybuk 2013/01/22 18:40:57 Better comment would be something like: Returns t
youngki 2013/01/22 20:38:13 Done.
29 31
30 // Returns the shared instance of the adapter that has already been created. 32 // Returns the shared instance of the adapter that has already been created,
33 // but may or may not have been initialized.
31 // It returns NULL if no adapter has been created at the time. 34 // It returns NULL if no adapter has been created at the time.
32 static scoped_refptr<BluetoothAdapter> GetAdapter(); 35 static scoped_refptr<BluetoothAdapter> MaybeGetAdapter();
33 36
34 // Creates an instance for a specific adapter at address |address|. 37 // Creates an instance for a specific adapter at address |address|.
35 static BluetoothAdapter* Create(const std::string& address); 38 static BluetoothAdapter* Create(const std::string& address);
36 }; 39 };
37 40
38 } // namespace device 41 } // namespace device
39 42
40 #endif // DEVICE_BLUETOOTH_BLUETOOTH_ADAPTER_FACTORY_H_ 43 #endif // DEVICE_BLUETOOTH_BLUETOOTH_ADAPTER_FACTORY_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698