Bug 782211 - Part 4: Add function to remote test for permission in nsIPermissionManager. r=cjones

This commit is contained in:
William Chen 2013-03-18 06:24:53 -07:00
Родитель cc741c6be0
Коммит 5125ca9fad
3 изменённых файлов: 37 добавлений и 0 удалений

Просмотреть файл

@ -2272,6 +2272,23 @@ ContentParent::RecvCloseAlert(const nsString& aName)
return true;
}
bool
ContentParent::RecvTestPermissionFromPrincipal(const IPC::Principal& aPrincipal,
const nsCString& aType,
uint32_t* permission)
{
nsCOMPtr<nsIPermissionManager> permissionManager =
do_GetService(NS_PERMISSIONMANAGER_CONTRACTID);
NS_ENSURE_TRUE(permissionManager, false);
nsresult rv = permissionManager->TestPermissionFromPrincipal(aPrincipal,
aType.get(),
permission);
NS_ENSURE_SUCCESS(rv, false);
return true;
}
bool
ContentParent::RecvSyncMessage(const nsString& aMsg,
const ClonedMessageData& aData,

Просмотреть файл

@ -333,6 +333,10 @@ private:
virtual bool RecvCloseAlert(const nsString& aName);
virtual bool RecvTestPermissionFromPrincipal(const IPC::Principal& aPrincipal,
const nsCString& aType,
uint32_t* permission);
virtual bool RecvLoadURIExternal(const URIParams& uri);
virtual bool RecvSyncMessage(const nsString& aMsg,

Просмотреть файл

@ -433,6 +433,22 @@ parent:
CloseAlert(nsString name);
/**
* Tests permission for a provided principal using the permission
* manager.
*
* @param principal
* The principal to test for the permissions.
* @param type
* The type of permission to for the principal.
*
* NOTE: The principal is untrusted in the parent process. Only
* principals that can live in the content process should
* be provided.
*/
sync TestPermissionFromPrincipal(Principal principal, nsCString type)
returns (uint32_t permission);
PExternalHelperApp(OptionalURIParams uri, nsCString aMimeContentType,
nsCString aContentDisposition, bool aForceSave,
int64_t aContentLength, OptionalURIParams aReferrer);