Chromium Code Reviews| 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..8317537c4b7bb6297359efe52324fc2f247dc1a5 |
| --- /dev/null |
| +++ b/content/browser/device_sensors/sensor_manager_chromeos.h |
| @@ -0,0 +1,56 @@ |
| +// 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/synchronization/lock.h" |
| +#include "chromeos/accelerometer/accelerometer_reader.h" |
| +#include "content/common/content_export.h" |
| +#include "content/common/device_sensors/device_orientation_hardware_buffer.h" |
| + |
| +template <typename T> |
| +struct DefaultSingletonTraits; |
|
timvolodine
2015/01/21 13:16:57
is this needed?
jonross
2015/01/21 16:02:11
Nope, missed removing it.
|
| + |
| +namespace content { |
| + |
| +class SensorManagerChromeOSTest; |
|
timvolodine
2015/01/21 13:16:57
is this needed?
jonross
2015/01/21 16:02:11
Done.
|
| + |
| +// Observes Chrome OS accelerometer sensors, and provides updated device |
| +// orientation information. |
| +class CONTENT_EXPORT SensorManagerChromeOS |
|
timvolodine
2015/01/21 13:16:57
you could probably put this class entirely inside
jonross
2015/01/21 16:02:11
I had considered that. However keeping it separate
|
| + : public chromeos::AccelerometerReader::Observer { |
| + public: |
| + SensorManagerChromeOS(); |
| + ~SensorManagerChromeOS() override; |
| + |
| + // Returns true if there are buffers being updated with accelerometer data. |
| + bool IsFetching(); |
| + |
| + // Begins monitoring of orientation events, the shared memory of |buffer| will |
| + // be updated upon subsequent events. |
| + bool StartFetchingDeviceOrientationData( |
| + DeviceOrientationHardwareBuffer* buffer); |
| + |
| + // Stops monitoring orientation events. Returns true if there is an active |
| + // |orientation_buffer_| and fetching stops. Otherwise returns false. |
| + bool StopFetchingDeviceOrientationData(); |
| + |
| + // chromeos::AccelerometerReader::Observer: |
| + void OnAccelerometerUpdated(const ui::AccelerometerUpdate& update) override; |
| + |
| + private: |
| + // Shared memory to to update. |
| + DeviceOrientationHardwareBuffer* orientation_buffer_; |
| + |
| + // Synchronize orientation_buffer_ across threads. |
| + base::Lock orientation_buffer_lock_; |
| + |
| + DISALLOW_COPY_AND_ASSIGN(SensorManagerChromeOS); |
| +}; |
| + |
| +} // namespace content |
| + |
| +#endif // CONTENT_BROWSER_DEVICE_SENSORS_SENSOR_MANAGER_CHROMEOS_H_ |