OLD | NEW |
1 // Copyright 2013 The Chromium Authors. All rights reserved. | 1 // Copyright 2013 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_CHROMEOS_H | 5 #ifndef DEVICE_BLUETOOTH_BLUETOOTH_DEVICE_CHROMEOS_H |
6 #define DEVICE_BLUETOOTH_BLUETOOTH_DEVICE_CHROMEOS_H | 6 #define DEVICE_BLUETOOTH_BLUETOOTH_DEVICE_CHROMEOS_H |
7 | 7 |
8 #include <string> | 8 #include <string> |
9 | 9 |
10 #include "base/memory/ref_counted.h" | 10 #include "base/memory/ref_counted.h" |
(...skipping 10 matching lines...) Expand all Loading... |
21 class BluetoothSocketThread; | 21 class BluetoothSocketThread; |
22 } // namespace device | 22 } // namespace device |
23 | 23 |
24 namespace chromeos { | 24 namespace chromeos { |
25 | 25 |
26 class BluetoothAdapterChromeOS; | 26 class BluetoothAdapterChromeOS; |
27 class BluetoothPairingChromeOS; | 27 class BluetoothPairingChromeOS; |
28 | 28 |
29 // The BluetoothDeviceChromeOS class implements BluetoothDevice for the | 29 // The BluetoothDeviceChromeOS class implements BluetoothDevice for the |
30 // Chrome OS platform. | 30 // Chrome OS platform. |
| 31 // |
| 32 // This class is not thread-safe, but is only called from the UI thread. |
| 33 // |
| 34 // A socket thread is used to create sockets but posts all callbacks on the UI |
| 35 // thread. |
31 class DEVICE_BLUETOOTH_EXPORT BluetoothDeviceChromeOS | 36 class DEVICE_BLUETOOTH_EXPORT BluetoothDeviceChromeOS |
32 : public device::BluetoothDevice, | 37 : public device::BluetoothDevice, |
33 public BluetoothGattServiceClient::Observer { | 38 public BluetoothGattServiceClient::Observer { |
34 public: | 39 public: |
35 // BluetoothDevice override | 40 // BluetoothDevice override |
36 uint32 GetBluetoothClass() const override; | 41 uint32 GetBluetoothClass() const override; |
37 std::string GetAddress() const override; | 42 std::string GetAddress() const override; |
38 VendorIDSource GetVendorIDSource() const override; | 43 VendorIDSource GetVendorIDSource() const override; |
39 uint16 GetVendorID() const override; | 44 uint16 GetVendorID() const override; |
40 uint16 GetProductID() const override; | 45 uint16 GetProductID() const override; |
(...skipping 46 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
87 // Returns the current pairing object or NULL if no pairing is in progress. | 92 // Returns the current pairing object or NULL if no pairing is in progress. |
88 BluetoothPairingChromeOS* GetPairing() const; | 93 BluetoothPairingChromeOS* GetPairing() const; |
89 | 94 |
90 // Returns the object path of the device. | 95 // Returns the object path of the device. |
91 const dbus::ObjectPath& object_path() const { return object_path_; } | 96 const dbus::ObjectPath& object_path() const { return object_path_; } |
92 | 97 |
93 // Returns the adapter which owns this device instance. | 98 // Returns the adapter which owns this device instance. |
94 BluetoothAdapterChromeOS* adapter() const { return adapter_; } | 99 BluetoothAdapterChromeOS* adapter() const { return adapter_; } |
95 | 100 |
96 protected: | 101 protected: |
97 // BluetoothDevice override | 102 // BluetoothDevice override |
98 std::string GetDeviceName() const override; | 103 std::string GetDeviceName() const override; |
99 | 104 |
100 private: | 105 private: |
101 friend class BluetoothAdapterChromeOS; | 106 friend class BluetoothAdapterChromeOS; |
102 | 107 |
103 BluetoothDeviceChromeOS( | 108 BluetoothDeviceChromeOS( |
104 BluetoothAdapterChromeOS* adapter, | 109 BluetoothAdapterChromeOS* adapter, |
105 const dbus::ObjectPath& object_path, | 110 const dbus::ObjectPath& object_path, |
106 scoped_refptr<base::SequencedTaskRunner> ui_task_runner, | 111 scoped_refptr<base::SequencedTaskRunner> ui_task_runner, |
107 scoped_refptr<device::BluetoothSocketThread> socket_thread); | 112 scoped_refptr<device::BluetoothSocketThread> socket_thread); |
(...skipping 85 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
193 // Note: This should remain the last member so it'll be destroyed and | 198 // Note: This should remain the last member so it'll be destroyed and |
194 // invalidate its weak pointers before any other members are destroyed. | 199 // invalidate its weak pointers before any other members are destroyed. |
195 base::WeakPtrFactory<BluetoothDeviceChromeOS> weak_ptr_factory_; | 200 base::WeakPtrFactory<BluetoothDeviceChromeOS> weak_ptr_factory_; |
196 | 201 |
197 DISALLOW_COPY_AND_ASSIGN(BluetoothDeviceChromeOS); | 202 DISALLOW_COPY_AND_ASSIGN(BluetoothDeviceChromeOS); |
198 }; | 203 }; |
199 | 204 |
200 } // namespace chromeos | 205 } // namespace chromeos |
201 | 206 |
202 #endif // DEVICE_BLUETOOTH_BLUETOOTH_DEVICE_CHROMEOS_H | 207 #endif // DEVICE_BLUETOOTH_BLUETOOTH_DEVICE_CHROMEOS_H |
OLD | NEW |