Chromium Code Reviews| OLD | NEW |
|---|---|
| 1 // Copyright 2014 The Chromium Authors. All rights reserved. | 1 // Copyright 2014 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_remote_gatt_service_android.h" | 5 #include "device/bluetooth/bluetooth_remote_gatt_service_android.h" |
| 6 | 6 |
| 7 #include <memory> | 7 #include <memory> |
| 8 | 8 |
| 9 #include "base/android/jni_android.h" | 9 #include "base/android/jni_android.h" |
| 10 #include "base/android/jni_string.h" | 10 #include "base/android/jni_string.h" |
| 11 #include "device/bluetooth/bluetooth_adapter_android.h" | 11 #include "device/bluetooth/bluetooth_adapter_android.h" |
| 12 #include "device/bluetooth/bluetooth_device_android.h" | 12 #include "device/bluetooth/bluetooth_device_android.h" |
| 13 #include "device/bluetooth/bluetooth_remote_gatt_characteristic_android.h" | 13 #include "device/bluetooth/bluetooth_remote_gatt_characteristic_android.h" |
| 14 #include "jni/ChromeBluetoothRemoteGattService_jni.h" | 14 #include "jni/ChromeBluetoothRemoteGattService_jni.h" |
| 15 | 15 |
| 16 using base::android::AttachCurrentThread; | 16 using base::android::AttachCurrentThread; |
| 17 using base::android::JavaParamRef; | 17 using base::android::JavaParamRef; |
| 18 using base::android::JavaRef; | |
| 18 | 19 |
| 19 namespace device { | 20 namespace device { |
| 20 | 21 |
| 21 // static | 22 // static |
| 22 std::unique_ptr<BluetoothRemoteGattServiceAndroid> | 23 std::unique_ptr<BluetoothRemoteGattServiceAndroid> |
| 23 BluetoothRemoteGattServiceAndroid::Create( | 24 BluetoothRemoteGattServiceAndroid::Create( |
| 24 BluetoothAdapterAndroid* adapter, | 25 BluetoothAdapterAndroid* adapter, |
| 25 BluetoothDeviceAndroid* device, | 26 BluetoothDeviceAndroid* device, |
| 26 jobject /* BluetoothGattServiceWrapper */ bluetooth_gatt_service_wrapper, | 27 const JavaRef< |
| 28 jobject>& /* BluetoothGattServiceWrapper */ bluetooth_gatt_service_wrapp er, | |
|
Torne
2016/09/07 16:50:50
This line and others like it in the change end up
scheib
2016/09/07 18:00:30
I believe clang format will be happier if the comm
| |
| 27 const std::string& instance_id, | 29 const std::string& instance_id, |
| 28 jobject /* ChromeBluetoothDevice */ chrome_bluetooth_device) { | 30 const JavaRef< |
| 31 jobject>& /* ChromeBluetoothDevice */ chrome_bluetooth_device) { | |
| 29 std::unique_ptr<BluetoothRemoteGattServiceAndroid> service( | 32 std::unique_ptr<BluetoothRemoteGattServiceAndroid> service( |
| 30 new BluetoothRemoteGattServiceAndroid(adapter, device, instance_id)); | 33 new BluetoothRemoteGattServiceAndroid(adapter, device, instance_id)); |
| 31 | 34 |
| 32 JNIEnv* env = AttachCurrentThread(); | 35 JNIEnv* env = AttachCurrentThread(); |
| 33 service->j_service_.Reset(Java_ChromeBluetoothRemoteGattService_create( | 36 service->j_service_.Reset(Java_ChromeBluetoothRemoteGattService_create( |
| 34 env, reinterpret_cast<intptr_t>(service.get()), | 37 env, reinterpret_cast<intptr_t>(service.get()), |
| 35 bluetooth_gatt_service_wrapper, | 38 bluetooth_gatt_service_wrapper, |
| 36 base::android::ConvertUTF8ToJavaString(env, instance_id), | 39 base::android::ConvertUTF8ToJavaString(env, instance_id), |
| 37 chrome_bluetooth_device)); | 40 chrome_bluetooth_device)); |
| 38 | 41 |
| (...skipping 143 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 182 void BluetoothRemoteGattServiceAndroid::EnsureCharacteristicsCreated() const { | 185 void BluetoothRemoteGattServiceAndroid::EnsureCharacteristicsCreated() const { |
| 183 if (!characteristics_.empty()) | 186 if (!characteristics_.empty()) |
| 184 return; | 187 return; |
| 185 | 188 |
| 186 // Java call | 189 // Java call |
| 187 Java_ChromeBluetoothRemoteGattService_createCharacteristics( | 190 Java_ChromeBluetoothRemoteGattService_createCharacteristics( |
| 188 AttachCurrentThread(), j_service_); | 191 AttachCurrentThread(), j_service_); |
| 189 } | 192 } |
| 190 | 193 |
| 191 } // namespace device | 194 } // namespace device |
| OLD | NEW |