commondrm/drmutility/inc/DrmUiHandlingImpl.h
changeset 0 95b198f216e5
child 18 8a03a285ab14
child 19 7c1aa284cf3b
equal deleted inserted replaced
-1:000000000000 0:95b198f216e5
       
     1 /*
       
     2 * Copyright (c) 2006-2009 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:  Implementation class of DRM UI Handling
       
    15 *
       
    16 */
       
    17 
       
    18 
       
    19 #ifndef C_CDRMUIHANDLINGIMPL_H
       
    20 #define C_CDRMUIHANDLINGIMPL_H
       
    21 
       
    22 //*** system include files go here:
       
    23 #include <e32base.h>
       
    24 #include <f32file.h>
       
    25 #include <aknserverapp.h>
       
    26 #include <caf/caftypes.h>
       
    27 #include <caf/caferr.h>
       
    28 #include <drmagents.h>
       
    29 #include <drmrightsclient.h>
       
    30 #include <drmutilitytypes.h>
       
    31 
       
    32 //*** forward declarations go here:
       
    33 class CCoeEnv;
       
    34 class CDRMConstraint;
       
    35 class CSchemeHandler;
       
    36 
       
    37 namespace ContentAccess
       
    38     {
       
    39     class CData;
       
    40     }
       
    41 
       
    42 namespace DRM
       
    43 {
       
    44 
       
    45     //*** forward declarations go here:
       
    46     class CDrmUtility;
       
    47     class CDrmUiHandlingData;
       
    48     class CDrmUtilityCommon;
       
    49     class CDrmUtilityUI;
       
    50     class MDrmAsyncObserver;
       
    51     class MDrmUiCheckRightsObserver;
       
    52     class MDrmHandleErrorObserver;
       
    53     class MDrmUtilityWMDrmWrapper;
       
    54     class CDrmUtilityWMDrm;
       
    55 
       
    56 /**
       
    57  *  Implementation class for CDrmUiHandling class
       
    58  *
       
    59  *  @lib drmuihandlingimpl.lib
       
    60  *  @since S60 v5.0
       
    61  */
       
    62 NONSHARABLE_CLASS( CDrmUiHandlingImpl ) : public CActive, public MAknServerAppExitObserver
       
    63     {
       
    64 
       
    65 public:
       
    66 
       
    67     /** Error codes that are handled by HandleError */
       
    68     enum TDrmUiError
       
    69         {
       
    70         ENoPermission = KErrCANoPermission,
       
    71         ENoRights = KErrCANoRights,
       
    72         EPendingRights = KErrCAPendingRights
       
    73         };
       
    74 
       
    75 public:
       
    76 
       
    77     /**
       
    78     * Two-phased constructor.
       
    79     */
       
    80     IMPORT_C static CDrmUiHandlingImpl* NewL( CDrmUtility* aDrmUtility, CCoeEnv* aCoeEnv = NULL );
       
    81     IMPORT_C static CDrmUiHandlingImpl* NewLC( CDrmUtility* aDrmUtility, CCoeEnv* aCoeEnv = NULL );
       
    82 
       
    83     /**
       
    84      * Destructor.
       
    85      */
       
    86     virtual ~CDrmUiHandlingImpl();
       
    87 
       
    88     /**
       
    89      * Check how much rights there are left for the content.
       
    90      * This method also displays appropriate notes, which observer can
       
    91      * override, if rights are invalid. Asynchronous version, all errors
       
    92      * are signalled using request status.
       
    93      *
       
    94      * @since S60 v5.0
       
    95      * @param[in]   aFile       file of which rights are checked.
       
    96      * @param[in]   aIntent     the CAF intent to be used for checking
       
    97      * @param[in]   aObserver   reference to observer
       
    98      *
       
    99      * @return Operation Identifier for the async request
       
   100      *         required for cancelling an operation and
       
   101      *         identifying which request has been completed
       
   102      *
       
   103      * @leave System wide error code
       
   104      *        KErrArgument  if file is not DRM protected.
       
   105      *
       
   106      * @see MDrmUiCheckRightsObserver
       
   107      */
       
   108     IMPORT_C TInt CheckRightsAmountAsyncL(
       
   109         RFile& aFile,
       
   110         ContentAccess::TIntent aIntent,
       
   111         MDrmUiCheckRightsObserver& aObserver );
       
   112 
       
   113      /**
       
   114      * Check how much rights there are left for the content.
       
   115      * This method also displays appropriate notes, which observer can
       
   116      * override, if rights are invalid. Synchronous version, leaves in case
       
   117      * of error.
       
   118      *
       
   119      * @since S60 v5.0
       
   120      * @param[in]   aFile       file of which rights are checked.
       
   121      * @param[in]   aIntent     the CAF intent to be used for checking
       
   122      * @param[in]   aObserver   pointer to observer, NULL if no observer
       
   123      *
       
   124      * @return none
       
   125      * @leave System wide error code
       
   126      *        KErrArgument  if file is not DRM protected.
       
   127      *
       
   128      * @see MDrmUiCheckRightsObserver
       
   129      */
       
   130     IMPORT_C void CheckRightsAmountL(
       
   131         RFile& aFile,
       
   132         ContentAccess::TIntent aIntent,
       
   133         MDrmUiCheckRightsObserver* aObserver );
       
   134 
       
   135     /**
       
   136      * Check how much rights there are left for the content.
       
   137      * This method also displays appropriate notes, which observer can
       
   138      * override, if rights are invalid. Asynchronous version, all errors
       
   139      * are signalled using request status.
       
   140      *
       
   141      * @since S60 v5.0
       
   142      * @param[in]   aFile       content of which rights are checked.
       
   143      * @param[in]   aIntent     the CAF intent to be used for checking
       
   144      * @param[in]   aObserver   reference to observer
       
   145      *
       
   146      * @return Operation Identifier for the async request
       
   147      *         required for cancelling an operation and
       
   148      *         identifying which request has been completed
       
   149      *
       
   150      * @leave System wide error code
       
   151      *        KErrArgument  if file is not DRM protected.
       
   152      *
       
   153      * @see MDrmUiCheckRightsObserver
       
   154      */
       
   155     IMPORT_C TInt CheckRightsAmountAsyncL(
       
   156         ContentAccess::CData& aFile,
       
   157         ContentAccess::TIntent aIntent,
       
   158         MDrmUiCheckRightsObserver& aObserver );
       
   159 
       
   160      /**
       
   161      * Check how much rights there are left for the content.
       
   162      * This method also displays appropriate notes, which observer can
       
   163      * override, if rights are invalid. Synchronous version, leaves in case
       
   164      * of error.
       
   165      *
       
   166      * @since S60 v5.0
       
   167      * @param[in]   aFile       content of which rights are checked.
       
   168      * @param[in]   aIntent     the CAF intent to be used for checking
       
   169      * @param[in]   aObserver   pointer to observer, NULL if no observer
       
   170      * @return none
       
   171      * @leave System wide error code
       
   172      *        KErrArgument  if file is not DRM protected.
       
   173      *
       
   174      * @see MDrmUiCheckRightsObserver
       
   175      */
       
   176     IMPORT_C void CheckRightsAmountL(
       
   177         ContentAccess::CData& aFile,
       
   178         ContentAccess::TIntent aIntent,
       
   179         MDrmUiCheckRightsObserver* aObserver );
       
   180 
       
   181     /**
       
   182      * Displays information about rights for given content.
       
   183      * Asynchronous version.
       
   184      *
       
   185      * @since S60 v5.0
       
   186      * @param[in]   aFile           file for which rights details are
       
   187      *                              displayed.
       
   188      * @param[in]   aObserver       reference to observer
       
   189      *
       
   190      * @return Operation Identifier for the async request
       
   191      *         required for cancelling an operation and
       
   192      *         identifying which request has been completed
       
   193      *
       
   194      * @leave   System wide error code
       
   195      */
       
   196     IMPORT_C TInt ShowDetailsViewAsyncL(
       
   197         RFile& aFile,
       
   198         MDrmAsyncObserver& aObserver );
       
   199 
       
   200     /**
       
   201      * Displays information about rights for given content.
       
   202      * Synchronous version, leaves in case of error.
       
   203      *
       
   204      * @since S60 v5.0
       
   205      * @param[in]   aFile       file for which rights details are
       
   206      *                          displayed.
       
   207      *
       
   208      * @leave   KErrArgument    File is not DRM protected.
       
   209      * @leave   KErrCANoRights  Rights object does not exist.
       
   210      *
       
   211      * @see caferr.h
       
   212      */
       
   213     IMPORT_C void ShowDetailsViewL(
       
   214         RFile& aFile );
       
   215 
       
   216     /**
       
   217      * Displays information about rights for given content.
       
   218      * Asynchronous version.
       
   219      *
       
   220      * @since S60 v5.0
       
   221      * @param[in]   aFile       content for which rights details are
       
   222      *                          displayed.
       
   223      * @param[in]   aObserver   reference to observer
       
   224      *
       
   225      * @return Operation Identifier for the async request
       
   226      *         required for cancelling an operation and
       
   227      *         identifying which request has been completed
       
   228      *
       
   229      * @leave System wide error code
       
   230      */
       
   231     IMPORT_C TInt ShowDetailsViewAsyncL(
       
   232         ContentAccess::CData& aFile,
       
   233         MDrmAsyncObserver& aObserver );
       
   234 
       
   235      /**
       
   236      * Displays information about rights for given content.
       
   237      * Synchronous version, leaves in case of error.
       
   238      *
       
   239      * @since S60 v5.0
       
   240      * @param[in]   aFile   content for which rights details are displayed.
       
   241      *
       
   242      * @leave   KErrArgument    Content is not DRM protected.
       
   243      * @leave   KErrCANoRights  Rights object does not exist.
       
   244      * @leave   System wide error code
       
   245      *
       
   246      * @see caferr.h
       
   247      */
       
   248     IMPORT_C void ShowDetailsViewL(
       
   249         ContentAccess::CData& aFile );
       
   250 
       
   251      /**
       
   252      * Handle the specific url defined by the file, such as InfoUrl
       
   253      * Asynchronous method
       
   254      *
       
   255      * @since S60 v5.0
       
   256      * @param[in]   aFile           file whose url is being handled
       
   257      * @param[in]   aType           type of the requested url,
       
   258      *                              only a single url may be requested
       
   259      *                              at a time
       
   260      * @param[in]   aObserver       reference to observer
       
   261      *
       
   262      * @return Operation Identifier for the async request
       
   263      *         required for cancelling an operation and
       
   264      *         identifying which request has been completed
       
   265      *
       
   266      * @leave   KErrArgument        File is not DRM protected.
       
   267      * @leave   KErrNotSupported    Url type is not supported for the file
       
   268      */
       
   269     IMPORT_C TInt HandleUrlAsyncL(
       
   270         RFile& aFile,
       
   271         TDrmUiUrlType aType,
       
   272         MDrmAsyncObserver& aObserver );
       
   273 
       
   274 
       
   275      /**
       
   276      * Handle the specific url defined by the file, such as InfoUrl
       
   277      *
       
   278      * @since S60 v5.0
       
   279      * @param[in]   aFile        file whose url is being handled
       
   280      * @param[in]   aType        type of the requested url,
       
   281      *                           only a single url may be requested
       
   282      *                           at a time
       
   283      *
       
   284      * @leave   KErrArgument     File is not DRM protected.
       
   285      * @leave   KErrNotSupported Url type is not supported for the file
       
   286      */
       
   287     IMPORT_C void HandleUrlL(
       
   288         RFile& aFile,
       
   289         TDrmUiUrlType aType );
       
   290 
       
   291      /**
       
   292      * Handle the specific url defined by the file, such as InfoUrl
       
   293      * Asynchronous method
       
   294      *
       
   295      * @since S60 v5.0
       
   296      * @param[in]   aFile           content whose url is being handled
       
   297      * @param[in]   aType           type of the requested url,
       
   298      *                              only a single url may be requested
       
   299      *                              at a time
       
   300      * @param[in]   aObserver       reference to observer
       
   301      *
       
   302      * @return Operation Identifier for the async request
       
   303      *         required for cancelling an operation and
       
   304      *         identifying which request has been completed
       
   305      *
       
   306      * @leave   KErrArgument        File is not DRM protected,
       
   307      *                              or multiple url:s were requested
       
   308      * @leave   KErrNotSupported    Url type is not supported for the file
       
   309      */
       
   310     IMPORT_C TInt HandleUrlAsyncL(
       
   311         ContentAccess::CData& aFile,
       
   312         TDrmUiUrlType aType,
       
   313         MDrmAsyncObserver& aObserver );
       
   314 
       
   315      /**
       
   316      * Handle the specific url defined by the file, such as InfoUrl
       
   317      *
       
   318      * @since S60 v5.0
       
   319      * @param[in]   aFile        content whose url is being handled
       
   320      * @param[in]   aType        type of the requested url,
       
   321      *                           only a single url may be requested
       
   322      *                           at a time
       
   323      *
       
   324      * @leave   KErrArgument     File is not DRM protected.
       
   325      * @leave   KErrNotSupported Url type is not supported for the file
       
   326      */
       
   327     IMPORT_C void HandleUrlL(
       
   328         ContentAccess::CData& aFile,
       
   329         TDrmUiUrlType aType );
       
   330 
       
   331 
       
   332      /**
       
   333      * Get information of the available urls
       
   334      * Asynchronous method
       
   335      *
       
   336      * @since S60 v5.0
       
   337      * @param[in]   aFile           file whose url is being handled
       
   338      * @param[out]  aType           A bitmask of the supported url types
       
   339      * @param[in]   aObserver       reference to observer
       
   340      *
       
   341      * @return Operation Identifier for the async request
       
   342      *         required for cancelling an operation and
       
   343      *         identifying which request has been completed
       
   344      *
       
   345      * @leave   KErrArgument        File is not DRM protected.
       
   346      */
       
   347     IMPORT_C TInt AvailableUrlsAsyncL(
       
   348         RFile& aFile,
       
   349         TDrmUiUrlType& aType,
       
   350         MDrmAsyncObserver& aObserver );
       
   351 
       
   352      /**
       
   353      * Get information of the available urls
       
   354      *
       
   355      * @since S60 v5.0
       
   356      * @param[in]   aFile           file whose url is being handled
       
   357      * @param[out]  aType           A bitmask of the supported url types
       
   358      *
       
   359      * @leave   KErrArgument        File is not DRM protected.
       
   360      */
       
   361     IMPORT_C void AvailableUrlsL(
       
   362         RFile& aFile,
       
   363         TDrmUiUrlType& aType );
       
   364 
       
   365 
       
   366      /**
       
   367      * Get information of the available urls
       
   368      * Asynchronous method
       
   369      *
       
   370      * @since S60 v5.0
       
   371      * @param[in]   aFile           content whose url is being handled
       
   372      * @param[out]  aType           A bitmask of the supported url types
       
   373      * @param[in]   aObserver       reference to observer
       
   374      *
       
   375      * @return Operation Identifier for the async request
       
   376      *         required for cancelling an operation and
       
   377      *         identifying which request has been completed
       
   378      *
       
   379      * @leave   KErrArgument        File is not DRM protected.
       
   380      */
       
   381     IMPORT_C TInt AvailableUrlsAsyncL(
       
   382         ContentAccess::CData& aFile,
       
   383         TDrmUiUrlType& aType,
       
   384         MDrmAsyncObserver& aObserver );
       
   385 
       
   386      /**
       
   387      * Get information of the available urls
       
   388      *
       
   389      * @since S60 v5.0
       
   390      * @param[in]   aFile           content whose url is being handled
       
   391      * @param[out]  aType           A bitmask of the supported url types
       
   392      *
       
   393      * @leave   KErrArgument        File is not DRM protected.
       
   394      */
       
   395     IMPORT_C void AvailableUrlsL(
       
   396         ContentAccess::CData& aFile,
       
   397         TDrmUiUrlType& aType );
       
   398 
       
   399 
       
   400     /**
       
   401      * Handles DRM error situations related to invalid rights.
       
   402      * This method displays appropriate notes, which observer can override,
       
   403      * to the user and acquires new rights if needed. Asynchronous version,
       
   404      * all errors are signalled using request status.
       
   405      *
       
   406      * @since S60 v5.0
       
   407      * @param[in]   aFile       file for which the error happened
       
   408      * @param[in]   aIntent     the CAF intent which was used to recieve
       
   409      *                          the error
       
   410      * @param[in]   aError      error code
       
   411      * @param[in]   aObserver   reference to observer
       
   412      *
       
   413      * @return Operation Identifier for the async request
       
   414      *         required for cancelling an operation and
       
   415      *         identifying which request has been completed
       
   416      *
       
   417      * @see MDrmHandleErrorObserver
       
   418      */
       
   419     IMPORT_C TInt HandleErrorAsyncL(
       
   420         RFile& aFile,
       
   421         ContentAccess::TIntent aIntent,
       
   422         TInt aError,
       
   423         MDrmHandleErrorObserver& aObserver );
       
   424 
       
   425      /**
       
   426      * Handles DRM error situations related to invalid rights.
       
   427      * This method displays appropriate notes, which observer can override,
       
   428      * to the user and acquires new rights if needed. Synchronous version,
       
   429      * leaves in case of error.
       
   430      *
       
   431      * @since S60 v5.0
       
   432      * @param[in]   aFile       file for which the error happened
       
   433      * @param[in]   aIntent     the CAF intent which was used to recieve
       
   434      *                          the error
       
   435      * @param[in]   aError      error code
       
   436      * @param[in]   aObserver   pointer to observer, NULL if no observer
       
   437      *
       
   438      * @leave   KErrArgument    File is not DRM protected.
       
   439      *
       
   440      * @see MDrmHandleErrorObserver
       
   441      */
       
   442     IMPORT_C void HandleErrorL(
       
   443         RFile& aFile,
       
   444         ContentAccess::TIntent aIntent,
       
   445         TInt aError,
       
   446         MDrmHandleErrorObserver* aObserver );
       
   447 
       
   448     /**
       
   449      * Handles DRM error situations related to invalid rights.
       
   450      * This method displays appropriate notes, which observer can override,
       
   451      * to the user and acquires new rights if needed. Asynchronous version,
       
   452      * all errors are signalled using request status.
       
   453      *
       
   454      * @since S60 v5.0
       
   455      * @param[in]   aFile       content for which the error happened
       
   456      * @param[in]   aIntent     the CAF intent which was used to recieve
       
   457      *                          the error
       
   458      * @param[in]   aError      error code
       
   459      * @param[in]   aObserver   reference to observer
       
   460      *
       
   461      * @return Operation Identifier for the async request
       
   462      *         required for cancelling an operation and
       
   463      *         identifying which request has been completed
       
   464      *
       
   465      * @see MDrmHandleErrorObserver
       
   466      */
       
   467     IMPORT_C TInt HandleErrorAsyncL(
       
   468         ContentAccess::CData& aFile,
       
   469         ContentAccess::TIntent aIntent,
       
   470         TInt aError,
       
   471         MDrmHandleErrorObserver& aObserver );
       
   472 
       
   473     /**
       
   474      * Handles DRM error situations related to invalid rights.
       
   475      * This method displays appropriate notes, which observer can override,
       
   476      * to the user and acquires new rights if needed. Synchronous version,
       
   477      * leaves in case of error.
       
   478      *
       
   479      * @since S60 v5.0
       
   480      * @param[in]   aFile       content for which the error happened
       
   481      * @param[in]   aIntent     the CAF intent which was used to recieve
       
   482      *                          the error
       
   483      * @param[in]   aError      error code
       
   484      * @param[in]   aObserver   pointer to observer, NULL if no observer
       
   485      *
       
   486      * @leave   KErrArgument    File is not DRM protected.
       
   487      *
       
   488      * @see MDrmHandleErrorObserver
       
   489      */
       
   490     IMPORT_C void HandleErrorL(
       
   491         ContentAccess::CData& aFile,
       
   492         ContentAccess::TIntent aIntent,
       
   493         TInt aError,
       
   494         MDrmHandleErrorObserver* aObserver );
       
   495 
       
   496 
       
   497     /**
       
   498      * Cancel an asyncronous operation
       
   499      *
       
   500      * @since S60 v5.0
       
   501      * @param[in]   aOperationId    identifier of the async operation
       
   502      *                              to be cancelled
       
   503      * @return KErrNotFound if the operation has already been executed
       
   504      *         or it does not exist
       
   505      */
       
   506     IMPORT_C TInt CancelOperation( TInt aOperationId );
       
   507 
       
   508 public: //From base classes
       
   509 
       
   510 
       
   511 protected: // Functions from base classes
       
   512 
       
   513     /**
       
   514     * From CActive Cancels async request.
       
   515     */
       
   516     void DoCancel();
       
   517 
       
   518     /**
       
   519     * From CActive Called when async request completes.
       
   520     */
       
   521 	void RunL();
       
   522 
       
   523     /**
       
   524     * From CActive Called when RunL leaves
       
   525     */
       
   526 	TInt RunError( TInt aError );
       
   527 
       
   528 private:
       
   529 
       
   530     /**
       
   531     * C++ default constructor.
       
   532     */
       
   533     CDrmUiHandlingImpl( CDrmUtility* aDrmUtility, CCoeEnv* aCoeEnv );
       
   534 
       
   535     void ConstructL();
       
   536 
       
   537     void Activate( TRequestStatus*& aStatus );
       
   538 
       
   539     void PerformCheckRightsAmountFileL( CDrmUiHandlingData& aData );
       
   540 
       
   541     void PerformCheckRightsAmountDataL( CDrmUiHandlingData& aData );
       
   542 
       
   543     void PerformShowDetailsViewFileL( CDrmUiHandlingData& aData );
       
   544 
       
   545     void PerformShowDetailsViewDataL( CDrmUiHandlingData& aData );
       
   546 
       
   547     void PerformHandleUrlFileL( CDrmUiHandlingData& aData );
       
   548 
       
   549     void PerformHandleUrlDataL( CDrmUiHandlingData& aData );
       
   550 
       
   551     void PerformAvailableUrlsFileL( CDrmUiHandlingData& aData );
       
   552 
       
   553     void PerformAvailableUrlsDataL( CDrmUiHandlingData& aData );
       
   554 
       
   555     void PerformHandleErrorFileL( CDrmUiHandlingData& aData );
       
   556 
       
   557     void PerformHandleErrorDataL( CDrmUiHandlingData& aData );
       
   558 
       
   559     void IsProtectedL( RFile& aFile, TPtrC& aAgent );
       
   560 
       
   561     void IsProtectedL( ContentAccess::CData* aContent,
       
   562                        TDrmAgentUid& aAgentUid );
       
   563 
       
   564     void IsProperErrorL( TInt aError );
       
   565 
       
   566     void CheckOmaRightsAmountL( ContentAccess::CData& aContent,
       
   567                                 ContentAccess::TIntent aIntent,
       
   568                                 MDrmUiCheckRightsObserver* aObserver,
       
   569                                 TInt aOperationId );
       
   570 
       
   571     void DoCheckOmaRightsAmountL( ContentAccess::CData& aContent,
       
   572                                   HBufC8*& aContentUri,
       
   573                                   ContentAccess::TIntent aIntent,
       
   574                                   const HBufC* aRightsUrl,
       
   575                                   TDrmUiUrlType aUrlType,
       
   576                                   const HBufC8* aSilentUrl,
       
   577                                   MDrmUiCheckRightsObserver* aObserver,
       
   578                                   TInt aOperationId );
       
   579 
       
   580     void HandleOmaErrorL( ContentAccess::CData& aContent,
       
   581                           ContentAccess::TIntent aIntent,
       
   582                           TInt aError,
       
   583                           MDrmHandleErrorObserver* aObserver,
       
   584                           TInt aOperationId );
       
   585 
       
   586 
       
   587     void CheckOmaBasedRightsAmountL( ContentAccess::CData& aContent,
       
   588                                      ContentAccess::TIntent aIntent,
       
   589                                      MDrmUiCheckRightsObserver* aObserver,
       
   590                                      TInt aOperationId );
       
   591 
       
   592     void DoCheckOmaBasedRightsAmountL( ContentAccess::CData& aContent,
       
   593                                        const HBufC8* aContentUri,
       
   594                                        ContentAccess::TIntent aIntent,
       
   595                                        const HBufC* aRightsUrl,
       
   596                                        TDrmUiUrlType aUrlType,
       
   597                                        MDrmUiCheckRightsObserver* aObserver,
       
   598                                        TInt aOperationId );
       
   599 
       
   600     void GetOmaBasedEndTimeL( ContentAccess::CData& aData, TTime& aEndTime );
       
   601 
       
   602     TInt OmaBasedHeaderParserL( TInt aOffset, TPtr8 aHeaderPtr, TTime& aEndTime );
       
   603 
       
   604     void ShowDetailsViewL( const HBufC8* aContentId,
       
   605                            const HBufC* aFullPath );
       
   606 
       
   607     void ShowDetailsViewL( const HBufC* aFullPath );
       
   608 
       
   609     void DoHandleOmaUrlL( ContentAccess::CData& aContent,
       
   610                           TDrmUiUrlType aType );
       
   611 
       
   612     void GetAvailableOmaUrlsL( ContentAccess::CData& aContent,
       
   613                                TDrmUiUrlType& aType );
       
   614 
       
   615     TInt GetContentIdLC( const ContentAccess::CData& aContent,
       
   616                          HBufC8*& aId );
       
   617 
       
   618     TInt GetOmaRightsIssuerLC( const ContentAccess::CData& aContent,
       
   619                               HBufC*& aIssuer );
       
   620 
       
   621     TInt GetOmaDomainRightsIssuerLC( const ContentAccess::CData& aContent,
       
   622                                     HBufC*& aIssuer );
       
   623 
       
   624     TInt GetOmaPreviewInfoLC( const ContentAccess::CData& aContent,
       
   625                              HBufC*& aPreviewUrl,
       
   626                              TInt& aPreviewType );
       
   627 
       
   628     TInt GetOmaSilentRightsUrlLC( const ContentAccess::CData& aContent,
       
   629                                   HBufC8*& aSilentUrl );
       
   630 
       
   631     TInt GetOmaInfoUrlLC( const ContentAccess::CData& aContent,
       
   632                          HBufC*& aInfoUrl );
       
   633 
       
   634     TInt GetOmaPendingRightsInfoLC( const ContentAccess::CData& aContent,
       
   635                                    HBufC*& aEta );
       
   636 
       
   637     TInt GetContentLocationLC( const ContentAccess::CData& aContent,
       
   638                                HBufC*& aPath );
       
   639 
       
   640     void SelectOmaRightsUrlL( const ContentAccess::CData& aContent,
       
   641                               const HBufC* aDomainRiUrl,
       
   642                               TDrmUiUrlType& aUrlType );
       
   643 
       
   644     void CallRightsNotValidL( MDrmUiCheckRightsObserver* aObserver,
       
   645                               TInt aOperationId,
       
   646                               TCheckRightsStatus aRightsStatus,
       
   647                               TUint32 aReason,
       
   648                               ContentAccess::CData& aContent,
       
   649                               const HBufC8* aContentUri,
       
   650                               CDRMConstraint* aConstraint,
       
   651                               const HBufC* aRightsUrl,
       
   652                               TDrmUiUrlType aUrlType,
       
   653                               const HBufC8* aSilentUrl,
       
   654                               ContentAccess::TIntent aIntent );
       
   655 
       
   656     void CallRightsLeftL( MDrmUiCheckRightsObserver* aObserver,
       
   657                           TInt aOperationId,
       
   658                           TBool aUnconstrained,
       
   659                           TTimeIntervalSeconds aTime,
       
   660                           TInt aCounts,
       
   661                           TTimeIntervalSeconds aAccumulated,
       
   662                           const HBufC8* aContentUri,
       
   663                           const HBufC* aRightsUrl,
       
   664                           const HBufC8* aSilentUrl,
       
   665                           CData& aData,
       
   666                           ContentAccess::TIntent aIntent );
       
   667 
       
   668     void CallEmbeddedPreviewAvailableL( MDrmHandleErrorObserver* aObserver,
       
   669                                         TInt aOperationId,
       
   670                                         ContentAccess::CData& aContent,
       
   671                                         const HBufC* aPreviewUrl,
       
   672                                         TDrmRightsInfo aRightsStatus,
       
   673                                         TUint32 aReason,
       
   674                                         const HBufC* aRightsUrl,
       
   675                                         const HBufC8* aContentUri,
       
   676                                         ContentAccess::TIntent aIntent );
       
   677 
       
   678     void CallPreviewRightsUrlAvailableL( MDrmHandleErrorObserver* aObserver,
       
   679                                          TInt aOperationId,
       
   680                                          ContentAccess::CData& aContent,
       
   681                                          const HBufC* aPreviewUrl,
       
   682                                          TDrmRightsInfo aRightsStatus,
       
   683                                          TUint32 aReason,
       
   684                                          const HBufC* aRightsUrl,
       
   685                                          const HBufC8* aContentUri,
       
   686                                          ContentAccess::TIntent aIntent );
       
   687 
       
   688     void CallSilentRightsUrlAvailableL( MDrmHandleErrorObserver* aObserver,
       
   689                                         TInt aOperationId,
       
   690                                         const HBufC8* aSilentUrl,
       
   691                                         TDrmRightsInfo aRightsStatus,
       
   692                                         TUint32 aReason,
       
   693                                         const HBufC* aRightsUrl,
       
   694                                         const HBufC8* aContentUri,
       
   695                                         ContentAccess::TIntent aIntent );
       
   696 
       
   697     void CallRightsUrlAvailableL( MDrmHandleErrorObserver* aObserver,
       
   698                                   TInt aOperationId,
       
   699                                   TDrmRightsInfo aRightsStatus,
       
   700                                   TUint32 aReason,
       
   701                                   CDRMConstraint* aConstraint,
       
   702                                   ContentAccess::CData& aContent,
       
   703                                   const HBufC8* aContentUri,
       
   704                                   const HBufC* aRightsUrl,
       
   705                                   TDrmUiUrlType aUrlType,
       
   706                                   ContentAccess::TIntent aIntent,
       
   707                                   TInt aError );
       
   708 
       
   709     void CallPreviewRightsAvailable( MDrmHandleErrorObserver* aObserver,
       
   710                                      TInt aOperationId,
       
   711                                      TInt aError );
       
   712 
       
   713     void CallSilentRightsAvailable( MDrmHandleErrorObserver* aObserver,
       
   714                                     TInt aOperationId,
       
   715                                     TInt aError );
       
   716 
       
   717     void CallRightsAvailable( MDrmHandleErrorObserver* aObserver,
       
   718                               TInt aOperationId,
       
   719                               TInt aError );
       
   720 
       
   721     void CallPlayEmbeddedPreviewSelected( MDrmHandleErrorObserver* aObserver,
       
   722                                           TInt aOperationId,
       
   723                                           const HBufC* aPreviewUrl );
       
   724 
       
   725     /**
       
   726     * @return ETrue if rights renewal wanted, EFalse  otherwise
       
   727     */
       
   728     TBool ShowNoRightsNoteL( ContentAccess::CData& aContent,
       
   729                              TDrmRightsInfo aRightsStatus,
       
   730                              TUint32 aReason,
       
   731                              CDRMConstraint* aConstraint,
       
   732                              const HBufC* aRightsUrl,
       
   733                              TDrmUiUrlType aUrlType,
       
   734                              TInt aError );
       
   735 
       
   736     TInt GetOmaConstraintInfo( CDRMConstraint* aConstraint,
       
   737                                TUint32& aCountsLeft,
       
   738                                TTime& aEndTime );
       
   739 
       
   740     TInt RejectReason( TUint32 aReason );
       
   741 
       
   742     TDrmRightsInfo RightsInfoStatus( TCheckRightsStatus aStatus );
       
   743 
       
   744     void CheckOmaDomainStatusL( const ContentAccess::CData& aContent,
       
   745                                 const HBufC* aDomainRiUrl,
       
   746                                 TInt& aIsRegistered,
       
   747                                 TInt& aIsJoined );
       
   748 
       
   749     /**
       
   750     * Launch rights manager UI
       
   751     */
       
   752     void LaunchRightsManagerUiL( const TDesC& aParam16 );
       
   753 
       
   754     /**
       
   755     * Form string needed to launch rights manager UI embedded.
       
   756     */
       
   757     void CreateLaunchParamL( const HBufC8* aUrl,
       
   758                              HBufC*& aLaunchParam,
       
   759                              const HBufC* aFullPath );
       
   760 
       
   761     void CreateLaunchParamL( const HBufC* aFullPath,
       
   762                              HBufC*& aLaunchParam );
       
   763 
       
   764     /**
       
   765     * Launch browser. Return ETrue if embedded launch
       
   766     */
       
   767     TBool LaunchBrowserL( const HBufC8* aUrl );
       
   768     TBool LaunchBrowserL( const HBufC* aUrl );
       
   769 
       
   770     /**
       
   771     * Get rights silently, if notes are not intended to be shown, put aShowNotes to EFalse 
       
   772     */
       
   773     TInt GetSilentRightsL( const TDesC8& aUrl, const TBool aShowNotes );
       
   774 
       
   775     /**
       
   776     * Check if the user has allowed silent rights
       
   777     */
       
   778     TBool SilentRightsAllowedL();
       
   779 
       
   780     /**
       
   781     * Check if browser AP has been defined
       
   782     */
       
   783     TBool BrowserAPDefinedL();
       
   784 
       
   785     /**
       
   786     * Returns the number of access points on phone
       
   787     */
       
   788     TInt APCountL();
       
   789 
       
   790     /**
       
   791     * Handles exit from service
       
   792     * from MAknServerAppExitObserver
       
   793     */
       
   794 	void HandleServerAppExit(TInt aReason);
       
   795 
       
   796     /**
       
   797      * Appends new async request data to async operation queue.
       
   798      *
       
   799      * @param[in]   aData: The data set in/out.
       
   800      * @return none
       
   801      */
       
   802     void AppendToQueue( CDrmUiHandlingData* aData );
       
   803 
       
   804     /**
       
   805      * Gets the next async request data from async operation queue
       
   806      *
       
   807      * @param[in]   none
       
   808      * @return next request data
       
   809      */
       
   810     CDrmUiHandlingData* PopFront();
       
   811 
       
   812     void GetOmaBasedInfoL();
       
   813 
       
   814     /**
       
   815     * Gets SilentRights and
       
   816     * checks status after 
       
   817     * CallSilentAvailble after right
       
   818     * @return Etrue, if silent RO rerieval led to usable content
       
   819     */
       
   820     TBool CDrmUiHandlingImpl::GetSilentAndCallL(
       
   821         MDrmHandleErrorObserver* aObserver,
       
   822         TInt aOperationId,
       
   823         const ContentAccess::TIntent aIntent,
       
   824         const HBufC8* aContentUri,
       
   825         const HBufC8* aSilentUrl,
       
   826         const TBool aShowNotes );
       
   827 
       
   828     /**
       
   829     * Gets Rights and
       
   830     * checks status if launched embedded.
       
   831     * CallRightsAvailable, if launched embedded or righsUrl not present
       
   832     */
       
   833     void CDrmUiHandlingImpl::GetRightsAndCallL(
       
   834         MDrmHandleErrorObserver* aObserver,
       
   835         TInt aOperationId,
       
   836         const ContentAccess::TIntent aIntent,
       
   837         const HBufC8* aContentUri,
       
   838         const HBufC* aRightsUrl );
       
   839 private: // data
       
   840 
       
   841     // Control environment
       
   842     CCoeEnv* iCoeEnv;
       
   843 
       
   844     // DrmUtility
       
   845     CDrmUtility* iDrmUtility;
       
   846 
       
   847     // DrmUtilityCommon
       
   848     CDrmUtilityCommon* iDrmUtilityCommon;
       
   849 
       
   850     // DrmUtilityUI
       
   851     CDrmUtilityUI* iDrmUtilityUi;
       
   852 
       
   853     // Oma Drm client
       
   854     RDRMRightsClient iOmaClient;
       
   855 
       
   856     // WM Drm Wrapper - Owned
       
   857     CDrmUtilityWMDrm* iWrapperLoader;
       
   858 
       
   859     // WM Drm Client - Not Owned
       
   860     MDrmUtilityWMDrmWrapper* iWmClient;
       
   861 
       
   862     // Async observer and current operation id for async operations
       
   863     MDrmAsyncObserver* iObserver;
       
   864     TInt iOperationId;
       
   865 
       
   866     // Wait for the notes and queries
       
   867     CActiveSchedulerWait iWait;
       
   868 
       
   869     // Schemehandler for url handling
       
   870     CSchemeHandler* iSchemeHandler;
       
   871 
       
   872     // Operation Queue:
       
   873     CDrmUiHandlingData* iFirst;
       
   874     CDrmUiHandlingData* iLast;
       
   875 
       
   876     // To prevent queue handling from being messed up by threads
       
   877     RSemaphore iSemaphore;
       
   878 
       
   879     // Oma based extensions
       
   880     HBufC* iOmaBasedAgentName;
       
   881     TInt iOmaBasedUid;
       
   882     HBufC8* iOmaBasedMimeType;
       
   883 
       
   884     };
       
   885 
       
   886 }
       
   887 
       
   888 #endif // C_CDRMUIHANDLINGIMPL_H