OLD | NEW |
1 // Copyright 2014 The Chromium Authors. All rights reserved. | 1 // Copyright 2014 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 "extensions/browser/api/bluetooth_socket/bluetooth_socket_api.h" | 5 #include "extensions/browser/api/bluetooth_socket/bluetooth_socket_api.h" |
6 | 6 |
7 #include <stdint.h> | 7 #include <stdint.h> |
8 | 8 |
9 #include "content/public/browser/browser_context.h" | 9 #include "content/public/browser/browser_context.h" |
10 #include "content/public/browser/browser_thread.h" | 10 #include "content/public/browser/browser_thread.h" |
11 #include "device/bluetooth/bluetooth_adapter.h" | 11 #include "device/bluetooth/bluetooth_adapter.h" |
12 #include "device/bluetooth/bluetooth_adapter_factory.h" | 12 #include "device/bluetooth/bluetooth_adapter_factory.h" |
13 #include "device/bluetooth/bluetooth_device.h" | 13 #include "device/bluetooth/bluetooth_device.h" |
14 #include "device/bluetooth/bluetooth_socket.h" | 14 #include "device/bluetooth/bluetooth_socket.h" |
15 #include "extensions/browser/api/bluetooth_socket/bluetooth_api_socket.h" | 15 #include "extensions/browser/api/bluetooth_socket/bluetooth_api_socket.h" |
16 #include "extensions/browser/api/bluetooth_socket/bluetooth_socket_event_dispatc
her.h" | 16 #include "extensions/browser/api/bluetooth_socket/bluetooth_socket_event_dispatc
her.h" |
17 #include "extensions/common/api/bluetooth/bluetooth_manifest_data.h" | 17 #include "extensions/common/api/bluetooth/bluetooth_manifest_data.h" |
18 #include "extensions/common/permissions/permissions_data.h" | 18 #include "extensions/common/permissions/permissions_data.h" |
19 #include "net/base/io_buffer.h" | 19 #include "net/base/io_buffer.h" |
20 | 20 |
21 using content::BrowserThread; | 21 using content::BrowserThread; |
22 using extensions::BluetoothApiSocket; | 22 using extensions::BluetoothApiSocket; |
23 using extensions::core_api::bluetooth_socket::ListenOptions; | 23 using extensions::api::bluetooth_socket::ListenOptions; |
24 using extensions::core_api::bluetooth_socket::SocketInfo; | 24 using extensions::api::bluetooth_socket::SocketInfo; |
25 using extensions::core_api::bluetooth_socket::SocketProperties; | 25 using extensions::api::bluetooth_socket::SocketProperties; |
26 | 26 |
27 namespace extensions { | 27 namespace extensions { |
28 namespace core_api { | 28 namespace api { |
29 | 29 |
30 namespace { | 30 namespace { |
31 | 31 |
32 const char kDeviceNotFoundError[] = "Device not found"; | 32 const char kDeviceNotFoundError[] = "Device not found"; |
33 const char kInvalidPsmError[] = "Invalid PSM"; | 33 const char kInvalidPsmError[] = "Invalid PSM"; |
34 const char kInvalidUuidError[] = "Invalid UUID"; | 34 const char kInvalidUuidError[] = "Invalid UUID"; |
35 const char kPermissionDeniedError[] = "Permission denied"; | 35 const char kPermissionDeniedError[] = "Permission denied"; |
36 const char kSocketNotFoundError[] = "Socket not found"; | 36 const char kSocketNotFoundError[] = "Socket not found"; |
37 | 37 |
38 linked_ptr<SocketInfo> CreateSocketInfo(int socket_id, | 38 linked_ptr<SocketInfo> CreateSocketInfo(int socket_id, |
(...skipping 628 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
667 int socket_id = *it; | 667 int socket_id = *it; |
668 BluetoothApiSocket* socket = GetSocket(socket_id); | 668 BluetoothApiSocket* socket = GetSocket(socket_id); |
669 if (socket) { | 669 if (socket) { |
670 socket_infos.push_back(CreateSocketInfo(socket_id, socket)); | 670 socket_infos.push_back(CreateSocketInfo(socket_id, socket)); |
671 } | 671 } |
672 } | 672 } |
673 } | 673 } |
674 results_ = bluetooth_socket::GetSockets::Results::Create(socket_infos); | 674 results_ = bluetooth_socket::GetSockets::Results::Create(socket_infos); |
675 } | 675 } |
676 | 676 |
677 } // namespace core_api | 677 } // namespace api |
678 } // namespace extensions | 678 } // namespace extensions |
OLD | NEW |