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 "base/id_map.h" | 8 #include "base/id_map.h" |
9 #include "base/memory/ref_counted.h" | 9 #include "base/memory/ref_counted.h" |
10 #include "content/child/worker_task_runner.h" | 10 #include "content/child/worker_task_runner.h" |
| 11 #include "content/common/bluetooth/bluetooth_device.h" |
11 #include "content/common/bluetooth/bluetooth_error.h" | 12 #include "content/common/bluetooth/bluetooth_error.h" |
12 #include "third_party/WebKit/public/platform/WebBluetooth.h" | 13 #include "third_party/WebKit/public/platform/WebBluetooth.h" |
13 | 14 |
14 namespace base { | 15 namespace base { |
15 class MessageLoop; | 16 class MessageLoop; |
16 class TaskRunner; | 17 class TaskRunner; |
17 } | 18 } |
18 | 19 |
19 namespace IPC { | 20 namespace IPC { |
20 class Message; | 21 class Message; |
(...skipping 28 matching lines...) Expand all Loading... |
49 void requestDevice(blink::WebBluetoothRequestDeviceCallbacks* callbacks); | 50 void requestDevice(blink::WebBluetoothRequestDeviceCallbacks* callbacks); |
50 void SetBluetoothMockDataSetForTesting(const std::string& name); | 51 void SetBluetoothMockDataSetForTesting(const std::string& name); |
51 | 52 |
52 // WorkerTaskRunner::Observer implementation. | 53 // WorkerTaskRunner::Observer implementation. |
53 void OnWorkerRunLoopStopped() override; | 54 void OnWorkerRunLoopStopped() override; |
54 | 55 |
55 private: | 56 private: |
56 // IPC Handlers, see definitions in bluetooth_messages.h. | 57 // IPC Handlers, see definitions in bluetooth_messages.h. |
57 void OnRequestDeviceSuccess(int thread_id, | 58 void OnRequestDeviceSuccess(int thread_id, |
58 int request_id, | 59 int request_id, |
59 const std::string& device_instance_id); | 60 const BluetoothDevice& device); |
60 void OnRequestDeviceError(int thread_id, | 61 void OnRequestDeviceError(int thread_id, |
61 int request_id, | 62 int request_id, |
62 BluetoothError error_type); | 63 BluetoothError error_type); |
63 | 64 |
64 scoped_refptr<ThreadSafeSender> thread_safe_sender_; | 65 scoped_refptr<ThreadSafeSender> thread_safe_sender_; |
65 | 66 |
66 // Tracks requests sent to browser to match replies with callbacks. | 67 // Tracks requests sent to browser to match replies with callbacks. |
67 // Owns callback objects. | 68 // Owns callback objects. |
68 IDMap<blink::WebBluetoothRequestDeviceCallbacks, IDMapOwnPointer> | 69 IDMap<blink::WebBluetoothRequestDeviceCallbacks, IDMapOwnPointer> |
69 pending_requests_; | 70 pending_requests_; |
70 | 71 |
71 DISALLOW_COPY_AND_ASSIGN(BluetoothDispatcher); | 72 DISALLOW_COPY_AND_ASSIGN(BluetoothDispatcher); |
72 }; | 73 }; |
73 | 74 |
74 } // namespace content | 75 } // namespace content |
75 | 76 |
76 #endif // CONTENT_CHILD_BLUETOOTH_BLUETOOTH_DISPATCHER_H_ | 77 #endif // CONTENT_CHILD_BLUETOOTH_BLUETOOTH_DISPATCHER_H_ |
OLD | NEW |