aboutsummaryrefslogtreecommitdiffstats
path: root/embed/mozilla
diff options
context:
space:
mode:
Diffstat (limited to 'embed/mozilla')
-rw-r--r--embed/mozilla/EphySingle.cpp10
-rw-r--r--embed/mozilla/mozilla-embed-single.cpp26
2 files changed, 23 insertions, 13 deletions
diff --git a/embed/mozilla/EphySingle.cpp b/embed/mozilla/EphySingle.cpp
index 1762b2e18..b9566a329 100644
--- a/embed/mozilla/EphySingle.cpp
+++ b/embed/mozilla/EphySingle.cpp
@@ -301,21 +301,23 @@ mozilla_permission_to_ephy_permission (nsIPermission *perm)
PRUint32 cap;
perm->GetCapability(&cap);
- gboolean allowed;
+ EphyPermission permission;
switch (cap)
{
case nsIPermissionManager::ALLOW_ACTION:
- allowed = TRUE;
+ permission = EPHY_PERMISSION_ALLOWED;
break;
case nsIPermissionManager::DENY_ACTION:
+ permission = EPHY_PERMISSION_DENIED;
+ break;
case nsIPermissionManager::UNKNOWN_ACTION:
default :
- allowed = FALSE;
+ permission = EPHY_PERMISSION_DEFAULT;
break;
}
nsCString host;
perm->GetHost(host);
- return ephy_permission_info_new (host.get(), type, allowed);
+ return ephy_permission_info_new (host.get(), type, permission);
}
diff --git a/embed/mozilla/mozilla-embed-single.cpp b/embed/mozilla/mozilla-embed-single.cpp
index b6c0a22f2..f60c60bee 100644
--- a/embed/mozilla/mozilla-embed-single.cpp
+++ b/embed/mozilla/mozilla-embed-single.cpp
@@ -730,8 +730,11 @@ void
impl_permission_manager_add (EphyPermissionManager *manager,
const char *host,
EphyPermissionType type,
- gboolean allow)
+ EphyPermission permission)
{
+ /* can only set allow or deny */
+ g_return_if_fail (permission != EPHY_PERMISSION_DEFAULT);
+
nsresult result;
nsCOMPtr<nsIPermissionManager> pm
(do_GetService (NS_PERMISSIONMANAGER_CONTRACTID, &result));
@@ -741,6 +744,8 @@ impl_permission_manager_add (EphyPermissionManager *manager,
result = NS_NewURI(getter_AddRefs(uri), host);
if (NS_FAILED(result) || !uri) return;
+ gboolean allow = (permission == EPHY_PERMISSION_ALLOWED);
+
pm->Add (uri,
#if MOZILLA_SNAPSHOT >= 10
permission_type_string [type],
@@ -781,7 +786,7 @@ impl_permission_manager_clear (EphyPermissionManager *manager)
}
}
-gboolean
+EphyPermission
impl_permission_manager_test (EphyPermissionManager *manager,
const char *host,
EphyPermissionType type)
@@ -789,11 +794,11 @@ impl_permission_manager_test (EphyPermissionManager *manager,
nsresult result;
nsCOMPtr<nsIPermissionManager> pm
(do_GetService (NS_PERMISSIONMANAGER_CONTRACTID, &result));
- if (NS_FAILED (result) || !pm) return FALSE;
+ if (NS_FAILED (result) || !pm) return EPHY_PERMISSION_DEFAULT;
nsCOMPtr<nsIURI> uri;
result = NS_NewURI(getter_AddRefs(uri), host);
- if (NS_FAILED(result) || !uri) return FALSE;
+ if (NS_FAILED(result) || !uri) return EPHY_PERMISSION_DEFAULT;
PRUint32 action;
#if MOZILLA_SNAPSHOT >= 10
@@ -801,22 +806,25 @@ impl_permission_manager_test (EphyPermissionManager *manager,
#else
result = pm->TestPermission (uri, type, &action);
#endif
- if (NS_FAILED (result)) return FALSE;
+ if (NS_FAILED (result)) return EPHY_PERMISSION_DEFAULT;
+
+ EphyPermission permission;
- gboolean allow;
switch (action)
{
case nsIPermissionManager::ALLOW_ACTION:
- allow = TRUE;
+ permission = EPHY_PERMISSION_ALLOWED;
break;
case nsIPermissionManager::DENY_ACTION:
+ permission = EPHY_PERMISSION_DENIED;
+ break;
case nsIPermissionManager::UNKNOWN_ACTION:
default:
- allow = FALSE;
+ permission = EPHY_PERMISSION_DEFAULT;
break;
}
- return allow;
+ return permission;
}
GList *