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_ADAPTER_CHROMEOS_H_ | 5 #ifndef DEVICE_BLUETOOTH_BLUETOOTH_ADAPTER_CHROMEOS_H_ |
6 #define DEVICE_BLUETOOTH_BLUETOOTH_ADAPTER_CHROMEOS_H_ | 6 #define DEVICE_BLUETOOTH_BLUETOOTH_ADAPTER_CHROMEOS_H_ |
7 | 7 |
8 #include <queue> | 8 #include <queue> |
9 #include <string> | 9 #include <string> |
10 | 10 |
(...skipping 26 matching lines...) Expand all Loading... |
37 class DEVICE_BLUETOOTH_EXPORT BluetoothAdapterChromeOS | 37 class DEVICE_BLUETOOTH_EXPORT BluetoothAdapterChromeOS |
38 : public device::BluetoothAdapter, | 38 : public device::BluetoothAdapter, |
39 public chromeos::BluetoothAdapterClient::Observer, | 39 public chromeos::BluetoothAdapterClient::Observer, |
40 public chromeos::BluetoothDeviceClient::Observer, | 40 public chromeos::BluetoothDeviceClient::Observer, |
41 public chromeos::BluetoothInputClient::Observer, | 41 public chromeos::BluetoothInputClient::Observer, |
42 public chromeos::BluetoothAgentServiceProvider::Delegate { | 42 public chromeos::BluetoothAgentServiceProvider::Delegate { |
43 public: | 43 public: |
44 static base::WeakPtr<BluetoothAdapter> CreateAdapter(); | 44 static base::WeakPtr<BluetoothAdapter> CreateAdapter(); |
45 | 45 |
46 // BluetoothAdapter: | 46 // BluetoothAdapter: |
| 47 void OnDBusThreadManagerShutdown() override; |
47 void DeleteOnCorrectThread() const override; | 48 void DeleteOnCorrectThread() const override; |
48 virtual void AddObserver( | 49 virtual void AddObserver( |
49 device::BluetoothAdapter::Observer* observer) override; | 50 device::BluetoothAdapter::Observer* observer) override; |
50 virtual void RemoveObserver( | 51 virtual void RemoveObserver( |
51 device::BluetoothAdapter::Observer* observer) override; | 52 device::BluetoothAdapter::Observer* observer) override; |
52 virtual std::string GetAddress() const override; | 53 virtual std::string GetAddress() const override; |
53 virtual std::string GetName() const override; | 54 virtual std::string GetName() const override; |
54 virtual void SetName(const std::string& name, | 55 virtual void SetName(const std::string& name, |
55 const base::Closure& callback, | 56 const base::Closure& callback, |
56 const ErrorCallback& error_callback) override; | 57 const ErrorCallback& error_callback) override; |
(...skipping 177 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
234 void OnStopDiscoveryError(const ErrorCallback& error_callback, | 235 void OnStopDiscoveryError(const ErrorCallback& error_callback, |
235 const std::string& error_name, | 236 const std::string& error_name, |
236 const std::string& error_message); | 237 const std::string& error_message); |
237 | 238 |
238 // Processes the queued discovery requests. For each DiscoveryCallbackPair in | 239 // Processes the queued discovery requests. For each DiscoveryCallbackPair in |
239 // the queue, this method will try to add a new discovery session. This method | 240 // the queue, this method will try to add a new discovery session. This method |
240 // is called whenever a pending D-Bus call to start or stop discovery has | 241 // is called whenever a pending D-Bus call to start or stop discovery has |
241 // ended (with either success or failure). | 242 // ended (with either success or failure). |
242 void ProcessQueuedDiscoveryRequests(); | 243 void ProcessQueuedDiscoveryRequests(); |
243 | 244 |
| 245 // Set in |OnDBusThreadManagerShutdown()|, makes IsPresent()| return false. |
| 246 bool dbus_is_shutdown_; |
| 247 |
244 // Number of discovery sessions that have been added. | 248 // Number of discovery sessions that have been added. |
245 int num_discovery_sessions_; | 249 int num_discovery_sessions_; |
246 | 250 |
247 // True, if there is a pending request to start or stop discovery. | 251 // True, if there is a pending request to start or stop discovery. |
248 bool discovery_request_pending_; | 252 bool discovery_request_pending_; |
249 | 253 |
250 // List of queued requests to add new discovery sessions. While there is a | 254 // List of queued requests to add new discovery sessions. While there is a |
251 // pending request to BlueZ to start or stop discovery, many requests from | 255 // pending request to BlueZ to start or stop discovery, many requests from |
252 // within Chrome to start or stop discovery sessions may occur. We only | 256 // within Chrome to start or stop discovery sessions may occur. We only |
253 // queue requests to add new sessions to be processed later. All requests to | 257 // queue requests to add new sessions to be processed later. All requests to |
(...skipping 21 matching lines...) Expand all Loading... |
275 // Note: This should remain the last member so it'll be destroyed and | 279 // Note: This should remain the last member so it'll be destroyed and |
276 // invalidate its weak pointers before any other members are destroyed. | 280 // invalidate its weak pointers before any other members are destroyed. |
277 base::WeakPtrFactory<BluetoothAdapterChromeOS> weak_ptr_factory_; | 281 base::WeakPtrFactory<BluetoothAdapterChromeOS> weak_ptr_factory_; |
278 | 282 |
279 DISALLOW_COPY_AND_ASSIGN(BluetoothAdapterChromeOS); | 283 DISALLOW_COPY_AND_ASSIGN(BluetoothAdapterChromeOS); |
280 }; | 284 }; |
281 | 285 |
282 } // namespace chromeos | 286 } // namespace chromeos |
283 | 287 |
284 #endif // DEVICE_BLUETOOTH_BLUETOOTH_ADAPTER_CHROMEOS_H_ | 288 #endif // DEVICE_BLUETOOTH_BLUETOOTH_ADAPTER_CHROMEOS_H_ |
OLD | NEW |