|
1 /* |
|
2 * Copyright (c) 2003-2006 Nokia Corporation and/or its subsidiary(-ies). |
|
3 * All rights reserved. |
|
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". |
|
8 * |
|
9 * Initial Contributors: |
|
10 * Nokia Corporation - initial contribution. |
|
11 * |
|
12 * Contributors: |
|
13 * |
|
14 * Description: |
|
15 * |
|
16 */ |
|
17 |
|
18 |
|
19 |
|
20 /** |
|
21 @file |
|
22 |
|
23 @publishedPartner |
|
24 @released |
|
25 */ |
|
26 |
|
27 |
|
28 #ifndef __RIGHTSMANAGER_H__ |
|
29 #define __RIGHTSMANAGER_H__ |
|
30 |
|
31 #include <e32std.h> |
|
32 #include <caf/caftypes.h> |
|
33 #include <caf/streamableptrarray.h> |
|
34 |
|
35 namespace ContentAccess |
|
36 { |
|
37 |
|
38 class TVirtualPathPtr; |
|
39 class CVirtualPath; |
|
40 class CRightsInfo; |
|
41 class CAgentInfo; |
|
42 class CAgentFactory; |
|
43 class CAgentRightsManager; |
|
44 class MAgentRightsBase; |
|
45 |
|
46 /** |
|
47 Manages and retrieves rights objects from an agent. |
|
48 |
|
49 @publishedPartner |
|
50 @released |
|
51 */ |
|
52 class CRightsManager : public CBase |
|
53 { |
|
54 public: |
|
55 virtual ~CRightsManager(); |
|
56 |
|
57 public: |
|
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 |
|
63 for any other errors. |
|
64 @capability DRM Access to DRM rights is not permitted for processes without DRM capability. |
|
65 */ |
|
66 IMPORT_C void ListAllRightsL(RStreamablePtrArray<CRightsInfo>& aArray) const; |
|
67 |
|
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 |
|
74 for any other errors. |
|
75 @capability DRM Access to DRM rights is not permitted for processes without DRM capability. |
|
76 */ |
|
77 IMPORT_C void ListRightsL(RStreamablePtrArray<CRightsInfo>& aArray, const TDesC& aUri) const; |
|
78 |
|
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 |
|
85 for any other errors. |
|
86 @capability DRM Access to DRM rights is not permitted for processes without DRM capability. |
|
87 */ |
|
88 IMPORT_C void ListRightsL(RStreamablePtrArray<CRightsInfo>& aArray, TVirtualPathPtr& aVirtualPath) const; |
|
89 |
|
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 |
|
96 for any other errors. |
|
97 @capability DRM Access to DRM rights is not permitted for processes without DRM capability. |
|
98 */ |
|
99 IMPORT_C void ListContentL(RStreamablePtrArray<CVirtualPath>& aArray, CRightsInfo& aRightsInfo) const; |
|
100 |
|
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. |
|
109 */ |
|
110 IMPORT_C MAgentRightsBase* GetRightsDataL(const CRightsInfo& aRightsInfo) const; |
|
111 |
|
112 /** Asks the DRM agent to delete a rights object |
|
113 |
|
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. |
|
117 |
|
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. |
|
125 */ |
|
126 IMPORT_C TInt DeleteRightsObject(const CRightsInfo& aRightsInfo); |
|
127 |
|
128 /** Deletes all rights associated with a particular content object |
|
129 |
|
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. |
|
133 |
|
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. |
|
140 */ |
|
141 IMPORT_C TInt DeleteAllRightsObjects(const TVirtualPathPtr& aVirtualPathPtr); |
|
142 |
|
143 |
|
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. |
|
146 |
|
147 @see ContentAccess::TAgentProperty |
|
148 |
|
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. |
|
156 */ |
|
157 IMPORT_C TInt SetProperty(TAgentProperty aProperty, TInt aValue); |
|
158 |
|
159 private: |
|
160 |
|
161 friend class CManager; |
|
162 |
|
163 /** Only created by CManager */ |
|
164 static CRightsManager* NewL(TUid aUid); |
|
165 |
|
166 /** Constructor */ |
|
167 CRightsManager(); |
|
168 |
|
169 /** 2nd phase constructor */ |
|
170 virtual void ConstructL(TUid aUid); |
|
171 |
|
172 private: |
|
173 CAgentFactory* iAgentFactory; |
|
174 CAgentRightsManager* iAgentRightsManager; |
|
175 }; |
|
176 } |
|
177 #endif |