| 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 |
| 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 | |
| 30 // Register C++ methods exposed to Java using JNI. | 26 // Register C++ methods exposed to Java using JNI. |
| 31 static bool RegisterJNI(JNIEnv* env); | 27 static bool RegisterJNI(JNIEnv* env); |
| 32 | 28 |
| 33 // True if this app has android permissions necessary for Bluetooth. | 29 // True if this app has android permissions necessary for Bluetooth. |
| 34 bool HasBluetoothPermission() const; | 30 bool HasBluetoothPermission() const; |
| 35 | 31 |
| 36 // BluetoothAdapter: | 32 // BluetoothAdapter: |
| 37 std::string GetAddress() const override; | 33 std::string GetAddress() const override; |
| 38 std::string GetName() const override; | 34 std::string GetName() const override; |
| 39 void SetName(const std::string& name, | 35 void SetName(const std::string& name, |
| (...skipping 55 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 95 // Note: This should remain the last member so it'll be destroyed and | 91 // Note: This should remain the last member so it'll be destroyed and |
| 96 // invalidate its weak pointers before any other members are destroyed. | 92 // invalidate its weak pointers before any other members are destroyed. |
| 97 base::WeakPtrFactory<BluetoothAdapterAndroid> weak_ptr_factory_; | 93 base::WeakPtrFactory<BluetoothAdapterAndroid> weak_ptr_factory_; |
| 98 | 94 |
| 99 DISALLOW_COPY_AND_ASSIGN(BluetoothAdapterAndroid); | 95 DISALLOW_COPY_AND_ASSIGN(BluetoothAdapterAndroid); |
| 100 }; | 96 }; |
| 101 | 97 |
| 102 } // namespace device | 98 } // namespace device |
| 103 | 99 |
| 104 #endif // DEVICE_BLUETOOTH_BLUETOOTH_ADAPTER_ANDROID_H_ | 100 #endif // DEVICE_BLUETOOTH_BLUETOOTH_ADAPTER_ANDROID_H_ |
| OLD | NEW |