commondrm/drmutility/inc/drmutilitywmdrmwrapper.h
changeset 0 95b198f216e5
child 18 8a03a285ab14
equal deleted inserted replaced
-1:000000000000 0:95b198f216e5
       
     1 /*
       
     2 * Copyright (c) 2006-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 "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:  Wraps WM DRM operations for use with DRM Utility
       
    15 *
       
    16 */
       
    17 
       
    18 
       
    19 #ifndef CDRMUTILITYWMDRMWRAPPER_H
       
    20 #define CDRMUTILITYWMDRMWRAPPER_H
       
    21 
       
    22 //*** system include files go here:
       
    23 #include <e32base.h>
       
    24 #include <f32file.h>
       
    25 #include <aknserverapp.h>
       
    26 #include <caf/caf.h>
       
    27 #include <drmutilitytypes.h>
       
    28 
       
    29 //*** user include files go here:
       
    30 #include "drmwmdrmwrapper.h"
       
    31 
       
    32 class CWmDrmDlaWrapper;
       
    33 
       
    34 namespace DRM
       
    35     {
       
    36 
       
    37     class CDrmUtilityUI;
       
    38 
       
    39  /**
       
    40   *  Utility class for DRM related common functions
       
    41   *
       
    42   *  @lib drmutilityemdrmwrapper.lib
       
    43   *  @since S60 v5.0
       
    44   */
       
    45 NONSHARABLE_CLASS( CDrmUtilityWMDrmWrapper ) : public CBase, public MDrmUtilityWMDrmWrapper,
       
    46     public MAknServerAppExitObserver
       
    47     {
       
    48 
       
    49 public:
       
    50 
       
    51     /**
       
    52      * Creates a new CDrmUtilityWMDrmWrapper object and returns a pointer to it
       
    53      *
       
    54      * @return A functional CDrmUtilityWMDrmWrapper -object
       
    55      * @leave System wide error code
       
    56      */
       
    57     IMPORT_C static CDrmUtilityWMDrmWrapper* NewL();
       
    58 
       
    59     /**
       
    60      * Creates a new CDrmUtilityWMDrmWrapper object and returns a pointer to it
       
    61      * Leaves the pointer to the cleanup stack
       
    62      *
       
    63      * @return A functional CDrmUtilityWMDrmWrapper -object
       
    64      * @leave System wide error code
       
    65      */
       
    66     IMPORT_C static CDrmUtilityWMDrmWrapper* NewLC();
       
    67 
       
    68     /**
       
    69      * Destructor
       
    70      */
       
    71     virtual ~CDrmUtilityWMDrmWrapper();
       
    72 
       
    73 
       
    74 public: // From MDrmUtilityWMDrmWrapper
       
    75 
       
    76     /**
       
    77      * Performs the check rights amount operation for windows media files
       
    78      *
       
    79      * @param[in]   aContent    The content itself
       
    80      * @param[in]   aIntent     The intent for the rights to check
       
    81      * @param[in]   aObserver   Observer for callbacks, NULL if not
       
    82      *                          available
       
    83      * @param[in]   aOperatioId The operation id of the async operation
       
    84      * @return none
       
    85      * @leave System wide error code
       
    86      */
       
    87     IMPORT_C void CheckWmRightsAmountL(
       
    88         ContentAccess::CData& aContent,
       
    89         ContentAccess::TIntent aIntent,
       
    90         MDrmUiCheckRightsObserver* aObserver,
       
    91         TInt aOperationId );
       
    92 
       
    93     /**
       
    94      * Performs the handle error operation for windows media files
       
    95      *
       
    96      * @param[in]   aContent    The content itself
       
    97      * @param[in]   aIntent     The intent for the rights to check
       
    98      * @param[in]   aError      The error code to be handled
       
    99      * @param[in]   aObserver   Observer for callbacks, NULL if not
       
   100      *                          available
       
   101      * @param[in]   aOperatioId The operation id of the async operation
       
   102      * @return none
       
   103      * @leave System wide error code
       
   104      */
       
   105     IMPORT_C void HandleWmErrorL(
       
   106         ContentAccess::CData& aContent,
       
   107         ContentAccess::TIntent aIntent,
       
   108         TInt aError,
       
   109         MDrmHandleErrorObserver* aObserver,
       
   110         TInt aOperationId );
       
   111 
       
   112     /**
       
   113      * Method for setting the control environment
       
   114      *
       
   115      * @param[in]   aCoeEnv     The control environment
       
   116      * @return none
       
   117      */
       
   118     IMPORT_C void SetCoeEnv(
       
   119         CCoeEnv* aCoeEnv );
       
   120 
       
   121 protected:
       
   122 
       
   123 private:
       
   124 
       
   125     CDrmUtilityWMDrmWrapper();
       
   126 
       
   127     void ConstructL();
       
   128 
       
   129 //*** Callback methods:
       
   130 
       
   131     // Callback to observer with info rights not valid and why
       
   132     void CallRightsNotValidL(
       
   133         MDrmUiCheckRightsObserver* aObserver,
       
   134         TInt aOperationId,
       
   135         TCheckRightsStatus aRightsStatus,
       
   136         TUint32 aReason,
       
   137         ContentAccess::CData& aContent,
       
   138         const TDesC& aContentUri );
       
   139 
       
   140     // Callback to the observer with the rights left information
       
   141     // if no observer do default handling
       
   142     void CallRightsLeftL(
       
   143         MDrmUiCheckRightsObserver* aObserver,
       
   144         TInt aOperationId,
       
   145         TBool aUnconstrained,
       
   146         TTimeIntervalSeconds aTime,
       
   147         TInt aCounts,
       
   148         TTimeIntervalSeconds aAccumulated,
       
   149         ContentAccess::CData& aContent,
       
   150         const TDesC& aContentUri );
       
   151 
       
   152     void CallRightsAvailable(
       
   153         DRM::MDrmHandleErrorObserver* aObserver,
       
   154         TInt aOperationId,
       
   155         TInt aError );
       
   156 
       
   157 
       
   158 //*** Helper methods:
       
   159 
       
   160     // Get rights data for WM DRM content
       
   161     void GetRightsDataL(
       
   162         const TDesC& aUniqueId,
       
   163         TBool& aUnconstrained,
       
   164         TTimeIntervalSeconds& aTime,
       
   165         TInt& aCounts,
       
   166         TTimeIntervalSeconds& aAccumulated );
       
   167 
       
   168     // Get a rights manager instance
       
   169     ContentAccess::CRightsManager* GetRightsManagerL();
       
   170 
       
   171     // Rejection reason mapping from agent reasons to generic
       
   172     TInt RejectReason( TUint32 aReason );
       
   173 
       
   174     // Launch rights manager UI
       
   175     void LaunchRightsManagerUiL( const TDesC& aParam16 );
       
   176 
       
   177     // Form string needed to launch rights manager UI embedded.
       
   178     void CreateLaunchParamL( const TDesC* aUrl,
       
   179                              HBufC*& aLaunchParam );
       
   180 
       
   181     // Handles exit from service from MAknServerAppExitObserver
       
   182     void HandleServerAppExit( TInt aReason );
       
   183 
       
   184 //*** Notes:
       
   185 
       
   186     // Show the appropriate notes
       
   187     void ShowNoRightsNoteL(
       
   188         ContentAccess::CData& aContent,
       
   189         TUint32 aReason );
       
   190 
       
   191 //*** DLA:
       
   192 
       
   193     void LoadDlaWrapperL();
       
   194     void GetRFileFromCDataL( ContentAccess::CData& aContent, RFile& aFile );
       
   195     TBool IsDlaLicenseAcquisitionSilentL( RFile& aFile  );
       
   196     void DlaLicenseAcquisitionL( RFile& aFile );
       
   197     void SilentDlaLicenseAcquisitionL( ContentAccess::CData& aContent );
       
   198     TInt DefaultAccessPointL();
       
   199 
       
   200 private: // Data members
       
   201 
       
   202     // Control environment, not owned
       
   203     CCoeEnv* iCoeEnv;
       
   204 
       
   205     // DrmUtilityCommon
       
   206     CDrmUtilityUI* iDrmUtilityUi;
       
   207 
       
   208     // Wait for the notes and queries
       
   209     CActiveSchedulerWait iWait;
       
   210 
       
   211     RFs iFs;
       
   212 
       
   213     RLibrary iDlaWrapperDll;
       
   214     CWmDrmDlaWrapper* iDlaWrapper;
       
   215     };
       
   216 }
       
   217 
       
   218 
       
   219 #endif // CDRMUTILITYWMDRMWRAPPER_H