platform_sensor_provider_android.h 2.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657
  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_ANDROID_H_
  5. #define SERVICES_DEVICE_GENERIC_SENSOR_PLATFORM_SENSOR_PROVIDER_ANDROID_H_
  6. #include "services/device/generic_sensor/platform_sensor_provider.h"
  7. #include "base/android/scoped_java_ref.h"
  8. namespace device {
  9. class PlatformSensorProviderAndroid : public PlatformSensorProvider {
  10. public:
  11. PlatformSensorProviderAndroid();
  12. PlatformSensorProviderAndroid(const PlatformSensorProviderAndroid&) = delete;
  13. PlatformSensorProviderAndroid& operator=(
  14. const PlatformSensorProviderAndroid&) = delete;
  15. ~PlatformSensorProviderAndroid() override;
  16. void SetSensorManagerToNullForTesting();
  17. protected:
  18. void CreateSensorInternal(mojom::SensorType type,
  19. SensorReadingSharedBuffer* reading_buffer,
  20. CreateSensorCallback callback) override;
  21. private:
  22. void CreateGravitySensor(JNIEnv* env,
  23. SensorReadingSharedBuffer* reading_buffer,
  24. CreateSensorCallback callback);
  25. void CreateLinearAccelerationSensor(JNIEnv* env,
  26. SensorReadingSharedBuffer* reading_buffer,
  27. CreateSensorCallback callback);
  28. void CreateAbsoluteOrientationEulerAnglesSensor(
  29. JNIEnv* env,
  30. SensorReadingSharedBuffer* reading_buffer,
  31. CreateSensorCallback callback);
  32. void CreateAbsoluteOrientationQuaternionSensor(
  33. JNIEnv* env,
  34. SensorReadingSharedBuffer* reading_buffer,
  35. CreateSensorCallback callback);
  36. void CreateRelativeOrientationEulerAnglesSensor(
  37. JNIEnv* env,
  38. SensorReadingSharedBuffer* reading_buffer,
  39. CreateSensorCallback callback);
  40. // Java object org.chromium.device.sensors.PlatformSensorProvider
  41. base::android::ScopedJavaGlobalRef<jobject> j_object_;
  42. };
  43. } // namespace device
  44. #endif // SERVICES_DEVICE_GENERIC_SENSOR_PLATFORM_SENSOR_PROVIDER_ANDROID_H_