OSDN Git Service

Cherry-pick WebKit change 55136 to add a means to cancel an ongoing Geolocation permi...
authorSteve Block <steveblock@google.com>
Tue, 23 Feb 2010 14:59:58 +0000 (14:59 +0000)
committerSteve Block <steveblock@google.com>
Tue, 23 Feb 2010 15:06:05 +0000 (15:06 +0000)
This is part of the change required to fix a Geolocation permissions bug.
See https://android-git.corp.google.com/g/#change,40601

Note that We take only the WebCore component of the change, but additional
changes are required to ChromeClientAndroid.

See http://trac.webkit.org/changeset/55136

Change-Id: Iff0eab3adc3e41876df7f114c0d50243d015664f

WebCore/page/Chrome.cpp
WebCore/page/Chrome.h
WebCore/page/ChromeClient.h
WebCore/page/Geolocation.cpp
WebKit/android/WebCoreSupport/ChromeClientAndroid.h

index 0b85535..d3b46ad 100644 (file)
@@ -417,6 +417,11 @@ void Chrome::requestGeolocationPermissionForFrame(Frame* frame, Geolocation* geo
     m_client->requestGeolocationPermissionForFrame(frame, geolocation);
 }
 
+void Chrome::cancelGeolocationPermissionRequestForFrame(Frame* frame)
+{
+    m_client->cancelGeolocationPermissionRequestForFrame(frame);
+}
+
 void Chrome::runOpenPanel(Frame* frame, PassRefPtr<FileChooser> fileChooser)
 {
     m_client->runOpenPanel(frame, fileChooser);
index 53dbb7a..3039b90 100644 (file)
@@ -133,6 +133,7 @@ namespace WebCore {
         void print(Frame*);
 
         void requestGeolocationPermissionForFrame(Frame*, Geolocation*);
+        void cancelGeolocationPermissionRequestForFrame(Frame*);
 
         void runOpenPanel(Frame*, PassRefPtr<FileChooser>);
 
index d4af73b..1615f3a 100644 (file)
@@ -185,8 +185,9 @@ namespace WebCore {
         virtual bool paintCustomScrollCorner(GraphicsContext*, const FloatRect&);
 
         // This can be either a synchronous or asynchronous call. The ChromeClient can display UI asking the user for permission
-        // to use Geolococation. The ChromeClient must call Geolocation::setShouldClearCache() appropriately.
+        // to use Geolocation.
         virtual void requestGeolocationPermissionForFrame(Frame*, Geolocation*) = 0;
+        virtual void cancelGeolocationPermissionRequestForFrame(Frame*) = 0;
             
         virtual void runOpenPanel(Frame*, PassRefPtr<FileChooser>) = 0;
 
index 9ca844c..161160a 100644 (file)
@@ -236,8 +236,12 @@ Geolocation::~Geolocation()
 void Geolocation::disconnectFrame()
 {
     stopUpdating();
-    if (m_frame && m_frame->document())
-        m_frame->document()->setUsingGeolocation(false);
+    if (m_frame) {
+        if (m_frame->document())
+            m_frame->document()->setUsingGeolocation(false);
+        if (m_frame->page() && m_allowGeolocation == InProgress)
+            m_frame->page()->chrome()->cancelGeolocationPermissionRequestForFrame(m_frame);
+    }
     m_frame = 0;
 }
 
index e75393b..15473ca 100644 (file)
@@ -143,6 +143,7 @@ namespace android {
 
         // Methods used to request and provide Geolocation permissions.
         virtual void requestGeolocationPermissionForFrame(Frame*, Geolocation*);
+        virtual void cancelGeolocationPermissionRequestForFrame(Frame*) { }
         // Android-specific
         void provideGeolocationPermissions(const String &origin, bool allow, bool remember);
         void storeGeolocationPermissions();