First public contribution.
2 * Copyright (c) 2003-2009 Nokia Corporation and/or its subsidiary(-ies).
4 * This component and the accompanying materials are made available
5 * under the terms of the License "Eclipse Public License v1.0"
6 * which accompanies this distribution, and is available
7 * at the URL "http://www.eclipse.org/legal/epl-v10.html".
9 * Initial Contributors:
10 * Nokia Corporation - initial contribution.
26 #ifndef __RIGHTSMANAGER_H__
27 #define __RIGHTSMANAGER_H__
30 #include <caf/caftypes.h>
31 #include <caf/streamableptrarray.h>
34 namespace ContentAccess
37 class TVirtualPathPtr;
42 class CAgentRightsManager;
43 class MAgentRightsBase;
46 Manages and retrieves rights objects from an agent.
51 class CRightsManager : public CBase
54 virtual ~CRightsManager();
57 /** List all rights held by the agent.
58 @param aArray The client supplied array used to store the CRightsInfo objects. The agent will add CRightsInfo objects to the supplied array.
59 @leave KErrPermissionDenied If the agent does not permit the client to access rights information.
60 @leave ... One of the CAF error codes defined in \c caferr.h
61 or one of the other system-wide error codes
63 @capability DRM Access to DRM rights is not permitted for processes without DRM capability.
65 IMPORT_C void ListAllRightsL(RStreamablePtrArray<CRightsInfo>& aArray) const;
67 /** List all rights associated with a particular file.
68 @param aArray The client supplied array used to store the CRightsInfo objects. The agent will add CRightsInfo objects to the supplied array.
69 @param aUri The name of the file.
70 @leave KErrPermissionDenied If the agent does not permit the client to access rights information.
71 @leave ... One of the CAF error codes defined in \c caferr.h
72 or one of the other system-wide error codes
74 @capability DRM Access to DRM rights is not permitted for processes without DRM capability.
76 IMPORT_C void ListRightsL(RStreamablePtrArray<CRightsInfo>& aArray, const TDesC& aUri) const;
78 /** List all rights associated with a particular content object
79 @param aArray The client supplied array used to store the CRightsInfo objects. The agent will add CRightsInfo objects to the supplied array.
80 @param aVirtualPath The content object.
81 @leave KErrPermissionDenied If the agent does not permit the client to access rights information.
82 @leave ... One of the CAF error codes defined in \c caferr.h
83 or one of the other system-wide error codes
85 @capability DRM Access to DRM rights is not permitted for processes without DRM capability.
87 IMPORT_C void ListRightsL(RStreamablePtrArray<CRightsInfo>& aArray, TVirtualPathPtr& aVirtualPath) const;
89 /** 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.
91 @param aArray The client supplied array used to store the CRightsInfo objects. The agent will add CRightsInfo objects to the supplied array.
92 @param aFile The file handle for the file containing the content object.
93 @param aUniqueId The unique id of the content object.
94 @leave KErrCANotSupported if the feature not supported.
95 @leave KErrPermissionDenied If the agent does not permit the client to access rights information.
96 @leave ... One of the CAF error codes defined in \c caferr.h
97 or one of the other system-wide error codes
99 @capability DRM Access to DRM rights is not permitted for processes without DRM capability.
101 IMPORT_C void ListRightsL(RStreamablePtrArray<CRightsInfo>& aArray, RFile& aFile, const TDesC& aUniqueId) const;
103 /** List all content associated with a particular rights object.
104 @param aArray The client supplied array used to store the list of content objects. The agent will add CVirtualPath objects to the supplied array.
105 @param aRightsInfo The rights object.
106 @leave KErrPermissionDenied If the agent does not permit the client to access rights information.
107 @leave ... One of the CAF error codes defined in \c caferr.h
108 or one of the other system-wide error codes
109 for any other errors.
110 @capability DRM Access to DRM rights is not permitted for processes without DRM capability.
112 IMPORT_C void ListContentL(RStreamablePtrArray<CVirtualPath>& aArray, CRightsInfo& aRightsInfo) const;
114 /** This will be used by applications to retrieve an agent specific rights object
115 @param aRightsInfo The rights object.
116 @return An agent specific rights object.
117 @leave KErrPermissionDenied If the agent does not permit the client to access rights information.
118 @leave ... One of the CAF error codes defined in \c caferr.h
119 or one of the other system-wide error codes
120 for any other errors.
121 @capability DRM Access to DRM rights is not permitted for processes without DRM capability.
123 IMPORT_C MAgentRightsBase* GetRightsDataL(const CRightsInfo& aRightsInfo) const;
125 /** Asks the DRM agent to delete a rights object
127 The agent may display a dialog asking the user to confirm the delete. Execution
128 will be blocked until the dialog is complete. Applications can request
129 to disable the agents user interface using the SetProperty() command.
131 @param aRightsInfo The rights object.
132 @return The outcome of the delete operation.
133 @return KErrNone if the rights were deleted.
134 @return KErrCancel if the user cancels an agent supplied confirmation dialog.
135 @return KErrNotFound if the rights object does not exist.
136 @return KErrPermissionDenied if the agent does not permit the client to access rights information.
137 @capability DRM Access to DRM rights is not permitted for processes without DRM capability.
139 IMPORT_C TInt DeleteRightsObject(const CRightsInfo& aRightsInfo);
141 /** Deletes all rights associated with a particular content object
143 The agent may display a dialog asking the user to confirm the delete. Execution
144 will be blocked until the dialog is complete. Applications can request
145 to disable the agents user interface using the SetProperty() command.
147 @param aVirtualPathPtr The content object.
148 @return KErrNone if the rights were deleted.
149 @return KErrNotFound if no rights objects exist for the specified content object.
150 @return KErrCancel if the user cancels an agent supplied confirmation dialog.
151 @return KErrPermissionDenied if the agent does not permit the client to access rights information.
152 @capability DRM Access to DRM rights is not permitted for processes without DRM capability.
154 IMPORT_C TInt DeleteAllRightsObjects(const TVirtualPathPtr& aVirtualPathPtr);
156 /** 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.
158 The agent may display a dialog asking the user to confirm the delete. Execution
159 will be blocked until the dialog is complete. Applications can request
160 to disable the agents user interface using the SetProperty() command.
162 @param aFile The file handle for the file containing the content object.
163 @param aUniqueId The unique id of the content object.
164 @return The outcome of the delete operation.
165 @return KErrNone if the rights were deleted.
166 @return KErrNotFound if no rights objects exist for the specified content object.
167 @return KErrCancel if the user cancels an agent supplied confirmation dialog.
168 @return KErrPermissionDenied if the agent does not permit the client to access rights information.
169 @return KErrCANotSupported if the feature not supported.
170 @capability DRM Access to DRM rights is not permitted for processes without DRM capability.
172 IMPORT_C TInt DeleteAllRightsObjects (RFile& aFile, const TDesC& aUniqueId);
174 /** Request the agent to set a property value. If the property is set
175 it is only set for this CRightsManager session and does not impact other CAF users.
177 @see ContentAccess::TAgentProperty
179 @param aProperty The property to set.
180 @param aValue The value of the property.
181 @return KErrNone if the property was set.
182 @return KErrCANotSupported if the agent does not support the property or value.
183 @return KErrAccessDenied if the agent does not permit the property to be changed.
184 @return KErrPermissionDenied if the application does not have the necessary capability to change the property.
185 @capability DRM Access to DRM protected content is not permitted for processes without DRM capability. Access to unprotected content is unrestricted.
187 IMPORT_C TInt SetProperty(TAgentProperty aProperty, TInt aValue);
191 friend class CManager;
193 /** Only created by CManager */
194 static CRightsManager* NewL(TUid aUid);
199 /** 2nd phase constructor */
200 virtual void ConstructL(TUid aUid);
203 CAgentFactory* iAgentFactory;
204 CAgentRightsManager* iAgentRightsManager;