Index: chrome/browser/extensions/api/bluetooth_socket/bluetooth_socket_api.h |
diff --git a/chrome/browser/extensions/api/bluetooth_socket/bluetooth_socket_api.h b/chrome/browser/extensions/api/bluetooth_socket/bluetooth_socket_api.h |
index 9ed740691de7b71c79b1677ffebfcea52110e2a9..34da64bfaaa6af9b756f7bbeae597db0e676854c 100644 |
--- a/chrome/browser/extensions/api/bluetooth_socket/bluetooth_socket_api.h |
+++ b/chrome/browser/extensions/api/bluetooth_socket/bluetooth_socket_api.h |
@@ -208,29 +208,49 @@ class BluetoothSocketListenUsingL2capFunction |
scoped_ptr<bluetooth_socket::ListenUsingL2cap::Params> params_; |
}; |
-class BluetoothSocketConnectFunction : public BluetoothSocketAsyncApiFunction { |
+class BluetoothSocketAbstractConnectFunction : |
+ public BluetoothSocketAsyncApiFunction { |
public: |
- DECLARE_EXTENSION_FUNCTION("bluetoothSocket.connect", |
- BLUETOOTHSOCKET_CONNECT); |
- |
- BluetoothSocketConnectFunction(); |
+ BluetoothSocketAbstractConnectFunction(); |
protected: |
- virtual ~BluetoothSocketConnectFunction(); |
+ virtual ~BluetoothSocketAbstractConnectFunction(); |
// BluetoothSocketAsyncApiFunction: |
virtual bool Prepare() OVERRIDE; |
virtual void AsyncWorkStart() OVERRIDE; |
- private: |
- virtual void OnGetAdapter(scoped_refptr<device::BluetoothAdapter> adapter); |
+ // Subclasses should implement this method to connect to the service |
+ // registered with |uuid| on the |device|. |
+ virtual void ConnectToService(device::BluetoothDevice* device, |
+ const device::BluetoothUUID& uuid) = 0; |
+ |
virtual void OnConnect(scoped_refptr<device::BluetoothSocket> socket); |
virtual void OnConnectError(const std::string& message); |
+ private: |
+ virtual void OnGetAdapter(scoped_refptr<device::BluetoothAdapter> adapter); |
+ |
scoped_ptr<bluetooth_socket::Connect::Params> params_; |
BluetoothSocketEventDispatcher* socket_event_dispatcher_; |
}; |
+class BluetoothSocketConnectFunction : |
+ public BluetoothSocketAbstractConnectFunction { |
+ public: |
+ DECLARE_EXTENSION_FUNCTION("bluetoothSocket.connect", |
+ BLUETOOTHSOCKET_CONNECT); |
+ |
+ BluetoothSocketConnectFunction(); |
+ |
+ protected: |
+ virtual ~BluetoothSocketConnectFunction(); |
+ |
+ // BluetoothSocketAbstractConnectFunction: |
+ virtual void ConnectToService(device::BluetoothDevice* device, |
+ const device::BluetoothUUID& uuid) OVERRIDE; |
+}; |
+ |
class BluetoothSocketDisconnectFunction |
: public BluetoothSocketAsyncApiFunction { |
public: |