| Index: device/bluetooth/bluetooth_profile_win.h
|
| diff --git a/device/bluetooth/bluetooth_profile_win.h b/device/bluetooth/bluetooth_profile_win.h
|
| index e235bd2ea6f0ed7b93b28cd906a572d18e66ec07..a5c853f4dfe8e0c2371cf99839a43058181e6e20 100644
|
| --- a/device/bluetooth/bluetooth_profile_win.h
|
| +++ b/device/bluetooth/bluetooth_profile_win.h
|
| @@ -7,23 +7,39 @@
|
|
|
| #include <string>
|
|
|
| +#include "base/memory/ref_counted.h"
|
| +#include "base/memory/weak_ptr.h"
|
| #include "device/bluetooth/bluetooth_profile.h"
|
| #include "device/bluetooth/bluetooth_uuid.h"
|
| #include "net/base/net_log.h"
|
|
|
| +namespace net {
|
| +class IPEndPoint;
|
| +class TCPSocket;
|
| +}
|
| +
|
| namespace device {
|
|
|
| +class BluetoothAdapter;
|
| +class BluetoothAdapterWin;
|
| class BluetoothDeviceWin;
|
| class BluetoothSocketThreadWin;
|
| +class BluetoothSocketWin;
|
|
|
| class BluetoothProfileWin : public BluetoothProfile {
|
| public:
|
| + typedef base::Callback<void(const std::string&)> ErrorCallback;
|
| +
|
| // BluetoothProfile override.
|
| virtual void Unregister() OVERRIDE;
|
| virtual void SetConnectionCallback(
|
| const ConnectionCallback& callback) OVERRIDE;
|
|
|
| - typedef base::Callback<void(const std::string&)> ErrorCallback;
|
| + // Called by BluetoothProfile::Register to initialize the profile object
|
| + // asynchronously.
|
| + void Init(const BluetoothUUID& uuid,
|
| + const device::BluetoothProfile::Options& options,
|
| + const ProfileCallback& callback);
|
|
|
| void Connect(const BluetoothDeviceWin* device,
|
| scoped_refptr<base::SequencedTaskRunner> ui_task_runner,
|
| @@ -36,13 +52,48 @@ class BluetoothProfileWin : public BluetoothProfile {
|
| private:
|
| friend BluetoothProfile;
|
|
|
| - BluetoothProfileWin(const BluetoothUUID& uuid, const std::string& name);
|
| + struct ProfileRegData;
|
| +
|
| + BluetoothProfileWin();
|
| virtual ~BluetoothProfileWin();
|
|
|
| - const BluetoothUUID uuid_;
|
| - const std::string name_;
|
| + // Internal method run to get the adapter object during initialization.
|
| + void OnGetAdapter(const ProfileCallback& callback,
|
| + scoped_refptr<BluetoothAdapter> adapter);
|
| +
|
| + // Start a bluetooth server socket and register a service.
|
| + static void RegisterProfileOnSocketThread(
|
| + const BluetoothUUID& uuid,
|
| + const std::string& name,
|
| + int rfcomm_channel,
|
| + bool* out_success,
|
| + scoped_ptr<net::TCPSocket>* out_socket,
|
| + scoped_ptr<ProfileRegData>* out_reg_data);
|
| + void OnRegisterProfileOnUI(bool* success,
|
| + scoped_ptr<net::TCPSocket>* socket,
|
| + scoped_ptr<ProfileRegData>* reg_data,
|
| + const ProfileCallback& callback);
|
| +
|
| + static void UnregisterProfileOnSocketThread(
|
| + scoped_ptr<ProfileRegData> reg_data);
|
| +
|
| + void OnNewConnection(scoped_refptr<BluetoothSocketWin> connected,
|
| + const net::IPEndPoint& peer_address);
|
| +
|
| + BluetoothAdapterWin* adapter() const;
|
| +
|
| + BluetoothUUID uuid_;
|
| + std::string name_;
|
| + int rfcomm_channel_;
|
| ConnectionCallback connection_callback_;
|
|
|
| + scoped_refptr<BluetoothAdapter> adapter_;
|
| +
|
| + scoped_refptr<BluetoothSocketWin> profile_socket_;
|
| + scoped_ptr<ProfileRegData> profile_reg_data_;
|
| +
|
| + base::WeakPtrFactory<BluetoothProfileWin> weak_ptr_factory_;
|
| +
|
| DISALLOW_COPY_AND_ASSIGN(BluetoothProfileWin);
|
| };
|
|
|
|
|