2 * Copyright (c) 2003-2006 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.
28 #ifndef __RIGHTSMANAGER_H__
29 #define __RIGHTSMANAGER_H__
32 #include <caf/caftypes.h>
33 #include <caf/streamableptrarray.h>
35 namespace ContentAccess
38 class TVirtualPathPtr;
43 class CAgentRightsManager;
44 class MAgentRightsBase;
47 Manages and retrieves rights objects from an agent.
52 class CRightsManager : public CBase
55 virtual ~CRightsManager();
58 /** List all rights held by the agent.
59 @param aArray The client supplied array used to store the CRightsInfo objects. The agent will add CRightsInfo objects to the supplied array.
60 @leave KErrPermissionDenied If the agent does not permit the client to access rights information.
61 @leave ... One of the CAF error codes defined in \c caferr.h
62 or one of the other system-wide error codes
64 @capability DRM Access to DRM rights is not permitted for processes without DRM capability.
66 IMPORT_C void ListAllRightsL(RStreamablePtrArray<CRightsInfo>& aArray) const;
68 /** List all rights associated with a particular file.
69 @param aArray The client supplied array used to store the CRightsInfo objects. The agent will add CRightsInfo objects to the supplied array.
70 @param aUri The name of the file.
71 @leave KErrPermissionDenied If the agent does not permit the client to access rights information.
72 @leave ... One of the CAF error codes defined in \c caferr.h
73 or one of the other system-wide error codes
75 @capability DRM Access to DRM rights is not permitted for processes without DRM capability.
77 IMPORT_C void ListRightsL(RStreamablePtrArray<CRightsInfo>& aArray, const TDesC& aUri) const;
79 /** List all rights associated with a particular content object
80 @param aArray The client supplied array used to store the CRightsInfo objects. The agent will add CRightsInfo objects to the supplied array.
81 @param aVirtualPath The content object.
82 @leave KErrPermissionDenied If the agent does not permit the client to access rights information.
83 @leave ... One of the CAF error codes defined in \c caferr.h
84 or one of the other system-wide error codes
86 @capability DRM Access to DRM rights is not permitted for processes without DRM capability.
88 IMPORT_C void ListRightsL(RStreamablePtrArray<CRightsInfo>& aArray, TVirtualPathPtr& aVirtualPath) const;
90 /** List all content associated with a particular rights object.
91 @param aArray The client supplied array used to store the list of content objects. The agent will add CVirtualPath objects to the supplied array.
92 @param aRightsInfo The rights object.
93 @leave KErrPermissionDenied If the agent does not permit the client to access rights information.
94 @leave ... One of the CAF error codes defined in \c caferr.h
95 or one of the other system-wide error codes
97 @capability DRM Access to DRM rights is not permitted for processes without DRM capability.
99 IMPORT_C void ListContentL(RStreamablePtrArray<CVirtualPath>& aArray, CRightsInfo& aRightsInfo) const;
101 /** This will be used by applications to retrieve an agent specific rights object
102 @param aRightsInfo The rights object.
103 @return An agent specific rights object.
104 @leave KErrPermissionDenied If the agent does not permit the client to access rights information.
105 @leave ... One of the CAF error codes defined in \c caferr.h
106 or one of the other system-wide error codes
107 for any other errors.
108 @capability DRM Access to DRM rights is not permitted for processes without DRM capability.
110 IMPORT_C MAgentRightsBase* GetRightsDataL(const CRightsInfo& aRightsInfo) const;
112 /** Asks the DRM agent to delete a rights object
114 The agent may display a dialog asking the user to confirm the delete. Execution
115 will be blocked until the dialog is complete. Applications can request
116 to disable the agents user interface using the SetProperty() command.
118 @param aRightsInfo The rights object.
119 @return The outcome of the delete operation.
120 @return KErrNone if the rights were deleted.
121 @return KErrCancel if the user cancels an agent supplied confirmation dialog.
122 @return KErrNotFound if the rights object does not exist.
123 @return KErrPermissionDenied if the agent does not permit the client to access rights information.
124 @capability DRM Access to DRM rights is not permitted for processes without DRM capability.
126 IMPORT_C TInt DeleteRightsObject(const CRightsInfo& aRightsInfo);
128 /** Deletes all rights associated with a particular content object
130 The agent may display a dialog asking the user to confirm the delete. Execution
131 will be blocked until the dialog is complete. Applications can request
132 to disable the agents user interface using the SetProperty() command.
134 @param aVirtualPathPtr The content object.
135 @return KErrNone if the rights were deleted.
136 @return KErrNotFound if no rights objects exist for the specified content object.
137 @return KErrCancel if the user cancels an agent supplied confirmation dialog.
138 @return KErrPermissionDenied if the agent does not permit the client to access rights information.
139 @capability DRM Access to DRM rights is not permitted for processes without DRM capability.
141 IMPORT_C TInt DeleteAllRightsObjects(const TVirtualPathPtr& aVirtualPathPtr);
144 /** Request the agent to set a property value. If the property is set
145 it is only set for this CRightsManager session and does not impact other CAF users.
147 @see ContentAccess::TAgentProperty
149 @param aProperty The property to set.
150 @param aValue The value of the property.
151 @return KErrNone if the property was set.
152 @return KErrCANotSupported if the agent does not support the property or value.
153 @return KErrAccessDenied if the agent does not permit the property to be changed.
154 @return KErrPermissionDenied if the application does not have the necessary capability to change the property.
155 @capability DRM Access to DRM protected content is not permitted for processes without DRM capability. Access to unprotected content is unrestricted.
157 IMPORT_C TInt SetProperty(TAgentProperty aProperty, TInt aValue);
161 friend class CManager;
163 /** Only created by CManager */
164 static CRightsManager* NewL(TUid aUid);
169 /** 2nd phase constructor */
170 virtual void ConstructL(TUid aUid);
173 CAgentFactory* iAgentFactory;
174 CAgentRightsManager* iAgentRightsManager;