browserplugins/browseraudiovideoplugin/src/BavpMain.cpp
branchRCL_3
changeset 64 6385c4c93049
parent 63 4baee4f15982
child 65 8e6fa1719340
equal deleted inserted replaced
63:4baee4f15982 64:6385c4c93049
     1 /*
       
     2 * Copyright (c) 2006 Nokia Corporation and/or its subsidiary(-ies).
       
     3 * All rights reserved.
       
     4 * This component and the accompanying materials are made available
       
     5 * under the terms of the License "Eclipse Public License v1.0"
       
     6 * which accompanies this distribution, and is available
       
     7 * at the URL "http://www.eclipse.org/legal/epl-v10.html".
       
     8 *
       
     9 * Initial Contributors:
       
    10 * Nokia Corporation - initial contribution.
       
    11 *
       
    12 * Contributors:
       
    13 *
       
    14 * Description:  Interface to Browser
       
    15 *
       
    16 */
       
    17 
       
    18 
       
    19 
       
    20 // INCLUDE FILES
       
    21 #include <e32std.h>     // For _LIT
       
    22 #include <npapi.h>      // For NPError
       
    23 #include <npupp.h>      // For NPNetscapeFuncs
       
    24 #include <ecom/implementationproxy.h>
       
    25 #include <cecombrowserplugininterface.h>
       
    26 
       
    27 #include "BavpLogger.h"
       
    28 #include "BavpPlugin.h" // For bap_xx methods
       
    29 
       
    30 /***************************************************/
       
    31 /**********ECOM STYLE BAVP PLUGIN ENTRY POINTS******/
       
    32 /***************************************************/
       
    33 
       
    34 // -----------------------------------------------------------------------------
       
    35 // CBavpPluginEcomMain::NewL
       
    36 // -----------------------------------------------------------------------------
       
    37 CBavpPluginEcomMain* CBavpPluginEcomMain::NewL( TAny* aInitParam )
       
    38     {
       
    39     Log( EFalse, _L("Calling CBavpPluginEcomMain::NewL ") );
       
    40 
       
    41     TFuncs* funcs = REINTERPRET_CAST( TFuncs*, aInitParam );
       
    42     CBavpPluginEcomMain* self = new (ELeave) CBavpPluginEcomMain( funcs->iNetscapeFuncs );
       
    43     CleanupStack::PushL( self );
       
    44     self->ConstructL( funcs->iPluginFuncs );
       
    45     CleanupStack::Pop( self );
       
    46 
       
    47     Dll::SetTls ( (void*) self );
       
    48 
       
    49     return self;
       
    50     }
       
    51 
       
    52 // -----------------------------------------------------------------------------
       
    53 // CBavpPluginEcomMain::ConstructL
       
    54 // -----------------------------------------------------------------------------
       
    55 void CBavpPluginEcomMain::ConstructL( NPPluginFuncs* aPluginFuncs )
       
    56     {
       
    57     Log( EFalse, _L("Calling CBavpPluginEcomMain::ConstructL ") );
       
    58     InitializeFuncs( aPluginFuncs );
       
    59     }
       
    60 
       
    61 // -----------------------------------------------------------------------------
       
    62 // CBavpPluginEcomMain::CBavpPluginEcomMain
       
    63 // -----------------------------------------------------------------------------
       
    64 CBavpPluginEcomMain::CBavpPluginEcomMain( NPNetscapeFuncs* aNpf ) 
       
    65     : CEcomBrowserPluginInterface(),
       
    66       iNpf( aNpf )
       
    67     {
       
    68     }
       
    69 
       
    70 // -----------------------------------------------------------------------------
       
    71 // CBavpPluginEcomMain::~CBavpPluginEcomMain
       
    72 // -----------------------------------------------------------------------------
       
    73 CBavpPluginEcomMain::~CBavpPluginEcomMain()
       
    74     {
       
    75     }
       
    76 
       
    77 // -----------------------------------------------------------------------------
       
    78 // KImplementationTable
       
    79 // -----------------------------------------------------------------------------
       
    80 const TImplementationProxy KImplementationTable[] =
       
    81     {
       
    82     {{KFirstBavpImplementationValue}, (TProxyNewLPtr)CBavpPluginEcomMain::NewL},
       
    83     {{KSecondBavpImplementationValue}, (TProxyNewLPtr)CBavpPluginEcomMain::NewL},
       
    84     {{KThirdBavpImplementationValue}, (TProxyNewLPtr)CBavpPluginEcomMain::NewL},
       
    85     {{KFourthBavpImplementationValue}, (TProxyNewLPtr)CBavpPluginEcomMain::NewL}
       
    86     };
       
    87 
       
    88 // -----------------------------------------------------------------------------
       
    89 // ImplementationGroupProxy
       
    90 // Returns the filters implemented in this DLL
       
    91 // Returns: The filters implemented in this DLL
       
    92 // -----------------------------------------------------------------------------
       
    93 EXPORT_C const TImplementationProxy* ImplementationGroupProxy(TInt& aTableCount)
       
    94     {
       
    95     aTableCount = sizeof(KImplementationTable) / sizeof(TImplementationProxy);
       
    96     return KImplementationTable;
       
    97     }
       
    98 
       
    99 // -----------------------------------------------------------------------------
       
   100 // InitializeFuncs
       
   101 // -----------------------------------------------------------------------------
       
   102 EXPORT_C NPError InitializeFuncs( NPPluginFuncs* aPpf )
       
   103     {
       
   104     aPpf->size          = sizeof(NPPluginFuncs);
       
   105     aPpf->version       = 1;
       
   106     aPpf->newp          = NewNPP_NewProc(BavpNewp);
       
   107     aPpf->destroy       = NewNPP_DestroyProc(BavpDestroy);
       
   108     aPpf->setwindow     = NewNPP_SetWindowProc(BavpSetwindow);
       
   109     aPpf->newstream     = NewNPP_NewStreamProc(BavpNewstream);
       
   110     aPpf->destroystream = NewNPP_DestroyStreamProc(BavpDestroystream);
       
   111     aPpf->asfile        = NewNPP_StreamAsFileProc(BavpAsfile);
       
   112     aPpf->writeready    = NewNPP_WriteReadyProc(BavpWriteready);
       
   113     aPpf->write         = NewNPP_WriteProc(BavpWrite);
       
   114     aPpf->print         = NewNPP_PrintProc(BavpPrint);
       
   115     aPpf->event         = NewNPP_HandleEventProc(BavpEvent);
       
   116     aPpf->urlnotify     = NewNPP_URLNotifyProc(BavpUrlnotify);
       
   117     aPpf->javaClass     = NULL;
       
   118     aPpf->getvalue      = NewNPP_GetValueProc(BavpGetvalue);
       
   119     aPpf->setvalue      = NewNPP_SetValueProc(BavpSetvalue);
       
   120 
       
   121     return NPERR_NO_ERROR;
       
   122     }
       
   123 
       
   124 // -----------------------------------------------------------------------------
       
   125 // NPP_Shutdown
       
   126 // -----------------------------------------------------------------------------
       
   127 EXPORT_C void NPP_Shutdown(void)
       
   128     {
       
   129     CBavpPluginEcomMain* npm = (CBavpPluginEcomMain*)Dll::Tls();
       
   130     delete npm;
       
   131     Dll::SetTls( NULL );
       
   132     }
       
   133 
       
   134 //  End of File