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

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

Issue 1057603004: bluetooth: Refactor (Add|Remove)Observer impls into BluetoothAdapter. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@bta-style-guide-ordering-
Patch Set: Merge TOT Created 5 years, 8 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
« no previous file with comments | « no previous file | device/bluetooth/bluetooth_adapter.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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 <list> 8 #include <list>
9 #include <map> 9 #include <map>
10 #include <set> 10 #include <set>
(...skipping 197 matching lines...) Expand 10 before | Expand all | Expand 10 after
208 // Shutdown the adapter: tear down and clean up all objects owned by 208 // Shutdown the adapter: tear down and clean up all objects owned by
209 // BluetoothAdapter. After this call, the BluetoothAdapter will behave as if 209 // BluetoothAdapter. After this call, the BluetoothAdapter will behave as if
210 // no Bluetooth controller exists in the local system. |IsPresent| will return 210 // no Bluetooth controller exists in the local system. |IsPresent| will return
211 // false. 211 // false.
212 virtual void Shutdown(); 212 virtual void Shutdown();
213 #endif 213 #endif
214 214
215 // Adds and removes observers for events on this bluetooth adapter. If 215 // Adds and removes observers for events on this bluetooth adapter. If
216 // monitoring multiple adapters, check the |adapter| parameter of observer 216 // monitoring multiple adapters, check the |adapter| parameter of observer
217 // methods to determine which adapter is issuing the event. 217 // methods to determine which adapter is issuing the event.
218 virtual void AddObserver(BluetoothAdapter::Observer* observer) = 0; 218 virtual void AddObserver(BluetoothAdapter::Observer* observer);
219 virtual void RemoveObserver( 219 virtual void RemoveObserver(BluetoothAdapter::Observer* observer);
220 BluetoothAdapter::Observer* observer) = 0;
221 220
222 // The address of this adapter. The address format is "XX:XX:XX:XX:XX:XX", 221 // The address of this adapter. The address format is "XX:XX:XX:XX:XX:XX",
223 // where each XX is a hexadecimal number. 222 // where each XX is a hexadecimal number.
224 virtual std::string GetAddress() const = 0; 223 virtual std::string GetAddress() const = 0;
225 224
226 // The name of the adapter. 225 // The name of the adapter.
227 virtual std::string GetName() const = 0; 226 virtual std::string GetName() const = 0;
228 227
229 // Set the human-readable name of the adapter to |name|. On success, 228 // Set the human-readable name of the adapter to |name|. On success,
230 // |callback| will be called. On failure, |error_callback| will be called. 229 // |callback| will be called. On failure, |error_callback| will be called.
(...skipping 216 matching lines...) Expand 10 before | Expand all | Expand 10 after
447 // BluetoothAdapter in the event that the adapter unexpectedly stops 446 // BluetoothAdapter in the event that the adapter unexpectedly stops
448 // discovering. This should be called by all platform implementations. 447 // discovering. This should be called by all platform implementations.
449 void MarkDiscoverySessionsAsInactive(); 448 void MarkDiscoverySessionsAsInactive();
450 449
451 // Removes |discovery_session| from |discovery_sessions_|, if its in there. 450 // Removes |discovery_session| from |discovery_sessions_|, if its in there.
452 // Called by DiscoverySession when an instance is destroyed or becomes 451 // Called by DiscoverySession when an instance is destroyed or becomes
453 // inactive. 452 // inactive.
454 void DiscoverySessionBecameInactive( 453 void DiscoverySessionBecameInactive(
455 BluetoothDiscoverySession* discovery_session); 454 BluetoothDiscoverySession* discovery_session);
456 455
456 // Observers of BluetoothAdapter, notified from implementation subclasses.
457 ObserverList<device::BluetoothAdapter::Observer> observers_;
458
457 // Devices paired with, connected to, discovered by, or visible to the 459 // Devices paired with, connected to, discovered by, or visible to the
458 // adapter. The key is the Bluetooth address of the device and the value is 460 // adapter. The key is the Bluetooth address of the device and the value is
459 // the BluetoothDevice object whose lifetime is managed by the adapter 461 // the BluetoothDevice object whose lifetime is managed by the adapter
460 // instance. 462 // instance.
461 DevicesMap devices_; 463 DevicesMap devices_;
462 464
463 // Default pairing delegates registered with the adapter. 465 // Default pairing delegates registered with the adapter.
464 std::list<PairingDelegatePair> pairing_delegates_; 466 std::list<PairingDelegatePair> pairing_delegates_;
465 467
466 private: 468 private:
(...skipping 19 matching lines...) Expand all
486 // Trait for RefCountedThreadSafe that deletes BluetoothAdapter. 488 // Trait for RefCountedThreadSafe that deletes BluetoothAdapter.
487 struct BluetoothAdapterDeleter { 489 struct BluetoothAdapterDeleter {
488 static void Destruct(const BluetoothAdapter* adapter) { 490 static void Destruct(const BluetoothAdapter* adapter) {
489 adapter->DeleteOnCorrectThread(); 491 adapter->DeleteOnCorrectThread();
490 } 492 }
491 }; 493 };
492 494
493 } // namespace device 495 } // namespace device
494 496
495 #endif // DEVICE_BLUETOOTH_BLUETOOTH_ADAPTER_H_ 497 #endif // DEVICE_BLUETOOTH_BLUETOOTH_ADAPTER_H_
OLDNEW
« no previous file with comments | « no previous file | device/bluetooth/bluetooth_adapter.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698