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 "content/child/bluetooth/bluetooth_dispatcher.h" | 5 #include "content/child/bluetooth/bluetooth_dispatcher.h" |
6 | 6 |
7 #include "base/lazy_instance.h" | 7 #include "base/lazy_instance.h" |
8 #include "base/memory/scoped_ptr.h" | 8 #include "base/memory/scoped_ptr.h" |
9 #include "base/message_loop/message_loop.h" | 9 #include "base/message_loop/message_loop.h" |
10 #include "base/thread_task_runner_handle.h" | 10 #include "base/thread_task_runner_handle.h" |
(...skipping 102 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
113 } | 113 } |
114 | 114 |
115 void BluetoothDispatcher::connectGATT( | 115 void BluetoothDispatcher::connectGATT( |
116 const blink::WebString& device_instance_id, | 116 const blink::WebString& device_instance_id, |
117 blink::WebBluetoothConnectGATTCallbacks* callbacks) { | 117 blink::WebBluetoothConnectGATTCallbacks* callbacks) { |
118 int request_id = pending_connect_requests_.Add(callbacks); | 118 int request_id = pending_connect_requests_.Add(callbacks); |
119 Send(new BluetoothHostMsg_ConnectGATT(CurrentWorkerId(), request_id, | 119 Send(new BluetoothHostMsg_ConnectGATT(CurrentWorkerId(), request_id, |
120 device_instance_id.utf8())); | 120 device_instance_id.utf8())); |
121 } | 121 } |
122 | 122 |
| 123 void BluetoothDispatcher::SetBluetoothMockDataSetForTesting( |
| 124 const std::string& name) { |
| 125 Send(new BluetoothHostMsg_SetBluetoothMockDataSetForTesting(name)); |
| 126 } |
| 127 |
123 void BluetoothDispatcher::OnWorkerRunLoopStopped() { | 128 void BluetoothDispatcher::OnWorkerRunLoopStopped() { |
124 delete this; | 129 delete this; |
125 } | 130 } |
126 | 131 |
127 void BluetoothDispatcher::OnRequestDeviceSuccess( | 132 void BluetoothDispatcher::OnRequestDeviceSuccess( |
128 int thread_id, | 133 int thread_id, |
129 int request_id, | 134 int request_id, |
130 const BluetoothDevice& device) { | 135 const BluetoothDevice& device) { |
131 DCHECK(pending_requests_.Lookup(request_id)) << request_id; | 136 DCHECK(pending_requests_.Lookup(request_id)) << request_id; |
132 | 137 |
(...skipping 25 matching lines...) Expand all Loading... |
158 int request_id, | 163 int request_id, |
159 BluetoothError error_type) { | 164 BluetoothError error_type) { |
160 DCHECK(pending_requests_.Lookup(request_id)) << request_id; | 165 DCHECK(pending_requests_.Lookup(request_id)) << request_id; |
161 pending_requests_.Lookup(request_id) | 166 pending_requests_.Lookup(request_id) |
162 ->onError(new WebBluetoothError( | 167 ->onError(new WebBluetoothError( |
163 WebBluetoothErrorFromBluetoothError(error_type), "")); | 168 WebBluetoothErrorFromBluetoothError(error_type), "")); |
164 pending_requests_.Remove(request_id); | 169 pending_requests_.Remove(request_id); |
165 } | 170 } |
166 | 171 |
167 } // namespace content | 172 } // namespace content |
OLD | NEW |