| 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 #include "device/bluetooth/bluetooth_adapter.h" | 5 #include "device/bluetooth/bluetooth_adapter.h" |
| 6 | 6 |
| 7 #include "base/bind.h" | 7 #include "base/bind.h" |
| 8 #include "base/stl_util.h" | 8 #include "base/stl_util.h" |
| 9 #include "device/bluetooth/bluetooth_device.h" | 9 #include "device/bluetooth/bluetooth_device.h" |
| 10 #include "device/bluetooth/bluetooth_discovery_session.h" | 10 #include "device/bluetooth/bluetooth_discovery_session.h" |
| (...skipping 95 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 106 if (pairing_delegates_.empty()) | 106 if (pairing_delegates_.empty()) |
| 107 return NULL; | 107 return NULL; |
| 108 | 108 |
| 109 return pairing_delegates_.front().first; | 109 return pairing_delegates_.front().first; |
| 110 } | 110 } |
| 111 | 111 |
| 112 void BluetoothAdapter::OnStartDiscoverySession( | 112 void BluetoothAdapter::OnStartDiscoverySession( |
| 113 const DiscoverySessionCallback& callback) { | 113 const DiscoverySessionCallback& callback) { |
| 114 VLOG(1) << "Discovery session started!"; | 114 VLOG(1) << "Discovery session started!"; |
| 115 scoped_ptr<BluetoothDiscoverySession> discovery_session( | 115 scoped_ptr<BluetoothDiscoverySession> discovery_session( |
| 116 new BluetoothDiscoverySession(scoped_refptr<BluetoothAdapter>(this))); | 116 new BluetoothDiscoverySession(this)); |
| 117 discovery_sessions_.insert(discovery_session.get()); | 117 discovery_sessions_.insert(discovery_session.get()); |
| 118 callback.Run(discovery_session.Pass()); | 118 callback.Run(discovery_session.Pass()); |
| 119 } | 119 } |
| 120 | 120 |
| 121 void BluetoothAdapter::MarkDiscoverySessionsAsInactive() { | 121 void BluetoothAdapter::MarkDiscoverySessionsAsInactive() { |
| 122 for (std::set<BluetoothDiscoverySession*>::iterator | 122 for (std::set<BluetoothDiscoverySession*>::iterator |
| 123 iter = discovery_sessions_.begin(); | 123 iter = discovery_sessions_.begin(); |
| 124 iter != discovery_sessions_.end(); ++iter) { | 124 iter != discovery_sessions_.end(); ++iter) { |
| 125 (*iter)->MarkAsInactive(); | 125 (*iter)->MarkAsInactive(); |
| 126 } | 126 } |
| 127 } | 127 } |
| 128 | 128 |
| 129 void BluetoothAdapter::DiscoverySessionDestroyed( | 129 void BluetoothAdapter::DiscoverySessionDestroyed( |
| 130 BluetoothDiscoverySession* discovery_session) { | 130 BluetoothDiscoverySession* discovery_session) { |
| 131 discovery_sessions_.erase(discovery_session); | 131 discovery_sessions_.erase(discovery_session); |
| 132 } | 132 } |
| 133 | 133 |
| 134 } // namespace device | 134 } // namespace device |
| OLD | NEW |