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

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: Created 5 years, 11 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 2014 The Chromium Authors. All rights reserved.
timvolodine 2015/01/26 15:29:07 nit: 2015?
jonross 2015/01/26 16:40:04 Done.
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 namespace content {
15
16 // Observes Chrome OS accelerometer sensors, and provides updated device
17 // orientation information.
18 class CONTENT_EXPORT SensorManagerChromeOS
19 : public chromeos::AccelerometerReader::Observer {
20 public:
21 SensorManagerChromeOS();
22 ~SensorManagerChromeOS() override;
23
24 // Begins monitoring of orientation events, the shared memory of |buffer| will
25 // be updated upon subsequent events.
26 bool StartFetchingDeviceOrientationData(
27 DeviceOrientationHardwareBuffer* buffer);
28
29 // Stops monitoring orientation events. Returns true if there is an active
30 // |orientation_buffer_| and fetching stops. Otherwise returns false.
31 bool StopFetchingDeviceOrientationData();
32
33 // chromeos::AccelerometerReader::Observer:
34 void OnAccelerometerUpdated(const ui::AccelerometerUpdate& update) override;
35
36 protected:
37 // Begins/ends the observation of accelerometer events.
38 virtual void StartObservingAccelerometer();
39 virtual void StopObservingAccelerometer();
40
41 private:
42 // Shared memory to to update.
timvolodine 2015/01/26 15:29:08 remove duplicate "to"
jonross 2015/01/26 16:40:04 Done.
43 DeviceOrientationHardwareBuffer* orientation_buffer_;
44
45 // Synchronize orientation_buffer_ across threads.
46 base::Lock orientation_buffer_lock_;
47
48 DISALLOW_COPY_AND_ASSIGN(SensorManagerChromeOS);
49 };
50
51 } // namespace content
52
53 #endif // CONTENT_BROWSER_DEVICE_SENSORS_SENSOR_MANAGER_CHROMEOS_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698