Commit 60411bcd authored by keybuk@chromium.org's avatar keybuk@chromium.org

Introduce chrome.bluetoothSocket API.

This CL adds the initial function and object type definitions of the
chrome.bluetoothSocket API. This API will replace the socket-related
functions in the existing chrome.bluetooth API and is intended to
supply the Bluetooth Classic complement to the
chrome.bluetoothLowEnergy API.

Unlike the sockets API, there is no separation of client and server
because such separation is not clearly defined in Bluetooth profiles
either. It will not be uncommon for an application to attempt to make
a connection, and if it fails, fall back to listening instead, for
example.

All functions currently return an error when invoked.

BUG=349475,364581
TBR=mkearney

Review URL: https://codereview.chromium.org/246883003

git-svn-id: svn://svn.chromium.org/chrome/trunk/src@266362 0039d316-1c4b-4281-b951-d872f2087c98
parent 83ba05d0
rpaquay@chromium.org
keybuk@chromium.org
// Copyright 2014 The Chromium Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
#include "chrome/browser/extensions/api/bluetooth_socket/bluetooth_socket_api.h"
namespace extensions {
namespace api {
bool BluetoothSocketCreateFunction::RunImpl() {
// TODO(keybuk): Implement.
SetError("Not yet implemented.");
return false;
}
bool BluetoothSocketUpdateFunction::RunImpl() {
// TODO(keybuk): Implement.
SetError("Not yet implemented.");
return false;
}
bool BluetoothSocketSetPausedFunction::RunImpl() {
// TODO(keybuk): Implement.
SetError("Not yet implemented.");
return false;
}
bool BluetoothSocketListenUsingRfcommFunction::RunImpl() {
// TODO(keybuk): Implement.
SetError("Not yet implemented.");
return false;
}
bool BluetoothSocketListenUsingInsecureRfcommFunction::RunImpl() {
// TODO(keybuk): Implement.
SetError("Not yet implemented.");
return false;
}
bool BluetoothSocketListenUsingL2capFunction::RunImpl() {
// TODO(keybuk): Implement.
SetError("Not yet implemented.");
return false;
}
bool BluetoothSocketConnectFunction::RunImpl() {
// TODO(keybuk): Implement.
SetError("Not yet implemented.");
return false;
}
bool BluetoothSocketDisconnectFunction::RunImpl() {
// TODO(keybuk): Implement.
SetError("Not yet implemented.");
return false;
}
bool BluetoothSocketCloseFunction::RunImpl() {
// TODO(keybuk): Implement.
SetError("Not yet implemented.");
return false;
}
bool BluetoothSocketSendFunction::RunImpl() {
// TODO(keybuk): Implement.
SetError("Not yet implemented.");
return false;
}
bool BluetoothSocketGetInfoFunction::RunImpl() {
// TODO(keybuk): Implement.
SetError("Not yet implemented.");
return false;
}
bool BluetoothSocketGetSocketsFunction::RunImpl() {
// TODO(keybuk): Implement.
SetError("Not yet implemented.");
return false;
}
} // namespace api
} // namespace extensions
// Copyright 2014 The Chromium Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
#ifndef CHROME_BROWSER_EXTENSIONS_API_BLUETOOTH_SOCKET_BLUETOOTH_SOCKET_API_H_
#define CHROME_BROWSER_EXTENSIONS_API_BLUETOOTH_SOCKET_BLUETOOTH_SOCKET_API_H_
#include "extensions/browser/extension_function.h"
#include "extensions/browser/extension_function_histogram_value.h"
namespace extensions {
namespace api {
class BluetoothSocketCreateFunction : public UIThreadExtensionFunction {
public:
DECLARE_EXTENSION_FUNCTION("bluetoothSocket.create", BLUETOOTHSOCKET_CREATE);
protected:
virtual ~BluetoothSocketCreateFunction() {}
// UIThreadExtensionFunction override:
virtual bool RunImpl() OVERRIDE;
};
class BluetoothSocketUpdateFunction : public UIThreadExtensionFunction {
public:
DECLARE_EXTENSION_FUNCTION("bluetoothSocket.update", BLUETOOTHSOCKET_UPDATE);
protected:
virtual ~BluetoothSocketUpdateFunction() {}
// UIThreadExtensionFunction override:
virtual bool RunImpl() OVERRIDE;
};
class BluetoothSocketSetPausedFunction : public UIThreadExtensionFunction {
public:
DECLARE_EXTENSION_FUNCTION("bluetoothSocket.setPaused",
BLUETOOTHSOCKET_SETPAUSED);
protected:
virtual ~BluetoothSocketSetPausedFunction() {}
// UIThreadExtensionFunction override:
virtual bool RunImpl() OVERRIDE;
};
class BluetoothSocketListenUsingRfcommFunction
: public UIThreadExtensionFunction {
public:
DECLARE_EXTENSION_FUNCTION("bluetoothSocket.listenUsingRfcomm",
BLUETOOTHSOCKET_LISTENUSINGRFCOMM);
protected:
virtual ~BluetoothSocketListenUsingRfcommFunction() {}
// UIThreadExtensionFunction override:
virtual bool RunImpl() OVERRIDE;
};
class BluetoothSocketListenUsingInsecureRfcommFunction
: public UIThreadExtensionFunction {
public:
DECLARE_EXTENSION_FUNCTION("bluetoothSocket.listenUsingInsecureRfcomm",
BLUETOOTHSOCKET_LISTENUSINGINSECURERFCOMM);
protected:
virtual ~BluetoothSocketListenUsingInsecureRfcommFunction() {}
// UIThreadExtensionFunction override:
virtual bool RunImpl() OVERRIDE;
};
class BluetoothSocketListenUsingL2capFunction
: public UIThreadExtensionFunction {
public:
DECLARE_EXTENSION_FUNCTION("bluetoothSocket.listenUsingL2cap",
BLUETOOTHSOCKET_LISTENUSINGL2CAP);
protected:
virtual ~BluetoothSocketListenUsingL2capFunction() {}
// UIThreadExtensionFunction override:
virtual bool RunImpl() OVERRIDE;
};
class BluetoothSocketConnectFunction : public UIThreadExtensionFunction {
public:
DECLARE_EXTENSION_FUNCTION("bluetoothSocket.connect",
BLUETOOTHSOCKET_CONNECT);
protected:
virtual ~BluetoothSocketConnectFunction() {}
// UIThreadExtensionFunction override:
virtual bool RunImpl() OVERRIDE;
};
class BluetoothSocketDisconnectFunction : public UIThreadExtensionFunction {
public:
DECLARE_EXTENSION_FUNCTION("bluetoothSocket.disconnect",
BLUETOOTHSOCKET_DISCONNECT);
protected:
virtual ~BluetoothSocketDisconnectFunction() {}
// UIThreadExtensionFunction override:
virtual bool RunImpl() OVERRIDE;
};
class BluetoothSocketCloseFunction : public UIThreadExtensionFunction {
public:
DECLARE_EXTENSION_FUNCTION("bluetoothSocket.close", BLUETOOTHSOCKET_CLOSE);
protected:
virtual ~BluetoothSocketCloseFunction() {}
// UIThreadExtensionFunction override:
virtual bool RunImpl() OVERRIDE;
};
class BluetoothSocketSendFunction : public UIThreadExtensionFunction {
public:
DECLARE_EXTENSION_FUNCTION("bluetoothSocket.send", BLUETOOTHSOCKET_SEND);
protected:
virtual ~BluetoothSocketSendFunction() {}
// UIThreadExtensionFunction override:
virtual bool RunImpl() OVERRIDE;
};
class BluetoothSocketGetInfoFunction : public UIThreadExtensionFunction {
public:
DECLARE_EXTENSION_FUNCTION("bluetoothSocket.getInfo",
BLUETOOTHSOCKET_GETINFO);
protected:
virtual ~BluetoothSocketGetInfoFunction() {}
// UIThreadExtensionFunction override:
virtual bool RunImpl() OVERRIDE;
};
class BluetoothSocketGetSocketsFunction : public UIThreadExtensionFunction {
public:
DECLARE_EXTENSION_FUNCTION("bluetoothSocket.getSockets",
BLUETOOTHSOCKET_GETSOCKETS);
protected:
virtual ~BluetoothSocketGetSocketsFunction() {}
// UIThreadExtensionFunction override:
virtual bool RunImpl() OVERRIDE;
};
} // namespace api
} // namespace extensions
#endif // CHROME_BROWSER_EXTENSIONS_API_BLUETOOTH_SOCKET_BLUETOOTH_SOCKET_API_H_
...@@ -162,6 +162,8 @@ ...@@ -162,6 +162,8 @@
'browser/extensions/api/bluetooth/bluetooth_socket_event_dispatcher.cc', 'browser/extensions/api/bluetooth/bluetooth_socket_event_dispatcher.cc',
'browser/extensions/api/bluetooth_low_energy/bluetooth_low_energy_api.cc', 'browser/extensions/api/bluetooth_low_energy/bluetooth_low_energy_api.cc',
'browser/extensions/api/bluetooth_low_energy/bluetooth_low_energy_api.h', 'browser/extensions/api/bluetooth_low_energy/bluetooth_low_energy_api.h',
'browser/extensions/api/bluetooth_socket/bluetooth_socket_api.cc',
'browser/extensions/api/bluetooth_socket/bluetooth_socket_api.h',
'browser/extensions/api/bookmark_manager_private/bookmark_manager_private_api.cc', 'browser/extensions/api/bookmark_manager_private/bookmark_manager_private_api.cc',
'browser/extensions/api/bookmark_manager_private/bookmark_manager_private_api.h', 'browser/extensions/api/bookmark_manager_private/bookmark_manager_private_api.h',
'browser/extensions/api/bookmarks/bookmark_api_constants.cc', 'browser/extensions/api/bookmarks/bookmark_api_constants.cc',
......
...@@ -119,6 +119,10 @@ ...@@ -119,6 +119,10 @@
"dependencies": ["permission:bluetoothPrivate"], "dependencies": ["permission:bluetoothPrivate"],
"contexts": ["blessed_extension"] "contexts": ["blessed_extension"]
}, },
"bluetoothSocket": {
"dependencies": ["manifest:bluetooth"],
"contexts": ["blessed_extension"]
},
"bookmarkManagerPrivate": { "bookmarkManagerPrivate": {
"dependencies": ["permission:bookmarkManagerPrivate"], "dependencies": ["permission:bookmarkManagerPrivate"],
"contexts": ["blessed_extension"] "contexts": ["blessed_extension"]
......
...@@ -72,9 +72,9 @@ ...@@ -72,9 +72,9 @@
"max_manifest_version": 1 "max_manifest_version": 1
}, },
"bluetooth": { "bluetooth": {
// Note: The "bluetooth" manifest permission is used by both // Note: The "bluetooth" manifest permission is used by the
// chrome.bluetooth and chrome.bluetoothLowEnergy APIs. Split this property // chrome.bluetooth, chrome.bluetoothSocket and chrome.bluetoothLowEnergy
// if the two APIs get released at different dates. // APIs. Split this property if the APIs get released at different dates.
"channel": "dev", "channel": "dev",
"extension_types": ["platform_app"] "extension_types": ["platform_app"]
}, },
......
...@@ -48,6 +48,7 @@ ...@@ -48,6 +48,7 @@
'bluetooth.idl', 'bluetooth.idl',
'bluetooth_low_energy.idl', 'bluetooth_low_energy.idl',
'bluetooth_private.json', 'bluetooth_private.json',
'bluetooth_socket.idl',
'bookmark_manager_private.json', 'bookmark_manager_private.json',
'bookmarks.json', 'bookmarks.json',
'braille_display_private.idl', 'braille_display_private.idl',
......
This diff is collapsed.
{{+partials.standard_apps_api api:apis.bluetooth_socket/}}
...@@ -794,6 +794,18 @@ enum HistogramValue { ...@@ -794,6 +794,18 @@ enum HistogramValue {
BLUETOOTHLOWENERGY_WRITEDESCRIPTORVALUE, BLUETOOTHLOWENERGY_WRITEDESCRIPTORVALUE,
BOOKMARKMANAGERPRIVATE_CREATEWITHMETAINFO, BOOKMARKMANAGERPRIVATE_CREATEWITHMETAINFO,
BOOKMARKMANAGERPRIVATE_UPDATEMETAINFO, BOOKMARKMANAGERPRIVATE_UPDATEMETAINFO,
BLUETOOTHSOCKET_CREATE,
BLUETOOTHSOCKET_UPDATE,
BLUETOOTHSOCKET_SETPAUSED,
BLUETOOTHSOCKET_LISTENUSINGRFCOMM,
BLUETOOTHSOCKET_LISTENUSINGINSECURERFCOMM,
BLUETOOTHSOCKET_LISTENUSINGL2CAP,
BLUETOOTHSOCKET_CONNECT,
BLUETOOTHSOCKET_DISCONNECT,
BLUETOOTHSOCKET_CLOSE,
BLUETOOTHSOCKET_SEND,
BLUETOOTHSOCKET_GETINFO,
BLUETOOTHSOCKET_GETSOCKETS,
// Last entry: Add new entries above and ensure to update // Last entry: Add new entries above and ensure to update
// tools/metrics/histograms/histograms/histograms.xml. // tools/metrics/histograms/histograms/histograms.xml.
ENUM_BOUNDARY ENUM_BOUNDARY
......
...@@ -33620,6 +33620,18 @@ Therefore, the affected-histogram name has to have at least one dot in it. ...@@ -33620,6 +33620,18 @@ Therefore, the affected-histogram name has to have at least one dot in it.
<int value="733" label="BLUETOOTHLOWENERGY_WRITEDESCRIPTORVALUE"/> <int value="733" label="BLUETOOTHLOWENERGY_WRITEDESCRIPTORVALUE"/>
<int value="734" label="BOOKMARKMANAGERPRIVATE_CREATEWITHMETAINFO"/> <int value="734" label="BOOKMARKMANAGERPRIVATE_CREATEWITHMETAINFO"/>
<int value="735" label="BOOKMARKMANAGERPRIVATE_UPDATEMETAINFO"/> <int value="735" label="BOOKMARKMANAGERPRIVATE_UPDATEMETAINFO"/>
<int value="736" label="BLUETOOTHSOCKET_CREATE"/>
<int value="737" label="BLUETOOTHSOCKET_UPDATE"/>
<int value="738" label="BLUETOOTHSOCKET_SETPAUSED"/>
<int value="739" label="BLUETOOTHSOCKET_LISTENUSINGRFCOMM"/>
<int value="740" label="BLUETOOTHSOCKET_LISTENUSINGINSECURERFCOMM"/>
<int value="741" label="BLUETOOTHSOCKET_LISTENUSINGL2CAP"/>
<int value="742" label="BLUETOOTHSOCKET_CONNECT"/>
<int value="743" label="BLUETOOTHSOCKET_DISCONNECT"/>
<int value="744" label="BLUETOOTHSOCKET_CLOSE"/>
<int value="745" label="BLUETOOTHSOCKET_SEND"/>
<int value="746" label="BLUETOOTHSOCKET_GETINFO"/>
<int value="747" label="BLUETOOTHSOCKET_GETSOCKETS"/>
</enum> </enum>
<enum name="ExtensionInstallCause" type="int"> <enum name="ExtensionInstallCause" type="int">
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment