Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(12)

Side by Side Diff: device/bluetooth/bluetooth_adapter.h

Issue 1842223003: Remove outdated devices from Android device chooser (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Reverted two small unnecessary changes. Created 4 years, 6 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
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 <stdint.h> 8 #include <stdint.h>
9 9
10 #include <list> 10 #include <list>
(...skipping 449 matching lines...) Expand 10 before | Expand all | Expand 10 after
460 BluetoothRemoteGattCharacteristic* characteristic); 460 BluetoothRemoteGattCharacteristic* characteristic);
461 void NotifyGattDescriptorAdded(BluetoothRemoteGattDescriptor* descriptor); 461 void NotifyGattDescriptorAdded(BluetoothRemoteGattDescriptor* descriptor);
462 void NotifyGattDescriptorRemoved(BluetoothRemoteGattDescriptor* descriptor); 462 void NotifyGattDescriptorRemoved(BluetoothRemoteGattDescriptor* descriptor);
463 void NotifyGattCharacteristicValueChanged( 463 void NotifyGattCharacteristicValueChanged(
464 BluetoothRemoteGattCharacteristic* characteristic, 464 BluetoothRemoteGattCharacteristic* characteristic,
465 const std::vector<uint8_t>& value); 465 const std::vector<uint8_t>& value);
466 void NotifyGattDescriptorValueChanged( 466 void NotifyGattDescriptorValueChanged(
467 BluetoothRemoteGattDescriptor* descriptor, 467 BluetoothRemoteGattDescriptor* descriptor,
468 const std::vector<uint8_t>& value); 468 const std::vector<uint8_t>& value);
469 469
470 // The timeout in seconds used by RemoveTimedOutDevices.
471 static const base::TimeDelta timeoutSec;
472
470 protected: 473 protected:
471 friend class base::RefCounted<BluetoothAdapter>; 474 friend class base::RefCounted<BluetoothAdapter>;
472 friend class BluetoothDiscoverySession; 475 friend class BluetoothDiscoverySession;
473 friend class BluetoothTestBase; 476 friend class BluetoothTestBase;
474 477
475 typedef base::ScopedPtrHashMap<std::string, std::unique_ptr<BluetoothDevice>> 478 typedef base::ScopedPtrHashMap<std::string, std::unique_ptr<BluetoothDevice>>
476 DevicesMap; 479 DevicesMap;
477 typedef std::pair<BluetoothDevice::PairingDelegate*, PairingDelegatePriority> 480 typedef std::pair<BluetoothDevice::PairingDelegate*, PairingDelegatePriority>
478 PairingDelegatePair; 481 PairingDelegatePair;
479 typedef base::Callback<void(UMABluetoothDiscoverySessionOutcome)> 482 typedef base::Callback<void(UMABluetoothDiscoverySessionOutcome)>
(...skipping 75 matching lines...) Expand 10 before | Expand all | Expand 10 after
555 void MarkDiscoverySessionsAsInactive(); 558 void MarkDiscoverySessionsAsInactive();
556 559
557 // Removes |discovery_session| from |discovery_sessions_|, if its in there. 560 // Removes |discovery_session| from |discovery_sessions_|, if its in there.
558 // Called by DiscoverySession when an instance is destroyed or becomes 561 // Called by DiscoverySession when an instance is destroyed or becomes
559 // inactive. 562 // inactive.
560 void DiscoverySessionBecameInactive( 563 void DiscoverySessionBecameInactive(
561 BluetoothDiscoverySession* discovery_session); 564 BluetoothDiscoverySession* discovery_session);
562 565
563 void DeleteDeviceForTesting(const std::string& address); 566 void DeleteDeviceForTesting(const std::string& address);
564 567
568 // Removes from |devices_| any previously paired, connected or seen
569 // devices which are no longer present. Notifies observers. Note:
570 // this is only used by platforms where there is no notification of
571 // lost devices.
572 void RemoveTimedOutDevices();
573
565 // Observers of BluetoothAdapter, notified from implementation subclasses. 574 // Observers of BluetoothAdapter, notified from implementation subclasses.
566 base::ObserverList<device::BluetoothAdapter::Observer> observers_; 575 base::ObserverList<device::BluetoothAdapter::Observer> observers_;
567 576
568 // Devices paired with, connected to, discovered by, or visible to the 577 // Devices paired with, connected to, discovered by, or visible to the
569 // adapter. The key is the Bluetooth address of the device and the value is 578 // adapter. The key is the Bluetooth address of the device and the value is
570 // the BluetoothDevice object whose lifetime is managed by the adapter 579 // the BluetoothDevice object whose lifetime is managed by the adapter
571 // instance. 580 // instance.
572 DevicesMap devices_; 581 DevicesMap devices_;
573 582
574 // Default pairing delegates registered with the adapter. 583 // Default pairing delegates registered with the adapter.
(...skipping 23 matching lines...) Expand all
598 std::set<BluetoothDiscoverySession*> discovery_sessions_; 607 std::set<BluetoothDiscoverySession*> discovery_sessions_;
599 608
600 // Note: This should remain the last member so it'll be destroyed and 609 // Note: This should remain the last member so it'll be destroyed and
601 // invalidate its weak pointers before any other members are destroyed. 610 // invalidate its weak pointers before any other members are destroyed.
602 base::WeakPtrFactory<BluetoothAdapter> weak_ptr_factory_; 611 base::WeakPtrFactory<BluetoothAdapter> weak_ptr_factory_;
603 }; 612 };
604 613
605 } // namespace device 614 } // namespace device
606 615
607 #endif // DEVICE_BLUETOOTH_BLUETOOTH_ADAPTER_H_ 616 #endif // DEVICE_BLUETOOTH_BLUETOOTH_ADAPTER_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698