| 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 #include "base/utf_string_conversions.h" | 7 #include "base/utf_string_conversions.h" |
| 8 #include "base/values.h" | 8 #include "base/values.h" |
| 9 #include "chrome/common/extensions/api/bluetooth.h" | 9 #include "chrome/common/extensions/api/bluetooth.h" |
| 10 #include "device/bluetooth/bluetooth_adapter.h" | 10 #include "device/bluetooth/bluetooth_adapter.h" |
| 11 #include "device/bluetooth/bluetooth_device.h" | 11 #include "device/bluetooth/bluetooth_device.h" |
| 12 | 12 |
| 13 namespace extensions { | 13 namespace extensions { |
| 14 namespace api { | 14 namespace api { |
| 15 namespace bluetooth { | 15 namespace bluetooth { |
| 16 | 16 |
| 17 void BluetoothDeviceToApiDevice(const device::BluetoothDevice& device, | 17 void BluetoothDeviceToApiDevice(const device::BluetoothDevice& device, |
| 18 Device* out) { | 18 Device* out) { |
| 19 out->name = UTF16ToUTF8(device.GetName()); | 19 out->name = UTF16ToUTF8(device.GetName()); |
| 20 out->address = device.address(); | 20 out->address = device.GetAddress(); |
| 21 out->paired = device.IsPaired(); | 21 out->paired = device.IsPaired(); |
| 22 out->bonded = device.IsBonded(); | |
| 23 out->connected = device.IsConnected(); | 22 out->connected = device.IsConnected(); |
| 24 } | 23 } |
| 25 | 24 |
| 26 void PopulateAdapterState(const device::BluetoothAdapter& adapter, | 25 void PopulateAdapterState(const device::BluetoothAdapter& adapter, |
| 27 AdapterState* out) { | 26 AdapterState* out) { |
| 28 out->discovering = adapter.IsDiscovering(); | 27 out->discovering = adapter.IsDiscovering(); |
| 29 out->available = adapter.IsPresent(); | 28 out->available = adapter.IsPresent(); |
| 30 out->powered = adapter.IsPowered(); | 29 out->powered = adapter.IsPowered(); |
| 31 out->name = adapter.name(); | 30 out->name = adapter.GetName(); |
| 32 out->address = adapter.address(); | 31 out->address = adapter.GetAddress(); |
| 33 } | 32 } |
| 34 | 33 |
| 35 } // namespace bluetooth | 34 } // namespace bluetooth |
| 36 } // namespace api | 35 } // namespace api |
| 37 } // namespace extensions | 36 } // namespace extensions |
| OLD | NEW |