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 48 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
75 void StopFetchingLightDataOnUI(); | 78 void StopFetchingLightDataOnUI(); |
76 | 79 |
77 void StartFetchingMotionDataOnUI(DeviceMotionHardwareBuffer* buffer); | 80 void StartFetchingMotionDataOnUI(DeviceMotionHardwareBuffer* buffer); |
78 void StopFetchingMotionDataOnUI(); | 81 void StopFetchingMotionDataOnUI(); |
79 | 82 |
80 void StartFetchingOrientationDataOnUI( | 83 void StartFetchingOrientationDataOnUI( |
81 DeviceOrientationHardwareBuffer* buffer); | 84 DeviceOrientationHardwareBuffer* buffer); |
82 void StopFetchingOrientationDataOnUI(); | 85 void StopFetchingOrientationDataOnUI(); |
83 | 86 |
84 private: | 87 private: |
85 friend struct DefaultSingletonTraits<SensorManagerAndroid>; | 88 friend struct base::DefaultSingletonTraits<SensorManagerAndroid>; |
86 | 89 |
87 enum { | 90 enum { |
88 RECEIVED_MOTION_DATA_ACCELERATION = 0, | 91 RECEIVED_MOTION_DATA_ACCELERATION = 0, |
89 RECEIVED_MOTION_DATA_ACCELERATION_INCL_GRAVITY = 1, | 92 RECEIVED_MOTION_DATA_ACCELERATION_INCL_GRAVITY = 1, |
90 RECEIVED_MOTION_DATA_ROTATION_RATE = 2, | 93 RECEIVED_MOTION_DATA_ROTATION_RATE = 2, |
91 RECEIVED_MOTION_DATA_MAX = 3, | 94 RECEIVED_MOTION_DATA_MAX = 3, |
92 }; | 95 }; |
93 | 96 |
94 void SetLightBufferValue(double lux); | 97 void SetLightBufferValue(double lux); |
95 | 98 |
(...skipping 21 matching lines...) Expand all Loading... |
117 | 120 |
118 bool is_using_backup_sensors_for_orientation_; | 121 bool is_using_backup_sensors_for_orientation_; |
119 bool is_shutdown_; | 122 bool is_shutdown_; |
120 | 123 |
121 DISALLOW_COPY_AND_ASSIGN(SensorManagerAndroid); | 124 DISALLOW_COPY_AND_ASSIGN(SensorManagerAndroid); |
122 }; | 125 }; |
123 | 126 |
124 } // namespace content | 127 } // namespace content |
125 | 128 |
126 #endif // CONTENT_BROWSER_DEVICE_SENSORS_SENSOR_MANAGER_ANDROID_H_ | 129 #endif // CONTENT_BROWSER_DEVICE_SENSORS_SENSOR_MANAGER_ANDROID_H_ |
OLD | NEW |