| 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" |
| 11 #include "base/memory/singleton.h" | 11 #include "base/memory/singleton.h" |
| 12 #include "base/message_loop/message_loop_proxy.h" |
| 12 #include "base/synchronization/lock.h" | 13 #include "base/synchronization/lock.h" |
| 13 | 14 |
| 14 namespace base { | |
| 15 class SingleThreadTaskRunner; | |
| 16 } | |
| 17 | |
| 18 namespace content { | 15 namespace content { |
| 19 class LocationProviderAndroid; | 16 class LocationProviderAndroid; |
| 20 struct Geoposition; | 17 struct Geoposition; |
| 21 | 18 |
| 22 // Interacts with JNI and reports back to AndroidLocationProvider. | 19 // Interacts with JNI and reports back to AndroidLocationProvider. |
| 23 // This class creates a LocationProvider java object and listens for | 20 // This class creates a LocationProvider java object and listens for |
| 24 // updates. | 21 // updates. |
| 25 // The simplified flow is: | 22 // The simplified flow is: |
| 26 // GeolocationProvider runs in a Geolocation Thread and fetches geolocation data | 23 // GeolocationProvider runs in a Geolocation Thread and fetches geolocation data |
| 27 // from a LocationProvider. | 24 // from a LocationProvider. |
| (...skipping 41 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 69 /// Called on the Geolocation thread. | 66 /// Called on the Geolocation thread. |
| 70 static void NotifyProviderNewGeoposition(const Geoposition& geoposition); | 67 static void NotifyProviderNewGeoposition(const Geoposition& geoposition); |
| 71 | 68 |
| 72 base::android::ScopedJavaGlobalRef<jobject> | 69 base::android::ScopedJavaGlobalRef<jobject> |
| 73 java_location_provider_android_object_; | 70 java_location_provider_android_object_; |
| 74 LocationProviderAndroid* location_provider_; | 71 LocationProviderAndroid* location_provider_; |
| 75 | 72 |
| 76 // Guards against the following member which is accessed on Geolocation | 73 // Guards against the following member which is accessed on Geolocation |
| 77 // thread and the JNI main thread looper. | 74 // thread and the JNI main thread looper. |
| 78 base::Lock lock_; | 75 base::Lock lock_; |
| 79 scoped_refptr<base::SingleThreadTaskRunner> task_runner_; | 76 scoped_refptr<base::MessageLoopProxy> message_loop_; |
| 80 }; | 77 }; |
| 81 | 78 |
| 82 } // namespace content | 79 } // namespace content |
| 83 | 80 |
| 84 #endif // CONTENT_BROWSER_GEOLOCATION_LOCATION_API_ADAPTER_ANDROID_H_ | 81 #endif // CONTENT_BROWSER_GEOLOCATION_LOCATION_API_ADAPTER_ANDROID_H_ |
| OLD | NEW |