williamr@2: /* williamr@2: * Copyright (c) 2003-2006 Nokia Corporation and/or its subsidiary(-ies). williamr@2: * All rights reserved. williamr@2: * This component and the accompanying materials are made available williamr@2: * under the terms of the License "Eclipse Public License v1.0" williamr@2: * which accompanies this distribution, and is available williamr@2: * at the URL "http://www.eclipse.org/legal/epl-v10.html". williamr@2: * williamr@2: * Initial Contributors: williamr@2: * Nokia Corporation - initial contribution. williamr@2: * williamr@2: * Contributors: williamr@2: * williamr@2: * Description: williamr@2: * williamr@2: */ williamr@2: williamr@2: williamr@2: williamr@2: /** williamr@2: @file williamr@2: williamr@2: @publishedPartner williamr@2: @released williamr@2: */ williamr@2: williamr@2: williamr@2: #ifndef __RIGHTSMANAGER_H__ williamr@2: #define __RIGHTSMANAGER_H__ williamr@2: williamr@2: #include <e32std.h> williamr@2: #include <caf/caftypes.h> williamr@2: #include <caf/streamableptrarray.h> williamr@2: williamr@2: namespace ContentAccess williamr@2: { williamr@2: williamr@2: class TVirtualPathPtr; williamr@2: class CVirtualPath; williamr@2: class CRightsInfo; williamr@2: class CAgentInfo; williamr@2: class CAgentFactory; williamr@2: class CAgentRightsManager; williamr@2: class MAgentRightsBase; williamr@2: williamr@2: /** williamr@2: Manages and retrieves rights objects from an agent. williamr@2: williamr@2: @publishedPartner williamr@2: @released williamr@2: */ williamr@2: class CRightsManager : public CBase williamr@2: { williamr@2: public: williamr@2: virtual ~CRightsManager(); williamr@2: williamr@2: public: williamr@2: /** List all rights held by the agent. williamr@2: @param aArray The client supplied array used to store the CRightsInfo objects. The agent will add CRightsInfo objects to the supplied array. williamr@2: @leave KErrPermissionDenied If the agent does not permit the client to access rights information. williamr@2: @leave ... One of the CAF error codes defined in \c caferr.h williamr@2: or one of the other system-wide error codes williamr@2: for any other errors. williamr@2: @capability DRM Access to DRM rights is not permitted for processes without DRM capability. williamr@2: */ williamr@2: IMPORT_C void ListAllRightsL(RStreamablePtrArray<CRightsInfo>& aArray) const; williamr@2: williamr@2: /** List all rights associated with a particular file. williamr@2: @param aArray The client supplied array used to store the CRightsInfo objects. The agent will add CRightsInfo objects to the supplied array. williamr@2: @param aUri The name of the file. williamr@2: @leave KErrPermissionDenied If the agent does not permit the client to access rights information. williamr@2: @leave ... One of the CAF error codes defined in \c caferr.h williamr@2: or one of the other system-wide error codes williamr@2: for any other errors. williamr@2: @capability DRM Access to DRM rights is not permitted for processes without DRM capability. williamr@2: */ williamr@2: IMPORT_C void ListRightsL(RStreamablePtrArray<CRightsInfo>& aArray, const TDesC& aUri) const; williamr@2: williamr@2: /** List all rights associated with a particular content object williamr@2: @param aArray The client supplied array used to store the CRightsInfo objects. The agent will add CRightsInfo objects to the supplied array. williamr@2: @param aVirtualPath The content object. williamr@2: @leave KErrPermissionDenied If the agent does not permit the client to access rights information. williamr@2: @leave ... One of the CAF error codes defined in \c caferr.h williamr@2: or one of the other system-wide error codes williamr@2: for any other errors. williamr@2: @capability DRM Access to DRM rights is not permitted for processes without DRM capability. williamr@2: */ williamr@2: IMPORT_C void ListRightsL(RStreamablePtrArray<CRightsInfo>& aArray, TVirtualPathPtr& aVirtualPath) const; williamr@2: williamr@2: /** List all content associated with a particular rights object. williamr@2: @param aArray The client supplied array used to store the list of content objects. The agent will add CVirtualPath objects to the supplied array. williamr@2: @param aRightsInfo The rights object. williamr@2: @leave KErrPermissionDenied If the agent does not permit the client to access rights information. williamr@2: @leave ... One of the CAF error codes defined in \c caferr.h williamr@2: or one of the other system-wide error codes williamr@2: for any other errors. williamr@2: @capability DRM Access to DRM rights is not permitted for processes without DRM capability. williamr@2: */ williamr@2: IMPORT_C void ListContentL(RStreamablePtrArray<CVirtualPath>& aArray, CRightsInfo& aRightsInfo) const; williamr@2: williamr@2: /** This will be used by applications to retrieve an agent specific rights object williamr@2: @param aRightsInfo The rights object. williamr@2: @return An agent specific rights object. williamr@2: @leave KErrPermissionDenied If the agent does not permit the client to access rights information. williamr@2: @leave ... One of the CAF error codes defined in \c caferr.h williamr@2: or one of the other system-wide error codes williamr@2: for any other errors. williamr@2: @capability DRM Access to DRM rights is not permitted for processes without DRM capability. williamr@2: */ williamr@2: IMPORT_C MAgentRightsBase* GetRightsDataL(const CRightsInfo& aRightsInfo) const; williamr@2: williamr@2: /** Asks the DRM agent to delete a rights object williamr@2: williamr@2: The agent may display a dialog asking the user to confirm the delete. Execution williamr@2: will be blocked until the dialog is complete. Applications can request williamr@2: to disable the agents user interface using the SetProperty() command. williamr@2: williamr@2: @param aRightsInfo The rights object. williamr@2: @return The outcome of the delete operation. williamr@2: @return KErrNone if the rights were deleted. williamr@2: @return KErrCancel if the user cancels an agent supplied confirmation dialog. williamr@2: @return KErrNotFound if the rights object does not exist. williamr@2: @return KErrPermissionDenied if the agent does not permit the client to access rights information. williamr@2: @capability DRM Access to DRM rights is not permitted for processes without DRM capability. williamr@2: */ williamr@2: IMPORT_C TInt DeleteRightsObject(const CRightsInfo& aRightsInfo); williamr@2: williamr@2: /** Deletes all rights associated with a particular content object williamr@2: williamr@2: The agent may display a dialog asking the user to confirm the delete. Execution williamr@2: will be blocked until the dialog is complete. Applications can request williamr@2: to disable the agents user interface using the SetProperty() command. williamr@2: williamr@2: @param aVirtualPathPtr The content object. williamr@2: @return KErrNone if the rights were deleted. williamr@2: @return KErrNotFound if no rights objects exist for the specified content object. williamr@2: @return KErrCancel if the user cancels an agent supplied confirmation dialog. williamr@2: @return KErrPermissionDenied if the agent does not permit the client to access rights information. williamr@2: @capability DRM Access to DRM rights is not permitted for processes without DRM capability. williamr@2: */ williamr@2: IMPORT_C TInt DeleteAllRightsObjects(const TVirtualPathPtr& aVirtualPathPtr); williamr@2: williamr@2: williamr@2: /** Request the agent to set a property value. If the property is set williamr@2: it is only set for this CRightsManager session and does not impact other CAF users. williamr@2: williamr@2: @see ContentAccess::TAgentProperty williamr@2: williamr@2: @param aProperty The property to set. williamr@2: @param aValue The value of the property. williamr@2: @return KErrNone if the property was set. williamr@2: @return KErrCANotSupported if the agent does not support the property or value. williamr@2: @return KErrAccessDenied if the agent does not permit the property to be changed. williamr@2: @return KErrPermissionDenied if the application does not have the necessary capability to change the property. williamr@2: @capability DRM Access to DRM protected content is not permitted for processes without DRM capability. Access to unprotected content is unrestricted. williamr@2: */ williamr@2: IMPORT_C TInt SetProperty(TAgentProperty aProperty, TInt aValue); williamr@2: williamr@2: private: williamr@2: williamr@2: friend class CManager; williamr@2: williamr@2: /** Only created by CManager */ williamr@2: static CRightsManager* NewL(TUid aUid); williamr@2: williamr@2: /** Constructor */ williamr@2: CRightsManager(); williamr@2: williamr@2: /** 2nd phase constructor */ williamr@2: virtual void ConstructL(TUid aUid); williamr@2: williamr@2: private: williamr@2: CAgentFactory* iAgentFactory; williamr@2: CAgentRightsManager* iAgentRightsManager; williamr@2: }; williamr@2: } williamr@2: #endif