| 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 #ifndef CONTENT_CHILD_BLUETOOTH_BLUETOOTH_DISPATCHER_H_ | 5 #ifndef CONTENT_CHILD_BLUETOOTH_BLUETOOTH_DISPATCHER_H_ |
| 6 #define CONTENT_CHILD_BLUETOOTH_BLUETOOTH_DISPATCHER_H_ | 6 #define CONTENT_CHILD_BLUETOOTH_BLUETOOTH_DISPATCHER_H_ |
| 7 | 7 |
| 8 #include <stdint.h> | 8 #include <stdint.h> |
| 9 | 9 |
| 10 #include <map> | 10 #include <map> |
| (...skipping 38 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 49 ThreadSafeSender* thread_safe_sender); | 49 ThreadSafeSender* thread_safe_sender); |
| 50 | 50 |
| 51 // IPC Send and Receiving interface, see IPC::Sender and IPC::Listener. | 51 // IPC Send and Receiving interface, see IPC::Sender and IPC::Listener. |
| 52 bool Send(IPC::Message* msg); | 52 bool Send(IPC::Message* msg); |
| 53 void OnMessageReceived(const IPC::Message& msg); | 53 void OnMessageReceived(const IPC::Message& msg); |
| 54 | 54 |
| 55 // Corresponding to WebBluetoothImpl methods. | 55 // Corresponding to WebBluetoothImpl methods. |
| 56 void requestDevice(int frame_routing_id, | 56 void requestDevice(int frame_routing_id, |
| 57 const blink::WebRequestDeviceOptions& options, | 57 const blink::WebRequestDeviceOptions& options, |
| 58 blink::WebBluetoothRequestDeviceCallbacks* callbacks); | 58 blink::WebBluetoothRequestDeviceCallbacks* callbacks); |
| 59 void connect(int frame_routing_id, | |
| 60 const blink::WebString& device_id, | |
| 61 blink::WebBluetoothRemoteGATTServerConnectCallbacks* callbacks); | |
| 62 void disconnect(int frame_routing_id, const blink::WebString& device_id); | |
| 63 | 59 |
| 64 // WorkerThread::Observer implementation. | 60 // WorkerThread::Observer implementation. |
| 65 void WillStopCurrentWorkerThread() override; | 61 void WillStopCurrentWorkerThread() override; |
| 66 | 62 |
| 67 private: | 63 private: |
| 68 // IPC Handlers, see definitions in bluetooth_messages.h. | 64 // IPC Handlers, see definitions in bluetooth_messages.h. |
| 69 void OnRequestDeviceSuccess(int thread_id, | 65 void OnRequestDeviceSuccess(int thread_id, |
| 70 int request_id, | 66 int request_id, |
| 71 const BluetoothDevice& device); | 67 const BluetoothDevice& device); |
| 72 void OnRequestDeviceError(int thread_id, | 68 void OnRequestDeviceError(int thread_id, |
| 73 int request_id, | 69 int request_id, |
| 74 blink::WebBluetoothError error); | 70 blink::WebBluetoothError error); |
| 75 void OnGATTServerConnectSuccess(int thread_id, int request_id); | |
| 76 void OnGATTServerConnectError(int thread_id, | |
| 77 int request_id, | |
| 78 blink::WebBluetoothError error); | |
| 79 | 71 |
| 80 scoped_refptr<ThreadSafeSender> thread_safe_sender_; | 72 scoped_refptr<ThreadSafeSender> thread_safe_sender_; |
| 81 | 73 |
| 82 // Tracks device requests sent to browser to match replies with callbacks. | 74 // Tracks device requests sent to browser to match replies with callbacks. |
| 83 // Owns callback objects. | 75 // Owns callback objects. |
| 84 IDMap<blink::WebBluetoothRequestDeviceCallbacks, IDMapOwnPointer> | 76 IDMap<blink::WebBluetoothRequestDeviceCallbacks, IDMapOwnPointer> |
| 85 pending_requests_; | 77 pending_requests_; |
| 86 // Tracks requests to connect to a device. | |
| 87 // Owns callback objects. | |
| 88 IDMap<blink::WebBluetoothRemoteGATTServerConnectCallbacks, IDMapOwnPointer> | |
| 89 pending_connect_requests_; | |
| 90 | 78 |
| 91 DISALLOW_COPY_AND_ASSIGN(BluetoothDispatcher); | 79 DISALLOW_COPY_AND_ASSIGN(BluetoothDispatcher); |
| 92 }; | 80 }; |
| 93 | 81 |
| 94 } // namespace content | 82 } // namespace content |
| 95 | 83 |
| 96 #endif // CONTENT_CHILD_BLUETOOTH_BLUETOOTH_DISPATCHER_H_ | 84 #endif // CONTENT_CHILD_BLUETOOTH_BLUETOOTH_DISPATCHER_H_ |
| OLD | NEW |