|
1 /* |
|
2 * Copyright (c) 2008-2009 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 "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: DRM utility implementation |
|
15 * |
|
16 */ |
|
17 |
|
18 |
|
19 |
|
20 /** |
|
21 * @internal reviewed 03/07/2007 by Rowland Cook |
|
22 */ |
|
23 |
|
24 |
|
25 #ifndef C_GLXDRMUTILITY_H |
|
26 #define C_GLXDRMUTILITY_H |
|
27 |
|
28 // INCLUDES |
|
29 |
|
30 #include <e32base.h> |
|
31 |
|
32 // FORWARD DECLARATIONS |
|
33 |
|
34 class CDRMHelper; |
|
35 |
|
36 namespace ContentAccess |
|
37 { |
|
38 class CContent; |
|
39 class CData; |
|
40 class CManager; |
|
41 } |
|
42 // DATA TYPES |
|
43 |
|
44 /** |
|
45 * Specifies a type of automated content. |
|
46 * |
|
47 * @ingroup drm_utility |
|
48 */ |
|
49 enum TGlxDrmAutomatedType |
|
50 { |
|
51 EGlxDrmAutomatedTypeWallpaper /**< Set image as wallpaper */ |
|
52 }; |
|
53 |
|
54 // CLASS DECLARATION |
|
55 |
|
56 /** |
|
57 * DRM utility class to provide DRM-related functionality used in many places. |
|
58 * |
|
59 * @ingroup drm_utility |
|
60 * @author M Byrne |
|
61 */ |
|
62 NONSHARABLE_CLASS( CGlxDRMUtility ) : public CBase |
|
63 { |
|
64 public: |
|
65 /** |
|
66 * Get the instance of the DRM utility, and increase its reference count. |
|
67 * |
|
68 * @return Pointer to singleton object. |
|
69 */ |
|
70 IMPORT_C static CGlxDRMUtility* InstanceL(); |
|
71 |
|
72 /** |
|
73 * Release the instance of the DRM utility by decreasing its reference |
|
74 * count. If the count becomes zero, the utility is deleted. |
|
75 */ |
|
76 IMPORT_C void Close(); |
|
77 |
|
78 /** |
|
79 * Destructor. |
|
80 */ |
|
81 ~CGlxDRMUtility(); |
|
82 |
|
83 /** |
|
84 * Check whether DRM rights are valid for specified item |
|
85 * |
|
86 * @param aUri URI of the media item. |
|
87 * @param aCheckViewRights, check view rights if true, play if false |
|
88 * @return ETrue if valid rights exist for the media item. |
|
89 */ |
|
90 IMPORT_C TBool CheckOpenRightsL(const TDesC& aUri, TBool aCheckViewRights); |
|
91 |
|
92 /** |
|
93 * Check whether DRM rights are valid for specified item |
|
94 * If the rights were just consumed, then allow to display |
|
95 * Otherwise, obtain current rights |
|
96 * |
|
97 * @param aUri URI of the media item. |
|
98 * @param aCheckViewRights, check view rights if true, play if false |
|
99 * @return ETrue if valid rights exist for the media item. |
|
100 */ |
|
101 IMPORT_C TBool CheckDisplayRightsL(const TDesC& aUri, TBool aCheckViewRights); |
|
102 |
|
103 /** |
|
104 * Consume rights for specified item |
|
105 * Caches item so that a client has right to display the item |
|
106 * |
|
107 * @param aUri URI for item |
|
108 * @return ETrue to no error in rights consumption |
|
109 */ |
|
110 IMPORT_C TBool ConsumeRightsL(const TDesC& aUri); |
|
111 |
|
112 |
|
113 |
|
114 /** |
|
115 * Test whether a media item is OMA DRM 2.0 protected and has an associated |
|
116 * info URL. |
|
117 * @param aUri URI of the media item. |
|
118 * @return ETrue if it does. |
|
119 */ |
|
120 IMPORT_C TBool CanShowInfoOnlineL(TDesC& aUri); |
|
121 |
|
122 /** |
|
123 * Open the associated info URL for a media item in the browser. |
|
124 * @param aUri URI of the media item. |
|
125 */ |
|
126 IMPORT_C void ShowInfoOnlineL(TDesC& aUri); |
|
127 |
|
128 /** |
|
129 * Test whether a media item can be set as automated content. * |
|
130 * @param aUri URI of the media item. |
|
131 * @param aType Automated content type, eg. wallpaper. |
|
132 * @return ETrue if it can. |
|
133 */ |
|
134 IMPORT_C TBool CanSetAsAutomatedL(const TDesC& aUri, TGlxDrmAutomatedType aType); |
|
135 |
|
136 /** |
|
137 * Set a media item as automated content. |
|
138 * @param aUri URI of the media item. |
|
139 * @param aType Automated content type, eg. wallpaper. |
|
140 */ |
|
141 IMPORT_C void SetAsAutomatedL(const TDesC& aUri, TGlxDrmAutomatedType aType); |
|
142 |
|
143 /** |
|
144 * Show DRM details for specified item. |
|
145 * @param aUri URI of the media item. |
|
146 */ |
|
147 IMPORT_C void ShowDRMDetailsPaneL(const TDesC& aUri); |
|
148 |
|
149 /** |
|
150 * Ask DRM manager if file is forward locked |
|
151 */ |
|
152 IMPORT_C TBool IsForwardLockedL(const TDesC& aUri); |
|
153 |
|
154 /** |
|
155 * Show rights info |
|
156 * @param aUri URI of the media item. |
|
157 */ |
|
158 IMPORT_C void ShowRightsInfoL(const TDesC& aUri); |
|
159 |
|
160 /** |
|
161 * Get size of thumbnail to be requested for DRM invalid item |
|
162 * @param aSize size of image |
|
163 * @return suggested thumbnail size (1/4 of original size) |
|
164 */ |
|
165 IMPORT_C TSize DRMThumbnailSize(TSize& aSize); |
|
166 |
|
167 |
|
168 private: |
|
169 /** |
|
170 * C++ default constructor. |
|
171 */ |
|
172 CGlxDRMUtility(); |
|
173 |
|
174 /** |
|
175 * By default Symbian 2nd phase constructor is private. |
|
176 */ |
|
177 void ConstructL(); |
|
178 |
|
179 private: |
|
180 /** Single instance of CGlxDRMUtility */ |
|
181 static CGlxDRMUtility* iDrmUtility; |
|
182 |
|
183 /** Reference count for DRM utility */ |
|
184 TInt iRefCount; |
|
185 |
|
186 /** Content access manager */ |
|
187 ContentAccess::CManager* iCManager; |
|
188 |
|
189 /** DRM helper used by the utility owned */ |
|
190 CDRMHelper* iDrmHelper; |
|
191 |
|
192 /** Last consumed item URI */ |
|
193 HBufC* iLastConsumedItemUri; |
|
194 }; |
|
195 |
|
196 #endif // C_GLXDRMUTILITY_H |
|
197 |
|
198 // End of File |