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