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 <memory> | 8 #include <memory> |
9 | 9 |
10 #include "base/android/jni_android.h" | 10 #include "base/android/jni_android.h" |
(...skipping 26 matching lines...) Expand all Loading... |
37 : public BluetoothAdapter { | 37 : public BluetoothAdapter { |
38 public: | 38 public: |
39 // Create a BluetoothAdapterAndroid instance. | 39 // Create a BluetoothAdapterAndroid instance. |
40 // | 40 // |
41 // |java_bluetooth_adapter_wrapper| is optional. If it is NULL the adapter | 41 // |java_bluetooth_adapter_wrapper| is optional. If it is NULL the adapter |
42 // will return false for |IsPresent()| and not be functional. | 42 // will return false for |IsPresent()| and not be functional. |
43 // | 43 // |
44 // The BluetoothAdapterAndroid instance will indirectly hold a Java reference | 44 // The BluetoothAdapterAndroid instance will indirectly hold a Java reference |
45 // to |bluetooth_adapter_wrapper|. | 45 // to |bluetooth_adapter_wrapper|. |
46 static base::WeakPtr<BluetoothAdapterAndroid> Create( | 46 static base::WeakPtr<BluetoothAdapterAndroid> Create( |
47 jobject bluetooth_adapter_wrapper); // Java Type: bluetoothAdapterWrapper | 47 const base::android::JavaRef<jobject>& |
| 48 bluetooth_adapter_wrapper); // Java Type: bluetoothAdapterWrapper |
48 | 49 |
49 // Register C++ methods exposed to Java using JNI. | 50 // Register C++ methods exposed to Java using JNI. |
50 static bool RegisterJNI(JNIEnv* env); | 51 static bool RegisterJNI(JNIEnv* env); |
51 | 52 |
52 // BluetoothAdapter: | 53 // BluetoothAdapter: |
53 std::string GetAddress() const override; | 54 std::string GetAddress() const override; |
54 std::string GetName() const override; | 55 std::string GetName() const override; |
55 void SetName(const std::string& name, | 56 void SetName(const std::string& name, |
56 const base::Closure& callback, | 57 const base::Closure& callback, |
57 const ErrorCallback& error_callback) override; | 58 const ErrorCallback& error_callback) override; |
(...skipping 85 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
143 // Note: This should remain the last member so it'll be destroyed and | 144 // Note: This should remain the last member so it'll be destroyed and |
144 // invalidate its weak pointers before any other members are destroyed. | 145 // invalidate its weak pointers before any other members are destroyed. |
145 base::WeakPtrFactory<BluetoothAdapterAndroid> weak_ptr_factory_; | 146 base::WeakPtrFactory<BluetoothAdapterAndroid> weak_ptr_factory_; |
146 | 147 |
147 DISALLOW_COPY_AND_ASSIGN(BluetoothAdapterAndroid); | 148 DISALLOW_COPY_AND_ASSIGN(BluetoothAdapterAndroid); |
148 }; | 149 }; |
149 | 150 |
150 } // namespace device | 151 } // namespace device |
151 | 152 |
152 #endif // DEVICE_BLUETOOTH_BLUETOOTH_ADAPTER_ANDROID_H_ | 153 #endif // DEVICE_BLUETOOTH_BLUETOOTH_ADAPTER_ANDROID_H_ |
OLD | NEW |