browserplugin/cpixnpplugin/inc/ccpixnpplugininterface.h
changeset 0 ccd0fd43f247
equal deleted inserted replaced
-1:000000000000 0:ccd0fd43f247
       
     1 /*
       
     2 * Copyright (c) 2010 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 "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: 
       
    15 *
       
    16 */
       
    17 
       
    18 
       
    19 #ifndef CPIXNPPLUGININTERFACE_H
       
    20 #define CPIXNPPLUGININTERFACE_H
       
    21 
       
    22 #include "e32def.h"
       
    23 
       
    24 //  INCLUDES
       
    25 #include "CObjectInterface.h"
       
    26 #include "idl/ICPixNPPlugin.h"
       
    27 
       
    28 // CLASS DECLARATION
       
    29 
       
    30 /**
       
    31  * Provides the interface between browser and the actual functionality implemented
       
    32  * in CCPixNPPlugin. Calls MCPixNPPlugin methods of the implementing class
       
    33  * as a response to method invokation requests from the browser.
       
    34  */
       
    35 class CCPixNPPluginInterface : public CObjectInterface, public MCPixNPPlugin
       
    36     {
       
    37 public:
       
    38     virtual ~CCPixNPPluginInterface();
       
    39 
       
    40 public:
       
    41     bool InvokeL( NPIdentifier name, NPVariant *args, uint32_t argCount, NPVariant *result );
       
    42     bool GetProperty( NPIdentifier name, NPVariant *variant );
       
    43     bool SetPropertyL( NPIdentifier name, NPVariant *variant );
       
    44 
       
    45 protected:
       
    46     void InitInterfaceL();
       
    47 
       
    48 private:
       
    49     // calls RSearchServerSession::DefineVolume()
       
    50     void InvokeDefineVolumeL(NPIdentifier name, NPVariant* args, uint32_t argCount, NPVariant *result);
       
    51     // calls RSearchServerSession::UnDefineVolume()
       
    52     void InvokeUnDefineVolumeL(NPIdentifier name, NPVariant* args, uint32_t argCount, NPVariant *result);
       
    53     };
       
    54     
       
    55 
       
    56 /**
       
    57  ********************************************************************************
       
    58      CPixPlugin API methods
       
    59  *********************************************************************************
       
    60  */
       
    61  typedef struct
       
    62      {
       
    63      NPObject object;
       
    64      CCPixNPPluginInterface *plugin;
       
    65      } CPixPluginObject;
       
    66 
       
    67  NPObject *CPixPluginAllocate();
       
    68 
       
    69  void CPixPluginInvalidate();
       
    70 
       
    71  void CPixPluginDeallocate( CPixPluginObject *obj );
       
    72 
       
    73  bool CPixPluginHasMethod( CPixPluginObject *obj, NPIdentifier name );
       
    74 
       
    75  bool CPixPluginInvokeFunctionL( CPixPluginObject* obj, NPIdentifier name,
       
    76                                       NPVariant *args, uint32_t argCount, NPVariant *result );
       
    77 
       
    78  bool CPixPluginHasProperty( CPixPluginObject *obj, NPIdentifier name );
       
    79 
       
    80  bool CPixPluginGetProperty ( CPixPluginObject *obj, NPIdentifier name,
       
    81                                     NPVariant *variant);
       
    82 
       
    83  void CPixPluginSetProperty( CPixPluginObject *obj, NPIdentifier name,
       
    84                                    NPVariant *variant);
       
    85 
       
    86  static NPClass _CPixPluginClass =
       
    87      {
       
    88      0,
       
    89      (NPAllocateFunctionPtr) CPixPluginAllocate,
       
    90      (NPDeallocateFunctionPtr) CPixPluginDeallocate,
       
    91      (NPInvalidateFunctionPtr) CPixPluginInvalidate,
       
    92      (NPHasMethodFunctionPtr) CPixPluginHasMethod,
       
    93      (NPInvokeFunctionPtr) CPixPluginInvokeFunctionL,
       
    94      (NPInvokeDefaultFunctionPtr) 0,
       
    95      (NPHasPropertyFunctionPtr) CPixPluginHasProperty,
       
    96      (NPGetPropertyFunctionPtr) CPixPluginGetProperty,
       
    97      (NPSetPropertyFunctionPtr) CPixPluginSetProperty,
       
    98      (NPRemovePropertyFunctionPtr) 0
       
    99      };
       
   100 
       
   101  /**
       
   102   * static instance of the function pointer table
       
   103   */
       
   104  static NPClass* CPixPluginClass = &_CPixPluginClass;
       
   105     
       
   106 #endif // CPIXBROWSERPLUGININTERFACE_H