OLD | NEW |
1 // Copyright 2015 The Chromium Authors. All rights reserved. | 1 // Copyright 2015 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 "device/test/test_device_client.h" | 5 #include "device/test/test_device_client.h" |
6 | 6 |
7 #include "device/hid/hid_service.h" | 7 // This file unconditionally includes these headers despite conditionally |
8 #include "device/usb/usb_service.h" | 8 // depending on the corresponding targets. The code below needs the destructors |
| 9 // of the classes defined even when the classes are never instantiated. |
| 10 // TODO: This should probably be done more explicitly to avoid ambiguity. |
| 11 #include "device/hid/hid_service.h" // nogncheck |
| 12 #include "device/usb/usb_service.h" // nogncheck |
9 | 13 |
10 namespace device { | 14 namespace device { |
11 | 15 |
12 TestDeviceClient::TestDeviceClient( | 16 TestDeviceClient::TestDeviceClient( |
13 scoped_refptr<base::SingleThreadTaskRunner> blocking_task_runner) | 17 scoped_refptr<base::SingleThreadTaskRunner> blocking_task_runner) |
14 : blocking_task_runner_(blocking_task_runner) {} | 18 : blocking_task_runner_(blocking_task_runner) {} |
15 | 19 |
16 TestDeviceClient::~TestDeviceClient() {} | 20 TestDeviceClient::~TestDeviceClient() {} |
17 | 21 |
18 HidService* TestDeviceClient::GetHidService() { | 22 HidService* TestDeviceClient::GetHidService() { |
19 #if !defined(OS_ANDROID) && !defined(OS_IOS) && \ | 23 #if !defined(OS_ANDROID) && !defined(OS_IOS) && \ |
20 !(defined(OS_LINUX) && !defined(USE_UDEV)) | 24 !(defined(OS_LINUX) && !defined(USE_UDEV)) |
21 if (!hid_service_) { | 25 if (!hid_service_) { |
22 hid_service_ = HidService::Create(blocking_task_runner_); | 26 hid_service_ = HidService::Create(blocking_task_runner_); |
23 } | 27 } |
24 #endif | 28 #endif |
25 return hid_service_.get(); | 29 return hid_service_.get(); |
26 } | 30 } |
27 | 31 |
28 UsbService* TestDeviceClient::GetUsbService() { | 32 UsbService* TestDeviceClient::GetUsbService() { |
29 #if !defined(OS_ANDROID) && !defined(OS_IOS) | 33 #if !defined(OS_ANDROID) && !defined(OS_IOS) |
30 if (!usb_service_) { | 34 if (!usb_service_) { |
31 usb_service_ = UsbService::Create(blocking_task_runner_); | 35 usb_service_ = UsbService::Create(blocking_task_runner_); |
32 } | 36 } |
33 #endif | 37 #endif |
34 return usb_service_.get(); | 38 return usb_service_.get(); |
35 } | 39 } |
36 | 40 |
37 } // namespace device | 41 } // namespace device |
OLD | NEW |