Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(143)

Side by Side Diff: content/browser/device_sensors/sensor_manager_chromeos.h

Issue 856123002: Device Orientation API on Chrome OS (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Update to reflect chromeos accelerometer changes Created 5 years, 10 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
(Empty)
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.
4
5 #ifndef CONTENT_BROWSER_DEVICE_SENSORS_SENSOR_MANAGER_CHROMEOS_H_
6 #define CONTENT_BROWSER_DEVICE_SENSORS_SENSOR_MANAGER_CHROMEOS_H_
7
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"
14
15 namespace content {
16
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;
24
25 // Begins monitoring of orientation events, the shared memory of |buffer| will
26 // be updated upon subsequent events.
27 bool StartFetchingDeviceOrientationData(
28 DeviceOrientationHardwareBuffer* buffer);
29
30 // Stops monitoring orientation events. Returns true if there is an active
31 // |orientation_buffer_| and fetching stops. Otherwise returns false.
32 bool StopFetchingDeviceOrientationData();
33
34 // chromeos::AccelerometerReader::Observer:
35 void OnAccelerometerUpdated(
36 const chromeos::AccelerometerUpdate& update) override;
37
38 protected:
39 // Begins/ends the observation of accelerometer events.
40 virtual void StartObservingAccelerometer();
41 virtual void StopObservingAccelerometer();
42
43 private:
44 // Shared memory to update.
45 DeviceOrientationHardwareBuffer* orientation_buffer_;
46
47 // Synchronize orientation_buffer_ across threads.
48 base::Lock orientation_buffer_lock_;
49
50 DISALLOW_COPY_AND_ASSIGN(SensorManagerChromeOS);
51 };
52
53 } // namespace content
54
55 #endif // CONTENT_BROWSER_DEVICE_SENSORS_SENSOR_MANAGER_CHROMEOS_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698