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/extensions/api/bluetooth/bluetooth_api_utils.h" | 5 #include "chrome/browser/extensions/api/bluetooth/bluetooth_api_utils.h" |
6 | 6 |
7 #if defined(OS_CHROMEOS) | 7 #if defined(OS_CHROMEOS) |
8 | 8 |
9 #include "base/utf_string_conversions.h" | 9 #include "base/utf_string_conversions.h" |
10 #include "base/values.h" | 10 #include "base/values.h" |
11 #include "chrome/browser/chromeos/bluetooth/bluetooth_device.h" | |
12 #include "chrome/common/extensions/api/experimental_bluetooth.h" | 11 #include "chrome/common/extensions/api/experimental_bluetooth.h" |
| 12 #include "device/bluetooth/bluetooth_device.h" |
13 | 13 |
14 namespace extensions { | 14 namespace extensions { |
15 namespace api { | 15 namespace api { |
16 namespace experimental_bluetooth { | 16 namespace experimental_bluetooth { |
17 | 17 |
18 // Fill in a Device object from a chromeos::BluetoothDevice. | 18 // Fill in a Device object from a device_bluetooth::BluetoothDevice. |
19 void BluetoothDeviceToApiDevice( | 19 void BluetoothDeviceToApiDevice( |
20 const chromeos::BluetoothDevice& device, | 20 const device_bluetooth::BluetoothDevice& device, |
21 Device* out) { | 21 Device* out) { |
22 out->name = UTF16ToUTF8(device.GetName()); | 22 out->name = UTF16ToUTF8(device.GetName()); |
23 out->address = device.address(); | 23 out->address = device.address(); |
24 out->paired = device.IsPaired(); | 24 out->paired = device.IsPaired(); |
25 out->bonded = device.IsBonded(); | 25 out->bonded = device.IsBonded(); |
26 out->connected = device.IsConnected(); | 26 out->connected = device.IsConnected(); |
27 } | 27 } |
28 | 28 |
29 // The caller takes ownership of the returned pointer. | 29 // The caller takes ownership of the returned pointer. |
30 base::Value* BluetoothDeviceToValue(const chromeos::BluetoothDevice& device) { | 30 base::Value* BluetoothDeviceToValue( |
| 31 const device_bluetooth::BluetoothDevice& device) { |
31 extensions::api::experimental_bluetooth::Device api_device; | 32 extensions::api::experimental_bluetooth::Device api_device; |
32 BluetoothDeviceToApiDevice(device, &api_device); | 33 BluetoothDeviceToApiDevice(device, &api_device); |
33 return api_device.ToValue().release(); | 34 return api_device.ToValue().release(); |
34 } | 35 } |
35 | 36 |
36 } // namespace experimental_bluetooth | 37 } // namespace experimental_bluetooth |
37 } // namespace api | 38 } // namespace api |
38 } // namespace extensions | 39 } // namespace extensions |
39 | 40 |
40 #endif | 41 #endif |
OLD | NEW |