| OLD | NEW |
| 1 // Copyright 2014 The Chromium Authors. All rights reserved. | 1 // Copyright 2014 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 #ifndef CONTENT_BROWSER_DEVICE_SENSORS_SENSOR_MANAGER_ANDROID_H_ | 5 #ifndef CONTENT_BROWSER_DEVICE_SENSORS_SENSOR_MANAGER_ANDROID_H_ |
| 6 #define CONTENT_BROWSER_DEVICE_SENSORS_SENSOR_MANAGER_ANDROID_H_ | 6 #define CONTENT_BROWSER_DEVICE_SENSORS_SENSOR_MANAGER_ANDROID_H_ |
| 7 | 7 |
| 8 #include "base/android/scoped_java_ref.h" | 8 #include "base/android/scoped_java_ref.h" |
| 9 #include "base/memory/scoped_ptr.h" | 9 #include "base/memory/scoped_ptr.h" |
| 10 #include "base/synchronization/lock.h" | 10 #include "base/synchronization/lock.h" |
| (...skipping 17 matching lines...) Expand all Loading... |
| 28 // memory buffer, which is read by the renderer processes. | 28 // memory buffer, which is read by the renderer processes. |
| 29 class CONTENT_EXPORT SensorManagerAndroid { | 29 class CONTENT_EXPORT SensorManagerAndroid { |
| 30 public: | 30 public: |
| 31 // Must be called at startup, before GetInstance(). | 31 // Must be called at startup, before GetInstance(). |
| 32 static bool Register(JNIEnv* env); | 32 static bool Register(JNIEnv* env); |
| 33 | 33 |
| 34 // Needs to be thread-safe, because accessed from different threads. | 34 // Needs to be thread-safe, because accessed from different threads. |
| 35 static SensorManagerAndroid* GetInstance(); | 35 static SensorManagerAndroid* GetInstance(); |
| 36 | 36 |
| 37 // Called from Java via JNI. | 37 // Called from Java via JNI. |
| 38 void GotLight(JNIEnv*, jobject, double value); | 38 void GotLight(JNIEnv*, |
| 39 void GotOrientation(JNIEnv*, jobject, | 39 const base::android::JavaParamRef<jobject>&, |
| 40 double alpha, double beta, double gamma); | 40 double value); |
| 41 void GotOrientationAbsolute(JNIEnv*, jobject, | 41 void GotOrientation(JNIEnv*, |
| 42 double alpha, double beta, double gamma); | 42 const base::android::JavaParamRef<jobject>&, |
| 43 void GotAcceleration(JNIEnv*, jobject, | 43 double alpha, |
| 44 double x, double y, double z); | 44 double beta, |
| 45 void GotAccelerationIncludingGravity(JNIEnv*, jobject, | 45 double gamma); |
| 46 double x, double y, double z); | 46 void GotOrientationAbsolute(JNIEnv*, |
| 47 void GotRotationRate(JNIEnv*, jobject, | 47 const base::android::JavaParamRef<jobject>&, |
| 48 double alpha, double beta, double gamma); | 48 double alpha, |
| 49 double beta, |
| 50 double gamma); |
| 51 void GotAcceleration(JNIEnv*, |
| 52 const base::android::JavaParamRef<jobject>&, |
| 53 double x, |
| 54 double y, |
| 55 double z); |
| 56 void GotAccelerationIncludingGravity( |
| 57 JNIEnv*, |
| 58 const base::android::JavaParamRef<jobject>&, |
| 59 double x, |
| 60 double y, |
| 61 double z); |
| 62 void GotRotationRate(JNIEnv*, |
| 63 const base::android::JavaParamRef<jobject>&, |
| 64 double alpha, |
| 65 double beta, |
| 66 double gamma); |
| 49 | 67 |
| 50 // Shared memory related methods. | 68 // Shared memory related methods. |
| 51 void StartFetchingDeviceLightData(DeviceLightHardwareBuffer* buffer); | 69 void StartFetchingDeviceLightData(DeviceLightHardwareBuffer* buffer); |
| 52 void StopFetchingDeviceLightData(); | 70 void StopFetchingDeviceLightData(); |
| 53 | 71 |
| 54 void StartFetchingDeviceMotionData(DeviceMotionHardwareBuffer* buffer); | 72 void StartFetchingDeviceMotionData(DeviceMotionHardwareBuffer* buffer); |
| 55 void StopFetchingDeviceMotionData(); | 73 void StopFetchingDeviceMotionData(); |
| 56 | 74 |
| 57 void StartFetchingDeviceOrientationData( | 75 void StartFetchingDeviceOrientationData( |
| 58 DeviceOrientationHardwareBuffer* buffer); | 76 DeviceOrientationHardwareBuffer* buffer); |
| (...skipping 82 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 141 base::Lock orientation_absolute_buffer_lock_; | 159 base::Lock orientation_absolute_buffer_lock_; |
| 142 | 160 |
| 143 bool is_shutdown_; | 161 bool is_shutdown_; |
| 144 | 162 |
| 145 DISALLOW_COPY_AND_ASSIGN(SensorManagerAndroid); | 163 DISALLOW_COPY_AND_ASSIGN(SensorManagerAndroid); |
| 146 }; | 164 }; |
| 147 | 165 |
| 148 } // namespace content | 166 } // namespace content |
| 149 | 167 |
| 150 #endif // CONTENT_BROWSER_DEVICE_SENSORS_SENSOR_MANAGER_ANDROID_H_ | 168 #endif // CONTENT_BROWSER_DEVICE_SENSORS_SENSOR_MANAGER_ANDROID_H_ |
| OLD | NEW |