ozone: evdev: Sync caps lock LED state to evdev
[chromium-blink-merge.git] / content / browser / device_sensors / sensor_manager_chromeos.h
blobfaeabeb7e69c4f2b7039a667bac9c8f01d92268d
1 // Copyright 2015 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.
5 #ifndef CONTENT_BROWSER_DEVICE_SENSORS_SENSOR_MANAGER_CHROMEOS_H_
6 #define CONTENT_BROWSER_DEVICE_SENSORS_SENSOR_MANAGER_CHROMEOS_H_
8 #include "base/macros.h"
9 #include "base/synchronization/lock.h"
10 #include "chromeos/accelerometer/accelerometer_reader.h"
11 #include "chromeos/accelerometer/accelerometer_types.h"
12 #include "content/common/content_export.h"
13 #include "content/common/device_sensors/device_orientation_hardware_buffer.h"
15 namespace content {
17 // Observes Chrome OS accelerometer sensors, and provides updated device
18 // orientation information.
19 class CONTENT_EXPORT SensorManagerChromeOS
20 : public chromeos::AccelerometerReader::Observer {
21 public:
22 SensorManagerChromeOS();
23 ~SensorManagerChromeOS() override;
25 // Begins monitoring of orientation events, the shared memory of |buffer| will
26 // be updated upon subsequent events.
27 bool StartFetchingDeviceOrientationData(
28 DeviceOrientationHardwareBuffer* buffer);
30 // Stops monitoring orientation events. Returns true if there is an active
31 // |orientation_buffer_| and fetching stops. Otherwise returns false.
32 bool StopFetchingDeviceOrientationData();
34 // chromeos::AccelerometerReader::Observer:
35 void OnAccelerometerUpdated(
36 const chromeos::AccelerometerUpdate& update) override;
38 protected:
39 // Begins/ends the observation of accelerometer events.
40 virtual void StartObservingAccelerometer();
41 virtual void StopObservingAccelerometer();
43 private:
44 // Shared memory to update.
45 DeviceOrientationHardwareBuffer* orientation_buffer_;
47 // Synchronize orientation_buffer_ across threads.
48 base::Lock orientation_buffer_lock_;
50 DISALLOW_COPY_AND_ASSIGN(SensorManagerChromeOS);
53 } // namespace content
55 #endif // CONTENT_BROWSER_DEVICE_SENSORS_SENSOR_MANAGER_CHROMEOS_H_