photosgallery/viewframework/drmutility/inc/glxdrmutility.h
branchRCL_3
changeset 60 5b3385a43d68
equal deleted inserted replaced
59:8e5f6eea9c9f 60:5b3385a43d68
       
     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 #include <f32file.h>
       
    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      * is called before right is consumed and for all items (focused or unfocused).
       
    87      * 
       
    88      * @param aUri URI of the media item.
       
    89      * @param aCheckViewRights, check view rights if true, play if false
       
    90      * @return ETrue if valid rights exist for the media item.
       
    91      */
       
    92     IMPORT_C TBool ItemRightsValidityCheckL(const TDesC& aUri, TBool aCheckViewRights);
       
    93     
       
    94     /**
       
    95      * Check whether DRM rights are valid for specified item
       
    96      * is called before right is consumed and for all items (focused or unfocused).
       
    97      * 
       
    98      * @param filehandle 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 ItemRightsValidityCheckL(RFile& aFileHandle, TBool aCheckViewRights);
       
   103 
       
   104     /**
       
   105      * Check whether DRM rights are valid for specified item
       
   106      * If the rights were just consumed, then allow to display
       
   107      * Otherwise, obtain current rights
       
   108      * is called after right is consumed and for only focused/displayed item.
       
   109      * 
       
   110      * @param aUri URI of the media item.
       
   111      * @param aCheckViewRights, check view rights if true, play if false
       
   112      * @return ETrue if valid rights exist for the media item.
       
   113      */
       
   114     IMPORT_C TBool DisplayItemRightsCheckL(const TDesC& aUri, TBool aCheckViewRights);
       
   115     
       
   116     /**
       
   117      * Check whether DRM rights are valid for specified item
       
   118      * If the rights were just consumed, then allow to display
       
   119      * Otherwise, obtain current rights
       
   120      * is called after right is consumed and for only focused/displayed item.
       
   121      * 
       
   122      * @param filehandle of the media item.
       
   123      * @param aCheckViewRights, check view rights if true, play if false
       
   124      * @return ETrue if valid rights exist for the media item.
       
   125      */
       
   126     IMPORT_C TBool DisplayItemRightsCheckL(RFile& aFileHandle, TBool aCheckViewRights);
       
   127     
       
   128     /**
       
   129       * Consume rights for specified item
       
   130       * Caches item so that a client has right to display the item
       
   131       *
       
   132       * @param aUri URI for item
       
   133       * @return ETrue to no error in rights consumption
       
   134       */
       
   135     IMPORT_C TBool ConsumeRightsL(const TDesC& aUri);
       
   136     
       
   137     /**
       
   138       * Consume rights for specified item
       
   139       * Caches item so that a client has right to display the item
       
   140       *
       
   141       * @param  Filehandle for item
       
   142       * @return ETrue to no error in rights consumption
       
   143       */
       
   144     IMPORT_C TBool ConsumeRightsL(RFile& aFileHandle);
       
   145 
       
   146     /**
       
   147      * Clears Last Consumed Uri
       
   148      */
       
   149     IMPORT_C void ClearLastConsumedItemUriL();
       
   150 
       
   151     /**
       
   152      * Test whether a media item is OMA DRM 2.0 protected and has an associated
       
   153      * info URL.
       
   154      * @param aUri URI of the media item.
       
   155      * @return ETrue if it does.
       
   156      */
       
   157     IMPORT_C TBool CanShowInfoOnlineL(const TDesC& aUri);
       
   158 
       
   159     /**
       
   160      * Open the associated info URL for a media item in the browser.
       
   161      * @param aUri URI of the media item.
       
   162      */
       
   163     IMPORT_C void ShowInfoOnlineL(const TDesC& aUri);
       
   164 
       
   165     /**
       
   166      * Test whether a media item can be set as automated content.     *
       
   167      * @param aUri URI of the media item.
       
   168      * @param aType Automated content type, eg. wallpaper.
       
   169      * @return ETrue if it can.
       
   170      */
       
   171     IMPORT_C TBool CanSetAsAutomatedL(const TDesC& aUri, TGlxDrmAutomatedType aType);
       
   172 
       
   173     /**
       
   174      * Set a media item as automated content.
       
   175      * @param aUri URI of the media item.
       
   176      * @param aType Automated content type, eg. wallpaper.
       
   177      */
       
   178     IMPORT_C void SetAsAutomatedL(const TDesC& aUri, TGlxDrmAutomatedType aType);
       
   179     
       
   180     /**
       
   181      * Show DRM details for specified item.
       
   182      * @param aUri URI of the media item.
       
   183      */
       
   184     IMPORT_C void ShowDRMDetailsPaneL(const TDesC& aUri);
       
   185     
       
   186     /**
       
   187      * Show DRM details for specified item.
       
   188      * @param Filehandle of the media item.
       
   189      */
       
   190     IMPORT_C void ShowDRMDetailsPaneL(RFile& aFileHandle);
       
   191     
       
   192     /**
       
   193       * Ask DRM manager if file is forward locked
       
   194       */
       
   195     IMPORT_C TBool IsForwardLockedL(const TDesC& aUri);
       
   196     
       
   197     /**
       
   198       * Show rights info
       
   199       * @param aUri URI of the media item.
       
   200       */
       
   201     IMPORT_C void ShowRightsInfoL(const TDesC& aUri);
       
   202     
       
   203     /**
       
   204       * Show rights info
       
   205       * @param filehandle of the media item.
       
   206       */
       
   207     IMPORT_C void ShowRightsInfoL(RFile& aFileHandle);
       
   208     
       
   209     /**
       
   210       * Get size of thumbnail to be requested for DRM invalid item
       
   211       * @param aSize size of image
       
   212       * @return suggested thumbnail size (1/4 of original size)
       
   213       */
       
   214     IMPORT_C TSize DRMThumbnailSize(TSize& aSize);
       
   215     
       
   216     
       
   217 private:
       
   218     /**
       
   219      * C++ default constructor.
       
   220      */
       
   221     CGlxDRMUtility();
       
   222 
       
   223     /**
       
   224      * By default Symbian 2nd phase constructor is private.
       
   225      */
       
   226     void ConstructL();
       
   227 
       
   228 private:
       
   229     /** Single instance of CGlxDRMUtility */
       
   230     static CGlxDRMUtility* iDrmUtility;
       
   231 
       
   232     /** Reference count for DRM utility */
       
   233     TInt iRefCount;
       
   234 
       
   235     /** Content access manager */
       
   236     ContentAccess::CManager* iCManager;
       
   237 
       
   238     /** DRM helper used by the utility owned */
       
   239     CDRMHelper* iDrmHelper;
       
   240 
       
   241     /** Last consumed item URI */
       
   242     HBufC* iLastConsumedItemUri;
       
   243     };
       
   244 
       
   245 #endif  // C_GLXDRMUTILITY_H
       
   246 
       
   247 // End of File