webengine/osswebengine/WebKit/s60/plugins/PluginHandler.cpp
branchRCL_3
changeset 93 79859ed3eea9
parent 91 30342f40acbf
child 94 919f36ff910f
equal deleted inserted replaced
92:e1bea15f9a39 93:79859ed3eea9
    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 = NULL;
   160     HBufC*  entry;
   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();
       
   419 }
   418 }
   420 
   419 
   421 
   420 
   422 // -----------------------------------------------------------------------------
   421 // -----------------------------------------------------------------------------
   423 // PluginHandler::NewL
   422 // PluginHandler::NewL
   440 // Deconstructor.
   439 // Deconstructor.
   441 // -----------------------------------------------------------------------------
   440 // -----------------------------------------------------------------------------
   442 //
   441 //
   443 PluginHandler::~PluginHandler()
   442 PluginHandler::~PluginHandler()
   444 {
   443 {
   445     m_visiblePlugins.Reset();
       
   446     m_visiblePlugins.Close();
       
   447     m_pluginInfoArray.ResetAndDestroy();
   444     m_pluginInfoArray.ResetAndDestroy();
   448     m_pluginInfoArray.Close();
   445     m_pluginInfoArray.Close();
   449     m_pluginObjects.clear();
   446     m_pluginObjects.clear();
   450     if (m_idle) {
   447     if (m_idle) {
   451        m_idle->Cancel();
   448        m_idle->Cancel();
   478 // PluginHandler::loadPluginsL
   475 // PluginHandler::loadPluginsL
   479 //
   476 //
   480 // Loads all the plugins and query them for details.
   477 // Loads all the plugins and query them for details.
   481 // -----------------------------------------------------------------------------
   478 // -----------------------------------------------------------------------------
   482 //
   479 //
   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  
       
   492 TBool PluginHandler::loadPluginsL()
   480 TBool PluginHandler::loadPluginsL()
   493 {
   481 {
   494     
   482     
   495     if(m_pluginsLoaded) {
   483     if(m_pluginsLoaded) {
   496         return EFalse;
   484         return EFalse;
   499     // 1) fetch CImplementationInformation instances from the ECOM infrastructure
   487     // 1) fetch CImplementationInformation instances from the ECOM infrastructure
   500     // 2) create plugin info for each plugin
   488     // 2) create plugin info for each plugin
   501 
   489 
   502     // Create the ECom info array, contains the plugin information
   490     // Create the ECom info array, contains the plugin information
   503     RImplInfoPtrArray ecomPluginInfoArray;
   491     RImplInfoPtrArray ecomPluginInfoArray;
   504     CleanupStack::PushL(TCleanupItem(CleanupPluginInfoArray, &ecomPluginInfoArray ) );
       
   505 
   492 
   506     // Get list of ECOM plugins that match the KNBrowserPluginInterfaceUid
   493     // Get list of ECOM plugins that match the KNBrowserPluginInterfaceUid
   507     REComSession::ListImplementationsL(KBrowserPluginInterfaceUid, ecomPluginInfoArray);
   494     REComSession::ListImplementationsL(KBrowserPluginInterfaceUid, ecomPluginInfoArray);
   508 
   495 
   509     // Loop through all the Netscape plugins found by ECom and populate the
   496     // Loop through all the Netscape plugins found by ECom and populate the
   530         User::LeaveIfError(m_pluginInfoArray.Append(pluginInfo));
   517         User::LeaveIfError(m_pluginInfoArray.Append(pluginInfo));
   531         CleanupStack::Pop();    // pluginInfo
   518         CleanupStack::Pop();    // pluginInfo
   532     }
   519     }
   533 
   520 
   534     // Clean up the ECom info array
   521     // Clean up the ECom info array
   535     CleanupStack::PopAndDestroy( &ecomPluginInfoArray );
   522     ecomPluginInfoArray.ResetAndDestroy();
       
   523     ecomPluginInfoArray.Close();
   536     
   524     
   537     m_pluginsLoaded = ETrue;
   525     m_pluginsLoaded = ETrue;
   538     return EFalse;
   526     return EFalse;
   539 }
   527 }
   540 
   528