OLD | NEW |
(Empty) | |
| 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 |
| 3 // found in the LICENSE file. |
| 4 |
| 5 #include "device/generic_sensor/platform_sensor_provider.h" |
| 6 |
| 7 #if defined(OS_MACOSX) |
| 8 #include "device/generic_sensor/platform_sensor_provider_mac.h" |
| 9 #elif defined(OS_ANDROID) |
| 10 #include "device/generic_sensor/platform_sensor_provider_android.h" |
| 11 #endif |
| 12 |
| 13 namespace { |
| 14 |
| 15 static device::PlatformSensorProvider* g_provider_for_testing = nullptr; |
| 16 } |
| 17 |
| 18 namespace device { |
| 19 |
| 20 // static |
| 21 void PlatformSensorProvider::SetProviderForTesting( |
| 22 PlatformSensorProvider* provider) { |
| 23 g_provider_for_testing = provider; |
| 24 } |
| 25 |
| 26 // static |
| 27 PlatformSensorProvider* PlatformSensorProvider::GetInstance() { |
| 28 if (g_provider_for_testing) |
| 29 return g_provider_for_testing; |
| 30 #if defined(OS_MACOSX) |
| 31 return PlatformSensorProviderMac::GetInstance(); |
| 32 #elif defined(OS_ANDROID) |
| 33 return PlatformSensorProviderAndroid::GetInstance(); |
| 34 #else |
| 35 return nullptr; |
| 36 #endif |
| 37 } |
| 38 |
| 39 } // namespace device |
OLD | NEW |