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

Unified Diff: chrome/browser/extensions/api/easy_unlock_private/easy_unlock_private_api.cc

Issue 491753002: [EasyUnlock] Add a private API for establishing an insecure Bluetooth connection. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Update a comment Created 6 years, 4 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/easy_unlock_private/easy_unlock_private_api.cc
diff --git a/chrome/browser/extensions/api/easy_unlock_private/easy_unlock_private_api.cc b/chrome/browser/extensions/api/easy_unlock_private/easy_unlock_private_api.cc
index 2c242b1c0af7cd9f93975d7f37dedda261bdae4f..e2f12c1ac5f883cd9d9ef075fd14387afa130e84 100644
--- a/chrome/browser/extensions/api/easy_unlock_private/easy_unlock_private_api.cc
+++ b/chrome/browser/extensions/api/easy_unlock_private/easy_unlock_private_api.cc
@@ -20,6 +20,7 @@
#if defined(OS_CHROMEOS)
#include "chrome/browser/chromeos/chromeos_utils.h"
+#include "device/bluetooth/bluetooth_device_chromeos.h"
#endif
namespace extensions {
@@ -30,6 +31,8 @@ namespace {
static base::LazyInstance<BrowserContextKeyedAPIFactory<EasyUnlockPrivateAPI> >
g_factory = LAZY_INSTANCE_INITIALIZER;
+const char kApiUnavailable[] = "This API is not implemented on this platform.";
+
// Utility method for getting the API's crypto delegate.
EasyUnlockPrivateCryptoDelegate* GetCryptoDelegate(
content::BrowserContext* context) {
@@ -401,6 +404,31 @@ void EasyUnlockPrivateSeekBluetoothDeviceByAddressFunction::OnSeekCompleted(
}
}
+EasyUnlockPrivateConnectToBluetoothServiceInsecurelyFunction::
+ EasyUnlockPrivateConnectToBluetoothServiceInsecurelyFunction() {}
+
+EasyUnlockPrivateConnectToBluetoothServiceInsecurelyFunction::
+ ~EasyUnlockPrivateConnectToBluetoothServiceInsecurelyFunction() {}
+
+void EasyUnlockPrivateConnectToBluetoothServiceInsecurelyFunction::
+ ConnectToService(device::BluetoothDevice* device,
+ const device::BluetoothUUID& uuid) {
+#if defined(OS_CHROMEOS)
+ chromeos::BluetoothDeviceChromeOS* device_chromeos =
+ static_cast<chromeos::BluetoothDeviceChromeOS*>(device);
+ device_chromeos->ConnectToServiceInsecurely(
+ uuid,
+ base::Bind(&EasyUnlockPrivateConnectToBluetoothServiceInsecurelyFunction::
+ OnConnect,
+ this),
+ base::Bind(&EasyUnlockPrivateConnectToBluetoothServiceInsecurelyFunction::
+ OnConnectError,
+ this));
+#else
+ OnConnectError(kApiUnavailable);
+#endif // defined(OS_CHROMEOS)
+}
+
EasyUnlockPrivateUpdateScreenlockStateFunction::
EasyUnlockPrivateUpdateScreenlockStateFunction() {}

Powered by Google App Engine
This is Rietveld 408576698