platform_sensor_provider.h 1.3 KB

1234567891011121314151617181920212223242526272829303132333435363738
  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. #ifndef SERVICES_DEVICE_GENERIC_SENSOR_PLATFORM_SENSOR_PROVIDER_H_
  5. #define SERVICES_DEVICE_GENERIC_SENSOR_PLATFORM_SENSOR_PROVIDER_H_
  6. #include <memory>
  7. #include "services/device/generic_sensor/platform_sensor_provider_base.h"
  8. namespace device {
  9. // This the base class for platform-specific sensor provider implementations.
  10. // In typical usage a single instance is owned by DeviceService.
  11. class PlatformSensorProvider : public PlatformSensorProviderBase {
  12. public:
  13. // Returns a PlatformSensorProvider for the current platform.
  14. // Note: returns 'nullptr' if there is no available implementation for
  15. // the current platform.
  16. static std::unique_ptr<PlatformSensorProvider> Create();
  17. PlatformSensorProvider(const PlatformSensorProvider&) = delete;
  18. PlatformSensorProvider& operator=(const PlatformSensorProvider&) = delete;
  19. ~PlatformSensorProvider() override = default;
  20. protected:
  21. PlatformSensorProvider() = default;
  22. // Determines if the ISensor or Windows.Devices.Sensors implementation
  23. // should be used on Windows.
  24. static bool UseWindowsWinrt();
  25. };
  26. } // namespace device
  27. #endif // SERVICES_DEVICE_GENERIC_SENSOR_PLATFORM_SENSOR_PROVIDER_H_