sl@0: /* sl@0: * Copyright (c) 2003-2009 Nokia Corporation and/or its subsidiary(-ies). sl@0: * All rights reserved. sl@0: * This component and the accompanying materials are made available sl@0: * under the terms of the License "Eclipse Public License v1.0" sl@0: * which accompanies this distribution, and is available sl@0: * at the URL "http://www.eclipse.org/legal/epl-v10.html". sl@0: * sl@0: * Initial Contributors: sl@0: * Nokia Corporation - initial contribution. sl@0: * sl@0: * Contributors: sl@0: * sl@0: * Description: sl@0: * sl@0: */ sl@0: sl@0: sl@0: /** sl@0: @file sl@0: @internalComponent sl@0: @released sl@0: */ sl@0: sl@0: sl@0: #ifndef __AGENTINFO_H__ sl@0: #define __AGENTINFO_H__ sl@0: sl@0: #include sl@0: sl@0: class CImplementationInformation; sl@0: sl@0: #include sl@0: sl@0: namespace ContentAccess sl@0: { sl@0: class CAgentFactory; sl@0: class CAgentManager; sl@0: sl@0: /** sl@0: Holds information about a Content Access Agent implementation. sl@0: sl@0: The metadata is supplied in the agents resource file so the information can be sl@0: obtained without the need to construct the agent. sl@0: sl@0: The AgentFactoryL() function is used by other CAF classes to access the sl@0: agent's CAgentFactory implementation. sl@0: sl@0: @internalComponent sl@0: @released sl@0: */ sl@0: class CAgentInfo : public CBase sl@0: { sl@0: public: sl@0: /** sl@0: Constructs a new CAgentInfo object from an ECOM CImplementationInfo. sl@0: sl@0: @param aImplInfo An ECOM Implementation from REComSession::ListImplementationsL(). sl@0: @return A new instance of a CAgentInfo object. sl@0: */ sl@0: static CAgentInfo* NewLC(const CImplementationInformation& aImplInfo); sl@0: sl@0: virtual ~CAgentInfo(); sl@0: sl@0: /** sl@0: Determines whether this agent recognizes the supplier MIME type. sl@0: sl@0: @param aSupplierMime The supplier MIME type to check. sl@0: @return ETrue, if the MIME type is a supported supplier MIME type. sl@0: */ sl@0: TBool IsSupportedSupplier(const TDesC8& aSupplierMime) const; sl@0: sl@0: /** sl@0: Determines whether this agent recognizes the consumer MIME type. sl@0: sl@0: @note Scheduled to be removed from the CAF API sl@0: recognizer uses MIME types based upon the content type, not the mime type sl@0: of the file itself. There will be no Consumer MIME types, only modified sl@0: content types. sl@0: sl@0: @param aConsumerMime The consumer mime type to check. sl@0: @return ETrue, if the MIME type is a supported consumer MIME type. sl@0: */ sl@0: TBool IsSupportedConsumer(const TDesC8& aConsumerMime) const; sl@0: sl@0: /** sl@0: * Exposes the array of supplier MIME types supported by this agent. sl@0: * sl@0: * @return The array of supplier MIME types. sl@0: */ sl@0: const RPointerArray& SupplierMimeTypes() const; sl@0: sl@0: /** sl@0: Exposes the array of consumer MIME types supported by this agent. sl@0: sl@0: @note Scheduled to be removed from the CAF API sl@0: recognizer uses MIME types based upon the content type, not the sl@0: mime type of the file itself. There will be no Consumer mime types, sl@0: only modified content types. sl@0: sl@0: @return A reference to the array of consumer mime types. sl@0: */ sl@0: const RPointerArray& ConsumerMimeTypes() const; sl@0: sl@0: /** sl@0: * Gets the preferred buffer size for this agent to recognize sl@0: * DRM files with the ContentAccess::CAgentResolver::DoRecognize() function. sl@0: * sl@0: * @return The preferred buffer size. sl@0: */ sl@0: TInt PreferredBufferSize() const; sl@0: sl@0: /** The private server directory managed by this agent sl@0: sl@0: This function returns the directory under C:\\private\\ used by this sl@0: agent. This is specified in the agents resource file in the opaque_data sl@0: field. sl@0: sl@0: If the agent does not use a private directory the return value will be sl@0: KNullDesC() sl@0: sl@0: @return The directory name sl@0: */ sl@0: const TDesC& PrivateDirectoryName() const; sl@0: sl@0: /** The agent sl@0: sl@0: @return A reference to this agent sl@0: */ sl@0: TAgent& Agent(); sl@0: sl@0: /** sl@0: Accessor for agent factory. sl@0: sl@0: Allows the factory to be constructed once and used many times. sl@0: DOES NOT transfer ownership of the CAgentFactory to the caller. sl@0: sl@0: @return The CAgentFactory for this particular agent sl@0: */ sl@0: CAgentFactory& AgentFactoryL(); sl@0: sl@0: /** sl@0: Accessor to the agent manager. sl@0: sl@0: The agent manager is stateless and this method allows it to be sl@0: constructed once and used several times. DOES NOT transfer ownership sl@0: of the CAgentManager to the caller. sl@0: sl@0: @return The CAgentManager for this particular agent sl@0: */ sl@0: CAgentManager& AgentManagerL(); sl@0: sl@0: sl@0: private: sl@0: CAgentInfo(); sl@0: void ConstructL(const CImplementationInformation& aImplInfo); sl@0: sl@0: // Helper function to parse MIME types of the form: sl@0: // ,, sl@0: void ParseMimeTypesL(const TDesC8& aBuf, RPointerArray& aMimeTypes); sl@0: sl@0: // Helper to add descriptor to RPointerArray sl@0: void AddToArrayL(const TDesC8& aElement, RPointerArray& aArray); sl@0: sl@0: private: sl@0: TInt iPreferredBufferSize; sl@0: RPointerArray iSupplierMimeTypes; sl@0: RPointerArray iConsumerMimeTypes; sl@0: sl@0: CAgentFactory* iAgentFactory; sl@0: CAgentManager* iAgentManager; sl@0: sl@0: // Holds the agent name and Implementation UID sl@0: TAgent iAgent; sl@0: sl@0: // Agent private directory is a SID sl@0: TBuf iPrivateDirectoryName; sl@0: }; sl@0: } sl@0: sl@0: #endif