1.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000
1.2 +++ b/os/security/contentmgmt/contentaccessfwfordrm/inc/rightsmanager.h Fri Jun 15 03:10:57 2012 +0200
1.3 @@ -0,0 +1,207 @@
1.4 +/*
1.5 +* Copyright (c) 2003-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 +/**
1.23 + @file
1.24 + @publishedPartner
1.25 + @released
1.26 +*/
1.27 +
1.28 +
1.29 +#ifndef __RIGHTSMANAGER_H__
1.30 +#define __RIGHTSMANAGER_H__
1.31 +
1.32 +#include <e32std.h>
1.33 +#include <caf/caftypes.h>
1.34 +#include <caf/streamableptrarray.h>
1.35 +#include <f32file.h>
1.36 +
1.37 +namespace ContentAccess
1.38 + {
1.39 +
1.40 + class TVirtualPathPtr;
1.41 + class CVirtualPath;
1.42 + class CRightsInfo;
1.43 + class CAgentInfo;
1.44 + class CAgentFactory;
1.45 + class CAgentRightsManager;
1.46 + class MAgentRightsBase;
1.47 +
1.48 + /**
1.49 + Manages and retrieves rights objects from an agent.
1.50 +
1.51 + @publishedPartner
1.52 + @released
1.53 + */
1.54 + class CRightsManager : public CBase
1.55 + {
1.56 + public:
1.57 + virtual ~CRightsManager();
1.58 +
1.59 + public:
1.60 + /** List all rights held by the agent.
1.61 + @param aArray The client supplied array used to store the CRightsInfo objects. The agent will add CRightsInfo objects to the supplied array.
1.62 + @leave KErrPermissionDenied If the agent does not permit the client to access rights information.
1.63 + @leave ... One of the CAF error codes defined in \c caferr.h
1.64 + or one of the other system-wide error codes
1.65 + for any other errors.
1.66 + @capability DRM Access to DRM rights is not permitted for processes without DRM capability.
1.67 + */
1.68 + IMPORT_C void ListAllRightsL(RStreamablePtrArray<CRightsInfo>& aArray) const;
1.69 +
1.70 + /** List all rights associated with a particular file.
1.71 + @param aArray The client supplied array used to store the CRightsInfo objects. The agent will add CRightsInfo objects to the supplied array.
1.72 + @param aUri The name of the file.
1.73 + @leave KErrPermissionDenied If the agent does not permit the client to access rights information.
1.74 + @leave ... One of the CAF error codes defined in \c caferr.h
1.75 + or one of the other system-wide error codes
1.76 + for any other errors.
1.77 + @capability DRM Access to DRM rights is not permitted for processes without DRM capability.
1.78 + */
1.79 + IMPORT_C void ListRightsL(RStreamablePtrArray<CRightsInfo>& aArray, const TDesC& aUri) const;
1.80 +
1.81 + /** List all rights associated with a particular content object
1.82 + @param aArray The client supplied array used to store the CRightsInfo objects. The agent will add CRightsInfo objects to the supplied array.
1.83 + @param aVirtualPath The content object.
1.84 + @leave KErrPermissionDenied If the agent does not permit the client to access rights information.
1.85 + @leave ... One of the CAF error codes defined in \c caferr.h
1.86 + or one of the other system-wide error codes
1.87 + for any other errors.
1.88 + @capability DRM Access to DRM rights is not permitted for processes without DRM capability.
1.89 + */
1.90 + IMPORT_C void ListRightsL(RStreamablePtrArray<CRightsInfo>& aArray, TVirtualPathPtr& aVirtualPath) const;
1.91 +
1.92 + /** 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.
1.93 +
1.94 + @param aArray The client supplied array used to store the CRightsInfo objects. The agent will add CRightsInfo objects to the supplied array.
1.95 + @param aFile The file handle for the file containing the content object.
1.96 + @param aUniqueId The unique id of the content object.
1.97 + @leave KErrCANotSupported if the feature not supported.
1.98 + @leave KErrPermissionDenied If the agent does not permit the client to access rights information.
1.99 + @leave ... One of the CAF error codes defined in \c caferr.h
1.100 + or one of the other system-wide error codes
1.101 + for any other errors.
1.102 + @capability DRM Access to DRM rights is not permitted for processes without DRM capability.
1.103 + */
1.104 + IMPORT_C void ListRightsL(RStreamablePtrArray<CRightsInfo>& aArray, RFile& aFile, const TDesC& aUniqueId) const;
1.105 +
1.106 + /** List all content associated with a particular rights object.
1.107 + @param aArray The client supplied array used to store the list of content objects. The agent will add CVirtualPath objects to the supplied array.
1.108 + @param aRightsInfo The rights object.
1.109 + @leave KErrPermissionDenied If the agent does not permit the client to access rights information.
1.110 + @leave ... One of the CAF error codes defined in \c caferr.h
1.111 + or one of the other system-wide error codes
1.112 + for any other errors.
1.113 + @capability DRM Access to DRM rights is not permitted for processes without DRM capability.
1.114 + */
1.115 + IMPORT_C void ListContentL(RStreamablePtrArray<CVirtualPath>& aArray, CRightsInfo& aRightsInfo) const;
1.116 +
1.117 + /** This will be used by applications to retrieve an agent specific rights object
1.118 + @param aRightsInfo The rights object.
1.119 + @return An agent specific rights object.
1.120 + @leave KErrPermissionDenied If the agent does not permit the client to access rights information.
1.121 + @leave ... One of the CAF error codes defined in \c caferr.h
1.122 + or one of the other system-wide error codes
1.123 + for any other errors.
1.124 + @capability DRM Access to DRM rights is not permitted for processes without DRM capability.
1.125 + */
1.126 + IMPORT_C MAgentRightsBase* GetRightsDataL(const CRightsInfo& aRightsInfo) const;
1.127 +
1.128 + /** Asks the DRM agent to delete a rights object
1.129 +
1.130 + The agent may display a dialog asking the user to confirm the delete. Execution
1.131 + will be blocked until the dialog is complete. Applications can request
1.132 + to disable the agents user interface using the SetProperty() command.
1.133 +
1.134 + @param aRightsInfo The rights object.
1.135 + @return The outcome of the delete operation.
1.136 + @return KErrNone if the rights were deleted.
1.137 + @return KErrCancel if the user cancels an agent supplied confirmation dialog.
1.138 + @return KErrNotFound if the rights object does not exist.
1.139 + @return KErrPermissionDenied if the agent does not permit the client to access rights information.
1.140 + @capability DRM Access to DRM rights is not permitted for processes without DRM capability.
1.141 + */
1.142 + IMPORT_C TInt DeleteRightsObject(const CRightsInfo& aRightsInfo);
1.143 +
1.144 + /** Deletes all rights associated with a particular content object
1.145 +
1.146 + The agent may display a dialog asking the user to confirm the delete. Execution
1.147 + will be blocked until the dialog is complete. Applications can request
1.148 + to disable the agents user interface using the SetProperty() command.
1.149 +
1.150 + @param aVirtualPathPtr The content object.
1.151 + @return KErrNone if the rights were deleted.
1.152 + @return KErrNotFound if no rights objects exist for the specified content object.
1.153 + @return KErrCancel if the user cancels an agent supplied confirmation dialog.
1.154 + @return KErrPermissionDenied if the agent does not permit the client to access rights information.
1.155 + @capability DRM Access to DRM rights is not permitted for processes without DRM capability.
1.156 + */
1.157 + IMPORT_C TInt DeleteAllRightsObjects(const TVirtualPathPtr& aVirtualPathPtr);
1.158 +
1.159 + /** 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.
1.160 +
1.161 + The agent may display a dialog asking the user to confirm the delete. Execution
1.162 + will be blocked until the dialog is complete. Applications can request
1.163 + to disable the agents user interface using the SetProperty() command.
1.164 +
1.165 + @param aFile The file handle for the file containing the content object.
1.166 + @param aUniqueId The unique id of the content object.
1.167 + @return The outcome of the delete operation.
1.168 + @return KErrNone if the rights were deleted.
1.169 + @return KErrNotFound if no rights objects exist for the specified content object.
1.170 + @return KErrCancel if the user cancels an agent supplied confirmation dialog.
1.171 + @return KErrPermissionDenied if the agent does not permit the client to access rights information.
1.172 + @return KErrCANotSupported if the feature not supported.
1.173 + @capability DRM Access to DRM rights is not permitted for processes without DRM capability.
1.174 + */
1.175 + IMPORT_C TInt DeleteAllRightsObjects (RFile& aFile, const TDesC& aUniqueId);
1.176 +
1.177 + /** Request the agent to set a property value. If the property is set
1.178 + it is only set for this CRightsManager session and does not impact other CAF users.
1.179 +
1.180 + @see ContentAccess::TAgentProperty
1.181 +
1.182 + @param aProperty The property to set.
1.183 + @param aValue The value of the property.
1.184 + @return KErrNone if the property was set.
1.185 + @return KErrCANotSupported if the agent does not support the property or value.
1.186 + @return KErrAccessDenied if the agent does not permit the property to be changed.
1.187 + @return KErrPermissionDenied if the application does not have the necessary capability to change the property.
1.188 + @capability DRM Access to DRM protected content is not permitted for processes without DRM capability. Access to unprotected content is unrestricted.
1.189 + */
1.190 + IMPORT_C TInt SetProperty(TAgentProperty aProperty, TInt aValue);
1.191 +
1.192 + private:
1.193 +
1.194 + friend class CManager;
1.195 +
1.196 + /** Only created by CManager */
1.197 + static CRightsManager* NewL(TUid aUid);
1.198 +
1.199 + /** Constructor */
1.200 + CRightsManager();
1.201 +
1.202 + /** 2nd phase constructor */
1.203 + virtual void ConstructL(TUid aUid);
1.204 +
1.205 + private:
1.206 + CAgentFactory* iAgentFactory;
1.207 + CAgentRightsManager* iAgentRightsManager;
1.208 + };
1.209 + }
1.210 +#endif