| 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 | |
| 128 void BluetoothDispatcher::OnWorkerRunLoopStopped() { | 123 void BluetoothDispatcher::OnWorkerRunLoopStopped() { |
| 129 delete this; | 124 delete this; |
| 130 } | 125 } |
| 131 | 126 |
| 132 void BluetoothDispatcher::OnRequestDeviceSuccess( | 127 void BluetoothDispatcher::OnRequestDeviceSuccess( |
| 133 int thread_id, | 128 int thread_id, |
| 134 int request_id, | 129 int request_id, |
| 135 const BluetoothDevice& device) { | 130 const BluetoothDevice& device) { |
| 136 DCHECK(pending_requests_.Lookup(request_id)) << request_id; | 131 DCHECK(pending_requests_.Lookup(request_id)) << request_id; |
| 137 | 132 |
| (...skipping 25 matching lines...) Expand all Loading... |
| 163 int request_id, | 158 int request_id, |
| 164 BluetoothError error_type) { | 159 BluetoothError error_type) { |
| 165 DCHECK(pending_requests_.Lookup(request_id)) << request_id; | 160 DCHECK(pending_requests_.Lookup(request_id)) << request_id; |
| 166 pending_requests_.Lookup(request_id) | 161 pending_requests_.Lookup(request_id) |
| 167 ->onError(new WebBluetoothError( | 162 ->onError(new WebBluetoothError( |
| 168 WebBluetoothErrorFromBluetoothError(error_type), "")); | 163 WebBluetoothErrorFromBluetoothError(error_type), "")); |
| 169 pending_requests_.Remove(request_id); | 164 pending_requests_.Remove(request_id); |
| 170 } | 165 } |
| 171 | 166 |
| 172 } // namespace content | 167 } // namespace content |
| OLD | NEW |