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 "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 |
(...skipping 624 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
635 | 635 |
636 void BluetoothDevice::GetServiceRecordsForConnectErrorCallback( | 636 void BluetoothDevice::GetServiceRecordsForConnectErrorCallback( |
637 const SocketCallback& callback) { | 637 const SocketCallback& callback) { |
638 callback.Run(NULL); | 638 callback.Run(NULL); |
639 } | 639 } |
640 | 640 |
641 void BluetoothDevice::GetServiceRecordsForConnectCallback( | 641 void BluetoothDevice::GetServiceRecordsForConnectCallback( |
642 const std::string& service_uuid, | 642 const std::string& service_uuid, |
643 const SocketCallback& callback, | 643 const SocketCallback& callback, |
644 const ServiceRecordList& list) { | 644 const ServiceRecordList& list) { |
645 // If multiple service records are found, use the first one that works. | |
646 for (ServiceRecordList::const_iterator i = list.begin(); | 645 for (ServiceRecordList::const_iterator i = list.begin(); |
647 i != list.end(); ++i) { | 646 i != list.end(); ++i) { |
648 scoped_refptr<BluetoothSocket> socket( | 647 if ((*i)->uuid() == service_uuid) { |
649 BluetoothSocket::CreateBluetoothSocket(**i)); | 648 // If multiple service records are found, use the first one that works. |
650 if (socket.get() != NULL) { | 649 scoped_refptr<BluetoothSocket> socket( |
651 callback.Run(socket); | 650 BluetoothSocket::CreateBluetoothSocket(**i)); |
652 return; | 651 if (socket.get() != NULL) { |
| 652 callback.Run(socket); |
| 653 return; |
| 654 } |
653 } | 655 } |
654 } | 656 } |
655 callback.Run(NULL); | 657 callback.Run(NULL); |
656 } | 658 } |
657 | 659 |
658 void BluetoothDevice::OnRemoteDataCallback(const base::Closure& callback, | 660 void BluetoothDevice::OnRemoteDataCallback(const base::Closure& callback, |
659 const ErrorCallback& error_callback, | 661 const ErrorCallback& error_callback, |
660 bool success) { | 662 bool success) { |
661 if (success) | 663 if (success) |
662 callback.Run(); | 664 callback.Run(); |
(...skipping 103 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
766 pairing_delegate_->DismissDisplayOrConfirm(); | 768 pairing_delegate_->DismissDisplayOrConfirm(); |
767 } | 769 } |
768 | 770 |
769 | 771 |
770 // static | 772 // static |
771 BluetoothDevice* BluetoothDevice::Create(BluetoothAdapter* adapter) { | 773 BluetoothDevice* BluetoothDevice::Create(BluetoothAdapter* adapter) { |
772 return new BluetoothDevice(adapter); | 774 return new BluetoothDevice(adapter); |
773 } | 775 } |
774 | 776 |
775 } // namespace chromeos | 777 } // namespace chromeos |
OLD | NEW |