Index: android_webview/native/aw_contents.cc |
diff --git a/android_webview/native/aw_contents.cc b/android_webview/native/aw_contents.cc |
index 4bdcf7ee2662a29f596dde2c22969756fc4adf9e..016ef12b17a9081f9141518458d5a7e500b0c3f7 100644 |
--- a/android_webview/native/aw_contents.cc |
+++ b/android_webview/native/aw_contents.cc |
@@ -42,6 +42,7 @@ |
#include "content/public/browser/browser_thread.h" |
#include "content/public/browser/cert_store.h" |
#include "content/public/browser/favicon_status.h" |
+#include "content/public/browser/geolocation_provider.h" |
#include "content/public/browser/navigation_entry.h" |
#include "content/public/browser/render_process_host.h" |
#include "content/public/browser/render_view_host.h" |
@@ -157,6 +158,17 @@ GetRendererPreferencesSubpixelRenderingEnum( |
} |
} |
+void PauseOrResumeGeolocationUpdatesInternal(bool should_pause) { |
+ DCHECK(BrowserThread::CurrentlyOn(BrowserThread::IO)); |
+ if (should_pause) { |
+ content::GeolocationProvider::GetInstance()-> |
+ PauseAllLocationUpdateCallbacks(); |
+ } else { |
+ content::GeolocationProvider::GetInstance()-> |
+ ResumeAllLocationUpdateCallbacks(); |
+ } |
+} |
+ |
} // namespace |
// static |
@@ -342,6 +354,16 @@ static jint GetAwDrawGLFunction(JNIEnv* env, jclass) { |
} |
// static |
+void PauseOrResumeGeolocation(JNIEnv* env, |
+ jclass, |
+ jboolean should_pause) { |
+ content::BrowserThread::PostTask( |
+ content::BrowserThread::IO, |
+ FROM_HERE, |
+ base::Bind(&PauseOrResumeGeolocationUpdatesInternal, should_pause)); |
+} |
+ |
+// static |
jint GetNativeInstanceCount(JNIEnv* env, jclass) { |
return base::subtle::NoBarrier_Load(&g_instance_count); |
} |
@@ -692,6 +714,8 @@ void AwContents::SetWindowVisibility(JNIEnv* env, jobject obj, bool visible) { |
void AwContents::SetIsPaused(JNIEnv* env, jobject obj, bool paused) { |
browser_view_renderer_->SetIsPaused(paused); |
+ render_view_host_ext_->PauseOrResumeGeolocation(paused); |
+ |
if (paused) { |
ContentViewCore* cvc = |
ContentViewCore::FromWebContents(web_contents_.get()); |