commondrm/drmutility/inc/drmautomatedusageerrorhandling.h
changeset 0 95b198f216e5
equal deleted inserted replaced
-1:000000000000 0:95b198f216e5
       
     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 "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 header of the implementation class that
       
    15 *                implements the MDrmErrorHandling API
       
    16 *
       
    17 */
       
    18 
       
    19 
       
    20 
       
    21 
       
    22 #ifndef C_CDRMAUTOMATEDUSAGEERRORHANDLING_H
       
    23 #define C_CDRMAUTOMATEDUSAGEERRORHANDLING_H
       
    24 
       
    25 #include <e32base.h>
       
    26 #include <f32file.h>
       
    27 #include <caf/caferr.h>
       
    28 #include <caf/caftypes.h>
       
    29 
       
    30 #include <drmerrorhandling.h>
       
    31 #include <drmhandleerrorobserver.h>
       
    32 
       
    33 
       
    34 
       
    35 namespace DRM
       
    36 {
       
    37 
       
    38 class CDrmAutomatedUsageImpl;
       
    39 
       
    40 /**
       
    41 *  Implementation class for the MDrmErrorHandling interface
       
    42 *  For DRM automated usage errors
       
    43 *  This class uses methods in CDrmAutomatedUsageimpl, and is instantiated
       
    44 *  on instantiation of class DRM::CDrmAutomatedUsage.
       
    45 *  The class is not intended to be instantiated from any other place.
       
    46 *
       
    47 *  @code
       
    48 *      DRM::DrmAutomatedUsage* iMyAutomatedUsage = 
       
    49 *          DRM::DrmAutomatedUsage::NewL( iMyCoeEnv );
       
    50 *      // do some fancy automatedUsage related stuff
       
    51 *      // ...
       
    52 *      // DrmAutomatedUsage error occurs
       
    53 *      DRM::MDrmErrorHandling& myErrorHandler =
       
    54 *          iMyAutomatedUsage->GetErrorHandler();
       
    55 *      myErrorHandler.HandleErrorL( theAutomatedUsageError );
       
    56 *  @endcode
       
    57 *
       
    58 *  @lib drmautomatedusageimpl.lib
       
    59 *  @since S60 5.0
       
    60 */
       
    61 NONSHARABLE_CLASS( CDrmAutomatedUsageErrorHandling ) :
       
    62     public CBase, public MDrmErrorHandling
       
    63     {
       
    64 public:
       
    65 
       
    66     /**
       
    67     * Two-phased constructor.
       
    68     * @param aImplementation pointer to the implementation class
       
    69     */
       
    70     IMPORT_C static CDrmAutomatedUsageErrorHandling* NewL(
       
    71         CDrmAutomatedUsageImpl* aImplementation );
       
    72 
       
    73     /**
       
    74     * Two-phased constructor. Leaves the created object into the
       
    75     * cleanup stack
       
    76     * @param aImplementation pointer to the implementation class
       
    77     */
       
    78     IMPORT_C static CDrmAutomatedUsageErrorHandling* NewLC(
       
    79         CDrmAutomatedUsageImpl* aImplementation );
       
    80     /**
       
    81     * Destructor.
       
    82     */
       
    83     virtual ~CDrmAutomatedUsageErrorHandling();
       
    84 
       
    85 
       
    86 public: // from base class MDrmErrorHandling
       
    87 
       
    88     /**
       
    89     * From MDrmErrorHandling
       
    90     *
       
    91     * Handles DRM error situations related to invalid rights.
       
    92     * This method displays appropriate notes, which observer can override,
       
    93     * to the user and acquires new rights if needed. Asynchronous version,
       
    94     * all errors are signalled using request status.
       
    95     *
       
    96     * @since S60 5.0
       
    97     * @param[in]   aFile       file for which the error happened
       
    98     * @param[in]   aIntent     the CAF intent which was used to recieve
       
    99     *                          the error
       
   100     * @param[in]   aError      error code
       
   101     * @param[in]   aObserver   reference to observer
       
   102     *
       
   103     * @return Operation Identifier for the async request
       
   104     *         required for cancelling an operation and
       
   105     *         identifying which request has been completed
       
   106     *
       
   107     * @see MDrmHandleErrorObserver
       
   108     * @see ContentAccess::TIntent
       
   109     * @see MDrmErrorHandling
       
   110     */
       
   111     virtual TInt HandleErrorAsyncL(
       
   112         RFile& aFile,
       
   113         ContentAccess::TIntent aIntent,
       
   114         TInt aError,
       
   115         MDrmHandleErrorObserver& aObserver );
       
   116 
       
   117     /**
       
   118     * From MDrmErrorHandling
       
   119     *
       
   120     * Handles DRM error situations related to invalid rights.
       
   121     * This method displays appropriate notes, which observer can override,
       
   122     * to the user and acquires new rights if needed. Synchronous version,
       
   123     * leaves in case of error.
       
   124     *
       
   125     * @since S60 5.0
       
   126     * @param[in]   aFile       file for which the error happened
       
   127     * @param[in]   aIntent     the CAF intent which was used to recieve
       
   128     *                          the error
       
   129     * @param[in]   aError      error code
       
   130     * @param[in]   aObserver   pointer to observer, NULL if no observer
       
   131     *
       
   132     * @leave   KErrArgument    File is not DRM protected.
       
   133     *
       
   134     * @see MDrmHandleErrorObserver
       
   135     * @see ContentAccess::TIntent
       
   136     * @see MDrmErrorHandling
       
   137     */
       
   138     virtual void HandleErrorL(
       
   139         RFile& aFile,
       
   140         ContentAccess::TIntent aIntent,
       
   141         TInt aError,
       
   142         MDrmHandleErrorObserver* aObserver );
       
   143 
       
   144     /**
       
   145     * From MDrmErrorHandling
       
   146     *
       
   147     * Handles DRM error situations related to invalid rights.
       
   148     * This method displays appropriate notes, which observer can override,
       
   149     * to the user and acquires new rights if needed. Asynchronous version,
       
   150     * all errors are signalled using request status.
       
   151     *
       
   152     * @since S60 5.0
       
   153     * @param[in]   aFile       content for which the error happened
       
   154     * @param[in]   aIntent     the CAF intent which was used to recieve
       
   155     *                          the error
       
   156     * @param[in]   aError      error code
       
   157     * @param[in]   aObserver   reference to observer
       
   158     *
       
   159     * @return Operation Identifier for the async request
       
   160     *         required for cancelling an operation and
       
   161     *         identifying which request has been completed
       
   162     *
       
   163     * @see MDrmHandleErrorObserver
       
   164     * @see ContentAccess::TIntent
       
   165     * @see MDrmErrorHandling
       
   166     */
       
   167     virtual TInt HandleErrorAsyncL(
       
   168         ContentAccess::CData& aFile,
       
   169         ContentAccess::TIntent aIntent,
       
   170         TInt aError,
       
   171         MDrmHandleErrorObserver& aObserver );
       
   172 
       
   173     /**
       
   174     * From MDrmErrorHandling
       
   175     *
       
   176     * Handles DRM error situations related to invalid rights.
       
   177     * This method displays appropriate notes, which observer can override,
       
   178     * to the user and acquires new rights if needed. Synchronous version,
       
   179     * leaves in case of error.
       
   180     *
       
   181     * @since S60 5.0
       
   182     * @param[in]   aFile       content for which the error happened
       
   183     * @param[in]   aIntent     the CAF intent which was used to recieve
       
   184     *                          the error
       
   185     * @param[in]   aError      error code
       
   186     * @param[in]   aObserver   pointer to observer, NULL if no observer
       
   187     *
       
   188     * @leave   KErrArgument    File is not DRM protected.
       
   189     *
       
   190     * @see MDrmHandleErrorObserver
       
   191     * @see ContentAccess::TIntent
       
   192     * @see MDrmErrorHandling
       
   193     */
       
   194     virtual void HandleErrorL(
       
   195         ContentAccess::CData& aFile,
       
   196         ContentAccess::TIntent aIntent,
       
   197         TInt aError,
       
   198         MDrmHandleErrorObserver* aObserver );
       
   199 
       
   200 
       
   201 private:
       
   202 
       
   203     /**
       
   204     * C++ constructor
       
   205     */
       
   206     CDrmAutomatedUsageErrorHandling();
       
   207 
       
   208     /**
       
   209     * Second phase constructor
       
   210     */
       
   211     void ConstructL( CDrmAutomatedUsageImpl* aImplementation );
       
   212 
       
   213 private: // data
       
   214 
       
   215     /**
       
   216     * Pointer to the implementation class, which
       
   217     * has actual error handling functionality
       
   218     * Not owned
       
   219     */
       
   220     CDrmAutomatedUsageImpl* iImplementation;
       
   221     };
       
   222 }
       
   223 #endif // C_CDRMAUTOMATEDUSAGEERRORHANDLING_H