OLD | NEW |
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_device_android.h" | 5 #include "device/bluetooth/bluetooth_device_android.h" |
6 | 6 |
7 #include "base/android/jni_android.h" | 7 #include "base/android/jni_android.h" |
8 #include "base/android/jni_array.h" | 8 #include "base/android/jni_array.h" |
9 #include "base/android/jni_string.h" | 9 #include "base/android/jni_string.h" |
10 #include "device/bluetooth/bluetooth_adapter_android.h" | 10 #include "device/bluetooth/bluetooth_adapter_android.h" |
(...skipping 10 matching lines...) Expand all Loading... |
21 BluetoothDeviceAndroid* device = new BluetoothDeviceAndroid(adapter); | 21 BluetoothDeviceAndroid* device = new BluetoothDeviceAndroid(adapter); |
22 | 22 |
23 device->j_device_.Reset(Java_ChromeBluetoothDevice_create( | 23 device->j_device_.Reset(Java_ChromeBluetoothDevice_create( |
24 AttachCurrentThread(), reinterpret_cast<intptr_t>(device), | 24 AttachCurrentThread(), reinterpret_cast<intptr_t>(device), |
25 bluetooth_device_wrapper)); | 25 bluetooth_device_wrapper)); |
26 | 26 |
27 return device; | 27 return device; |
28 } | 28 } |
29 | 29 |
30 BluetoothDeviceAndroid::~BluetoothDeviceAndroid() { | 30 BluetoothDeviceAndroid::~BluetoothDeviceAndroid() { |
| 31 Java_ChromeBluetoothDevice_onBluetoothDeviceAndroidDestruction( |
| 32 AttachCurrentThread(), j_device_.obj()); |
31 } | 33 } |
32 | 34 |
33 bool BluetoothDeviceAndroid::UpdateAdvertisedUUIDs(jobject advertised_uuids) { | 35 bool BluetoothDeviceAndroid::UpdateAdvertisedUUIDs(jobject advertised_uuids) { |
34 return Java_ChromeBluetoothDevice_updateAdvertisedUUIDs( | 36 return Java_ChromeBluetoothDevice_updateAdvertisedUUIDs( |
35 AttachCurrentThread(), j_device_.obj(), advertised_uuids); | 37 AttachCurrentThread(), j_device_.obj(), advertised_uuids); |
36 } | 38 } |
37 | 39 |
38 // static | 40 // static |
39 bool BluetoothDeviceAndroid::RegisterJNI(JNIEnv* env) { | 41 bool BluetoothDeviceAndroid::RegisterJNI(JNIEnv* env) { |
40 return RegisterNativesImpl(env); // Generated in ChromeBluetoothDevice_jni.h | 42 return RegisterNativesImpl(env); // Generated in ChromeBluetoothDevice_jni.h |
(...skipping 191 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
232 AttachCurrentThread(), j_device_.obj(), | 234 AttachCurrentThread(), j_device_.obj(), |
233 base::android::GetApplicationContext()); | 235 base::android::GetApplicationContext()); |
234 } | 236 } |
235 | 237 |
236 void BluetoothDeviceAndroid::DisconnectGatt() { | 238 void BluetoothDeviceAndroid::DisconnectGatt() { |
237 Java_ChromeBluetoothDevice_disconnectGatt(AttachCurrentThread(), | 239 Java_ChromeBluetoothDevice_disconnectGatt(AttachCurrentThread(), |
238 j_device_.obj()); | 240 j_device_.obj()); |
239 } | 241 } |
240 | 242 |
241 } // namespace device | 243 } // namespace device |
OLD | NEW |