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

Side by Side Diff: device/bluetooth/bluetooth_adapter_android.cc

Issue 1610053005: bluetooth: android: Fix a couple of crashes when adapter is turned on/off. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Rebased on latest master Created 4 years, 10 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 unified diff | Download patch
OLDNEW
1 // Copyright 2015 The Chromium Authors. All rights reserved. 1 // Copyright 2015 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #include "device/bluetooth/bluetooth_adapter_android.h" 5 #include "device/bluetooth/bluetooth_adapter_android.h"
6 6
7 #include "base/android/jni_android.h" 7 #include "base/android/jni_android.h"
8 #include "base/android/jni_string.h" 8 #include "base/android/jni_string.h"
9 #include "base/sequenced_task_runner.h" 9 #include "base/sequenced_task_runner.h"
10 #include "base/single_thread_task_runner.h" 10 #include "base/single_thread_task_runner.h"
(...skipping 59 matching lines...) Expand 10 before | Expand all | Expand 10 after
70 } 70 }
71 71
72 bool BluetoothAdapterAndroid::IsPowered() const { 72 bool BluetoothAdapterAndroid::IsPowered() const {
73 return Java_ChromeBluetoothAdapter_isPowered(AttachCurrentThread(), 73 return Java_ChromeBluetoothAdapter_isPowered(AttachCurrentThread(),
74 j_adapter_.obj()); 74 j_adapter_.obj());
75 } 75 }
76 76
77 void BluetoothAdapterAndroid::SetPowered(bool powered, 77 void BluetoothAdapterAndroid::SetPowered(bool powered,
78 const base::Closure& callback, 78 const base::Closure& callback,
79 const ErrorCallback& error_callback) { 79 const ErrorCallback& error_callback) {
80 NOTIMPLEMENTED(); 80 if (Java_ChromeBluetoothAdapter_setPowered(AttachCurrentThread(),
81 j_adapter_.obj(), powered)) {
82 callback.Run();
83 } else {
84 error_callback.Run();
85 }
81 } 86 }
82 87
83 bool BluetoothAdapterAndroid::IsDiscoverable() const { 88 bool BluetoothAdapterAndroid::IsDiscoverable() const {
84 return Java_ChromeBluetoothAdapter_isDiscoverable(AttachCurrentThread(), 89 return Java_ChromeBluetoothAdapter_isDiscoverable(AttachCurrentThread(),
85 j_adapter_.obj()); 90 j_adapter_.obj());
86 } 91 }
87 92
88 void BluetoothAdapterAndroid::SetDiscoverable( 93 void BluetoothAdapterAndroid::SetDiscoverable(
89 bool discoverable, 94 bool discoverable,
90 const base::Closure& callback, 95 const base::Closure& callback,
(...skipping 116 matching lines...) Expand 10 before | Expand all | Expand 10 after
207 // TODO(scheib): Support filters crbug.com/490401 212 // TODO(scheib): Support filters crbug.com/490401
208 NOTIMPLEMENTED(); 213 NOTIMPLEMENTED();
209 error_callback.Run(UMABluetoothDiscoverySessionOutcome::NOT_IMPLEMENTED); 214 error_callback.Run(UMABluetoothDiscoverySessionOutcome::NOT_IMPLEMENTED);
210 } 215 }
211 216
212 void BluetoothAdapterAndroid::RemovePairingDelegateInternal( 217 void BluetoothAdapterAndroid::RemovePairingDelegateInternal(
213 device::BluetoothDevice::PairingDelegate* pairing_delegate) { 218 device::BluetoothDevice::PairingDelegate* pairing_delegate) {
214 } 219 }
215 220
216 } // namespace device 221 } // namespace device
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698