Implement nacl_irt_memory for non-sfi mode.
[chromium-blink-merge.git] / device / bluetooth / bluetooth_adapter.cc
blob8cce6ece2c1e339ce7587793682e4a03703bf5a0
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
3 // found in the LICENSE file.
5 #include "device/bluetooth/bluetooth_adapter.h"
7 #include "base/stl_util.h"
8 #include "device/bluetooth/bluetooth_device.h"
10 namespace device {
12 BluetoothAdapter::BluetoothAdapter() {
15 BluetoothAdapter::~BluetoothAdapter() {
16 STLDeleteValues(&devices_);
19 BluetoothAdapter::DeviceList BluetoothAdapter::GetDevices() {
20 ConstDeviceList const_devices =
21 const_cast<const BluetoothAdapter *>(this)->GetDevices();
23 DeviceList devices;
24 for (ConstDeviceList::const_iterator i = const_devices.begin();
25 i != const_devices.end(); ++i)
26 devices.push_back(const_cast<BluetoothDevice *>(*i));
28 return devices;
31 BluetoothAdapter::ConstDeviceList BluetoothAdapter::GetDevices() const {
32 ConstDeviceList devices;
33 for (DevicesMap::const_iterator iter = devices_.begin();
34 iter != devices_.end();
35 ++iter)
36 devices.push_back(iter->second);
38 return devices;
41 BluetoothDevice* BluetoothAdapter::GetDevice(const std::string& address) {
42 return const_cast<BluetoothDevice *>(
43 const_cast<const BluetoothAdapter *>(this)->GetDevice(address));
46 const BluetoothDevice* BluetoothAdapter::GetDevice(
47 const std::string& address) const {
48 DevicesMap::const_iterator iter = devices_.find(address);
49 if (iter != devices_.end())
50 return iter->second;
52 return NULL;
55 } // namespace device