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.
     1 /*
     2 * Copyright (c) 2003-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 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  @file
    21  @publishedPartner
    22  @released
    23 */
    24 
    25 
    26 #ifndef __RIGHTSMANAGER_H__
    27 #define __RIGHTSMANAGER_H__
    28 
    29 #include <e32std.h>
    30 #include <caf/caftypes.h>
    31 #include <caf/streamableptrarray.h>
    32 #include <f32file.h>
    33 
    34 namespace ContentAccess
    35 	{
    36 
    37 	class TVirtualPathPtr;
    38 	class CVirtualPath;
    39 	class CRightsInfo;
    40 	class CAgentInfo;
    41 	class CAgentFactory;
    42 	class CAgentRightsManager;
    43 	class MAgentRightsBase;
    44 
    45 	/** 
    46 	Manages and retrieves rights objects from an agent.
    47 
    48 	@publishedPartner
    49 	@released
    50 	*/
    51 	class CRightsManager : public CBase
    52 		{
    53 	public:
    54 		virtual ~CRightsManager();
    55 
    56 	public:
    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 
    62 						for any other errors.				
    63 		@capability DRM Access to DRM rights is not permitted for processes without DRM capability.
    64 		*/
    65 		IMPORT_C void ListAllRightsL(RStreamablePtrArray<CRightsInfo>& aArray) const;
    66 
    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 
    73 						for any other errors.				
    74 		@capability DRM Access to DRM rights is not permitted for processes without DRM capability. 
    75 		*/
    76 		IMPORT_C void ListRightsL(RStreamablePtrArray<CRightsInfo>& aArray, const TDesC& aUri) const;
    77 
    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 
    84 						for any other errors.				
    85 		@capability DRM Access to DRM rights is not permitted for processes without DRM capability. 
    86 		*/
    87 		IMPORT_C void ListRightsL(RStreamablePtrArray<CRightsInfo>& aArray, TVirtualPathPtr& aVirtualPath) const;
    88 
    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.
    90 		
    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 
    98 						for any other errors.				
    99 		@capability DRM Access to DRM rights is not permitted for processes without DRM capability. 
   100 		*/
   101 		IMPORT_C void ListRightsL(RStreamablePtrArray<CRightsInfo>& aArray, RFile& aFile, const TDesC& aUniqueId) const;			
   102 		
   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. 
   111 		*/
   112 		IMPORT_C void ListContentL(RStreamablePtrArray<CVirtualPath>& aArray, CRightsInfo& aRightsInfo) const;
   113 
   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. 
   122 		*/
   123 		IMPORT_C MAgentRightsBase* GetRightsDataL(const CRightsInfo& aRightsInfo) const;
   124 
   125 		/** Asks the DRM agent to delete a rights object 
   126 
   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.
   130 	
   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. 
   138 		*/
   139 		IMPORT_C TInt DeleteRightsObject(const CRightsInfo& aRightsInfo);
   140 
   141 		/** Deletes all rights associated with a particular content object
   142 
   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.
   146 
   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. 
   153 		*/
   154 		IMPORT_C TInt DeleteAllRightsObjects(const TVirtualPathPtr& aVirtualPathPtr);
   155 		
   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.
   157 
   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.
   161 
   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. 
   171 		*/
   172 		IMPORT_C TInt DeleteAllRightsObjects (RFile& aFile, const TDesC& aUniqueId); 
   173 		
   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.
   176 	
   177 	  	@see ContentAccess::TAgentProperty
   178 
   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. 
   186 		*/
   187 		IMPORT_C TInt SetProperty(TAgentProperty aProperty, TInt aValue);
   188 
   189 	private:
   190 
   191 		friend class CManager;
   192 
   193 		/** Only created by CManager */
   194 		static CRightsManager* NewL(TUid aUid);
   195 	
   196 		/** Constructor */
   197 		CRightsManager();
   198 
   199 		/** 2nd phase constructor */
   200 		virtual void ConstructL(TUid aUid);
   201 
   202 	private:
   203 		CAgentFactory* iAgentFactory;
   204 		CAgentRightsManager* iAgentRightsManager;
   205 		};
   206 	}
   207 #endif