Chromium Code Reviews| OLD | NEW |
|---|---|
| (Empty) | |
| 1 // Copyright 2014 The Chromium Authors. All rights reserved. | |
|
timvolodine
2014/11/07 03:27:39
is there any chance we can put it in content/brows
jonross
2014/11/07 19:59:37
I'm going to go with the Callback suggestion.
con
| |
| 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_PUBLIC_BROWSER_SENSOR_MANAGER_H_ | |
| 6 #define CONTENT_PUBLIC_BROWSER_SENSOR_MANAGER_H_ | |
| 7 | |
| 8 #include "base/macros.h" | |
| 9 #include "base/synchronization/lock.h" | |
| 10 #include "content/common/content_export.h" | |
| 11 #include "content/common/device_sensors/device_orientation_hardware_buffer.h" | |
| 12 #include "ui/gfx/geometry/vector3d_f.h" | |
| 13 | |
| 14 template <typename T> | |
| 15 struct DefaultSingletonTraits; | |
| 16 | |
| 17 namespace content { | |
| 18 | |
| 19 // For platforms with a push API for accelerometer sensors. Received data is | |
| 20 // placed in a shared memory buffer, which is read by the renderer process. | |
| 21 class CONTENT_EXPORT SensorManager { | |
|
timvolodine
2014/11/07 03:27:39
this is chrome OS specific right? so probably shou
| |
| 22 public: | |
| 23 // Returns the SensorManager singleton | |
| 24 static SensorManager* GetInstance(); | |
| 25 | |
| 26 // Push sensor notifications to shared memory. | |
| 27 void OnAccelerationIncludingGravity(double x, double y, double z); | |
| 28 | |
| 29 // Set the shared memory buffer for orientation events. Accelerometer events | |
| 30 // will begin being processed. | |
| 31 void StartFetchingDeviceOrientationData( | |
| 32 DeviceOrientationHardwareBuffer* buffer); | |
| 33 | |
| 34 // Stop processing accelerometer events for orientation. | |
| 35 void StopFetchingDeviceOrientationData(); | |
| 36 | |
| 37 private: | |
| 38 friend class SensorManagerTest; | |
| 39 friend struct DefaultSingletonTraits<SensorManager>; | |
| 40 | |
| 41 // Shared memory buffers, not owned. | |
| 42 DeviceOrientationHardwareBuffer* orientation_buffer_; | |
| 43 | |
| 44 // Synchronize orientation_buffer_ across threads. | |
| 45 base::Lock orientation_buffer_lock_; | |
| 46 | |
| 47 SensorManager(); | |
| 48 virtual ~SensorManager(); | |
| 49 | |
| 50 DeviceOrientationHardwareBuffer* GetOrientationBufferForTest() { | |
| 51 return orientation_buffer_; | |
| 52 } | |
| 53 | |
| 54 DISALLOW_COPY_AND_ASSIGN(SensorManager); | |
| 55 }; | |
| 56 | |
| 57 } // namespace content | |
| 58 | |
| 59 #endif // CONTENT_PUBLIC_BROWSER_SENSOR_MANAGER_H_ | |
| OLD | NEW |