| 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 DEVICE_GEOLOCATION_LOCATION_API_ADAPTER_ANDROID_H_ | 5 #ifndef CONTENT_BROWSER_GEOLOCATION_LOCATION_API_ADAPTER_ANDROID_H_ |
| 6 #define DEVICE_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/synchronization/lock.h" | 12 #include "base/synchronization/lock.h" |
| 13 | 13 |
| 14 namespace base { | 14 namespace base { |
| 15 class SingleThreadTaskRunner; | 15 class SingleThreadTaskRunner; |
| 16 } | 16 } |
| 17 | 17 |
| 18 namespace device { | 18 namespace content { |
| 19 class LocationProviderAndroid; | 19 class LocationProviderAndroid; |
| 20 struct Geoposition; | 20 struct Geoposition; |
| 21 | 21 |
| 22 // Interacts with JNI and reports back to LocationProviderAndroid. This class | 22 // Interacts with JNI and reports back to LocationProviderAndroid. This class |
| 23 // creates a LocationProvider java object and listens for updates. | 23 // creates a LocationProvider java object and listens for updates. |
| 24 // The simplified flow is: | 24 // The simplified flow is: |
| 25 // - GeolocationProvider runs in a Geolocation Thread and fetches geolocation | 25 // - GeolocationProvider runs in a Geolocation Thread and fetches geolocation |
| 26 // data from a LocationProvider. | 26 // data from a LocationProvider. |
| 27 // - LocationProviderAndroid accesses a singleton AndroidLocationApiAdapter. | 27 // - LocationProviderAndroid accesses a singleton AndroidLocationApiAdapter. |
| 28 // - AndroidLocationApiAdapter calls via JNI and uses the main thread Looper | 28 // - AndroidLocationApiAdapter calls via JNI and uses the main thread Looper |
| (...skipping 44 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 73 java_location_provider_android_object_; | 73 java_location_provider_android_object_; |
| 74 // TODO(mvanouwerkerk): Use a callback instead of holding a pointer. | 74 // TODO(mvanouwerkerk): Use a callback instead of holding a pointer. |
| 75 LocationProviderAndroid* location_provider_; // Owned by the arbitrator. | 75 LocationProviderAndroid* location_provider_; // Owned by the arbitrator. |
| 76 | 76 |
| 77 // Guards against the following member which is accessed on Geolocation | 77 // Guards against the following member which is accessed on Geolocation |
| 78 // thread and the JNI main thread looper. | 78 // thread and the JNI main thread looper. |
| 79 base::Lock lock_; | 79 base::Lock lock_; |
| 80 scoped_refptr<base::SingleThreadTaskRunner> task_runner_; | 80 scoped_refptr<base::SingleThreadTaskRunner> task_runner_; |
| 81 }; | 81 }; |
| 82 | 82 |
| 83 } // namespace device | 83 } // namespace content |
| 84 | 84 |
| 85 #endif // DEVICE_GEOLOCATION_LOCATION_API_ADAPTER_ANDROID_H_ | 85 #endif // CONTENT_BROWSER_GEOLOCATION_LOCATION_API_ADAPTER_ANDROID_H_ |
| OLD | NEW |