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 494 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
505 callback.Run(socket); | 505 callback.Run(socket); |
506 return; | 506 return; |
507 } | 507 } |
508 } | 508 } |
509 } | 509 } |
510 callback.Run(NULL); | 510 callback.Run(NULL); |
511 } | 511 } |
512 | 512 |
513 void BluetoothDevice::ConnectToService(const std::string& service_uuid, | 513 void BluetoothDevice::ConnectToService(const std::string& service_uuid, |
514 SocketCallback callback) { | 514 SocketCallback callback) { |
515 // quick sanity check | |
516 if (!ProvidesServiceWithUUID(service_uuid)) { | |
517 callback.Run(NULL); | |
518 return; | |
519 } | |
520 | |
521 DBusThreadManager::Get()->GetBluetoothDeviceClient()-> | 515 DBusThreadManager::Get()->GetBluetoothDeviceClient()-> |
522 DiscoverServices( | 516 DiscoverServices( |
523 object_path_, | 517 object_path_, |
524 service_uuid, | 518 service_uuid, |
525 base::Bind(&BluetoothDevice::ConnectToMatchingService, | 519 base::Bind(&BluetoothDevice::ConnectToMatchingService, |
526 weak_ptr_factory_.GetWeakPtr(), | 520 weak_ptr_factory_.GetWeakPtr(), |
527 service_uuid, | 521 service_uuid, |
528 callback)); | 522 callback)); |
529 } | 523 } |
530 | 524 |
(...skipping 128 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
659 // static | 653 // static |
660 BluetoothDevice* BluetoothDevice::CreateUnbound( | 654 BluetoothDevice* BluetoothDevice::CreateUnbound( |
661 BluetoothAdapter* adapter, | 655 BluetoothAdapter* adapter, |
662 const BluetoothDeviceClient::Properties* properties) { | 656 const BluetoothDeviceClient::Properties* properties) { |
663 BluetoothDevice* device = new BluetoothDevice(adapter); | 657 BluetoothDevice* device = new BluetoothDevice(adapter); |
664 device->Update(properties, false); | 658 device->Update(properties, false); |
665 return device; | 659 return device; |
666 } | 660 } |
667 | 661 |
668 } // namespace chromeos | 662 } // namespace chromeos |
OLD | NEW |