Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(243)

Side by Side Diff: device/bluetooth/bluetooth_device_android.h

Issue 1284073002: bluetooth: Add adapter to BluetoothDevice (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@bt-drop-callback-
Patch Set: Merge TOT Created 5 years, 3 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « device/bluetooth/bluetooth_device.cc ('k') | device/bluetooth/bluetooth_device_android.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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_DEVICE_ANDROID_H_ 5 #ifndef DEVICE_BLUETOOTH_BLUETOOTH_DEVICE_ANDROID_H_
6 #define DEVICE_BLUETOOTH_BLUETOOTH_DEVICE_ANDROID_H_ 6 #define DEVICE_BLUETOOTH_BLUETOOTH_DEVICE_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_device.h" 10 #include "device/bluetooth/bluetooth_device.h"
11 11
12 namespace device { 12 namespace device {
13 13
14 class BluetoothAdapterAndroid;
15
14 // BluetoothDeviceAndroid along with the Java class 16 // BluetoothDeviceAndroid along with the Java class
15 // org.chromium.device.bluetooth.BluetoothDevice implement BluetoothDevice. 17 // org.chromium.device.bluetooth.ChromeBluetoothDevice implement
18 // BluetoothDevice.
16 class DEVICE_BLUETOOTH_EXPORT BluetoothDeviceAndroid final 19 class DEVICE_BLUETOOTH_EXPORT BluetoothDeviceAndroid final
17 : public BluetoothDevice { 20 : public BluetoothDevice {
18 public: 21 public:
19 // Create a BluetoothDeviceAndroid instance and associated Java 22 // Create a BluetoothDeviceAndroid instance and associated Java
20 // ChromeBluetoothDevice using the provided |java_bluetooth_device_wrapper|. 23 // ChromeBluetoothDevice using the provided |java_bluetooth_device_wrapper|.
21 // 24 //
22 // The ChromeBluetoothDevice instance will hold a Java reference 25 // The ChromeBluetoothDevice instance will hold a Java reference
23 // to |bluetooth_device_wrapper|. 26 // to |bluetooth_device_wrapper|.
24 // 27 //
25 // TODO(scheib): Return a scoped_ptr<>, but then adapter will need to handle 28 // TODO(scheib): Return a scoped_ptr<>, but then adapter will need to handle
26 // this correctly. http://crbug.com/506416 29 // this correctly. http://crbug.com/506416
27 static BluetoothDeviceAndroid* Create( 30 static BluetoothDeviceAndroid* Create(
31 BluetoothAdapterAndroid* adapter,
28 jobject bluetooth_device_wrapper); // Java Type: bluetoothDeviceWrapper 32 jobject bluetooth_device_wrapper); // Java Type: bluetoothDeviceWrapper
29 33
30 ~BluetoothDeviceAndroid() override; 34 ~BluetoothDeviceAndroid() override;
31 35
32 // Register C++ methods exposed to Java using JNI. 36 // Register C++ methods exposed to Java using JNI.
33 static bool RegisterJNI(JNIEnv* env); 37 static bool RegisterJNI(JNIEnv* env);
34 38
35 // Updates cached copy of advertised UUIDs discovered during a scan. 39 // Updates cached copy of advertised UUIDs discovered during a scan.
36 // Returns true if new UUIDs differed from cached values. 40 // Returns true if new UUIDs differed from cached values.
37 bool UpdateAdvertisedUUIDs( 41 bool UpdateAdvertisedUUIDs(
(...skipping 34 matching lines...) Expand 10 before | Expand all | Expand 10 after
72 const ConnectToServiceErrorCallback& error_callback) override; 76 const ConnectToServiceErrorCallback& error_callback) override;
73 void ConnectToServiceInsecurely( 77 void ConnectToServiceInsecurely(
74 const device::BluetoothUUID& uuid, 78 const device::BluetoothUUID& uuid,
75 const ConnectToServiceCallback& callback, 79 const ConnectToServiceCallback& callback,
76 const ConnectToServiceErrorCallback& error_callback) override; 80 const ConnectToServiceErrorCallback& error_callback) override;
77 void CreateGattConnection( 81 void CreateGattConnection(
78 const GattConnectionCallback& callback, 82 const GattConnectionCallback& callback,
79 const ConnectErrorCallback& error_callback) override; 83 const ConnectErrorCallback& error_callback) override;
80 84
81 protected: 85 protected:
82 BluetoothDeviceAndroid(); 86 BluetoothDeviceAndroid(BluetoothAdapterAndroid* adapter);
83 87
84 // BluetoothDevice: 88 // BluetoothDevice:
85 std::string GetDeviceName() const override; 89 std::string GetDeviceName() const override;
86 90
87 // Java object org.chromium.device.bluetooth.ChromeBluetoothDevice. 91 // Java object org.chromium.device.bluetooth.ChromeBluetoothDevice.
88 base::android::ScopedJavaGlobalRef<jobject> j_device_; 92 base::android::ScopedJavaGlobalRef<jobject> j_device_;
89 93
90 DISALLOW_COPY_AND_ASSIGN(BluetoothDeviceAndroid); 94 DISALLOW_COPY_AND_ASSIGN(BluetoothDeviceAndroid);
91 }; 95 };
92 96
93 } // namespace device 97 } // namespace device
94 98
95 #endif // DEVICE_BLUETOOTH_BLUETOOTH_DEVICE_ANDROID_H_ 99 #endif // DEVICE_BLUETOOTH_BLUETOOTH_DEVICE_ANDROID_H_
OLDNEW
« no previous file with comments | « device/bluetooth/bluetooth_device.cc ('k') | device/bluetooth/bluetooth_device_android.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698