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

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

Issue 288903003: [Bluetooth] Standardize Bluetooth device address format to XX:XX:XX:XX:XX:XX. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Fix ChromeOS tests too Created 6 years, 7 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 | Annotate | Revision Log
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 #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 55 matching lines...) Expand 10 before | Expand all | Expand 10 after
66 return devices; 66 return devices;
67 } 67 }
68 68
69 BluetoothDevice* BluetoothAdapter::GetDevice(const std::string& address) { 69 BluetoothDevice* BluetoothAdapter::GetDevice(const std::string& address) {
70 return const_cast<BluetoothDevice *>( 70 return const_cast<BluetoothDevice *>(
71 const_cast<const BluetoothAdapter *>(this)->GetDevice(address)); 71 const_cast<const BluetoothAdapter *>(this)->GetDevice(address));
72 } 72 }
73 73
74 const BluetoothDevice* BluetoothAdapter::GetDevice( 74 const BluetoothDevice* BluetoothAdapter::GetDevice(
75 const std::string& address) const { 75 const std::string& address) const {
76 DevicesMap::const_iterator iter = devices_.find(address); 76 std::string canonicalized_address =
77 BluetoothDevice::CanonicalizeAddress(address);
78 if (canonicalized_address.empty())
79 return NULL;
80
81 DevicesMap::const_iterator iter = devices_.find(canonicalized_address);
77 if (iter != devices_.end()) 82 if (iter != devices_.end())
78 return iter->second; 83 return iter->second;
79 84
80 return NULL; 85 return NULL;
81 } 86 }
82 87
83 void BluetoothAdapter::AddPairingDelegate( 88 void BluetoothAdapter::AddPairingDelegate(
84 BluetoothDevice::PairingDelegate* pairing_delegate, 89 BluetoothDevice::PairingDelegate* pairing_delegate,
85 PairingDelegatePriority priority) { 90 PairingDelegatePriority priority) {
86 // Remove the delegate, if it already exists, before inserting to allow a 91 // Remove the delegate, if it already exists, before inserting to allow a
(...skipping 49 matching lines...) Expand 10 before | Expand all | Expand 10 after
136 } 141 }
137 } 142 }
138 143
139 void BluetoothAdapter::DiscoverySessionBecameInactive( 144 void BluetoothAdapter::DiscoverySessionBecameInactive(
140 BluetoothDiscoverySession* discovery_session) { 145 BluetoothDiscoverySession* discovery_session) {
141 DCHECK(!discovery_session->IsActive()); 146 DCHECK(!discovery_session->IsActive());
142 discovery_sessions_.erase(discovery_session); 147 discovery_sessions_.erase(discovery_session);
143 } 148 }
144 149
145 } // namespace device 150 } // namespace device
OLDNEW
« no previous file with comments | « chromeos/dbus/fake_bluetooth_adapter_client.cc ('k') | device/bluetooth/bluetooth_adapter_chromeos.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698