| Index: device/bluetooth/bluetooth_adapter_android.cc
|
| diff --git a/device/bluetooth/bluetooth_adapter_android.cc b/device/bluetooth/bluetooth_adapter_android.cc
|
| index 4a7a15039dbf292b8e06e1c08dae4c57e57db0fb..489050c005e34178f2e3256f2d6bd9cf7ff90d5b 100644
|
| --- a/device/bluetooth/bluetooth_adapter_android.cc
|
| +++ b/device/bluetooth/bluetooth_adapter_android.cc
|
| @@ -31,7 +31,8 @@ base::WeakPtr<BluetoothAdapterAndroid> BluetoothAdapterAndroid::Create(
|
| BluetoothAdapterAndroid* adapter = new BluetoothAdapterAndroid();
|
|
|
| adapter->j_adapter_.Reset(Java_ChromeBluetoothAdapter_create(
|
| - AttachCurrentThread(), java_bluetooth_adapter_wrapper));
|
| + AttachCurrentThread(), reinterpret_cast<intptr_t>(adapter),
|
| + java_bluetooth_adapter_wrapper));
|
|
|
| return adapter->weak_ptr_factory_.GetWeakPtr();
|
| }
|
| @@ -126,30 +127,49 @@ void BluetoothAdapterAndroid::RegisterAdvertisement(
|
| error_callback.Run(BluetoothAdvertisement::ERROR_UNSUPPORTED_PLATFORM);
|
| }
|
|
|
| +void BluetoothAdapterAndroid::OnScanFailed(JNIEnv* env, jobject obj) {
|
| + MarkDiscoverySessionsAsInactive();
|
| +}
|
| +
|
| BluetoothAdapterAndroid::BluetoothAdapterAndroid() : weak_ptr_factory_(this) {
|
| }
|
|
|
| BluetoothAdapterAndroid::~BluetoothAdapterAndroid() {
|
| + Java_ChromeBluetoothAdapter_onBluetoothAdapterAndroidDestruction(
|
| + AttachCurrentThread(), j_adapter_.obj());
|
| }
|
|
|
| void BluetoothAdapterAndroid::AddDiscoverySession(
|
| BluetoothDiscoveryFilter* discovery_filter,
|
| const base::Closure& callback,
|
| const ErrorCallback& error_callback) {
|
| - error_callback.Run();
|
| + // TODO(scheib): Support filters crbug.com/490401
|
| + if (Java_ChromeBluetoothAdapter_addDiscoverySession(AttachCurrentThread(),
|
| + j_adapter_.obj())) {
|
| + callback.Run();
|
| + } else {
|
| + error_callback.Run();
|
| + }
|
| }
|
|
|
| void BluetoothAdapterAndroid::RemoveDiscoverySession(
|
| BluetoothDiscoveryFilter* discovery_filter,
|
| const base::Closure& callback,
|
| const ErrorCallback& error_callback) {
|
| - error_callback.Run();
|
| + if (Java_ChromeBluetoothAdapter_removeDiscoverySession(AttachCurrentThread(),
|
| + j_adapter_.obj())) {
|
| + callback.Run();
|
| + } else {
|
| + error_callback.Run();
|
| + }
|
| }
|
|
|
| void BluetoothAdapterAndroid::SetDiscoveryFilter(
|
| scoped_ptr<BluetoothDiscoveryFilter> discovery_filter,
|
| const base::Closure& callback,
|
| const ErrorCallback& error_callback) {
|
| + // TODO(scheib): Support filters crbug.com/490401
|
| + NOTIMPLEMENTED();
|
| error_callback.Run();
|
| }
|
|
|
|
|