OLD | NEW |
---|---|
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 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 CHROME_BROWSER_DEVICE_ORIENTATION_DATA_FETCHER_IMPL_ANDROID_H_ | 5 #ifndef CHROME_BROWSER_DEVICE_ORIENTATION_DATA_FETCHER_IMPL_ANDROID_H_ |
6 #define CHROME_BROWSER_DEVICE_ORIENTATION_DATA_FETCHER_IMPL_ANDROID_H_ | 6 #define CHROME_BROWSER_DEVICE_ORIENTATION_DATA_FETCHER_IMPL_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" |
(...skipping 19 matching lines...) Expand all Loading... | |
30 | 30 |
31 // Factory function. We'll listen for events for the lifetime of this object. | 31 // Factory function. We'll listen for events for the lifetime of this object. |
32 // Returns NULL on error. | 32 // Returns NULL on error. |
33 static DataFetcher* Create(); | 33 static DataFetcher* Create(); |
34 | 34 |
35 virtual ~DataFetcherImplAndroid(); | 35 virtual ~DataFetcherImplAndroid(); |
36 | 36 |
37 // Called from Java via JNI. | 37 // Called from Java via JNI. |
38 void GotOrientation(JNIEnv*, jobject, | 38 void GotOrientation(JNIEnv*, jobject, |
39 double alpha, double beta, double gamma); | 39 double alpha, double beta, double gamma); |
40 void GotAcceleration(JNIEnv*, jobject, | |
41 double x, double y, double z); | |
42 void GotAccelerationIncludingGravity(JNIEnv*, jobject, | |
43 double x, double y, double z); | |
44 void GotRotationRate(JNIEnv*, jobject, | |
45 double alpha, double beta, double gamma); | |
40 | 46 |
41 // Implementation of DataFetcher. | 47 // Implementation of DataFetcher. |
42 virtual const DeviceData* GetDeviceData(DeviceData::Type type) OVERRIDE; | 48 virtual const DeviceData* GetDeviceData(DeviceData::Type type) OVERRIDE; |
43 | 49 |
44 private: | 50 private: |
45 DataFetcherImplAndroid(); | 51 DataFetcherImplAndroid(); |
46 const Orientation* GetOrientation(); | 52 const Orientation* GetOrientation(); |
47 | 53 |
48 // Wrappers for JNI methods. | 54 // Wrappers for JNI methods. |
49 bool Start(int rate_in_milliseconds); | 55 // bool Start(int rate_in_milliseconds); |
Peter Beverloo
2013/03/12 11:26:39
Please don't include commented out code.
timvolodine
2013/03/12 16:12:46
Done.
| |
50 void Stop(); | 56 bool Start(DeviceData::Type event_type, int rate_in_milliseconds); |
Peter Beverloo
2013/03/12 11:26:39
While device data definitely is not the correct pl
timvolodine
2013/03/12 16:12:46
Done.
| |
57 | |
58 // void Stop(); | |
Peter Beverloo
2013/03/12 11:26:39
Dito.
timvolodine
2013/03/12 16:12:46
Done.
| |
59 void Stop(DeviceData::Type event_type); | |
51 | 60 |
52 // Value returned by GetDeviceData. | 61 // Value returned by GetDeviceData. |
53 scoped_refptr<Orientation> current_orientation_; | 62 scoped_refptr<Orientation> current_orientation_; |
54 | 63 |
55 // 1-element buffer, written by GotOrientation, read by GetDeviceData. | 64 // 1-element buffer, written by GotOrientation, read by GetDeviceData. |
56 base::Lock next_orientation_lock_; | 65 base::Lock next_orientation_lock_; |
57 scoped_refptr<Orientation> next_orientation_; | 66 scoped_refptr<Orientation> next_orientation_; |
58 | 67 |
59 // The Java provider of orientation info. | 68 // The Java provider of orientation info. |
60 base::android::ScopedJavaGlobalRef<jobject> device_orientation_; | 69 base::android::ScopedJavaGlobalRef<jobject> device_orientation_; |
61 | 70 |
62 DISALLOW_COPY_AND_ASSIGN(DataFetcherImplAndroid); | 71 DISALLOW_COPY_AND_ASSIGN(DataFetcherImplAndroid); |
63 }; | 72 }; |
64 | 73 |
65 } // namespace content | 74 } // namespace content |
66 | 75 |
67 #endif // CHROME_BROWSER_DEVICE_ORIENTATION_DATA_FETCHER_IMPL_ANDROID_H_ | 76 #endif // CHROME_BROWSER_DEVICE_ORIENTATION_DATA_FETCHER_IMPL_ANDROID_H_ |
OLD | NEW |