| 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/context_utils.h" | 7 #include "base/android/context_utils.h" |
| 8 #include "base/android/jni_android.h" | 8 #include "base/android/jni_android.h" |
| 9 #include "base/android/jni_string.h" | 9 #include "base/android/jni_string.h" |
| 10 #include "base/metrics/histogram_macros.h" | 10 #include "base/metrics/histogram_macros.h" |
| (...skipping 25 matching lines...) Expand all Loading... |
| 36 BluetoothDeviceAndroid* BluetoothDeviceAndroid::Create( | 36 BluetoothDeviceAndroid* BluetoothDeviceAndroid::Create( |
| 37 BluetoothAdapterAndroid* adapter, | 37 BluetoothAdapterAndroid* adapter, |
| 38 const JavaRef<jobject>& | 38 const JavaRef<jobject>& |
| 39 bluetooth_device_wrapper) { // Java Type: bluetoothDeviceWrapper | 39 bluetooth_device_wrapper) { // Java Type: bluetoothDeviceWrapper |
| 40 BluetoothDeviceAndroid* device = new BluetoothDeviceAndroid(adapter); | 40 BluetoothDeviceAndroid* device = new BluetoothDeviceAndroid(adapter); |
| 41 | 41 |
| 42 device->j_device_.Reset(Java_ChromeBluetoothDevice_create( | 42 device->j_device_.Reset(Java_ChromeBluetoothDevice_create( |
| 43 AttachCurrentThread(), reinterpret_cast<intptr_t>(device), | 43 AttachCurrentThread(), reinterpret_cast<intptr_t>(device), |
| 44 bluetooth_device_wrapper)); | 44 bluetooth_device_wrapper)); |
| 45 | 45 |
| 46 device->UpdateTimestamp(); |
| 46 return device; | 47 return device; |
| 47 } | 48 } |
| 48 | 49 |
| 49 BluetoothDeviceAndroid::~BluetoothDeviceAndroid() { | 50 BluetoothDeviceAndroid::~BluetoothDeviceAndroid() { |
| 50 Java_ChromeBluetoothDevice_onBluetoothDeviceAndroidDestruction( | 51 Java_ChromeBluetoothDevice_onBluetoothDeviceAndroidDestruction( |
| 51 AttachCurrentThread(), j_device_); | 52 AttachCurrentThread(), j_device_); |
| 52 } | 53 } |
| 53 | 54 |
| 54 // static | 55 // static |
| 55 bool BluetoothDeviceAndroid::RegisterJNI(JNIEnv* env) { | 56 bool BluetoothDeviceAndroid::RegisterJNI(JNIEnv* env) { |
| (...skipping 209 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 265 void BluetoothDeviceAndroid::CreateGattConnectionImpl() { | 266 void BluetoothDeviceAndroid::CreateGattConnectionImpl() { |
| 266 Java_ChromeBluetoothDevice_createGattConnectionImpl( | 267 Java_ChromeBluetoothDevice_createGattConnectionImpl( |
| 267 AttachCurrentThread(), j_device_, base::android::GetApplicationContext()); | 268 AttachCurrentThread(), j_device_, base::android::GetApplicationContext()); |
| 268 } | 269 } |
| 269 | 270 |
| 270 void BluetoothDeviceAndroid::DisconnectGatt() { | 271 void BluetoothDeviceAndroid::DisconnectGatt() { |
| 271 Java_ChromeBluetoothDevice_disconnectGatt(AttachCurrentThread(), j_device_); | 272 Java_ChromeBluetoothDevice_disconnectGatt(AttachCurrentThread(), j_device_); |
| 272 } | 273 } |
| 273 | 274 |
| 274 } // namespace device | 275 } // namespace device |
| OLD | NEW |