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 44 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
85 // Returns the current pairing object or NULL if no pairing is in progress. | 90 // Returns the current pairing object or NULL if no pairing is in progress. |
86 BluetoothPairingChromeOS* GetPairing() const; | 91 BluetoothPairingChromeOS* GetPairing() const; |
87 | 92 |
88 // Returns the object path of the device. | 93 // Returns the object path of the device. |
89 const dbus::ObjectPath& object_path() const { return object_path_; } | 94 const dbus::ObjectPath& object_path() const { return object_path_; } |
90 | 95 |
91 // Returns the adapter which owns this device instance. | 96 // Returns the adapter which owns this device instance. |
92 BluetoothAdapterChromeOS* adapter() const { return adapter_; } | 97 BluetoothAdapterChromeOS* adapter() const { return adapter_; } |
93 | 98 |
94 protected: | 99 protected: |
95 // BluetoothDevice override | 100 // BluetoothDevice override |
96 std::string GetDeviceName() const override; | 101 std::string GetDeviceName() const override; |
97 | 102 |
98 private: | 103 private: |
99 friend class BluetoothAdapterChromeOS; | 104 friend class BluetoothAdapterChromeOS; |
100 | 105 |
101 BluetoothDeviceChromeOS( | 106 BluetoothDeviceChromeOS( |
102 BluetoothAdapterChromeOS* adapter, | 107 BluetoothAdapterChromeOS* adapter, |
103 const dbus::ObjectPath& object_path, | 108 const dbus::ObjectPath& object_path, |
104 scoped_refptr<base::SequencedTaskRunner> ui_task_runner, | 109 scoped_refptr<base::SequencedTaskRunner> ui_task_runner, |
105 scoped_refptr<device::BluetoothSocketThread> socket_thread); | 110 scoped_refptr<device::BluetoothSocketThread> socket_thread); |
(...skipping 85 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
191 // Note: This should remain the last member so it'll be destroyed and | 196 // Note: This should remain the last member so it'll be destroyed and |
192 // invalidate its weak pointers before any other members are destroyed. | 197 // invalidate its weak pointers before any other members are destroyed. |
193 base::WeakPtrFactory<BluetoothDeviceChromeOS> weak_ptr_factory_; | 198 base::WeakPtrFactory<BluetoothDeviceChromeOS> weak_ptr_factory_; |
194 | 199 |
195 DISALLOW_COPY_AND_ASSIGN(BluetoothDeviceChromeOS); | 200 DISALLOW_COPY_AND_ASSIGN(BluetoothDeviceChromeOS); |
196 }; | 201 }; |
197 | 202 |
198 } // namespace chromeos | 203 } // namespace chromeos |
199 | 204 |
200 #endif // DEVICE_BLUETOOTH_BLUETOOTH_DEVICE_CHROMEOS_H | 205 #endif // DEVICE_BLUETOOTH_BLUETOOTH_DEVICE_CHROMEOS_H |
| 206 |
OLD | NEW |