| 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 CONTENT_BROWSER_GEOLOCATION_LOCATION_API_ADAPTER_ANDROID_H_ | 5 #ifndef CONTENT_BROWSER_GEOLOCATION_LOCATION_API_ADAPTER_ANDROID_H_ |
| 6 #define CONTENT_BROWSER_GEOLOCATION_LOCATION_API_ADAPTER_ANDROID_H_ | 6 #define CONTENT_BROWSER_GEOLOCATION_LOCATION_API_ADAPTER_ANDROID_H_ |
| 7 | 7 |
| 8 #include "base/android/jni_weak_ref.h" | 8 #include "base/android/jni_weak_ref.h" |
| 9 #include "base/android/scoped_java_ref.h" | 9 #include "base/android/scoped_java_ref.h" |
| 10 #include "base/memory/ref_counted.h" | 10 #include "base/memory/ref_counted.h" |
| (...skipping 39 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 50 static void OnNewLocationAvailable(double latitude, | 50 static void OnNewLocationAvailable(double latitude, |
| 51 double longitude, | 51 double longitude, |
| 52 double time_stamp, | 52 double time_stamp, |
| 53 bool has_altitude, double altitude, | 53 bool has_altitude, double altitude, |
| 54 bool has_accuracy, double accuracy, | 54 bool has_accuracy, double accuracy, |
| 55 bool has_heading, double heading, | 55 bool has_heading, double heading, |
| 56 bool has_speed, double speed); | 56 bool has_speed, double speed); |
| 57 static void OnNewErrorAvailable(JNIEnv* env, jstring message); | 57 static void OnNewErrorAvailable(JNIEnv* env, jstring message); |
| 58 | 58 |
| 59 private: | 59 private: |
| 60 friend struct DefaultSingletonTraits<AndroidLocationApiAdapter>; | 60 friend struct base::DefaultSingletonTraits<AndroidLocationApiAdapter>; |
| 61 AndroidLocationApiAdapter(); | 61 AndroidLocationApiAdapter(); |
| 62 ~AndroidLocationApiAdapter(); | 62 ~AndroidLocationApiAdapter(); |
| 63 | 63 |
| 64 void CreateJavaObject(JNIEnv* env); | 64 void CreateJavaObject(JNIEnv* env); |
| 65 | 65 |
| 66 // Called on the JNI main thread looper. | 66 // Called on the JNI main thread looper. |
| 67 void OnNewGeopositionInternal(const Geoposition& geoposition); | 67 void OnNewGeopositionInternal(const Geoposition& geoposition); |
| 68 | 68 |
| 69 /// Called on the Geolocation thread. | 69 /// Called on the Geolocation thread. |
| 70 static void NotifyProviderNewGeoposition(const Geoposition& geoposition); | 70 static void NotifyProviderNewGeoposition(const Geoposition& geoposition); |
| 71 | 71 |
| 72 base::android::ScopedJavaGlobalRef<jobject> | 72 base::android::ScopedJavaGlobalRef<jobject> |
| 73 java_location_provider_android_object_; | 73 java_location_provider_android_object_; |
| 74 LocationProviderAndroid* location_provider_; | 74 LocationProviderAndroid* location_provider_; |
| 75 | 75 |
| 76 // Guards against the following member which is accessed on Geolocation | 76 // Guards against the following member which is accessed on Geolocation |
| 77 // thread and the JNI main thread looper. | 77 // thread and the JNI main thread looper. |
| 78 base::Lock lock_; | 78 base::Lock lock_; |
| 79 scoped_refptr<base::SingleThreadTaskRunner> task_runner_; | 79 scoped_refptr<base::SingleThreadTaskRunner> task_runner_; |
| 80 }; | 80 }; |
| 81 | 81 |
| 82 } // namespace content | 82 } // namespace content |
| 83 | 83 |
| 84 #endif // CONTENT_BROWSER_GEOLOCATION_LOCATION_API_ADAPTER_ANDROID_H_ | 84 #endif // CONTENT_BROWSER_GEOLOCATION_LOCATION_API_ADAPTER_ANDROID_H_ |
| OLD | NEW |