OLD | NEW |
1 // Copyright 2014 The Chromium Authors. All rights reserved. | 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 | 2 // Use of this source code is governed by a BSD-style license that can be |
3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
4 | 4 |
5 #ifndef CONTENT_BROWSER_DEVICE_SENSORS_SENSOR_MANAGER_ANDROID_H_ | 5 #ifndef CONTENT_BROWSER_DEVICE_SENSORS_SENSOR_MANAGER_ANDROID_H_ |
6 #define CONTENT_BROWSER_DEVICE_SENSORS_SENSOR_MANAGER_ANDROID_H_ | 6 #define CONTENT_BROWSER_DEVICE_SENSORS_SENSOR_MANAGER_ANDROID_H_ |
7 | 7 |
8 #include "base/android/scoped_java_ref.h" | 8 #include "base/android/scoped_java_ref.h" |
9 #include "base/memory/scoped_ptr.h" | 9 #include "base/memory/scoped_ptr.h" |
10 #include "base/synchronization/lock.h" | 10 #include "base/synchronization/lock.h" |
11 #include "content/common/content_export.h" | 11 #include "content/common/content_export.h" |
12 #include "content/common/device_sensors/device_light_hardware_buffer.h" | 12 #include "content/common/device_sensors/device_light_hardware_buffer.h" |
13 #include "content/common/device_sensors/device_motion_hardware_buffer.h" | 13 #include "content/common/device_sensors/device_motion_hardware_buffer.h" |
14 #include "content/common/device_sensors/device_orientation_hardware_buffer.h" | 14 #include "content/common/device_sensors/device_orientation_hardware_buffer.h" |
15 | 15 |
16 template<typename T> struct DefaultSingletonTraits; | 16 namespace base { |
| 17 template <typename T> |
| 18 struct DefaultSingletonTraits; |
| 19 } |
17 | 20 |
18 namespace content { | 21 namespace content { |
19 | 22 |
20 // Android implementation of Device {Motion|Orientation|Light} API. | 23 // Android implementation of Device {Motion|Orientation|Light} API. |
21 // | 24 // |
22 // Android's SensorManager has a push API, so when Got*() methods are called | 25 // Android's SensorManager has a push API, so when Got*() methods are called |
23 // by the system the browser process puts the received data into a shared | 26 // by the system the browser process puts the received data into a shared |
24 // memory buffer, which is read by the renderer processes. | 27 // memory buffer, which is read by the renderer processes. |
25 class CONTENT_EXPORT SensorManagerAndroid { | 28 class CONTENT_EXPORT SensorManagerAndroid { |
26 public: | 29 public: |
(...skipping 49 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
76 void StopFetchingLightDataOnUI(); | 79 void StopFetchingLightDataOnUI(); |
77 | 80 |
78 void StartFetchingMotionDataOnUI(DeviceMotionHardwareBuffer* buffer); | 81 void StartFetchingMotionDataOnUI(DeviceMotionHardwareBuffer* buffer); |
79 void StopFetchingMotionDataOnUI(); | 82 void StopFetchingMotionDataOnUI(); |
80 | 83 |
81 void StartFetchingOrientationDataOnUI( | 84 void StartFetchingOrientationDataOnUI( |
82 DeviceOrientationHardwareBuffer* buffer); | 85 DeviceOrientationHardwareBuffer* buffer); |
83 void StopFetchingOrientationDataOnUI(); | 86 void StopFetchingOrientationDataOnUI(); |
84 | 87 |
85 private: | 88 private: |
86 friend struct DefaultSingletonTraits<SensorManagerAndroid>; | 89 friend struct base::DefaultSingletonTraits<SensorManagerAndroid>; |
87 | 90 |
88 enum { | 91 enum { |
89 RECEIVED_MOTION_DATA_ACCELERATION = 0, | 92 RECEIVED_MOTION_DATA_ACCELERATION = 0, |
90 RECEIVED_MOTION_DATA_ACCELERATION_INCL_GRAVITY = 1, | 93 RECEIVED_MOTION_DATA_ACCELERATION_INCL_GRAVITY = 1, |
91 RECEIVED_MOTION_DATA_ROTATION_RATE = 2, | 94 RECEIVED_MOTION_DATA_ROTATION_RATE = 2, |
92 RECEIVED_MOTION_DATA_MAX = 3, | 95 RECEIVED_MOTION_DATA_MAX = 3, |
93 }; | 96 }; |
94 | 97 |
95 void SetLightBufferValue(double lux); | 98 void SetLightBufferValue(double lux); |
96 | 99 |
(...skipping 19 matching lines...) Expand all Loading... |
116 base::Lock orientation_buffer_lock_; | 119 base::Lock orientation_buffer_lock_; |
117 | 120 |
118 bool is_shutdown_; | 121 bool is_shutdown_; |
119 | 122 |
120 DISALLOW_COPY_AND_ASSIGN(SensorManagerAndroid); | 123 DISALLOW_COPY_AND_ASSIGN(SensorManagerAndroid); |
121 }; | 124 }; |
122 | 125 |
123 } // namespace content | 126 } // namespace content |
124 | 127 |
125 #endif // CONTENT_BROWSER_DEVICE_SENSORS_SENSOR_MANAGER_ANDROID_H_ | 128 #endif // CONTENT_BROWSER_DEVICE_SENSORS_SENSOR_MANAGER_ANDROID_H_ |
OLD | NEW |