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

Unified Diff: chrome/browser/extensions/api/bluetooth_socket/bluetooth_socket_api.h

Issue 278663002: Implement chrome.bluetoothSocket.listenUsing*() (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Fix BluetoothAdapterMac include typo Created 6 years, 7 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: 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 4eff552cff58acff68602a272b5a4f51749f08c1..56733625039f365ebf1948da7aad55fe0033a300 100644
--- a/chrome/browser/extensions/api/bluetooth_socket/bluetooth_socket_api.h
+++ b/chrome/browser/extensions/api/bluetooth_socket/bluetooth_socket_api.h
@@ -119,41 +119,118 @@ class BluetoothSocketSetPausedFunction
BluetoothSocketEventDispatcher* socket_event_dispatcher_;
};
-class BluetoothSocketListenUsingRfcommFunction : public AsyncExtensionFunction {
+class BluetoothSocketListenFunction : public BluetoothSocketAsyncApiFunction {
+ public:
+ BluetoothSocketListenFunction();
+
+ virtual bool CreateParams() = 0;
+ virtual void CreateService(
+ scoped_refptr<device::BluetoothAdapter> adapter,
+ const device::BluetoothUUID& uuid,
+ const device::BluetoothAdapter::CreateServiceCallback& callback,
+ const device::BluetoothAdapter::CreateServiceErrorCallback&
+ error_callback) = 0;
+ virtual void CreateResults() = 0;
+
+ virtual int socket_id() const = 0;
+ virtual const std::string& uuid() const = 0;
+
+ // BluetoothSocketAsyncApiFunction:
+ virtual bool Prepare() OVERRIDE;
+ virtual void AsyncWorkStart() OVERRIDE;
+
+ protected:
+ virtual ~BluetoothSocketListenFunction();
+
+ virtual void OnGetAdapter(scoped_refptr<device::BluetoothAdapter> adapter);
+ virtual void OnCreateService(scoped_refptr<device::BluetoothSocket> socket);
+ virtual void OnCreateServiceError(const std::string& message);
+
+ BluetoothSocketEventDispatcher* socket_event_dispatcher_;
+};
+
+class BluetoothSocketListenUsingRfcommFunction
+ : public BluetoothSocketListenFunction {
public:
DECLARE_EXTENSION_FUNCTION("bluetoothSocket.listenUsingRfcomm",
BLUETOOTHSOCKET_LISTENUSINGRFCOMM);
+ BluetoothSocketListenUsingRfcommFunction();
+
+ // BluetoothSocketListenFunction:
+ virtual int socket_id() const OVERRIDE;
+ virtual const std::string& uuid() const OVERRIDE;
+
+ virtual bool CreateParams() OVERRIDE;
+ virtual void CreateService(
+ scoped_refptr<device::BluetoothAdapter> adapter,
+ const device::BluetoothUUID& uuid,
+ const device::BluetoothAdapter::CreateServiceCallback& callback,
+ const device::BluetoothAdapter::CreateServiceErrorCallback&
+ error_callback) OVERRIDE;
+ virtual void CreateResults() OVERRIDE;
+
protected:
- virtual ~BluetoothSocketListenUsingRfcommFunction() {}
+ virtual ~BluetoothSocketListenUsingRfcommFunction();
- // AsyncExtensionFunction override:
- virtual bool RunAsync() OVERRIDE;
+ private:
+ scoped_ptr<bluetooth_socket::ListenUsingRfcomm::Params> params_;
};
class BluetoothSocketListenUsingInsecureRfcommFunction
- : public AsyncExtensionFunction {
+ : public BluetoothSocketListenFunction {
public:
DECLARE_EXTENSION_FUNCTION("bluetoothSocket.listenUsingInsecureRfcomm",
BLUETOOTHSOCKET_LISTENUSINGINSECURERFCOMM);
+ BluetoothSocketListenUsingInsecureRfcommFunction();
+
+ // BluetoothSocketListenFunction:
+ virtual int socket_id() const OVERRIDE;
+ virtual const std::string& uuid() const OVERRIDE;
+
+ virtual bool CreateParams() OVERRIDE;
+ virtual void CreateService(
+ scoped_refptr<device::BluetoothAdapter> adapter,
+ const device::BluetoothUUID& uuid,
+ const device::BluetoothAdapter::CreateServiceCallback& callback,
+ const device::BluetoothAdapter::CreateServiceErrorCallback&
+ error_callback) OVERRIDE;
+ virtual void CreateResults() OVERRIDE;
+
protected:
- virtual ~BluetoothSocketListenUsingInsecureRfcommFunction() {}
+ virtual ~BluetoothSocketListenUsingInsecureRfcommFunction();
- // AsyncExtensionFunction override:
- virtual bool RunAsync() OVERRIDE;
+ private:
+ scoped_ptr<bluetooth_socket::ListenUsingInsecureRfcomm::Params> params_;
};
-class BluetoothSocketListenUsingL2capFunction : public AsyncExtensionFunction {
+class BluetoothSocketListenUsingL2capFunction
+ : public BluetoothSocketListenFunction {
public:
DECLARE_EXTENSION_FUNCTION("bluetoothSocket.listenUsingL2cap",
BLUETOOTHSOCKET_LISTENUSINGL2CAP);
+ BluetoothSocketListenUsingL2capFunction();
+
+ // BluetoothSocketListenFunction:
+ virtual int socket_id() const OVERRIDE;
+ virtual const std::string& uuid() const OVERRIDE;
+
+ virtual bool CreateParams() OVERRIDE;
+ virtual void CreateService(
+ scoped_refptr<device::BluetoothAdapter> adapter,
+ const device::BluetoothUUID& uuid,
+ const device::BluetoothAdapter::CreateServiceCallback& callback,
+ const device::BluetoothAdapter::CreateServiceErrorCallback&
+ error_callback) OVERRIDE;
+ virtual void CreateResults() OVERRIDE;
+
protected:
- virtual ~BluetoothSocketListenUsingL2capFunction() {}
+ virtual ~BluetoothSocketListenUsingL2capFunction();
- // AsyncExtensionFunction override:
- virtual bool RunAsync() OVERRIDE;
+ private:
+ scoped_ptr<bluetooth_socket::ListenUsingL2cap::Params> params_;
};
class BluetoothSocketConnectFunction : public BluetoothSocketAsyncApiFunction {

Powered by Google App Engine
This is Rietveld 408576698