webengine/deviceextension/src/DeviceExtension.cpp
changeset 0 dd21522fd290
equal deleted inserted replaced
-1:000000000000 0:dd21522fd290
       
     1 /*
       
     2 * Copyright (c) 2007 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:  Implementation of the Device Extension object which is the
       
    15 *                webengine part of the device interface
       
    16 *
       
    17 */
       
    18 
       
    19 
       
    20 
       
    21 // INCLUDE FILES
       
    22 #include <e32std.h>
       
    23 #include "DeviceExtension.h"
       
    24 
       
    25 // ============================ MEMBER FUNCTIONS ===============================
       
    26 
       
    27 
       
    28 // ----------------------------------------------------------------------------
       
    29 // CDeviceExtension::NewL
       
    30 //
       
    31 //
       
    32 //
       
    33 // ----------------------------------------------------------------------------
       
    34 
       
    35 CDeviceExtension* CDeviceExtension::NewL(
       
    36 	CWebKitView& aWebKitView )
       
    37     {
       
    38     CDeviceExtension* self = new ( ELeave ) CDeviceExtension( aWebKitView );
       
    39     CleanupStack::PushL( self );
       
    40     self->ConstructL();
       
    41     CleanupStack::Pop();
       
    42     return self;
       
    43     }
       
    44 
       
    45 // ----------------------------------------------------------------------------
       
    46 // CDeviceExtension::CDeviceExtension
       
    47 //
       
    48 //
       
    49 //
       
    50 // ----------------------------------------------------------------------------
       
    51 CDeviceExtension::CDeviceExtension( CWebKitView& aWebKitView )
       
    52     :iWebKitView( &aWebKitView )
       
    53     {	
       
    54     }
       
    55 
       
    56 
       
    57 // ----------------------------------------------------------------------------
       
    58 // CDeviceExtension::~CDeviceExtension
       
    59 //
       
    60 //
       
    61 //
       
    62 // ----------------------------------------------------------------------------
       
    63 CDeviceExtension::~CDeviceExtension()
       
    64     {
       
    65     if ( iDeviceBridge )
       
    66         {
       
    67         delete iDeviceBridge;
       
    68         }
       
    69 
       
    70     dLibrary.Close();
       
    71     }
       
    72 
       
    73 // ----------------------------------------------------------------------------
       
    74 // CDeviceExtension::ConstructL
       
    75 //
       
    76 //
       
    77 //
       
    78 // ----------------------------------------------------------------------------
       
    79 void CDeviceExtension::ConstructL()
       
    80     {
       
    81     LoadDeviceDllL(); //Load the device interface implementation
       
    82     }
       
    83 
       
    84     
       
    85 // ----------------------------------------------------------------------------
       
    86 // CDeviceExtension::createDeviceObject
       
    87 //
       
    88 //
       
    89 //
       
    90 // ----------------------------------------------------------------------------
       
    91 void* CDeviceExtension::createDeviceObject( void* aExec )
       
    92     {
       
    93     if ( iDeviceBridge )
       
    94         {
       
    95         return iDeviceBridge->Device( aExec );
       
    96         }
       
    97 
       
    98     return NULL;
       
    99     }    	
       
   100  
       
   101 
       
   102 // -----------------------------------------------------------------------------
       
   103 // CDeviceExtension::LoadDeviceDllL
       
   104 //
       
   105 // -----------------------------------------------------------------------------
       
   106 //
       
   107 void CDeviceExtension::LoadDeviceDllL()
       
   108     {
       
   109     if ( !iDeviceBridge )
       
   110         {
       
   111         _LIT( KBrowserDeviceLibName, "jsdevice.dll" );
       
   112         User::LeaveIfError( dLibrary.Load( KBrowserDeviceLibName ) );
       
   113 
       
   114         TLibraryFunction entry = dLibrary.Lookup( 1 );
       
   115 
       
   116         if ( !entry )
       
   117             User::Leave( KErrNotFound );
       
   118 
       
   119         //Create instance of DeviceBridge class
       
   120         iDeviceBridge = ( MDeviceBridge* ) entry();
       
   121         }
       
   122     }
       
   123     
       
   124 //END OF FILE