diff options
| author | Steve Block <steveblock@google.com> | 2009-11-08 07:56:39 +0000 |
|---|---|---|
| committer | Steve Block <steveblock@google.com> | 2009-11-09 22:10:22 +0000 |
| commit | 7de0f59ef4a50e0a204f9918636f10b254865d5e (patch) | |
| tree | f6a560781163bef9625d941229d12927893da66f /WebKit | |
| parent | b9fca1a768e8d5f3948b492fb962210af28d8d23 (diff) | |
| download | external_webkit-7de0f59ef4a50e0a204f9918636f10b254865d5e.zip external_webkit-7de0f59ef4a50e0a204f9918636f10b254865d5e.tar.gz external_webkit-7de0f59ef4a50e0a204f9918636f10b254865d5e.tar.bz2 | |
Stop Geolocation service when browser tab is in the background. Do not merge.
This is a fix for bug http://b/issue?id=2211437
This has already been submitted to Eclair MR2 branch.
Change-Id: I43c19e84fda6291590ff2f07bbadb18a4f86df5f
Diffstat (limited to 'WebKit')
| -rw-r--r-- | WebKit/android/jni/WebViewCore.cpp | 17 |
1 files changed, 17 insertions, 0 deletions
diff --git a/WebKit/android/jni/WebViewCore.cpp b/WebKit/android/jni/WebViewCore.cpp index f129600..b16a69d 100644 --- a/WebKit/android/jni/WebViewCore.cpp +++ b/WebKit/android/jni/WebViewCore.cpp @@ -35,6 +35,7 @@ #include "Color.h" #include "DatabaseTracker.h" #include "Document.h" +#include "DOMWindow.h" #include "Element.h" #include "Editor.h" #include "EditorClientAndroid.h" @@ -47,6 +48,7 @@ #include "FrameLoaderClientAndroid.h" #include "FrameTree.h" #include "FrameView.h" +#include "Geolocation.h" #include "GraphicsContext.h" #include "GraphicsJNI.h" #include "HitTestResult.h" @@ -64,6 +66,7 @@ #include "InlineTextBox.h" #include <JNIHelp.h> #include "KeyboardCodes.h" +#include "Navigator.h" #include "Node.h" #include "Page.h" #include "PageGroup.h" @@ -2773,6 +2776,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; @@ -2781,6 +2791,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; |
