summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rwxr-xr-xWebKit/android/WebCoreSupport/GeolocationPermissions.cpp26
-rwxr-xr-xWebKit/android/WebCoreSupport/GeolocationPermissions.h4
-rwxr-xr-xWebKit/android/jni/GeolocationPermissionsBridge.cpp8
3 files changed, 27 insertions, 11 deletions
diff --git a/WebKit/android/WebCoreSupport/GeolocationPermissions.cpp b/WebKit/android/WebCoreSupport/GeolocationPermissions.cpp
index dfce970..a0b234b 100755
--- a/WebKit/android/WebCoreSupport/GeolocationPermissions.cpp
+++ b/WebKit/android/WebCoreSupport/GeolocationPermissions.cpp
@@ -79,19 +79,20 @@ void GeolocationPermissions::queryPermissionState(Frame* frame)
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);
- PermissionsMap::const_iterator end = m_temporaryPermissions.end();
+ // See if we have a record for this origin in the permanent permissions.
+ // These take precedence over temporary permissions so that changes made
+ // from the browser settings work as intended.
+ PermissionsMap::const_iterator iter = s_permanentPermissions.find(originString);
+ PermissionsMap::const_iterator end = s_permanentPermissions.end();
if (iter != end) {
bool allow = iter->second;
makeAsynchronousCallbackToGeolocation(originString, allow);
return;
}
- // Check the permanent permisions.
- iter = s_permanentPermissions.find(originString);
- end = s_permanentPermissions.end();
+ // Check the temporary permisions.
+ iter = m_temporaryPermissions.find(originString);
+ end = m_temporaryPermissions.end();
if (iter != end) {
bool allow = iter->second;
makeAsynchronousCallbackToGeolocation(originString, allow);
@@ -158,9 +159,6 @@ void GeolocationPermissions::recordPermissionState(String origin, bool allow, bo
{
if (remember) {
s_permanentPermissions.set(m_originInProgress, allow);
- // If we already have a temporary permission for this origin, remove it,
- // so that later clearing the permanent permission works as expected.
- m_temporaryPermissions.remove(origin);
} else {
// It's possible that another tab recorded a permanent permission for
// this origin while our request was in progress, but we record it
@@ -258,6 +256,14 @@ void GeolocationPermissions::clear(String origin)
maybeStorePermanentPermissions();
}
+void GeolocationPermissions::allow(String origin)
+{
+ maybeLoadPermanentPermissions();
+ // We replace any existing permanent permission.
+ s_permanentPermissions.set(origin, true);
+ maybeStorePermanentPermissions();
+}
+
void GeolocationPermissions::clearAll()
{
maybeLoadPermanentPermissions();
diff --git a/WebKit/android/WebCoreSupport/GeolocationPermissions.h b/WebKit/android/WebCoreSupport/GeolocationPermissions.h
index 30d3be4..b0ba3ec 100755
--- a/WebKit/android/WebCoreSupport/GeolocationPermissions.h
+++ b/WebKit/android/WebCoreSupport/GeolocationPermissions.h
@@ -80,11 +80,13 @@ namespace android {
void resetTemporaryPermissionStates();
// Static methods for use from Java. These are used to interact with the
- // browser settings menu.
+ // browser settings menu and to update the permanent permissions when
+ // system settings are changed.
typedef HashSet<WebCore::String> OriginSet;
static OriginSet getOrigins();
static bool getAllowed(WebCore::String origin);
static void clear(WebCore::String origin);
+ static void allow(WebCore::String origin);
static void clearAll();
static void setAlwaysDeny(bool deny);
diff --git a/WebKit/android/jni/GeolocationPermissionsBridge.cpp b/WebKit/android/jni/GeolocationPermissionsBridge.cpp
index ddcca5d..0eeab3a 100755
--- a/WebKit/android/jni/GeolocationPermissionsBridge.cpp
+++ b/WebKit/android/jni/GeolocationPermissionsBridge.cpp
@@ -69,6 +69,12 @@ static void clear(JNIEnv* env, jobject obj, jstring origin)
GeolocationPermissions::clear(originString);
}
+static void allow(JNIEnv* env, jobject obj, jstring origin)
+{
+ WebCore::String originString = to_string(env, origin);
+ GeolocationPermissions::allow(originString);
+}
+
static void clearAll(JNIEnv* env, jobject obj)
{
GeolocationPermissions::clearAll();
@@ -84,6 +90,8 @@ static JNINativeMethod gGeolocationPermissionsMethods[] = {
(void*) getAllowed },
{ "nativeClear", "(Ljava/lang/String;)V",
(void*) clear },
+ { "nativeAllow", "(Ljava/lang/String;)V",
+ (void*) allow },
{ "nativeClearAll", "()V",
(void*) clearAll }
};