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

Side by Side Diff: device/sensors/sensor_manager_android.h

Issue 2646093002: Move //content/browser/device_sensor/ into device/sensors (Closed)
Patch Set: gn format & code rebase Created 3 years, 10 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
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 DEVICE_SENSORS_SENSOR_MANAGER_ANDROID_H_
6 #define CONTENT_BROWSER_DEVICE_SENSORS_SENSOR_MANAGER_ANDROID_H_ 6 #define DEVICE_SENSORS_SENSOR_MANAGER_ANDROID_H_
7 7
8 #include <memory> 8 #include <memory>
9 9
10 #include "base/android/scoped_java_ref.h" 10 #include "base/android/scoped_java_ref.h"
11 #include "base/macros.h" 11 #include "base/macros.h"
12 #include "base/synchronization/lock.h" 12 #include "base/synchronization/lock.h"
13 #include "base/threading/thread_checker.h" 13 #include "base/threading/thread_checker.h"
14 #include "content/browser/device_sensors/device_sensors_consts.h" 14 #include "device/sensors/device_sensor_export.h"
15 #include "content/common/content_export.h" 15 #include "device/sensors/device_sensors_consts.h"
16 #include "device/sensors/public/cpp/device_light_hardware_buffer.h" 16 #include "device/sensors/public/cpp/device_light_hardware_buffer.h"
17 #include "device/sensors/public/cpp/device_motion_hardware_buffer.h" 17 #include "device/sensors/public/cpp/device_motion_hardware_buffer.h"
18 #include "device/sensors/public/cpp/device_orientation_hardware_buffer.h" 18 #include "device/sensors/public/cpp/device_orientation_hardware_buffer.h"
19 19
20 namespace base { 20 namespace base {
21 template <typename T> 21 template <typename T>
22 struct DefaultSingletonTraits; 22 struct DefaultSingletonTraits;
23 } 23 }
24 24
25 namespace content { 25 namespace device {
26 26
27 // Android implementation of Device {Motion|Orientation|Light} API. 27 // Android implementation of Device {Motion|Orientation|Light} API.
28 // 28 //
29 // Android's SensorManager has a push API, so when Got*() methods are called 29 // Android's SensorManager has a push API, so when Got*() methods are called
30 // by the system the browser process puts the received data into a shared 30 // by the system the browser process puts the received data into a shared
31 // memory buffer, which is read by the renderer processes. 31 // memory buffer, which is read by the renderer processes.
32 class CONTENT_EXPORT SensorManagerAndroid { 32 class DEVICE_SENSOR_EXPORT SensorManagerAndroid {
33 public: 33 public:
34 // Must be called at startup, before GetInstance(). 34 // Must be called at startup, before GetInstance().
35 static bool Register(JNIEnv* env); 35 static bool Register(JNIEnv* env);
36 36
37 // Should be called only on the UI thread. 37 // Should be called only on the UI thread.
38 static SensorManagerAndroid* GetInstance(); 38 static SensorManagerAndroid* GetInstance();
39 39
40 // Called from Java via JNI. 40 // Called from Java via JNI.
41 void GotLight(JNIEnv*, 41 void GotLight(JNIEnv*,
42 const base::android::JavaParamRef<jobject>&, 42 const base::android::JavaParamRef<jobject>&,
(...skipping 36 matching lines...) Expand 10 before | Expand all | Expand 10 after
79 DeviceOrientationHardwareBuffer* buffer); 79 DeviceOrientationHardwareBuffer* buffer);
80 void StopFetchingDeviceOrientationData(); 80 void StopFetchingDeviceOrientationData();
81 81
82 void StartFetchingDeviceOrientationAbsoluteData( 82 void StartFetchingDeviceOrientationAbsoluteData(
83 DeviceOrientationHardwareBuffer* buffer); 83 DeviceOrientationHardwareBuffer* buffer);
84 void StopFetchingDeviceOrientationAbsoluteData(); 84 void StopFetchingDeviceOrientationAbsoluteData();
85 85
86 void Shutdown(); 86 void Shutdown();
87 87
88 // A Java counterpart will be generated for this enum. 88 // A Java counterpart will be generated for this enum.
89 // GENERATED_JAVA_ENUM_PACKAGE: org.chromium.content.browser 89 // GENERATED_JAVA_ENUM_PACKAGE: org.chromium.device.sensors
90 // When adding new constants don't modify the order as they are used for UMA. 90 // When adding new constants don't modify the order as they are used for UMA.
91 enum OrientationSensorType { 91 enum OrientationSensorType {
92 NOT_AVAILABLE = 0, 92 NOT_AVAILABLE = 0,
93 ROTATION_VECTOR = 1, 93 ROTATION_VECTOR = 1,
94 ACCELEROMETER_MAGNETIC = 2, 94 ACCELEROMETER_MAGNETIC = 2,
95 GAME_ROTATION_VECTOR = 3, 95 GAME_ROTATION_VECTOR = 3,
96 ORIENTATION_SENSOR_MAX = 4, 96 ORIENTATION_SENSOR_MAX = 4,
97 }; 97 };
98 98
99 protected: 99 protected:
(...skipping 46 matching lines...) Expand 10 before | Expand all | Expand 10 after
146 base::Lock motion_buffer_lock_; 146 base::Lock motion_buffer_lock_;
147 base::Lock orientation_buffer_lock_; 147 base::Lock orientation_buffer_lock_;
148 base::Lock orientation_absolute_buffer_lock_; 148 base::Lock orientation_absolute_buffer_lock_;
149 149
150 bool is_shutdown_; 150 bool is_shutdown_;
151 base::ThreadChecker thread_checker_; 151 base::ThreadChecker thread_checker_;
152 152
153 DISALLOW_COPY_AND_ASSIGN(SensorManagerAndroid); 153 DISALLOW_COPY_AND_ASSIGN(SensorManagerAndroid);
154 }; 154 };
155 155
156 } // namespace content 156 } // namespace device
157 157
158 #endif // CONTENT_BROWSER_DEVICE_SENSORS_SENSOR_MANAGER_ANDROID_H_ 158 #endif // DEVICE_SENSORS_SENSOR_MANAGER_ANDROID_H_
OLDNEW
« no previous file with comments | « device/sensors/public/cpp/device_orientation_hardware_buffer.h ('k') | device/sensors/sensor_manager_android.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698