| Index: content/renderer/device_sensors/device_orientation_util.h
|
| diff --git a/content/renderer/device_sensors/device_orientation_util.h b/content/renderer/device_sensors/device_orientation_util.h
|
| new file mode 100644
|
| index 0000000000000000000000000000000000000000..ca08af3508a48f3020e25cfb25a86c2f59cb88ed
|
| --- /dev/null
|
| +++ b/content/renderer/device_sensors/device_orientation_util.h
|
| @@ -0,0 +1,52 @@
|
| +// Copyright 2017 The Chromium Authors. All rights reserved.
|
| +// Use of this source code is governed by a BSD-style license that can be
|
| +// found in the LICENSE file.
|
| +
|
| +#ifndef CONTENT_RENDERER_DEVICE_SENSORS_DEVICE_ORIENTATION_UTIL_H_
|
| +#define CONTENT_RENDERER_DEVICE_SENSORS_DEVICE_ORIENTATION_UTIL_H_
|
| +
|
| +#include "content/common/content_export.h"
|
| +#include "device/generic_sensor/public/cpp/sensor_reading.h"
|
| +#include "device/generic_sensor/public/interfaces/sensor.mojom.h"
|
| +
|
| +namespace blink {
|
| +class WebDeviceOrientationData;
|
| +}
|
| +
|
| +namespace content {
|
| +
|
| +// Angle threshold beyond which two orientation events are considered
|
| +// sufficiently different.
|
| +constexpr double kOrientationThreshold = 0.1;
|
| +
|
| +constexpr uint64_t kReadingBufferSize =
|
| + sizeof(device::SensorReadingSharedBuffer);
|
| +
|
| +constexpr uint64_t kSharedBufferSizeInBytes =
|
| + kReadingBufferSize * static_cast<uint64_t>(device::mojom::SensorType::LAST);
|
| +
|
| +bool IsSignificantlyDifferent(const blink::WebDeviceOrientationData& data1,
|
| + const blink::WebDeviceOrientationData& data2);
|
| +
|
| +void CONTENT_EXPORT ComputeDeviceOrientationFromQuaternion(double x,
|
| + double y,
|
| + double z,
|
| + double w,
|
| + double* alpha,
|
| + double* beta,
|
| + double* gamma);
|
| +
|
| +bool CONTENT_EXPORT
|
| +ComputeDeviceOrientationFromGravityAndGeomagnetic(double gravity_x,
|
| + double gravity_y,
|
| + double gravity_z,
|
| + double geomagnetic_x,
|
| + double geomagnetic_y,
|
| + double geomagnetic_z,
|
| + double* alpha,
|
| + double* beta,
|
| + double* gamma);
|
| +
|
| +} // namespace content
|
| +
|
| +#endif // CONTENT_RENDERER_DEVICE_SENSORS_DEVICE_ORIENTATION_UTIL_H_
|
|
|