| 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 21 matching lines...) Expand all Loading... |
| 32 BluetoothDispatcher* const kHasBeenDeleted = | 32 BluetoothDispatcher* const kHasBeenDeleted = |
| 33 reinterpret_cast<BluetoothDispatcher*>(0x1); | 33 reinterpret_cast<BluetoothDispatcher*>(0x1); |
| 34 | 34 |
| 35 int CurrentWorkerId() { | 35 int CurrentWorkerId() { |
| 36 return WorkerTaskRunner::Instance()->CurrentWorkerId(); | 36 return WorkerTaskRunner::Instance()->CurrentWorkerId(); |
| 37 } | 37 } |
| 38 | 38 |
| 39 WebBluetoothError::ErrorType WebBluetoothErrorFromBluetoothError( | 39 WebBluetoothError::ErrorType WebBluetoothErrorFromBluetoothError( |
| 40 BluetoothError error_type) { | 40 BluetoothError error_type) { |
| 41 switch (error_type) { | 41 switch (error_type) { |
| 42 case BluetoothError::NETWORK_ERROR: |
| 43 return WebBluetoothError::NetworkError; |
| 42 case BluetoothError::NOT_FOUND: | 44 case BluetoothError::NOT_FOUND: |
| 43 return WebBluetoothError::NotFoundError; | 45 return WebBluetoothError::NotFoundError; |
| 44 case BluetoothError::SECURITY: | 46 case BluetoothError::SECURITY: |
| 45 return WebBluetoothError::SecurityError; | 47 return WebBluetoothError::SecurityError; |
| 46 } | 48 } |
| 47 NOTIMPLEMENTED(); | 49 NOTIMPLEMENTED(); |
| 48 return WebBluetoothError::NotFoundError; | 50 return WebBluetoothError::NotFoundError; |
| 49 } | 51 } |
| 50 | 52 |
| 51 WebBluetoothDevice::VendorIDSource GetWebVendorIdSource( | 53 WebBluetoothDevice::VendorIDSource GetWebVendorIdSource( |
| (...skipping 120 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 172 int request_id, | 174 int request_id, |
| 173 BluetoothError error_type) { | 175 BluetoothError error_type) { |
| 174 DCHECK(pending_connect_requests_.Lookup(request_id)) << request_id; | 176 DCHECK(pending_connect_requests_.Lookup(request_id)) << request_id; |
| 175 pending_connect_requests_.Lookup(request_id) | 177 pending_connect_requests_.Lookup(request_id) |
| 176 ->onError(new WebBluetoothError( | 178 ->onError(new WebBluetoothError( |
| 177 WebBluetoothErrorFromBluetoothError(error_type), "")); | 179 WebBluetoothErrorFromBluetoothError(error_type), "")); |
| 178 pending_connect_requests_.Remove(request_id); | 180 pending_connect_requests_.Remove(request_id); |
| 179 } | 181 } |
| 180 | 182 |
| 181 } // namespace content | 183 } // namespace content |
| OLD | NEW |