OLD | NEW |
1 // Copyright 2016 The Chromium Authors. All rights reserved. | 1 // Copyright 2016 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/generic_sensor/platform_sensor_provider.h" | 5 #include "device/generic_sensor/platform_sensor_provider.h" |
6 | 6 |
7 #if defined(OS_MACOSX) | 7 #if defined(OS_MACOSX) |
8 #include "device/generic_sensor/platform_sensor_provider_mac.h" | 8 #include "device/generic_sensor/platform_sensor_provider_mac.h" |
9 #elif defined(OS_ANDROID) | 9 #elif defined(OS_ANDROID) |
10 #include "device/generic_sensor/platform_sensor_provider_android.h" | 10 #include "device/generic_sensor/platform_sensor_provider_android.h" |
| 11 #elif defined(OS_LINUX) |
| 12 #include "device/generic_sensor/platform_sensor_provider_iio.h" |
11 #endif | 13 #endif |
12 | 14 |
13 namespace { | 15 namespace { |
14 | 16 |
15 static device::PlatformSensorProvider* g_provider_for_testing = nullptr; | 17 static device::PlatformSensorProvider* g_provider_for_testing = nullptr; |
16 | 18 |
17 } // namespace | 19 } // namespace |
18 | 20 |
19 namespace device { | 21 namespace device { |
20 | 22 |
21 // static | 23 // static |
22 void PlatformSensorProvider::SetProviderForTesting( | 24 void PlatformSensorProvider::SetProviderForTesting( |
23 PlatformSensorProvider* provider) { | 25 PlatformSensorProvider* provider) { |
24 g_provider_for_testing = provider; | 26 g_provider_for_testing = provider; |
25 } | 27 } |
26 | 28 |
27 // static | 29 // static |
28 PlatformSensorProvider* PlatformSensorProvider::GetInstance() { | 30 PlatformSensorProvider* PlatformSensorProvider::GetInstance() { |
29 if (g_provider_for_testing) | 31 if (g_provider_for_testing) |
30 return g_provider_for_testing; | 32 return g_provider_for_testing; |
31 #if defined(OS_MACOSX) | 33 #if defined(OS_MACOSX) |
32 return PlatformSensorProviderMac::GetInstance(); | 34 return PlatformSensorProviderMac::GetInstance(); |
33 #elif defined(OS_ANDROID) | 35 #elif defined(OS_ANDROID) |
34 return PlatformSensorProviderAndroid::GetInstance(); | 36 return PlatformSensorProviderAndroid::GetInstance(); |
| 37 #elif defined(OS_LINUX) |
| 38 return PlatformSensorProviderIio::GetInstance(); |
35 #else | 39 #else |
36 return nullptr; | 40 return nullptr; |
37 #endif | 41 #endif |
38 } | 42 } |
39 | 43 |
40 } // namespace device | 44 } // namespace device |
OLD | NEW |