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 |
11 #include "base/bind.h" | 11 #include "base/bind.h" |
12 #include "base/logging.h" | 12 #include "base/logging.h" |
13 #include "base/memory/weak_ptr.h" | 13 #include "base/memory/weak_ptr.h" |
14 #include "base/string16.h" | 14 #include "base/string16.h" |
15 #include "base/string_util.h" | 15 #include "base/string_util.h" |
16 #include "base/utf_string_conversions.h" | 16 #include "base/utf_string_conversions.h" |
17 #include "base/values.h" | 17 #include "base/values.h" |
18 #include "chrome/browser/chromeos/bluetooth/bluetooth_adapter.h" | 18 #include "chrome/browser/chromeos/bluetooth/bluetooth_adapter.h" |
19 #include "chrome/browser/chromeos/bluetooth/bluetooth_service_record.h" | 19 #include "chrome/browser/chromeos/bluetooth/bluetooth_service_record.h" |
20 #include "chrome/browser/chromeos/bluetooth/bluetooth_socket.h" | 20 #include "chrome/browser/chromeos/bluetooth/bluetooth_socket.h" |
21 #include "chrome/browser/chromeos/dbus/introspect_util.h" | |
22 #include "chromeos/dbus/bluetooth_adapter_client.h" | 21 #include "chromeos/dbus/bluetooth_adapter_client.h" |
23 #include "chromeos/dbus/bluetooth_agent_service_provider.h" | 22 #include "chromeos/dbus/bluetooth_agent_service_provider.h" |
24 #include "chromeos/dbus/bluetooth_device_client.h" | 23 #include "chromeos/dbus/bluetooth_device_client.h" |
25 #include "chromeos/dbus/bluetooth_input_client.h" | 24 #include "chromeos/dbus/bluetooth_input_client.h" |
26 #include "chromeos/dbus/dbus_thread_manager.h" | 25 #include "chromeos/dbus/dbus_thread_manager.h" |
27 #include "chromeos/dbus/introspectable_client.h" | 26 #include "chromeos/dbus/introspectable_client.h" |
28 #include "dbus/bus.h" | 27 #include "dbus/bus.h" |
29 #include "dbus/object_path.h" | 28 #include "dbus/object_path.h" |
30 #include "grit/generated_resources.h" | 29 #include "grit/generated_resources.h" |
31 #include "third_party/cros_system_api/dbus/service_constants.h" | 30 #include "third_party/cros_system_api/dbus/service_constants.h" |
(...skipping 315 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
347 LOG(WARNING) << "Failed to determine supported applications: " << address_; | 346 LOG(WARNING) << "Failed to determine supported applications: " << address_; |
348 error_callback.Run(); | 347 error_callback.Run(); |
349 return; | 348 return; |
350 } | 349 } |
351 | 350 |
352 // The introspection data for the device object may list one or more | 351 // The introspection data for the device object may list one or more |
353 // additional D-Bus interfaces that BlueZ supports for this particular | 352 // additional D-Bus interfaces that BlueZ supports for this particular |
354 // device. Send appropraite Connect calls for each of those interfaces | 353 // device. Send appropraite Connect calls for each of those interfaces |
355 // to connect all of the application protocols for this device. | 354 // to connect all of the application protocols for this device. |
356 std::vector<std::string> interfaces = | 355 std::vector<std::string> interfaces = |
357 GetInterfacesFromIntrospectResult(xml_data); | 356 IntrospectableClient::GetInterfacesFromIntrospectResult(xml_data); |
358 | 357 |
359 for (std::vector<std::string>::iterator iter = interfaces.begin(); | 358 for (std::vector<std::string>::iterator iter = interfaces.begin(); |
360 iter != interfaces.end(); ++iter) { | 359 iter != interfaces.end(); ++iter) { |
361 if (*iter == bluetooth_input::kBluetoothInputInterface) { | 360 if (*iter == bluetooth_input::kBluetoothInputInterface) { |
362 // Supports Input interface. | 361 // Supports Input interface. |
363 DBusThreadManager::Get()->GetBluetoothInputClient()-> | 362 DBusThreadManager::Get()->GetBluetoothInputClient()-> |
364 Connect(object_path_, | 363 Connect(object_path_, |
365 base::Bind(&BluetoothDevice::OnConnect, | 364 base::Bind(&BluetoothDevice::OnConnect, |
366 weak_ptr_factory_.GetWeakPtr(), | 365 weak_ptr_factory_.GetWeakPtr(), |
367 error_callback, *iter)); | 366 error_callback, *iter)); |
(...skipping 276 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
644 // static | 643 // static |
645 BluetoothDevice* BluetoothDevice::CreateUnbound( | 644 BluetoothDevice* BluetoothDevice::CreateUnbound( |
646 BluetoothAdapter* adapter, | 645 BluetoothAdapter* adapter, |
647 const BluetoothDeviceClient::Properties* properties) { | 646 const BluetoothDeviceClient::Properties* properties) { |
648 BluetoothDevice* device = new BluetoothDevice(adapter); | 647 BluetoothDevice* device = new BluetoothDevice(adapter); |
649 device->Update(properties, false); | 648 device->Update(properties, false); |
650 return device; | 649 return device; |
651 } | 650 } |
652 | 651 |
653 } // namespace chromeos | 652 } // namespace chromeos |
OLD | NEW |