OLD | NEW |
---|---|
(Empty) | |
1 // Copyright 2014 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 "content/common/content_export.h" | |
12 #include "content/common/device_sensors/device_orientation_hardware_buffer.h" | |
13 | |
14 template <typename T> | |
15 struct DefaultSingletonTraits; | |
timvolodine
2015/01/21 13:16:57
is this needed?
jonross
2015/01/21 16:02:11
Nope, missed removing it.
| |
16 | |
17 namespace content { | |
18 | |
19 class SensorManagerChromeOSTest; | |
timvolodine
2015/01/21 13:16:57
is this needed?
jonross
2015/01/21 16:02:11
Done.
| |
20 | |
21 // Observes Chrome OS accelerometer sensors, and provides updated device | |
22 // orientation information. | |
23 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
| |
24 : public chromeos::AccelerometerReader::Observer { | |
25 public: | |
26 SensorManagerChromeOS(); | |
27 ~SensorManagerChromeOS() override; | |
28 | |
29 // Returns true if there are buffers being updated with accelerometer data. | |
30 bool IsFetching(); | |
31 | |
32 // Begins monitoring of orientation events, the shared memory of |buffer| will | |
33 // be updated upon subsequent events. | |
34 bool StartFetchingDeviceOrientationData( | |
35 DeviceOrientationHardwareBuffer* buffer); | |
36 | |
37 // Stops monitoring orientation events. Returns true if there is an active | |
38 // |orientation_buffer_| and fetching stops. Otherwise returns false. | |
39 bool StopFetchingDeviceOrientationData(); | |
40 | |
41 // chromeos::AccelerometerReader::Observer: | |
42 void OnAccelerometerUpdated(const ui::AccelerometerUpdate& update) override; | |
43 | |
44 private: | |
45 // Shared memory to to update. | |
46 DeviceOrientationHardwareBuffer* orientation_buffer_; | |
47 | |
48 // Synchronize orientation_buffer_ across threads. | |
49 base::Lock orientation_buffer_lock_; | |
50 | |
51 DISALLOW_COPY_AND_ASSIGN(SensorManagerChromeOS); | |
52 }; | |
53 | |
54 } // namespace content | |
55 | |
56 #endif // CONTENT_BROWSER_DEVICE_SENSORS_SENSOR_MANAGER_CHROMEOS_H_ | |
OLD | NEW |