photosgallery/viewframework/drmutility/inc/glxdrmutility.h
changeset 0 4e91876724a2
child 14 ce1c7ad1f18b
equal deleted inserted replaced
-1:000000000000 0:4e91876724a2
       
     1 /*
       
     2 * Copyright (c) 2008-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:    DRM utility implementation
       
    15 *
       
    16 */
       
    17 
       
    18 
       
    19 
       
    20 
       
    21 /**
       
    22  * @internal reviewed 03/07/2007 by Rowland Cook
       
    23  */
       
    24 
       
    25 
       
    26 #ifndef C_GLXDRMUTILITY_H
       
    27 #define C_GLXDRMUTILITY_H
       
    28 
       
    29 // INCLUDES
       
    30 
       
    31 #include <e32base.h>
       
    32 
       
    33 // FORWARD DECLARATIONS
       
    34 
       
    35 class CDRMHelper;
       
    36 
       
    37 namespace ContentAccess
       
    38     {
       
    39     class CContent;
       
    40     class CData;
       
    41     class CManager;
       
    42     }
       
    43 // DATA TYPES
       
    44 
       
    45 /**
       
    46  * Specifies a type of automated content.
       
    47  *
       
    48  * @ingroup drm_utility
       
    49  */
       
    50 enum TGlxDrmAutomatedType
       
    51     {
       
    52     EGlxDrmAutomatedTypeWallpaper   /**< Set image as wallpaper */
       
    53     };
       
    54 
       
    55 // CLASS DECLARATION
       
    56 
       
    57 /**
       
    58  * DRM utility class to provide DRM-related functionality used in many places.
       
    59  *
       
    60  * @ingroup drm_utility
       
    61  * @author M Byrne
       
    62  */
       
    63 NONSHARABLE_CLASS( CGlxDRMUtility ) : public CBase
       
    64     {
       
    65 public:
       
    66     /**
       
    67      * Get the instance of the DRM utility, and increase its reference count.
       
    68      *
       
    69      * @return Pointer to singleton object.
       
    70      */
       
    71     IMPORT_C static CGlxDRMUtility* InstanceL();
       
    72 
       
    73     /**
       
    74      * Release the instance of the DRM utility by decreasing its reference
       
    75      * count.  If the count becomes zero, the utility is deleted.
       
    76      */
       
    77     IMPORT_C void Close();
       
    78 
       
    79     /**
       
    80      * Destructor.
       
    81      */
       
    82     ~CGlxDRMUtility();
       
    83 
       
    84     /**
       
    85      * Check whether DRM rights are valid for specified item
       
    86      *
       
    87      * @param aUri URI of the media item.
       
    88      * @param aCheckViewRights, check view rights if true, play if false
       
    89      * @return ETrue if valid rights exist for the media item.
       
    90      */
       
    91     IMPORT_C TBool CheckOpenRightsL(const TDesC& aUri, TBool aCheckViewRights);
       
    92 
       
    93     /**
       
    94      * Check whether DRM rights are valid for specified item
       
    95      * If the rights were just consumed, then allow to display
       
    96      * Otherwise, obtain current rights
       
    97      *
       
    98      * @param aUri URI of the media item.
       
    99      * @param aCheckViewRights, check view rights if true, play if false
       
   100      * @return ETrue if valid rights exist for the media item.
       
   101      */
       
   102     IMPORT_C TBool CheckDisplayRightsL(const TDesC& aUri, TBool aCheckViewRights);
       
   103     
       
   104     /**
       
   105       * Consume rights for specified item
       
   106       * Caches item so that a client has right to display the item
       
   107       *
       
   108       * @param aUri URI for item
       
   109       * @return ETrue to no error in rights consumption
       
   110       */
       
   111     IMPORT_C TBool ConsumeRightsL(const TDesC& aUri);
       
   112     
       
   113     
       
   114 
       
   115     /**
       
   116      * Test whether a media item is OMA DRM 2.0 protected and has an associated
       
   117      * info URL.
       
   118      * @param aUri URI of the media item.
       
   119      * @return ETrue if it does.
       
   120      */
       
   121     IMPORT_C TBool CanShowInfoOnlineL(TDesC& aUri);
       
   122 
       
   123     /**
       
   124      * Open the associated info URL for a media item in the browser.
       
   125      * @param aUri URI of the media item.
       
   126      */
       
   127     IMPORT_C void ShowInfoOnlineL(TDesC& aUri);
       
   128 
       
   129     /**
       
   130      * Test whether a media item can be set as automated content.     *
       
   131      * @param aUri URI of the media item.
       
   132      * @param aType Automated content type, eg. wallpaper.
       
   133      * @return ETrue if it can.
       
   134      */
       
   135     IMPORT_C TBool CanSetAsAutomatedL(const TDesC& aUri, TGlxDrmAutomatedType aType);
       
   136 
       
   137     /**
       
   138      * Set a media item as automated content.
       
   139      * @param aUri URI of the media item.
       
   140      * @param aType Automated content type, eg. wallpaper.
       
   141      */
       
   142     IMPORT_C void SetAsAutomatedL(const TDesC& aUri, TGlxDrmAutomatedType aType);
       
   143     
       
   144     /**
       
   145      * Show DRM details for specified item.
       
   146      * @param aUri URI of the media item.
       
   147      */
       
   148     IMPORT_C void ShowDRMDetailsPaneL(const TDesC& aUri);
       
   149     
       
   150     /**
       
   151       * Ask DRM manager if file is forward locked
       
   152       */
       
   153     IMPORT_C TBool IsForwardLockedL(const TDesC& aUri);
       
   154     
       
   155     /**
       
   156       * Show rights info
       
   157       * @param aUri URI of the media item.
       
   158       */
       
   159     IMPORT_C void ShowRightsInfoL(const TDesC& aUri);
       
   160     
       
   161     /**
       
   162       * Get size of thumbnail to be requested for DRM invalid item
       
   163       * @param aSize size of image
       
   164       * @return suggested thumbnail size (1/4 of original size)
       
   165       */
       
   166     IMPORT_C TSize DRMThumbnailSize(TSize& aSize);
       
   167     
       
   168     
       
   169 private:
       
   170     /**
       
   171      * C++ default constructor.
       
   172      */
       
   173     CGlxDRMUtility();
       
   174 
       
   175     /**
       
   176      * By default Symbian 2nd phase constructor is private.
       
   177      */
       
   178     void ConstructL();
       
   179 
       
   180 private:
       
   181     /** Single instance of CGlxDRMUtility */
       
   182     static CGlxDRMUtility* iDrmUtility;
       
   183 
       
   184     /** Reference count for DRM utility */
       
   185     TInt iRefCount;
       
   186 
       
   187     /** Content access manager */
       
   188     ContentAccess::CManager* iCManager;
       
   189 
       
   190     /** DRM helper used by the utility owned */
       
   191     CDRMHelper* iDrmHelper;
       
   192 
       
   193     /** Last consumed item URI */
       
   194     HBufC* iLastConsumedItemUri;
       
   195     };
       
   196 
       
   197 #endif  // C_GLXDRMUTILITY_H
       
   198 
       
   199 // End of File