OLD | NEW |
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 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_H_ | 5 #ifndef DEVICE_BLUETOOTH_BLUETOOTH_ADAPTER_H_ |
6 #define DEVICE_BLUETOOTH_BLUETOOTH_ADAPTER_H_ | 6 #define DEVICE_BLUETOOTH_BLUETOOTH_ADAPTER_H_ |
7 | 7 |
8 #include <list> | 8 #include <list> |
9 #include <map> | 9 #include <map> |
10 #include <set> | 10 #include <set> |
(...skipping 368 matching lines...) Loading... |
379 // Creates and registers an advertisement for broadcast over the LE channel. | 379 // Creates and registers an advertisement for broadcast over the LE channel. |
380 // The created advertisement will be returned via the success callback. | 380 // The created advertisement will be returned via the success callback. |
381 virtual void RegisterAdvertisement( | 381 virtual void RegisterAdvertisement( |
382 scoped_ptr<BluetoothAdvertisement::Data> advertisement_data, | 382 scoped_ptr<BluetoothAdvertisement::Data> advertisement_data, |
383 const CreateAdvertisementCallback& callback, | 383 const CreateAdvertisementCallback& callback, |
384 const CreateAdvertisementErrorCallback& error_callback) = 0; | 384 const CreateAdvertisementErrorCallback& error_callback) = 0; |
385 | 385 |
386 protected: | 386 protected: |
387 friend class base::RefCounted<BluetoothAdapter>; | 387 friend class base::RefCounted<BluetoothAdapter>; |
388 friend class BluetoothDiscoverySession; | 388 friend class BluetoothDiscoverySession; |
| 389 friend class BluetoothTestBase; |
389 | 390 |
390 typedef std::map<const std::string, BluetoothDevice*> DevicesMap; | 391 typedef std::map<const std::string, BluetoothDevice*> DevicesMap; |
391 typedef std::pair<BluetoothDevice::PairingDelegate*, PairingDelegatePriority> | 392 typedef std::pair<BluetoothDevice::PairingDelegate*, PairingDelegatePriority> |
392 PairingDelegatePair; | 393 PairingDelegatePair; |
393 typedef base::Callback<void(UMABluetoothDiscoverySessionOutcome)> | 394 typedef base::Callback<void(UMABluetoothDiscoverySessionOutcome)> |
394 DiscoverySessionErrorCallback; | 395 DiscoverySessionErrorCallback; |
395 | 396 |
396 BluetoothAdapter(); | 397 BluetoothAdapter(); |
397 virtual ~BluetoothAdapter(); | 398 virtual ~BluetoothAdapter(); |
398 | 399 |
(...skipping 68 matching lines...) Loading... |
467 // BluetoothAdapter in the event that the adapter unexpectedly stops | 468 // BluetoothAdapter in the event that the adapter unexpectedly stops |
468 // discovering. This should be called by all platform implementations. | 469 // discovering. This should be called by all platform implementations. |
469 void MarkDiscoverySessionsAsInactive(); | 470 void MarkDiscoverySessionsAsInactive(); |
470 | 471 |
471 // Removes |discovery_session| from |discovery_sessions_|, if its in there. | 472 // Removes |discovery_session| from |discovery_sessions_|, if its in there. |
472 // Called by DiscoverySession when an instance is destroyed or becomes | 473 // Called by DiscoverySession when an instance is destroyed or becomes |
473 // inactive. | 474 // inactive. |
474 void DiscoverySessionBecameInactive( | 475 void DiscoverySessionBecameInactive( |
475 BluetoothDiscoverySession* discovery_session); | 476 BluetoothDiscoverySession* discovery_session); |
476 | 477 |
| 478 void DeleteDeviceForTesting(const std::string& address); |
| 479 |
477 // Observers of BluetoothAdapter, notified from implementation subclasses. | 480 // Observers of BluetoothAdapter, notified from implementation subclasses. |
478 base::ObserverList<device::BluetoothAdapter::Observer> observers_; | 481 base::ObserverList<device::BluetoothAdapter::Observer> observers_; |
479 | 482 |
480 // Devices paired with, connected to, discovered by, or visible to the | 483 // Devices paired with, connected to, discovered by, or visible to the |
481 // adapter. The key is the Bluetooth address of the device and the value is | 484 // adapter. The key is the Bluetooth address of the device and the value is |
482 // the BluetoothDevice object whose lifetime is managed by the adapter | 485 // the BluetoothDevice object whose lifetime is managed by the adapter |
483 // instance. | 486 // instance. |
484 DevicesMap devices_; | 487 DevicesMap devices_; |
485 | 488 |
486 // Default pairing delegates registered with the adapter. | 489 // Default pairing delegates registered with the adapter. |
(...skipping 23 matching lines...) Loading... |
510 std::set<BluetoothDiscoverySession*> discovery_sessions_; | 513 std::set<BluetoothDiscoverySession*> discovery_sessions_; |
511 | 514 |
512 // Note: This should remain the last member so it'll be destroyed and | 515 // Note: This should remain the last member so it'll be destroyed and |
513 // invalidate its weak pointers before any other members are destroyed. | 516 // invalidate its weak pointers before any other members are destroyed. |
514 base::WeakPtrFactory<BluetoothAdapter> weak_ptr_factory_; | 517 base::WeakPtrFactory<BluetoothAdapter> weak_ptr_factory_; |
515 }; | 518 }; |
516 | 519 |
517 } // namespace device | 520 } // namespace device |
518 | 521 |
519 #endif // DEVICE_BLUETOOTH_BLUETOOTH_ADAPTER_H_ | 522 #endif // DEVICE_BLUETOOTH_BLUETOOTH_ADAPTER_H_ |
OLD | NEW |