diff options
author | Steve Block <steveblock@google.com> | 2009-10-28 11:29:58 +0000 |
---|---|---|
committer | Steve Block <steveblock@google.com> | 2009-11-05 06:42:49 +0000 |
commit | b999b2f567121b11fe014341931a72a5a7a6f4b4 (patch) | |
tree | 6d8ec5a53c72e138a3379ca2c3b1290c4e6e5be7 /WebKit/android/jni | |
parent | 2675a5cf2dfbe6a2b08e57bd2e7594c68e8025a2 (diff) | |
download | external_webkit-b999b2f567121b11fe014341931a72a5a7a6f4b4.zip external_webkit-b999b2f567121b11fe014341931a72a5a7a6f4b4.tar.gz external_webkit-b999b2f567121b11fe014341931a72a5a7a6f4b4.tar.bz2 |
Stop Geolocation service when browser tab is in the background.
This is a fix for bug http://b/issue?id=2211437
Change-Id: Id44b5b5679a302ecb16d5f493ea900d252faf2dc
Diffstat (limited to 'WebKit/android/jni')
-rw-r--r-- | WebKit/android/jni/WebViewCore.cpp | 16 |
1 files changed, 16 insertions, 0 deletions
diff --git a/WebKit/android/jni/WebViewCore.cpp b/WebKit/android/jni/WebViewCore.cpp index 1588967..53f9fd0 100644 --- a/WebKit/android/jni/WebViewCore.cpp +++ b/WebKit/android/jni/WebViewCore.cpp @@ -47,6 +47,7 @@ #include "FrameLoaderClientAndroid.h" #include "FrameTree.h" #include "FrameView.h" +#include "Geolocation.h" #include "GraphicsContext.h" #include "GraphicsJNI.h" #include "HitTestResult.h" @@ -64,6 +65,7 @@ #include "InlineTextBox.h" #include <JNIHelp.h> #include "KeyboardCodes.h" +#include "Navigator.h" #include "Node.h" #include "Page.h" #include "PageGroup.h" @@ -2986,6 +2988,13 @@ static void Pause(JNIEnv* env, jobject obj) ChromeClientAndroid* chromeClientAndroid = static_cast<ChromeClientAndroid*>(chromeClient); chromeClientAndroid->storeGeolocationPermissions(); + Frame* mainFrame = GET_NATIVE_VIEW(env, obj)->mainFrame(); + for (Frame* frame = mainFrame; frame; frame = frame->tree()->traverseNext()) { + Geolocation* geolocation = frame->domWindow()->navigator()->optionalGeolocation(); + if (geolocation) + geolocation->suspend(); + } + ANPEvent event; SkANP::InitEvent(&event, kLifecycle_ANPEventType); event.data.lifecycle.action = kPause_ANPLifecycleAction; @@ -2994,6 +3003,13 @@ static void Pause(JNIEnv* env, jobject obj) static void Resume(JNIEnv* env, jobject obj) { + Frame* mainFrame = GET_NATIVE_VIEW(env, obj)->mainFrame(); + for (Frame* frame = mainFrame; frame; frame = frame->tree()->traverseNext()) { + Geolocation* geolocation = frame->domWindow()->navigator()->optionalGeolocation(); + if (geolocation) + geolocation->resume(); + } + ANPEvent event; SkANP::InitEvent(&event, kLifecycle_ANPEventType); event.data.lifecycle.action = kResume_ANPLifecycleAction; |