webengine/osswebengine/WebKit/s60/plugins/PluginHandler.cpp
branchRCL_3
changeset 49 919f36ff910f
parent 48 79859ed3eea9
equal deleted inserted replaced
48:79859ed3eea9 49:919f36ff910f
    29 #include <ecom/ecom.h>
    29 #include <ecom/ecom.h>
    30 
    30 
    31 
    31 
    32 //  INCLUDES
    32 //  INCLUDES
    33 #include "WebCorePluginHandler.h"
    33 #include "WebCorePluginHandler.h"
    34 #include "NpnImplementation.h"
    34 #include "NPNImplementation.h"
    35 #include "PluginHandler.h"
    35 #include "PluginHandler.h"
    36 
    36 
    37 // CONSTANTS
    37 // CONSTANTS
    38 
    38 
    39 const TInt KPluginGranularity = 3;
    39 const TInt KPluginGranularity = 3;
   155 //
   155 //
   156 void PluginInfo::copyMimeDescription(PluginInfo& pluginInfo)
   156 void PluginInfo::copyMimeDescription(PluginInfo& pluginInfo)
   157 {
   157 {
   158     TUint   i;
   158     TUint   i;
   159     TUint   count;
   159     TUint   count;
   160     HBufC*  entry;
   160     HBufC*  entry = NULL;
   161     
   161     
   162     m_mimeTypes.ResetAndDestroy();
   162     m_mimeTypes.ResetAndDestroy();
   163     m_mimeExtensionToTypeMap.Reset();
   163     m_mimeExtensionToTypeMap.Reset();
   164     count = pluginInfo.m_mimeTypes.Count();
   164     count = pluginInfo.m_mimeTypes.Count();
   165     for (i = 0; i < count; i++) {
   165     for (i = 0; i < count; i++) {
   413 //
   413 //
   414 void PluginHandler::ConstructL()
   414 void PluginHandler::ConstructL()
   415 {
   415 {
   416     m_idle = CIdle::NewL(CActive::EPriorityLow);
   416     m_idle = CIdle::NewL(CActive::EPriorityLow);
   417     m_idle->Start(TCallBack(initialize, this));
   417     m_idle->Start(TCallBack(initialize, this));
       
   418     m_visiblePlugins.Reset();
   418 }
   419 }
   419 
   420 
   420 
   421 
   421 // -----------------------------------------------------------------------------
   422 // -----------------------------------------------------------------------------
   422 // PluginHandler::NewL
   423 // PluginHandler::NewL
   439 // Deconstructor.
   440 // Deconstructor.
   440 // -----------------------------------------------------------------------------
   441 // -----------------------------------------------------------------------------
   441 //
   442 //
   442 PluginHandler::~PluginHandler()
   443 PluginHandler::~PluginHandler()
   443 {
   444 {
       
   445     m_visiblePlugins.Reset();
       
   446     m_visiblePlugins.Close();
   444     m_pluginInfoArray.ResetAndDestroy();
   447     m_pluginInfoArray.ResetAndDestroy();
   445     m_pluginInfoArray.Close();
   448     m_pluginInfoArray.Close();
   446     m_pluginObjects.clear();
   449     m_pluginObjects.clear();
   447     if (m_idle) {
   450     if (m_idle) {
   448        m_idle->Cancel();
   451        m_idle->Cancel();
   475 // PluginHandler::loadPluginsL
   478 // PluginHandler::loadPluginsL
   476 //
   479 //
   477 // Loads all the plugins and query them for details.
   480 // Loads all the plugins and query them for details.
   478 // -----------------------------------------------------------------------------
   481 // -----------------------------------------------------------------------------
   479 //
   482 //
       
   483 static void CleanupPluginInfoArray( TAny* aObj )
       
   484     {
       
   485     if ( aObj )
       
   486         {
       
   487         static_cast<RImplInfoPtrArray*>( aObj )->ResetAndDestroy();
       
   488         static_cast<RImplInfoPtrArray*>( aObj )->Close();
       
   489         }
       
   490     }
       
   491  
   480 TBool PluginHandler::loadPluginsL()
   492 TBool PluginHandler::loadPluginsL()
   481 {
   493 {
   482     
   494     
   483     if(m_pluginsLoaded) {
   495     if(m_pluginsLoaded) {
   484         return EFalse;
   496         return EFalse;
   487     // 1) fetch CImplementationInformation instances from the ECOM infrastructure
   499     // 1) fetch CImplementationInformation instances from the ECOM infrastructure
   488     // 2) create plugin info for each plugin
   500     // 2) create plugin info for each plugin
   489 
   501 
   490     // Create the ECom info array, contains the plugin information
   502     // Create the ECom info array, contains the plugin information
   491     RImplInfoPtrArray ecomPluginInfoArray;
   503     RImplInfoPtrArray ecomPluginInfoArray;
       
   504     CleanupStack::PushL(TCleanupItem(CleanupPluginInfoArray, &ecomPluginInfoArray ) );
   492 
   505 
   493     // Get list of ECOM plugins that match the KNBrowserPluginInterfaceUid
   506     // Get list of ECOM plugins that match the KNBrowserPluginInterfaceUid
   494     REComSession::ListImplementationsL(KBrowserPluginInterfaceUid, ecomPluginInfoArray);
   507     REComSession::ListImplementationsL(KBrowserPluginInterfaceUid, ecomPluginInfoArray);
   495 
   508 
   496     // Loop through all the Netscape plugins found by ECom and populate the
   509     // Loop through all the Netscape plugins found by ECom and populate the
   517         User::LeaveIfError(m_pluginInfoArray.Append(pluginInfo));
   530         User::LeaveIfError(m_pluginInfoArray.Append(pluginInfo));
   518         CleanupStack::Pop();    // pluginInfo
   531         CleanupStack::Pop();    // pluginInfo
   519     }
   532     }
   520 
   533 
   521     // Clean up the ECom info array
   534     // Clean up the ECom info array
   522     ecomPluginInfoArray.ResetAndDestroy();
   535     CleanupStack::PopAndDestroy( &ecomPluginInfoArray );
   523     ecomPluginInfoArray.Close();
       
   524     
   536     
   525     m_pluginsLoaded = ETrue;
   537     m_pluginsLoaded = ETrue;
   526     return EFalse;
   538     return EFalse;
   527 }
   539 }
   528 
   540