os/security/contentmgmt/contentaccessfwfordrm/source/caf/Rightsmanager.cpp
changeset 0 bde4ae8d615e
     1.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
     1.2 +++ b/os/security/contentmgmt/contentaccessfwfordrm/source/caf/Rightsmanager.cpp	Fri Jun 15 03:10:57 2012 +0200
     1.3 @@ -0,0 +1,105 @@
     1.4 +/*
     1.5 +* Copyright (c) 2004-2009 Nokia Corporation and/or its subsidiary(-ies).
     1.6 +* All rights reserved.
     1.7 +* This component and the accompanying materials are made available
     1.8 +* under the terms of the License "Eclipse Public License v1.0"
     1.9 +* which accompanies this distribution, and is available
    1.10 +* at the URL "http://www.eclipse.org/legal/epl-v10.html".
    1.11 +*
    1.12 +* Initial Contributors:
    1.13 +* Nokia Corporation - initial contribution.
    1.14 +*
    1.15 +* Contributors:
    1.16 +*
    1.17 +* Description: 
    1.18 +*
    1.19 +*/
    1.20 +
    1.21 +
    1.22 +#include <caf/rightsmanager.h>
    1.23 +#include <caf/agentfactory.h>
    1.24 +#include "agentinfo.h"
    1.25 +#include <caf/agentinterface.h>
    1.26 +
    1.27 +using namespace ContentAccess;
    1.28 +
    1.29 +CRightsManager* CRightsManager::NewL(TUid aUid)
    1.30 +	{
    1.31 +	CRightsManager *self = new (ELeave) CRightsManager;
    1.32 +	CleanupStack::PushL(self);
    1.33 +	self->ConstructL(aUid);
    1.34 +	CleanupStack::Pop(self);
    1.35 +	return self;
    1.36 +	}
    1.37 +
    1.38 +CRightsManager::CRightsManager()
    1.39 +	{
    1.40 +	
    1.41 +	}
    1.42 +
    1.43 +CRightsManager::~CRightsManager()
    1.44 +	{
    1.45 +	delete iAgentRightsManager;
    1.46 +	delete iAgentFactory;
    1.47 +	REComSession::FinalClose();
    1.48 +	}
    1.49 +
    1.50 +void CRightsManager::ConstructL(TUid aUid)
    1.51 +	{	
    1.52 +	// create our own agent factory (de-facto session handle for ECOM)
    1.53 +	iAgentFactory = CAgentFactory::NewL(aUid);
    1.54 +
    1.55 +	// Create an instance of the Agent's CAgentData
    1.56 +	iAgentRightsManager = iAgentFactory->CreateRightsManagerL();
    1.57 +	}
    1.58 +
    1.59 +EXPORT_C void CRightsManager::ListAllRightsL(RStreamablePtrArray<CRightsInfo>& aArray) const
    1.60 +	{
    1.61 +	iAgentRightsManager->ListAllRightsL(aArray);
    1.62 +	}
    1.63 +
    1.64 +EXPORT_C void CRightsManager::ListRightsL(RStreamablePtrArray<CRightsInfo>& aArray, const TDesC& aUri) const
    1.65 +	{
    1.66 +	iAgentRightsManager->ListRightsL(aArray, aUri);
    1.67 +	}
    1.68 +
    1.69 +EXPORT_C void CRightsManager::ListRightsL(RStreamablePtrArray<CRightsInfo>& aArray, TVirtualPathPtr& aVirtualPath) const
    1.70 +	{
    1.71 +	iAgentRightsManager->ListRightsL(aArray, aVirtualPath);
    1.72 +	}
    1.73 +
    1.74 +EXPORT_C void CRightsManager::ListRightsL(RStreamablePtrArray<CRightsInfo>& aArray, RFile& aFile, const TDesC& aUniqueId) const	
    1.75 +	{
    1.76 +	iAgentRightsManager->ListRightsL(aArray, aFile, aUniqueId);
    1.77 +	}
    1.78 +
    1.79 +EXPORT_C void CRightsManager::ListContentL(RStreamablePtrArray<CVirtualPath>& aArray, CRightsInfo& aRightsInfo) const
    1.80 +	{
    1.81 +	iAgentRightsManager->ListContentL(aArray, aRightsInfo);
    1.82 +	}
    1.83 +
    1.84 +EXPORT_C MAgentRightsBase* CRightsManager::GetRightsDataL(const CRightsInfo& aRightsInfo) const
    1.85 +	{
    1.86 +	return iAgentRightsManager->GetRightsDataL(aRightsInfo);
    1.87 +	}
    1.88 +
    1.89 +EXPORT_C TInt CRightsManager::DeleteRightsObject(const CRightsInfo& aRightsInfo)
    1.90 +	{
    1.91 +	return iAgentRightsManager->DeleteRightsObject(aRightsInfo);
    1.92 +	}
    1.93 +
    1.94 +EXPORT_C TInt CRightsManager::DeleteAllRightsObjects(const TVirtualPathPtr& aVirtualPathPtr)
    1.95 +	{
    1.96 +	return iAgentRightsManager->DeleteAllRightsObjects(aVirtualPathPtr);
    1.97 +	}
    1.98 +
    1.99 +EXPORT_C TInt CRightsManager::DeleteAllRightsObjects (RFile& aFile, const TDesC& aUniqueId) 
   1.100 +	{
   1.101 +	return iAgentRightsManager->DeleteAllRightsObjects(aFile, aUniqueId);
   1.102 +	}
   1.103 +
   1.104 +EXPORT_C TInt CRightsManager::SetProperty(TAgentProperty aProperty, TInt aValue)
   1.105 +	{
   1.106 +	return iAgentRightsManager->SetProperty(aProperty, aValue);
   1.107 +	}
   1.108 +