diff options
author | benm@chromium.org <benm@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2013-12-13 19:43:51 +0000 |
---|---|---|
committer | benm@chromium.org <benm@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2013-12-13 19:43:51 +0000 |
commit | 36d6a43ae9c4603c36d5602cc3fb15bf06c7ff97 (patch) | |
tree | 21c392b3f9e121a17da0e09fd2aa09478cb502d0 /content/browser/geolocation/location_api_adapter_android.cc | |
parent | 139574d77dc97eb3b6307e7ec87ceb613a8b11b2 (diff) | |
download | chromium_src-36d6a43ae9c4603c36d5602cc3fb15bf06c7ff97.zip chromium_src-36d6a43ae9c4603c36d5602cc3fb15bf06c7ff97.tar.gz chromium_src-36d6a43ae9c4603c36d5602cc3fb15bf06c7ff97.tar.bz2 |
Add a mechanism to pause and resume geolocation requests. Currently Android WebView is the only platform to make use of this new API. We implement this as a new API on the Browser-side GeolocationDispatcherHost.
In doing so:
- Refactor the current LocationProvider such that it doesn't rely on ActivityStatus, updating LocationProviderTest accordingly
- Introduce ContentViewLocationTest.java that verifies the LocationProvider implementation is paused and resumed when the ContentView is hidde/shown
- Introduce a AwGeolocationTest that verifies the LocationProvider implementation is paused and resumed when the new API is invoked
- Introduce LocationProviderFactory and a MockLocationProvider to avoid relying on the system location provider when running tests, as it's not possible to enable mock locations on Android user builds without physical access to the device.
BUG=b/11336074
Review URL: https://codereview.chromium.org/65273002
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@240719 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'content/browser/geolocation/location_api_adapter_android.cc')
-rw-r--r-- | content/browser/geolocation/location_api_adapter_android.cc | 9 |
1 files changed, 5 insertions, 4 deletions
diff --git a/content/browser/geolocation/location_api_adapter_android.cc b/content/browser/geolocation/location_api_adapter_android.cc index 3ab693b..84cfd10 100644 --- a/content/browser/geolocation/location_api_adapter_android.cc +++ b/content/browser/geolocation/location_api_adapter_android.cc @@ -9,7 +9,7 @@ #include "base/bind.h" #include "base/location.h" #include "content/browser/geolocation/location_provider_android.h" -#include "jni/LocationProvider_jni.h" +#include "jni/LocationProviderAdapter_jni.h" using base::android::AttachCurrentThread; using base::android::CheckException; @@ -65,7 +65,7 @@ bool AndroidLocationApiAdapter::Start( CHECK(!java_location_provider_android_object_.is_null()); // We'll start receiving notifications from java in the main thread looper // until Stop() is called. - return Java_LocationProvider_start(env, + return Java_LocationProviderAdapter_start(env, java_location_provider_android_object_.obj(), high_accuracy); } @@ -84,7 +84,8 @@ void AndroidLocationApiAdapter::Stop() { location_provider_ = NULL; JNIEnv* env = AttachCurrentThread(); - Java_LocationProvider_stop(env, java_location_provider_android_object_.obj()); + Java_LocationProviderAdapter_stop( + env, java_location_provider_android_object_.obj()); java_location_provider_android_object_.Reset(); } @@ -143,7 +144,7 @@ bool AndroidLocationApiAdapter::RegisterGeolocationService(JNIEnv* env) { void AndroidLocationApiAdapter::CreateJavaObject(JNIEnv* env) { // Create the Java AndroidLocationProvider object. java_location_provider_android_object_.Reset( - Java_LocationProvider_create(env, + Java_LocationProviderAdapter_create(env, base::android::GetApplicationContext())); CHECK(!java_location_provider_android_object_.is_null()); } |