diff options
author | Christian Persch <chpe@cvs.gnome.org> | 2003-12-13 05:44:35 +0800 |
---|---|---|
committer | Christian Persch <chpe@src.gnome.org> | 2003-12-13 05:44:35 +0800 |
commit | a24d8402cd926c267682ede6f4325d8da0c4479d (patch) | |
tree | 9465fa6e65660158388323c570221d6ae19cc89e /embed/mozilla/mozilla-embed-single.cpp | |
parent | ac58742bbf40beaa31967cc8a75b4b3504e52f65 (diff) | |
download | gsoc2013-epiphany-a24d8402cd926c267682ede6f4325d8da0c4479d.tar gsoc2013-epiphany-a24d8402cd926c267682ede6f4325d8da0c4479d.tar.gz gsoc2013-epiphany-a24d8402cd926c267682ede6f4325d8da0c4479d.tar.bz2 gsoc2013-epiphany-a24d8402cd926c267682ede6f4325d8da0c4479d.tar.lz gsoc2013-epiphany-a24d8402cd926c267682ede6f4325d8da0c4479d.tar.xz gsoc2013-epiphany-a24d8402cd926c267682ede6f4325d8da0c4479d.tar.zst gsoc2013-epiphany-a24d8402cd926c267682ede6f4325d8da0c4479d.zip |
Fix permission return types.
2003-12-12 Christian Persch <chpe@cvs.gnome.org>
* embed/ephy-permission-manager.c: (ephy_permission_info_new),
(ephy_permission_info_copy), (ephy_permission_manager_add):
* embed/ephy-permission-manager.h:
* embed/mozilla/EphySingle.cpp:
* embed/mozilla/mozilla-embed-single.cpp:
Fix permission return types.
Diffstat (limited to 'embed/mozilla/mozilla-embed-single.cpp')
-rw-r--r-- | embed/mozilla/mozilla-embed-single.cpp | 26 |
1 files changed, 17 insertions, 9 deletions
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 * |