epoc32/include/mw/flash_ui.h
branchSymbian2
changeset 2 2fe1408b6811
parent 1 666f914201fb
child 4 837f303aceeb
     1.1 --- a/epoc32/include/mw/flash_ui.h	Tue Nov 24 13:55:44 2009 +0000
     1.2 +++ b/epoc32/include/mw/flash_ui.h	Tue Mar 16 16:12:26 2010 +0000
     1.3 @@ -1,1 +1,189 @@
     1.4 -flash_ui.h
     1.5 +/*
     1.6 +* Copyright (c) 2005 Nokia Corporation and/or its subsidiary(-ies).
     1.7 +* All rights reserved.
     1.8 +* This component and the accompanying materials are made available
     1.9 +* under the terms of the License "Symbian Foundation License v1.0" to Symbian Foundation members and "Symbian Foundation End User License Agreement v1.0" to non-members
    1.10 +* which accompanies this distribution, and is available
    1.11 +* at the URL "http://www.symbianfoundation.org/legal/licencesv10.html".
    1.12 +*
    1.13 +* Initial Contributors:
    1.14 +* Nokia Corporation - initial contribution.
    1.15 +*
    1.16 +* Contributors:
    1.17 +*
    1.18 +* Description:  Loads the UI library and creates the instance of the document class.
    1.19 +*
    1.20 +*/
    1.21 +
    1.22 +#ifndef __FLASH_UI_H__
    1.23 +#define __FLASH_UI_H__
    1.24 +
    1.25 +#include <eikapp.h>
    1.26 +#include <apparc.h>
    1.27 +#include <apgcli.h>
    1.28 +
    1.29 +
    1.30 +/** @file flash_ui.h
    1.31 + * The API to start Viewer UI for playing Flash content file from a Viewer or a stub 
    1.32 + * application.
    1.33 + *
    1.34 + * The point here is to offer easy-of-use API for stubs applications which has 
    1.35 + * dedicated set of platform security capabilities for rendering private SWF content. 
    1.36 + * However, also standard Flash Viewer can utilize the same API as well. 
    1.37 + *
    1.38 + * Example usage of the API:
    1.39 + *
    1.40 + * @code
    1.41 + * LOCAL_C CApaApplication* NewApplication( )
    1.42 + *     {
    1.43 + *	   return new(ELeave) CFlashStubApplication;
    1.44 + *	   }
    1.45 + *
    1.46 + * GLDEF_C TInt E32Main()
    1.47 + *     {
    1.48 + *     return EikStart::RunApplication(NewApplication);
    1.49 + *     }
    1.50 + * 
    1.51 + * CFlashStubApplication::~CFlashStubApplication()
    1.52 + *     {
    1.53 + *     if (iFlashLibrary.Handle())
    1.54 + *         {
    1.55 + *         iFlashLibrary.Close();
    1.56 + *         }
    1.57 + *     }
    1.58 + * 
    1.59 + * const TUid KUidFlashStubApp = { 0x1027367B };
    1.60 + * 
    1.61 + * TUid CFlashStubApplication::AppDllUid() const
    1.62 + *     {
    1.63 + *     return KUidFlashStubApp;
    1.64 + *     }
    1.65 + * 
    1.66 + * 
    1.67 + * _LIT(KStubFlashContent, "C:\\Data\\Others\\example.swf");
    1.68 + * 
    1.69 + * const TUint32 KContentChecksum = 0;
    1.70 + * 
    1.71 + * CApaDocument* CFlashStubApplication::CreateDocumentL()
    1.72 + *     {
    1.73 + *     FlashUIConfig config;
    1.74 + *     config.iIsMMI = EFalse;
    1.75 + *     config.iIsStubApp = ETrue;
    1.76 + *     config.iContentFileName.Copy(KStubFlashContent);
    1.77 + *     config.iContentChecksum = KContentChecksum;
    1.78 + *     config.iExtensions = NULL;
    1.79 + * 
    1.80 + *     if(!FlashStubsSupported())
    1.81 + *	       {
    1.82 + *	       User::Leave(KErrNotSupported); 	
    1.83 + *         } 
    1.84 + *     return CreateFlashDocumentL(iFlashLibrary, this, config);
    1.85 + *    }
    1.86 + * @endcode
    1.87 + */
    1.88 +
    1.89 +/** 
    1.90 + Structure containing configuration information for UI.
    1.91 + */
    1.92 +struct FlashUIConfig
    1.93 +{
    1.94 +	/** 
    1.95 +	* ETrue if MMI is supported. 
    1.96 +	*/
    1.97 +	TBool iIsMMI;	 
    1.98 +	
    1.99 +	/** 
   1.100 +	* ETrue if is a stub application.
   1.101 +	*/
   1.102 +	TBool iIsStubApp;
   1.103 +	
   1.104 +	/** 
   1.105 +	* The swf file which accesses the MMI features. 
   1.106 +	*/
   1.107 +	TFileName iContentFileName;
   1.108 +
   1.109 +	/** 
   1.110 +	* Check sum for security. 
   1.111 +	*/
   1.112 +	TUint32 iContentChecksum;
   1.113 +
   1.114 +	/** 
   1.115 +	* Name of the ECom plug-in
   1.116 +	*/
   1.117 +	const TDesC8* iExtensions;
   1.118 +
   1.119 +	/** 
   1.120 +	* Reserved for future use 
   1.121 +	*/
   1.122 +	const TDesC8* iReserved1;
   1.123 +
   1.124 +	/** 
   1.125 +	* Reserved for future use 
   1.126 +	*/
   1.127 +	TUint32 iReserved2;
   1.128 +};
   1.129 +
   1.130 +/**
   1.131 +* The Flash UI dll name. 
   1.132 +*/
   1.133 +_LIT(KFlashUILibraryName, "flash2ui.dll");
   1.134 +
   1.135 +/** 
   1.136 +* The ordinal of the exported function in the Flash UI dll.
   1.137 +*/
   1.138 +const TInt KFlashCreateDocumentOrdinal = 1;
   1.139 +
   1.140 +/** 
   1.141 +* Pointer to a function that creates the document class. 
   1.142 +*/
   1.143 +typedef void*	(*PFNC_CreateFlashDocumentL)(CEikApplication* aApp, const FlashUIConfig& aUIConfig);
   1.144 +
   1.145 +class CEikApplication;
   1.146 +/**
   1.147 + *  CreateFlashDocumentL creates a Flash document for an application and
   1.148 + *  starts playing the given SWF file. If there is no S60 Flash Lite
   1.149 + *  Viewer Framework DLL installed in the device, the function leaves with error
   1.150 + *  code returned from the RLibrary::Load. 
   1.151 + *
   1.152 + * @since S60 v3.1
   1.153 + *
   1.154 + * @param aLibrary Handle to the flash UI dll.
   1.155 + * @param aApp Instance of the application class.
   1.156 + * @param aUIConfig Instance of the class that contains the configuration for the UI.
   1.157 + * @return The new document object.
   1.158 + * @leave KErrGeneral Error in using the successfully loaded Flash Viewer Framework DLL 
   1.159 + */
   1.160 +inline CApaDocument* CreateFlashDocumentL(RLibrary& aLibrary, CEikApplication* aApp, const FlashUIConfig& aUIConfig)
   1.161 +{
   1.162 +	CApaDocument* doc = NULL;
   1.163 +	User::LeaveIfError(aLibrary.Load(KFlashUILibraryName));
   1.164 +	PFNC_CreateFlashDocumentL pFncCreateFlashDocumentL = (PFNC_CreateFlashDocumentL)aLibrary.Lookup(KFlashCreateDocumentOrdinal);
   1.165 +	if (pFncCreateFlashDocumentL == NULL)
   1.166 +	{
   1.167 +		User::Leave(KErrGeneral);
   1.168 +	}
   1.169 +	doc = (CApaDocument*)pFncCreateFlashDocumentL(aApp, aUIConfig);
   1.170 +	return doc;
   1.171 +}
   1.172 +
   1.173 +/**
   1.174 + * Checks whether S60 Flash Lite Viewer Framework DLL exists in the device for stub
   1.175 + * applications.
   1.176 + * @return ETrue if Flash Lite stub applications is suppported, EFalse otherwise.
   1.177 + */
   1.178 +inline TBool FlashStubsSupported() 
   1.179 +{
   1.180 +
   1.181 +	RLibrary library;
   1.182 +	TInt err = library.Load(KFlashUILibraryName);
   1.183 +	if(err == KErrNone)
   1.184 +	{
   1.185 +		library.Close();
   1.186 +		return ETrue;
   1.187 +	}
   1.188 +	else
   1.189 +	{
   1.190 +		return EFalse;
   1.191 +	}
   1.192 +}
   1.193 +#endif // __FLASH_UI_H__
   1.194 \ No newline at end of file