os/security/contentmgmt/contentaccessfwfordrm/source/caf/agentinfo.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
 @internalComponent
sl@0
    22
 @released
sl@0
    23
*/
sl@0
    24
sl@0
    25
sl@0
    26
#ifndef __AGENTINFO_H__
sl@0
    27
#define __AGENTINFO_H__
sl@0
    28
sl@0
    29
#include <e32base.h>
sl@0
    30
sl@0
    31
class CImplementationInformation;
sl@0
    32
sl@0
    33
#include <caf/agent.h>
sl@0
    34
sl@0
    35
namespace ContentAccess
sl@0
    36
	{
sl@0
    37
	class CAgentFactory;
sl@0
    38
	class CAgentManager;
sl@0
    39
sl@0
    40
	/**
sl@0
    41
	 Holds information about a Content Access Agent implementation. 
sl@0
    42
	
sl@0
    43
	The metadata is supplied in the agents resource file so the information can be 
sl@0
    44
	obtained without the need to construct the agent.
sl@0
    45
	
sl@0
    46
	The AgentFactoryL() function is used by other CAF classes to access the 
sl@0
    47
	agent's CAgentFactory implementation.
sl@0
    48
	
sl@0
    49
	@internalComponent
sl@0
    50
	@released
sl@0
    51
	*/
sl@0
    52
	class CAgentInfo : public CBase
sl@0
    53
		{
sl@0
    54
	public:
sl@0
    55
		/** 
sl@0
    56
		Constructs a new CAgentInfo object from an ECOM CImplementationInfo.
sl@0
    57
		
sl@0
    58
		@param aImplInfo	An ECOM Implementation from REComSession::ListImplementationsL().
sl@0
    59
		@return				A new instance of a CAgentInfo object.
sl@0
    60
		*/
sl@0
    61
		static CAgentInfo* NewLC(const CImplementationInformation& aImplInfo);
sl@0
    62
sl@0
    63
		virtual ~CAgentInfo();
sl@0
    64
sl@0
    65
		/** 
sl@0
    66
		Determines whether this agent recognizes the supplier MIME type.
sl@0
    67
		
sl@0
    68
		@param aSupplierMime	The supplier MIME type to check.
sl@0
    69
		@return					ETrue, if the MIME type is a supported supplier MIME type.
sl@0
    70
		*/
sl@0
    71
		TBool IsSupportedSupplier(const TDesC8& aSupplierMime) const;
sl@0
    72
sl@0
    73
		/** 
sl@0
    74
		Determines whether this agent recognizes the consumer MIME type.
sl@0
    75
		
sl@0
    76
		@note Scheduled to be removed from the CAF API
sl@0
    77
		recognizer uses MIME types based upon the content type, not the mime type
sl@0
    78
		of the file itself. There will be no Consumer MIME types, only modified 
sl@0
    79
		content types.
sl@0
    80
		 
sl@0
    81
		@param aConsumerMime	The consumer mime type to check.
sl@0
    82
		@return					ETrue, if the MIME type is a supported consumer MIME type.
sl@0
    83
		*/
sl@0
    84
		TBool IsSupportedConsumer(const TDesC8& aConsumerMime) const;
sl@0
    85
sl@0
    86
		/** 
sl@0
    87
		* Exposes the array of supplier MIME types supported by this agent.
sl@0
    88
		*
sl@0
    89
		* @return	The array of supplier MIME types.
sl@0
    90
		*/
sl@0
    91
		const RPointerArray<HBufC8>& SupplierMimeTypes() const;
sl@0
    92
sl@0
    93
		/** 
sl@0
    94
		Exposes the array of consumer MIME types supported by this agent.
sl@0
    95
		
sl@0
    96
		@note Scheduled to be removed from the CAF API
sl@0
    97
		recognizer uses MIME types based upon the content type, not the 
sl@0
    98
		mime type of the file itself. There will be no Consumer mime types, 
sl@0
    99
		only modified content types.
sl@0
   100
		
sl@0
   101
		@return 	A reference to the array of consumer mime types.
sl@0
   102
		*/
sl@0
   103
		const RPointerArray<HBufC8>& ConsumerMimeTypes() const;
sl@0
   104
		
sl@0
   105
		/** 
sl@0
   106
		* Gets the preferred buffer size for this agent to recognize 
sl@0
   107
		* DRM files with the ContentAccess::CAgentResolver::DoRecognize() function.
sl@0
   108
		*
sl@0
   109
		* @return	The preferred buffer size.
sl@0
   110
		*/
sl@0
   111
		TInt PreferredBufferSize() const;
sl@0
   112
sl@0
   113
		/** The private server directory managed by this agent 
sl@0
   114
sl@0
   115
		This function returns the directory under C:\\private\\ used by this 
sl@0
   116
		agent. This is specified in the agents resource file in the opaque_data
sl@0
   117
		field. 
sl@0
   118
		
sl@0
   119
		If the agent does not use a private directory the return value will be
sl@0
   120
		KNullDesC()
sl@0
   121
sl@0
   122
		@return The directory name
sl@0
   123
		*/
sl@0
   124
		const TDesC& PrivateDirectoryName() const;
sl@0
   125
		
sl@0
   126
		/** The agent 
sl@0
   127
		
sl@0
   128
		@return A reference to this agent
sl@0
   129
		*/
sl@0
   130
		TAgent& Agent(); 
sl@0
   131
sl@0
   132
		/**
sl@0
   133
		Accessor for agent factory.
sl@0
   134
		
sl@0
   135
		Allows the factory to be constructed once and used many times. 
sl@0
   136
		DOES NOT transfer ownership of the CAgentFactory to the caller. 
sl@0
   137
sl@0
   138
		@return The CAgentFactory for this particular agent
sl@0
   139
		*/
sl@0
   140
		CAgentFactory& AgentFactoryL();
sl@0
   141
sl@0
   142
		/**
sl@0
   143
		Accessor to the agent manager. 
sl@0
   144
		
sl@0
   145
		The agent manager is stateless and this method allows it to be 
sl@0
   146
		constructed once and used several times. DOES NOT transfer ownership 
sl@0
   147
		of the CAgentManager to the caller. 
sl@0
   148
sl@0
   149
		@return The CAgentManager for this particular agent
sl@0
   150
		*/
sl@0
   151
		CAgentManager& AgentManagerL();
sl@0
   152
sl@0
   153
sl@0
   154
	private:
sl@0
   155
		CAgentInfo();
sl@0
   156
		void ConstructL(const CImplementationInformation& aImplInfo);
sl@0
   157
sl@0
   158
		// Helper function to parse MIME types of the form:
sl@0
   159
		// <mime1>,<mime2>,<mime3>
sl@0
   160
		void ParseMimeTypesL(const TDesC8& aBuf, RPointerArray<HBufC8>& aMimeTypes);
sl@0
   161
sl@0
   162
		// Helper to add descriptor to RPointerArray
sl@0
   163
		void AddToArrayL(const TDesC8& aElement, RPointerArray<HBufC8>& aArray);
sl@0
   164
sl@0
   165
	private:
sl@0
   166
		TInt iPreferredBufferSize;
sl@0
   167
		RPointerArray<HBufC8> iSupplierMimeTypes;
sl@0
   168
		RPointerArray<HBufC8> iConsumerMimeTypes;
sl@0
   169
sl@0
   170
		CAgentFactory* iAgentFactory;
sl@0
   171
		CAgentManager* iAgentManager;
sl@0
   172
sl@0
   173
		// Holds the agent name and Implementation UID
sl@0
   174
		TAgent iAgent;
sl@0
   175
		
sl@0
   176
		// Agent private directory is a SID
sl@0
   177
		TBuf <KMaxSIDLength> iPrivateDirectoryName;
sl@0
   178
		};
sl@0
   179
	}
sl@0
   180
sl@0
   181
#endif