omadrm/drmhelper/src/DRMHelperDownloadManager.cpp
changeset 0 95b198f216e5
child 12 8a03a285ab14
equal deleted inserted replaced
-1:000000000000 0:95b198f216e5
       
     1 /*
       
     2 * Copyright (c) 2004-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 "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:  DRMHelperDownloadManager implementation
       
    15 *
       
    16 */
       
    17 
       
    18 
       
    19 // INCLUDE FILES
       
    20 #include "DRMHelperDownloadManager.h"
       
    21 #include "drmhelperdmgrwrapper.h"
       
    22 
       
    23 // CONSTANTS
       
    24 _LIT( KDRMHelperDMgrHandlerName, "\\system\\libs\\drmhelperdmgrwrapper.dll" );
       
    25 
       
    26 typedef TAny* (*NewDMgrL)();
       
    27 
       
    28 const TInt KFirstFunction = 1;
       
    29 
       
    30 // ======== MEMBER FUNCTIONS ========
       
    31 
       
    32 CDrmHelperDownloadManager::CDrmHelperDownloadManager()
       
    33     {
       
    34     }
       
    35 
       
    36 void CDrmHelperDownloadManager::ConstructL()
       
    37     {
       
    38     User::LeaveIfError( iDMgrDll.Load( KDRMHelperDMgrHandlerName ) );
       
    39     NewDMgrL createDMgr = (NewDMgrL) iDMgrDll.Lookup( KFirstFunction );
       
    40     if ( !createDMgr )
       
    41         {
       
    42         User::Leave( KErrGeneral );
       
    43         }
       
    44     // Create the class, leaves in case of failure
       
    45     iDMgrHandler = (CDRMHelperDMgrWrapper*) (*createDMgr)();
       
    46     }
       
    47 
       
    48 CDrmHelperDownloadManager* CDrmHelperDownloadManager::NewL()
       
    49     {
       
    50     CDrmHelperDownloadManager* self = new( ELeave ) CDrmHelperDownloadManager();
       
    51     
       
    52     CleanupStack::PushL( self );
       
    53     self->ConstructL();
       
    54     CleanupStack::Pop();
       
    55 
       
    56     return self;
       
    57     }
       
    58 
       
    59 CDrmHelperDownloadManager::~CDrmHelperDownloadManager()
       
    60     {
       
    61     delete iDMgrHandler;
       
    62     iDMgrDll.Close();
       
    63     }
       
    64     
       
    65 void CDrmHelperDownloadManager::DownloadAndHandleRoapTriggerL(
       
    66     const HBufC8* aUrl, CCoeEnv& aCoeEnv )
       
    67     {
       
    68     iDMgrHandler->DownloadAndHandleRoapTriggerL( aUrl, aCoeEnv );
       
    69     }
       
    70 
       
    71 void CDrmHelperDownloadManager::DownloadAndHandleRoapTriggerL(
       
    72     const HBufC8* aUrl )
       
    73     {
       
    74     iDMgrHandler->DownloadAndHandleRoapTriggerL( aUrl );
       
    75     }
       
    76 
       
    77 HBufC8* CDrmHelperDownloadManager::GetErrorUrlL()
       
    78     {
       
    79     return iDMgrHandler->GetErrorUrlL();
       
    80     }
       
    81