Chromium Code Reviews| 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 #ifndef DEVICE_BLUETOOTH_BLUETOOTH_ADAPTER_ANDROID_H_ | 5 #ifndef DEVICE_BLUETOOTH_BLUETOOTH_ADAPTER_ANDROID_H_ |
| 6 #define DEVICE_BLUETOOTH_BLUETOOTH_ADAPTER_ANDROID_H_ | 6 #define DEVICE_BLUETOOTH_BLUETOOTH_ADAPTER_ANDROID_H_ |
| 7 | 7 |
| 8 #include "base/android/jni_android.h" | 8 #include "base/android/jni_android.h" |
| 9 #include "base/memory/weak_ptr.h" | 9 #include "base/memory/weak_ptr.h" |
| 10 #include "device/bluetooth/bluetooth_adapter.h" | 10 #include "device/bluetooth/bluetooth_adapter.h" |
| 11 | 11 |
| 12 namespace base { | 12 namespace base { |
| 13 class SequencedTaskRunner; | 13 class SequencedTaskRunner; |
| 14 } // namespace base | 14 } // namespace base |
| 15 | 15 |
| 16 namespace device { | 16 namespace device { |
| 17 | 17 |
| 18 // The BluetoothAdapterAndroid class implements BluetoothAdapter for the | 18 // The BluetoothAdapterAndroid class implements BluetoothAdapter for the |
| 19 // Android platform. | 19 // Android platform. |
| 20 class DEVICE_BLUETOOTH_EXPORT BluetoothAdapterAndroid final | 20 class DEVICE_BLUETOOTH_EXPORT BluetoothAdapterAndroid final |
|
Ted C
2015/05/07 22:23:57
FWIW, you can call the java side BluetoothAdapterA
scheib
2015/05/07 23:59:17
Thanks. I've pondered a bit. For now I'm going to
| |
| 21 : public BluetoothAdapter { | 21 : public BluetoothAdapter { |
| 22 public: | 22 public: |
| 23 // Create a BluetoothAdapterAndroid instance. | 23 // Create a BluetoothAdapterAndroid instance. |
| 24 static base::WeakPtr<BluetoothAdapterAndroid> CreateAdapter(); | 24 static base::WeakPtr<BluetoothAdapterAndroid> CreateAdapter(); |
| 25 | 25 |
| 26 // Create a BluetoothAdapterAndroid instance without Bluetooth permission. | |
| 27 static base::WeakPtr<BluetoothAdapterAndroid> | |
| 28 CreateAdapterWithoutPermissionForTesting(); | |
| 29 | |
| 26 // Register C++ methods exposed to Java using JNI. | 30 // Register C++ methods exposed to Java using JNI. |
| 27 static bool RegisterJNI(JNIEnv* env); | 31 static bool RegisterJNI(JNIEnv* env); |
| 28 | 32 |
| 29 // True if this app has android permissions necessary for Bluetooth. | 33 // True if this app has android permissions necessary for Bluetooth. |
| 30 bool HasBluetoothPermission() const; | 34 bool HasBluetoothPermission() const; |
| 31 | 35 |
| 32 // BluetoothAdapter: | 36 // BluetoothAdapter: |
| 33 std::string GetAddress() const override; | 37 std::string GetAddress() const override; |
| 34 std::string GetName() const override; | 38 std::string GetName() const override; |
| 35 void SetName(const std::string& name, | 39 void SetName(const std::string& name, |
| (...skipping 55 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 91 // Note: This should remain the last member so it'll be destroyed and | 95 // Note: This should remain the last member so it'll be destroyed and |
| 92 // invalidate its weak pointers before any other members are destroyed. | 96 // invalidate its weak pointers before any other members are destroyed. |
| 93 base::WeakPtrFactory<BluetoothAdapterAndroid> weak_ptr_factory_; | 97 base::WeakPtrFactory<BluetoothAdapterAndroid> weak_ptr_factory_; |
| 94 | 98 |
| 95 DISALLOW_COPY_AND_ASSIGN(BluetoothAdapterAndroid); | 99 DISALLOW_COPY_AND_ASSIGN(BluetoothAdapterAndroid); |
| 96 }; | 100 }; |
| 97 | 101 |
| 98 } // namespace device | 102 } // namespace device |
| 99 | 103 |
| 100 #endif // DEVICE_BLUETOOTH_BLUETOOTH_ADAPTER_ANDROID_H_ | 104 #endif // DEVICE_BLUETOOTH_BLUETOOTH_ADAPTER_ANDROID_H_ |
| OLD | NEW |