omadrm/drmhelper/inc/DRMHelperDMgrWrapper.h
changeset 0 95b198f216e5
child 18 8a03a285ab14
child 23 493788a4a8a4
equal deleted inserted replaced
-1:000000000000 0:95b198f216e5
       
     1 /*
       
     2 * Copyright (c) 2006-2008 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: 
       
    15 *
       
    16 */
       
    17 
       
    18 
       
    19 #ifndef CDRMHELPERDMGRWRAPPER_H
       
    20 #define CDRMHELPERDMGRWRAPPER_H
       
    21 
       
    22 #include <DownloadMgrClient.h>
       
    23 #include <aknprogressdialog.h>
       
    24 #include <eikprogi.h>
       
    25 
       
    26 /**
       
    27 * Environment gate function
       
    28 *
       
    29 * @since S60 3.1
       
    30 * @return pointer to DMgr handler
       
    31 */
       
    32 IMPORT_C TAny* GateFunctionDMgr();
       
    33 
       
    34 class MDRMHelperDMgrWrapper
       
    35     {
       
    36 
       
    37 public:
       
    38     virtual void DownloadAndHandleRoapTriggerL( const HBufC8* aUrl ) = 0;
       
    39 
       
    40     virtual void DownloadAndHandleRoapTriggerL( const HBufC8* aUrl,
       
    41                                                 CCoeEnv& aCoeEnv ) = 0;
       
    42 
       
    43     virtual HBufC8* GetErrorUrlL() = 0;
       
    44 
       
    45     };
       
    46 
       
    47 /**
       
    48 *  Class for downloading ROAP triggers
       
    49 *
       
    50 *  @lib DRMHelperDMgrWrapper
       
    51 *  @since S60 v3.1
       
    52 */
       
    53 class CDRMHelperDMgrWrapper : CBase,
       
    54                               public MHttpDownloadMgrObserver,
       
    55                               public MDRMHelperDMgrWrapper,
       
    56                               public MProgressDialogCallback
       
    57     {
       
    58 
       
    59 public:
       
    60 
       
    61     static CDRMHelperDMgrWrapper* NewL();
       
    62 
       
    63     static CDRMHelperDMgrWrapper* NewLC();
       
    64 
       
    65     virtual ~CDRMHelperDMgrWrapper();
       
    66 
       
    67     /**
       
    68     * Download a ROAP trigger from URL and handle it
       
    69     *
       
    70     * @since S60 3.1
       
    71     * @param aUrl  URL of ROAP trigger
       
    72     */
       
    73     void DownloadAndHandleRoapTriggerL( const HBufC8* aUrl );
       
    74 
       
    75     void DownloadAndHandleRoapTriggerL( const HBufC8* aUrl, CCoeEnv& aCoeEnv );
       
    76 
       
    77     HBufC8* GetErrorUrlL();
       
    78 
       
    79 
       
    80 // from base class MHttpDownloadMgrObserver
       
    81 
       
    82     /**
       
    83     * From MHttpDownloadMgrObserver.
       
    84     * Handle download manager events
       
    85     *
       
    86     * @since S60 3.1
       
    87     * @param aDownload the download
       
    88     * @param aEvent the event
       
    89     */
       
    90     void HandleDMgrEventL( RHttpDownload& aDownload, THttpDownloadEvent aEvent );
       
    91 
       
    92 public: // Call back methods of MAknProgressDialogCallback
       
    93 
       
    94     /**
       
    95     * ProgressDialog call back method.
       
    96     * Get's called when a dialog is dismissed.
       
    97     *
       
    98     * @since S60 3.2
       
    99     * @param aButtonId ID of the button pressed
       
   100     */
       
   101     void DialogDismissedL( TInt aButtonId );
       
   102 
       
   103 protected:
       
   104 
       
   105 private:
       
   106 
       
   107     /**
       
   108     * C++ default constructor.
       
   109     */
       
   110     CDRMHelperDMgrWrapper();
       
   111 
       
   112     void ConstructL();
       
   113 
       
   114     /**
       
   115     * Set the browser default access point to be used
       
   116     *
       
   117     * @since S60 3.0
       
   118     */
       
   119     void SetDefaultAccessPointL();
       
   120 
       
   121     void DoDownloadAndHandleRoapTriggerL( const HBufC8* aUrl );
       
   122 
       
   123     void ShowProgressNoteL( );
       
   124 
       
   125     void RemoveProgressNoteL( );
       
   126 
       
   127     void HandlePostResponseUrlL();
       
   128 
       
   129 
       
   130 private: // data
       
   131 
       
   132     /**
       
   133     * Download manager session
       
   134     */
       
   135     RHttpDownloadMgr iDlMgr;
       
   136 
       
   137     /**
       
   138     * Used to make downloads synchronous
       
   139     */
       
   140     CActiveSchedulerWait iWait;
       
   141 
       
   142     /**
       
   143     * to store information on download
       
   144     */
       
   145     TBool iDownloadSuccess;
       
   146     TBool iConnectionError;
       
   147 
       
   148     TBool iDialogDismissed;
       
   149 
       
   150     /**
       
   151     * Progess note dialog and progress info
       
   152     */
       
   153     CAknProgressDialog* iProgressNoteDialog;        // owned
       
   154     CEikProgressInfo* iProgressInfo;                // not owned
       
   155     TInt iCurrentProgressValue;                     // owned
       
   156     TInt iProgressIncrement;                        // owned
       
   157 
       
   158     /**
       
   159     * Control environment
       
   160     */
       
   161     CCoeEnv* iCoeEnv;
       
   162 
       
   163     /**
       
   164     * Is CoeEnv given
       
   165     */
       
   166     TBool iUseCoeEnv;
       
   167 
       
   168     /**
       
   169     * Error url for ROAP temporary error
       
   170     */
       
   171     HBufC8* iErrorUrl;
       
   172 
       
   173     /**
       
   174     * Post response url for ROAP prUrl
       
   175     */
       
   176     HBufC8* iPostResponseUrl;
       
   177 
       
   178     };
       
   179 
       
   180 #endif // CDRMHELPERDMGRWRAPPER_H