os/security/contentmgmt/contentaccessfwfordrm/inc/rightsmanager.h
author sl@SLION-WIN7.fritz.box
Fri, 15 Jun 2012 03:10:57 +0200
changeset 0 bde4ae8d615e
permissions -rw-r--r--
First public contribution.
sl@0
     1
/*
sl@0
     2
* Copyright (c) 2003-2009 Nokia Corporation and/or its subsidiary(-ies).
sl@0
     3
* All rights reserved.
sl@0
     4
* This component and the accompanying materials are made available
sl@0
     5
* under the terms of the License "Eclipse Public License v1.0"
sl@0
     6
* which accompanies this distribution, and is available
sl@0
     7
* at the URL "http://www.eclipse.org/legal/epl-v10.html".
sl@0
     8
*
sl@0
     9
* Initial Contributors:
sl@0
    10
* Nokia Corporation - initial contribution.
sl@0
    11
*
sl@0
    12
* Contributors:
sl@0
    13
*
sl@0
    14
* Description: 
sl@0
    15
*
sl@0
    16
*/
sl@0
    17
sl@0
    18
sl@0
    19
/**
sl@0
    20
 @file
sl@0
    21
 @publishedPartner
sl@0
    22
 @released
sl@0
    23
*/
sl@0
    24
sl@0
    25
sl@0
    26
#ifndef __RIGHTSMANAGER_H__
sl@0
    27
#define __RIGHTSMANAGER_H__
sl@0
    28
sl@0
    29
#include <e32std.h>
sl@0
    30
#include <caf/caftypes.h>
sl@0
    31
#include <caf/streamableptrarray.h>
sl@0
    32
#include <f32file.h>
sl@0
    33
sl@0
    34
namespace ContentAccess
sl@0
    35
	{
sl@0
    36
sl@0
    37
	class TVirtualPathPtr;
sl@0
    38
	class CVirtualPath;
sl@0
    39
	class CRightsInfo;
sl@0
    40
	class CAgentInfo;
sl@0
    41
	class CAgentFactory;
sl@0
    42
	class CAgentRightsManager;
sl@0
    43
	class MAgentRightsBase;
sl@0
    44
sl@0
    45
	/** 
sl@0
    46
	Manages and retrieves rights objects from an agent.
sl@0
    47
sl@0
    48
	@publishedPartner
sl@0
    49
	@released
sl@0
    50
	*/
sl@0
    51
	class CRightsManager : public CBase
sl@0
    52
		{
sl@0
    53
	public:
sl@0
    54
		virtual ~CRightsManager();
sl@0
    55
sl@0
    56
	public:
sl@0
    57
		/** List all rights held by the agent.
sl@0
    58
		@param aArray The client supplied array used to store the CRightsInfo objects. The agent will add CRightsInfo objects to the supplied array.
sl@0
    59
		@leave KErrPermissionDenied If the agent does not permit the client to access rights information.
sl@0
    60
		@leave ...		One of the CAF error codes defined in \c caferr.h  
sl@0
    61
		 				or one of the other system-wide error codes 
sl@0
    62
						for any other errors.				
sl@0
    63
		@capability DRM Access to DRM rights is not permitted for processes without DRM capability.
sl@0
    64
		*/
sl@0
    65
		IMPORT_C void ListAllRightsL(RStreamablePtrArray<CRightsInfo>& aArray) const;
sl@0
    66
sl@0
    67
		/** List all rights associated with a particular file.
sl@0
    68
		@param aArray The client supplied array used to store the CRightsInfo objects. The agent will add CRightsInfo objects to the supplied array.
sl@0
    69
		@param aUri The name of the file.
sl@0
    70
		@leave KErrPermissionDenied If the agent does not permit the client to access rights information.
sl@0
    71
		@leave ...		One of the CAF error codes defined in \c caferr.h  
sl@0
    72
		 				or one of the other system-wide error codes 
sl@0
    73
						for any other errors.				
sl@0
    74
		@capability DRM Access to DRM rights is not permitted for processes without DRM capability. 
sl@0
    75
		*/
sl@0
    76
		IMPORT_C void ListRightsL(RStreamablePtrArray<CRightsInfo>& aArray, const TDesC& aUri) const;
sl@0
    77
sl@0
    78
		/** List all rights associated with a particular content object
sl@0
    79
		@param aArray The client supplied array used to store the CRightsInfo objects. The agent will add CRightsInfo objects to the supplied array.
sl@0
    80
		@param aVirtualPath The content object.
sl@0
    81
		@leave KErrPermissionDenied If the agent does not permit the client to access rights information.
sl@0
    82
		@leave ...		One of the CAF error codes defined in \c caferr.h  
sl@0
    83
		 				or one of the other system-wide error codes 
sl@0
    84
						for any other errors.				
sl@0
    85
		@capability DRM Access to DRM rights is not permitted for processes without DRM capability. 
sl@0
    86
		*/
sl@0
    87
		IMPORT_C void ListRightsL(RStreamablePtrArray<CRightsInfo>& aArray, TVirtualPathPtr& aVirtualPath) const;
sl@0
    88
sl@0
    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.
sl@0
    90
		
sl@0
    91
		@param aArray  		The client supplied array used to store the CRightsInfo objects. The agent will add CRightsInfo objects to the supplied array.
sl@0
    92
		@param aFile  		The file handle for the file containing the content object.
sl@0
    93
		@param aUniqueId	The unique id of the content object.
sl@0
    94
		@leave KErrCANotSupported if the feature not supported.
sl@0
    95
		@leave KErrPermissionDenied If the agent does not permit the client to access rights information.
sl@0
    96
		@leave ...		One of the CAF error codes defined in \c caferr.h  
sl@0
    97
		 				or one of the other system-wide error codes 
sl@0
    98
						for any other errors.				
sl@0
    99
		@capability DRM Access to DRM rights is not permitted for processes without DRM capability. 
sl@0
   100
		*/
sl@0
   101
		IMPORT_C void ListRightsL(RStreamablePtrArray<CRightsInfo>& aArray, RFile& aFile, const TDesC& aUniqueId) const;			
sl@0
   102
		
sl@0
   103
		/** List all content associated with a particular rights object.
sl@0
   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.
sl@0
   105
		@param aRightsInfo The rights object.
sl@0
   106
		@leave KErrPermissionDenied If the agent does not permit the client to access rights information.
sl@0
   107
		@leave ...		One of the CAF error codes defined in \c caferr.h  
sl@0
   108
		 				or one of the other system-wide error codes 
sl@0
   109
						for any other errors.				
sl@0
   110
		@capability DRM Access to DRM rights is not permitted for processes without DRM capability. 
sl@0
   111
		*/
sl@0
   112
		IMPORT_C void ListContentL(RStreamablePtrArray<CVirtualPath>& aArray, CRightsInfo& aRightsInfo) const;
sl@0
   113
sl@0
   114
		/** This will be used by applications to retrieve an agent specific rights object
sl@0
   115
		@param aRightsInfo The rights object.
sl@0
   116
		@return An agent specific rights object.
sl@0
   117
		@leave KErrPermissionDenied If the agent does not permit the client to access rights information.
sl@0
   118
		@leave ...		One of the CAF error codes defined in \c caferr.h  
sl@0
   119
		 				or one of the other system-wide error codes 
sl@0
   120
						for any other errors.				
sl@0
   121
		@capability DRM Access to DRM rights is not permitted for processes without DRM capability. 
sl@0
   122
		*/
sl@0
   123
		IMPORT_C MAgentRightsBase* GetRightsDataL(const CRightsInfo& aRightsInfo) const;
sl@0
   124
sl@0
   125
		/** Asks the DRM agent to delete a rights object 
sl@0
   126
sl@0
   127
		The agent may display a dialog asking the user to confirm the delete. Execution
sl@0
   128
		will be blocked until the dialog is complete. Applications can request 
sl@0
   129
		to disable the agents user interface using the SetProperty() command.
sl@0
   130
	
sl@0
   131
		@param aRightsInfo The rights object.
sl@0
   132
		@return The outcome of the delete operation.
sl@0
   133
		@return KErrNone if the rights were deleted.
sl@0
   134
		@return KErrCancel if the user cancels an agent supplied confirmation dialog.
sl@0
   135
		@return KErrNotFound if the rights object does not exist.
sl@0
   136
		@return KErrPermissionDenied if the agent does not permit the client to access rights information.
sl@0
   137
		@capability DRM Access to DRM rights is not permitted for processes without DRM capability. 
sl@0
   138
		*/
sl@0
   139
		IMPORT_C TInt DeleteRightsObject(const CRightsInfo& aRightsInfo);
sl@0
   140
sl@0
   141
		/** Deletes all rights associated with a particular content object
sl@0
   142
sl@0
   143
		The agent may display a dialog asking the user to confirm the delete. Execution
sl@0
   144
		will be blocked until the dialog is complete. Applications can request 
sl@0
   145
		to disable the agents user interface using the SetProperty() command.
sl@0
   146
sl@0
   147
		@param aVirtualPathPtr The content object.
sl@0
   148
		@return KErrNone if the rights were deleted.
sl@0
   149
		@return KErrNotFound if no rights objects exist for the specified content object.
sl@0
   150
		@return KErrCancel if the user cancels an agent supplied confirmation dialog.
sl@0
   151
		@return KErrPermissionDenied if the agent does not permit the client to access rights information.
sl@0
   152
		@capability DRM Access to DRM rights is not permitted for processes without DRM capability. 
sl@0
   153
		*/
sl@0
   154
		IMPORT_C TInt DeleteAllRightsObjects(const TVirtualPathPtr& aVirtualPathPtr);
sl@0
   155
		
sl@0
   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.
sl@0
   157
sl@0
   158
		The agent may display a dialog asking the user to confirm the delete. Execution
sl@0
   159
		will be blocked until the dialog is complete. Applications can request 
sl@0
   160
		to disable the agents user interface using the SetProperty() command.
sl@0
   161
sl@0
   162
		@param aFile The file handle for the file containing the content object.
sl@0
   163
		@param aUniqueId The unique id of the content object.
sl@0
   164
		@return The outcome of the delete operation.
sl@0
   165
		@return KErrNone if the rights were deleted.
sl@0
   166
		@return KErrNotFound if no rights objects exist for the specified content object.
sl@0
   167
		@return KErrCancel if the user cancels an agent supplied confirmation dialog.
sl@0
   168
		@return KErrPermissionDenied if the agent does not permit the client to access rights information.
sl@0
   169
		@return KErrCANotSupported if the feature not supported.
sl@0
   170
		@capability DRM Access to DRM rights is not permitted for processes without DRM capability. 
sl@0
   171
		*/
sl@0
   172
		IMPORT_C TInt DeleteAllRightsObjects (RFile& aFile, const TDesC& aUniqueId); 
sl@0
   173
		
sl@0
   174
		/** Request the agent to set a property value. If the property is set
sl@0
   175
		it is only set for this CRightsManager session and does not impact other CAF users.
sl@0
   176
	
sl@0
   177
	  	@see ContentAccess::TAgentProperty
sl@0
   178
sl@0
   179
		@param aProperty The property to set.
sl@0
   180
		@param aValue The value of the property.
sl@0
   181
		@return KErrNone if the property was set.
sl@0
   182
		@return KErrCANotSupported if the agent does not support the property or value.
sl@0
   183
		@return KErrAccessDenied if the agent does not permit the property to be changed.
sl@0
   184
		@return KErrPermissionDenied if the application does not have the necessary capability to change the property.
sl@0
   185
		@capability DRM Access to DRM protected content is not permitted for processes without DRM capability. Access to unprotected content is unrestricted. 
sl@0
   186
		*/
sl@0
   187
		IMPORT_C TInt SetProperty(TAgentProperty aProperty, TInt aValue);
sl@0
   188
sl@0
   189
	private:
sl@0
   190
sl@0
   191
		friend class CManager;
sl@0
   192
sl@0
   193
		/** Only created by CManager */
sl@0
   194
		static CRightsManager* NewL(TUid aUid);
sl@0
   195
	
sl@0
   196
		/** Constructor */
sl@0
   197
		CRightsManager();
sl@0
   198
sl@0
   199
		/** 2nd phase constructor */
sl@0
   200
		virtual void ConstructL(TUid aUid);
sl@0
   201
sl@0
   202
	private:
sl@0
   203
		CAgentFactory* iAgentFactory;
sl@0
   204
		CAgentRightsManager* iAgentRightsManager;
sl@0
   205
		};
sl@0
   206
	}
sl@0
   207
#endif