diff options
-rwxr-xr-x | WebKit/android/WebCoreSupport/GeolocationPermissions.cpp | 12 | ||||
-rwxr-xr-x | WebKit/android/WebCoreSupport/GeolocationPermissions.h | 2 | ||||
-rw-r--r-- | WebKit/android/jni/WebSettings.cpp | 5 |
3 files changed, 19 insertions, 0 deletions
diff --git a/WebKit/android/WebCoreSupport/GeolocationPermissions.cpp b/WebKit/android/WebCoreSupport/GeolocationPermissions.cpp index ca84f17..1462ce2 100755 --- a/WebKit/android/WebCoreSupport/GeolocationPermissions.cpp +++ b/WebKit/android/WebCoreSupport/GeolocationPermissions.cpp @@ -43,6 +43,7 @@ namespace android { // the browser closes and read them on startup. GeolocationPermissions::PermissionsMap GeolocationPermissions::s_permanentPermissions; GeolocationPermissions::GeolocationPermissionsVector GeolocationPermissions::s_instances; +bool GeolocationPermissions::s_alwaysDeny = false; GeolocationPermissions::GeolocationPermissions(WebViewCore* webViewCore, Frame* mainFrame) : m_webViewCore(webViewCore) @@ -66,6 +67,12 @@ void GeolocationPermissions::queryPermissionState(Frame* frame) // the SecurityOrigin pointer for equality is insufficient. String originString = frame->document()->securityOrigin()->toString(); + // If we've been told to always deny requests, do so. + if (s_alwaysDeny) { + makeAsynchronousCallbackToGeolocation(originString, false); + return; + } + // See if we have a record for this origin in the temporary permissions for // this tab. These take precedence over permanent permissions. PermissionsMap::const_iterator iter = m_temporaryPermissions.find(originString); @@ -243,4 +250,9 @@ void GeolocationPermissions::clearAll() s_permanentPermissions.clear(); } +void GeolocationPermissions::setAlwaysDeny(bool deny) +{ + s_alwaysDeny = deny; +} + } // namespace android diff --git a/WebKit/android/WebCoreSupport/GeolocationPermissions.h b/WebKit/android/WebCoreSupport/GeolocationPermissions.h index 1dbc3da..9ae11af 100755 --- a/WebKit/android/WebCoreSupport/GeolocationPermissions.h +++ b/WebKit/android/WebCoreSupport/GeolocationPermissions.h @@ -86,6 +86,7 @@ namespace android { static bool getAllowed(WebCore::String origin); static void clear(WebCore::String origin); static void clearAll(); + static void setAlwaysDeny(bool deny); private: // Records the permission state for the specified origin. @@ -128,6 +129,7 @@ namespace android { }; CallbackData m_callbackData; + static bool s_alwaysDeny; }; } // namespace android diff --git a/WebKit/android/jni/WebSettings.cpp b/WebKit/android/jni/WebSettings.cpp index eca03cc..dcc4ab6 100644 --- a/WebKit/android/jni/WebSettings.cpp +++ b/WebKit/android/jni/WebSettings.cpp @@ -100,6 +100,7 @@ struct FieldIds { #if ENABLE(WORKERS) mWorkersEnabled = env->GetFieldID(clazz, "mWorkersEnabled", "Z"); #endif + mGeolocationEnabled = env->GetFieldID(clazz, "mGeolocationEnabled", "Z"); mJavaScriptCanOpenWindowsAutomatically = env->GetFieldID(clazz, "mJavaScriptCanOpenWindowsAutomatically", "Z"); mUseWideViewport = env->GetFieldID(clazz, "mUseWideViewport", "Z"); @@ -195,6 +196,7 @@ struct FieldIds { #if ENABLE(DOM_STORAGE) jfieldID mDomStorageEnabled; #endif + jfieldID mGeolocationEnabled; #if ENABLE(DATABASE) || ENABLE(DOM_STORAGE) jfieldID mDatabasePath; #endif @@ -349,6 +351,9 @@ public: } } #endif + + flag = env->GetBooleanField(obj, gFieldIds->mGeolocationEnabled); + GeolocationPermissions::setAlwaysDeny(!flag); } }; |