omadrm/drmhelper/src/DRMHelperDownloadManager.cpp
author Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
Wed, 31 Mar 2010 22:01:10 +0300
branchRCL_3
changeset 13 a20e54f39dd4
parent 12 8a03a285ab14
permissions -rw-r--r--
Revision: 201011 Kit: 201013

/*
* Copyright (c) 2004-2010 Nokia Corporation and/or its subsidiary(-ies).
* All rights reserved.
* This component and the accompanying materials are made available
* under the terms of "Eclipse Public License v1.0"
* which accompanies this distribution, and is available
* at the URL "http://www.eclipse.org/legal/epl-v10.html".
*
* Initial Contributors:
* Nokia Corporation - initial contribution.
*
* Contributors:
*
* Description:  DRMHelperDownloadManager implementation
*
*/


// INCLUDE FILES
#include "DRMHelperDownloadManager.h"
#include "DrmUtilityDmgrWrapper.h"

// CONSTANTS
_LIT( KDrmUtilityDmgrHandlerName, "DrmUtilityDmgrWrapper.dll" );

typedef TAny* (*NewDMgrL)();

const TInt KFirstFunction = 1;

// ======== MEMBER FUNCTIONS ========

CDrmHelperDownloadManager::CDrmHelperDownloadManager()
    {
    }

void CDrmHelperDownloadManager::ConstructL()
    {
    User::LeaveIfError( iDMgrDll.Load( KDrmUtilityDmgrHandlerName ) );
    NewDMgrL createDMgr = (NewDMgrL) iDMgrDll.Lookup( KFirstFunction );
    if ( !createDMgr )
        {
        User::Leave( KErrGeneral );
        }
    // Create the class, leaves in case of failure
    iDMgrHandler = reinterpret_cast<CDrmUtilityDmgrWrapper*>( (*createDMgr)() );
    }

CDrmHelperDownloadManager* CDrmHelperDownloadManager::NewL()
    {
    CDrmHelperDownloadManager* self = new( ELeave ) CDrmHelperDownloadManager();

    CleanupStack::PushL( self );
    self->ConstructL();
    CleanupStack::Pop();

    return self;
    }

CDrmHelperDownloadManager::~CDrmHelperDownloadManager()
    {
    delete iDMgrHandler;
    iDMgrDll.Close();
    }

void CDrmHelperDownloadManager::DownloadAndHandleRoapTriggerL(
    const HBufC8* aUrl, CCoeEnv& aCoeEnv )
    {
    iDMgrHandler->DownloadAndHandleRoapTriggerL( aUrl, aCoeEnv );
    }

void CDrmHelperDownloadManager::DownloadAndHandleRoapTriggerL(
    const HBufC8* aUrl )
    {
    iDMgrHandler->DownloadAndHandleRoapTriggerL( aUrl );
    }

HBufC8* CDrmHelperDownloadManager::GetErrorUrlL()
    {
    return iDMgrHandler->GetErrorUrlL();
    }