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 #pragma once | 7 #pragma once |
8 | 8 |
9 #include <jni.h> | 9 #include <jni.h> |
10 | 10 |
(...skipping 21 matching lines...) Expand all Loading... |
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 | 40 |
41 // Implementation of DataFetcher. | 41 // Implementation of DataFetcher. |
| 42 virtual bool GetMotion(Motion* motion) OVERRIDE; |
42 virtual bool GetOrientation(Orientation* orientation) OVERRIDE; | 43 virtual bool GetOrientation(Orientation* orientation) OVERRIDE; |
43 | 44 |
44 private: | 45 private: |
45 DataFetcherImplAndroid(); | 46 DataFetcherImplAndroid(); |
46 | 47 |
47 // Wrappers for JNI methods. | 48 // Wrappers for JNI methods. |
48 bool Start(int rate_in_milliseconds); | 49 bool Start(int rate_in_milliseconds); |
49 void Stop(); | 50 void Stop(); |
50 | 51 |
51 // Value returned by GetOrientation. | 52 // Value returned by GetOrientation. |
52 scoped_ptr<Orientation> current_orientation_; | 53 scoped_ptr<Orientation> current_orientation_; |
53 | 54 |
54 // 1-element buffer, written by GotOrientation, read by GetOrientation. | 55 // 1-element buffer, written by GotOrientation, read by GetOrientation. |
55 base::Lock next_orientation_lock_; | 56 base::Lock next_orientation_lock_; |
56 scoped_ptr<Orientation> next_orientation_; | 57 scoped_ptr<Orientation> next_orientation_; |
57 | 58 |
58 DISALLOW_COPY_AND_ASSIGN(DataFetcherImplAndroid); | 59 DISALLOW_COPY_AND_ASSIGN(DataFetcherImplAndroid); |
59 }; | 60 }; |
60 | 61 |
61 } // namespace device_orientation | 62 } // namespace device_orientation |
62 | 63 |
63 #endif // CHROME_BROWSER_DEVICE_ORIENTATION_DATA_FETCHER_IMPL_ANDROID_H_ | 64 #endif // CHROME_BROWSER_DEVICE_ORIENTATION_DATA_FETCHER_IMPL_ANDROID_H_ |
OLD | NEW |