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