| Index: content/browser/device_sensors/sensor_manager_chromeos.h
|
| diff --git a/content/browser/device_sensors/sensor_manager_chromeos.h b/content/browser/device_sensors/sensor_manager_chromeos.h
|
| new file mode 100644
|
| index 0000000000000000000000000000000000000000..36e27819bcc9d89eba7fdad21caf0005d7d6fc7f
|
| --- /dev/null
|
| +++ b/content/browser/device_sensors/sensor_manager_chromeos.h
|
| @@ -0,0 +1,66 @@
|
| +// Copyright 2014 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_BROWSER_DEVICE_SENSORS_SENSOR_MANAGER_CHROMEOS_H_
|
| +#define CONTENT_BROWSER_DEVICE_SENSORS_SENSOR_MANAGER_CHROMEOS_H_
|
| +
|
| +#include "base/macros.h"
|
| +#include "base/memory/ref_counted.h"
|
| +#include "base/synchronization/lock.h"
|
| +#include "content/common/content_export.h"
|
| +#include "content/common/device_sensors/device_orientation_hardware_buffer.h"
|
| +
|
| +template <typename T>
|
| +struct DefaultSingletonTraits;
|
| +
|
| +namespace content {
|
| +
|
| +class SensorManagerChromeOSTest;
|
| +
|
| +// Notifies Chrome OS sensors to start and stop observing accelerometer sensors.
|
| +// Provides a callback, which interprets accelerometer data for
|
| +// Device Orientation events.
|
| +class CONTENT_EXPORT SensorManagerChromeOS
|
| + : public base::RefCountedThreadSafe<SensorManagerChromeOS> {
|
| + public:
|
| + // Retrieves the singleton instance.
|
| + static SensorManagerChromeOS* GetInstance();
|
| +
|
| + // Begins monitoring of orientation events, the shared memory of |buffer| will
|
| + // be updated upon subsequent events.
|
| + bool StartFetchingDeviceOrientationData(
|
| + DeviceOrientationHardwareBuffer* buffer);
|
| +
|
| + // Stops monitoring orientation events.
|
| + void StopFetchingDeviceOrientationData();
|
| +
|
| + protected:
|
| + virtual ~SensorManagerChromeOS();
|
| +
|
| + private:
|
| + friend class base::RefCountedThreadSafe<SensorManagerChromeOS>;
|
| + friend class SensorManagerChromeOSTest;
|
| + friend struct DefaultSingletonTraits<SensorManagerChromeOS>;
|
| +
|
| + // Shared memory to to update.
|
| + DeviceOrientationHardwareBuffer* orientation_buffer_;
|
| +
|
| + // Synchronize orientation_buffer_ across threads.
|
| + base::Lock orientation_buffer_lock_;
|
| +
|
| + // Thread safe tracking of callback for Chrome OS sensors.
|
| + scoped_refptr<SensorManagerChromeOS> callback_ref_;
|
| +
|
| + SensorManagerChromeOS();
|
| +
|
| + // Callback that receives accelerometer events. These events are interpreted
|
| + // into orientation events.
|
| + void OnAccelerationIncludingGravity(double x, double y, double z);
|
| +
|
| + DISALLOW_COPY_AND_ASSIGN(SensorManagerChromeOS);
|
| +};
|
| +
|
| +} // namespace content
|
| +
|
| +#endif // CONTENT_BROWSER_DEVICE_SENSORS_SENSOR_MANAGER_CHROMEOS_H_
|
|
|