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

Side by Side Diff: chrome/browser/chromeos/bluetooth/bluetooth_device.cc

Issue 10816023: Ensure canonical Bluetooth UUIDs are used. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: rebase Created 8 years, 4 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 "chrome/browser/chromeos/bluetooth/bluetooth_device.h" 5 #include "chrome/browser/chromeos/bluetooth/bluetooth_device.h"
6 6
7 #include <map> 7 #include <map>
8 #include <string> 8 #include <string>
9 #include <vector> 9 #include <vector>
10 10
11 #include "base/bind.h" 11 #include "base/bind.h"
12 #include "base/command_line.h" 12 #include "base/command_line.h"
13 #include "base/logging.h" 13 #include "base/logging.h"
14 #include "base/memory/scoped_vector.h" 14 #include "base/memory/scoped_vector.h"
15 #include "base/memory/weak_ptr.h" 15 #include "base/memory/weak_ptr.h"
16 #include "base/string16.h" 16 #include "base/string16.h"
17 #include "base/string_util.h" 17 #include "base/string_util.h"
18 #include "base/utf_string_conversions.h" 18 #include "base/utf_string_conversions.h"
19 #include "base/values.h" 19 #include "base/values.h"
20 #include "chrome/browser/chromeos/bluetooth/bluetooth_adapter.h" 20 #include "chrome/browser/chromeos/bluetooth/bluetooth_adapter.h"
21 #include "chrome/browser/chromeos/bluetooth/bluetooth_service_record.h" 21 #include "chrome/browser/chromeos/bluetooth/bluetooth_service_record.h"
22 #include "chrome/browser/chromeos/bluetooth/bluetooth_socket.h" 22 #include "chrome/browser/chromeos/bluetooth/bluetooth_socket.h"
23 #include "chrome/browser/chromeos/bluetooth/bluetooth_utils.h"
23 #include "chrome/common/chrome_switches.h" 24 #include "chrome/common/chrome_switches.h"
24 #include "chromeos/dbus/bluetooth_adapter_client.h" 25 #include "chromeos/dbus/bluetooth_adapter_client.h"
25 #include "chromeos/dbus/bluetooth_agent_service_provider.h" 26 #include "chromeos/dbus/bluetooth_agent_service_provider.h"
26 #include "chromeos/dbus/bluetooth_device_client.h" 27 #include "chromeos/dbus/bluetooth_device_client.h"
27 #include "chromeos/dbus/bluetooth_input_client.h" 28 #include "chromeos/dbus/bluetooth_input_client.h"
28 #include "chromeos/dbus/bluetooth_out_of_band_client.h" 29 #include "chromeos/dbus/bluetooth_out_of_band_client.h"
29 #include "chromeos/dbus/dbus_thread_manager.h" 30 #include "chromeos/dbus/dbus_thread_manager.h"
30 #include "chromeos/dbus/introspectable_client.h" 31 #include "chromeos/dbus/introspectable_client.h"
31 #include "dbus/bus.h" 32 #include "dbus/bus.h"
32 #include "dbus/object_path.h" 33 #include "dbus/object_path.h"
(...skipping 153 matching lines...) Expand 10 before | Expand all | Expand 10 after
186 object_path_, 187 object_path_,
187 "", // empty pattern to browse all services 188 "", // empty pattern to browse all services
188 base::Bind(&BluetoothDevice::CollectServiceRecordsCallback, 189 base::Bind(&BluetoothDevice::CollectServiceRecordsCallback,
189 weak_ptr_factory_.GetWeakPtr(), 190 weak_ptr_factory_.GetWeakPtr(),
190 callback, 191 callback,
191 error_callback)); 192 error_callback));
192 } 193 }
193 194
194 bool BluetoothDevice::ProvidesServiceWithUUID(const std::string& uuid) const { 195 bool BluetoothDevice::ProvidesServiceWithUUID(const std::string& uuid) const {
195 const BluetoothDevice::ServiceList& services = GetServices(); 196 const BluetoothDevice::ServiceList& services = GetServices();
196 for (BluetoothDevice::ServiceList::const_iterator j = services.begin(); 197 for (BluetoothDevice::ServiceList::const_iterator iter = services.begin();
197 j != services.end(); ++j) { 198 iter != services.end(); ++iter) {
198 if (*j == uuid) 199 if (bluetooth_utils::CanonicalUuid(*iter) == uuid)
199 return true; 200 return true;
200 } 201 }
201 return false; 202 return false;
202 } 203 }
203 204
204 void BluetoothDevice::ProvidesServiceWithName(const std::string& name, 205 void BluetoothDevice::ProvidesServiceWithName(const std::string& name,
205 const ProvidesServiceCallback& callback) { 206 const ProvidesServiceCallback& callback) {
206 GetServiceRecords( 207 GetServiceRecords(
207 base::Bind(&BluetoothDevice::SearchServicesForNameCallback, 208 base::Bind(&BluetoothDevice::SearchServicesForNameCallback,
208 weak_ptr_factory_.GetWeakPtr(), 209 weak_ptr_factory_.GetWeakPtr(),
(...skipping 552 matching lines...) Expand 10 before | Expand all | Expand 10 after
761 pairing_delegate_->DismissDisplayOrConfirm(); 762 pairing_delegate_->DismissDisplayOrConfirm();
762 } 763 }
763 764
764 765
765 // static 766 // static
766 BluetoothDevice* BluetoothDevice::Create(BluetoothAdapter* adapter) { 767 BluetoothDevice* BluetoothDevice::Create(BluetoothAdapter* adapter) {
767 return new BluetoothDevice(adapter); 768 return new BluetoothDevice(adapter);
768 } 769 }
769 770
770 } // namespace chromeos 771 } // namespace chromeos
OLDNEW
« no previous file with comments | « chrome/browser/chromeos/bluetooth/bluetooth_device.h ('k') | chrome/browser/extensions/api/bluetooth/bluetooth_api.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698