| 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 <map> | 8 #include <map> |
| 9 #include <queue> | 9 #include <queue> |
| 10 #include <string> | 10 #include <string> |
| (...skipping 48 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 59 typedef base::Callback<void(const std::string& error_message)> | 59 typedef base::Callback<void(const std::string& error_message)> |
| 60 ErrorCompletionCallback; | 60 ErrorCompletionCallback; |
| 61 typedef base::Callback<void(BluetoothAdapterProfileChromeOS* profile)> | 61 typedef base::Callback<void(BluetoothAdapterProfileChromeOS* profile)> |
| 62 ProfileRegisteredCallback; | 62 ProfileRegisteredCallback; |
| 63 | 63 |
| 64 static base::WeakPtr<BluetoothAdapter> CreateAdapter(); | 64 static base::WeakPtr<BluetoothAdapter> CreateAdapter(); |
| 65 | 65 |
| 66 // BluetoothAdapter: | 66 // BluetoothAdapter: |
| 67 void Shutdown() override; | 67 void Shutdown() override; |
| 68 void DeleteOnCorrectThread() const override; | 68 void DeleteOnCorrectThread() const override; |
| 69 void AddObserver(device::BluetoothAdapter::Observer* observer) override; | |
| 70 void RemoveObserver(device::BluetoothAdapter::Observer* observer) override; | |
| 71 std::string GetAddress() const override; | 69 std::string GetAddress() const override; |
| 72 std::string GetName() const override; | 70 std::string GetName() const override; |
| 73 void SetName(const std::string& name, | 71 void SetName(const std::string& name, |
| 74 const base::Closure& callback, | 72 const base::Closure& callback, |
| 75 const ErrorCallback& error_callback) override; | 73 const ErrorCallback& error_callback) override; |
| 76 bool IsInitialized() const override; | 74 bool IsInitialized() const override; |
| 77 bool IsPresent() const override; | 75 bool IsPresent() const override; |
| 78 bool IsPowered() const override; | 76 bool IsPowered() const override; |
| 79 void SetPowered(bool powered, | 77 void SetPowered(bool powered, |
| 80 const base::Closure& callback, | 78 const base::Closure& callback, |
| (...skipping 265 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 346 // remove a session while a call is pending immediately return failure. Note | 344 // remove a session while a call is pending immediately return failure. Note |
| 347 // that since BlueZ keeps its own reference count of applications that have | 345 // that since BlueZ keeps its own reference count of applications that have |
| 348 // requested discovery, dropping our count to 0 won't necessarily result in | 346 // requested discovery, dropping our count to 0 won't necessarily result in |
| 349 // the controller actually stopping discovery if, for example, an application | 347 // the controller actually stopping discovery if, for example, an application |
| 350 // other than Chrome, such as bt_console, was also used to start discovery. | 348 // other than Chrome, such as bt_console, was also used to start discovery. |
| 351 DiscoveryCallbackQueue discovery_request_queue_; | 349 DiscoveryCallbackQueue discovery_request_queue_; |
| 352 | 350 |
| 353 // Object path of the adapter we track. | 351 // Object path of the adapter we track. |
| 354 dbus::ObjectPath object_path_; | 352 dbus::ObjectPath object_path_; |
| 355 | 353 |
| 356 // List of observers interested in event notifications from us. | |
| 357 ObserverList<device::BluetoothAdapter::Observer> observers_; | |
| 358 | |
| 359 // Instance of the D-Bus agent object used for pairing, initialized with | 354 // Instance of the D-Bus agent object used for pairing, initialized with |
| 360 // our own class as its delegate. | 355 // our own class as its delegate. |
| 361 scoped_ptr<BluetoothAgentServiceProvider> agent_; | 356 scoped_ptr<BluetoothAgentServiceProvider> agent_; |
| 362 | 357 |
| 363 // UI thread task runner and socket thread object used to create sockets. | 358 // UI thread task runner and socket thread object used to create sockets. |
| 364 scoped_refptr<base::SequencedTaskRunner> ui_task_runner_; | 359 scoped_refptr<base::SequencedTaskRunner> ui_task_runner_; |
| 365 scoped_refptr<device::BluetoothSocketThread> socket_thread_; | 360 scoped_refptr<device::BluetoothSocketThread> socket_thread_; |
| 366 | 361 |
| 367 // The profiles we have registered with the bluetooth daemon. | 362 // The profiles we have registered with the bluetooth daemon. |
| 368 std::map<device::BluetoothUUID, BluetoothAdapterProfileChromeOS*> profiles_; | 363 std::map<device::BluetoothUUID, BluetoothAdapterProfileChromeOS*> profiles_; |
| 369 | 364 |
| 370 // Queue of delegates waiting for a profile to register. | 365 // Queue of delegates waiting for a profile to register. |
| 371 std::map<device::BluetoothUUID, std::vector<RegisterProfileCompletionPair>*> | 366 std::map<device::BluetoothUUID, std::vector<RegisterProfileCompletionPair>*> |
| 372 profile_queues_; | 367 profile_queues_; |
| 373 | 368 |
| 374 scoped_ptr<device::BluetoothDiscoveryFilter> current_filter_; | 369 scoped_ptr<device::BluetoothDiscoveryFilter> current_filter_; |
| 375 | 370 |
| 376 // Note: This should remain the last member so it'll be destroyed and | 371 // Note: This should remain the last member so it'll be destroyed and |
| 377 // invalidate its weak pointers before any other members are destroyed. | 372 // invalidate its weak pointers before any other members are destroyed. |
| 378 base::WeakPtrFactory<BluetoothAdapterChromeOS> weak_ptr_factory_; | 373 base::WeakPtrFactory<BluetoothAdapterChromeOS> weak_ptr_factory_; |
| 379 | 374 |
| 380 DISALLOW_COPY_AND_ASSIGN(BluetoothAdapterChromeOS); | 375 DISALLOW_COPY_AND_ASSIGN(BluetoothAdapterChromeOS); |
| 381 }; | 376 }; |
| 382 | 377 |
| 383 } // namespace chromeos | 378 } // namespace chromeos |
| 384 | 379 |
| 385 #endif // DEVICE_BLUETOOTH_BLUETOOTH_ADAPTER_CHROMEOS_H_ | 380 #endif // DEVICE_BLUETOOTH_BLUETOOTH_ADAPTER_CHROMEOS_H_ |
| OLD | NEW |