ncdengine/engine/transport/inc/catalogshttpdownload.h
branchRCL_3
changeset 25 7333d7932ef7
parent 11 3ba40be8e484
child 26 8b7f4e561641
equal deleted inserted replaced
24:5cc91383ab1e 25:7333d7932ef7
    17 
    17 
    18 
    18 
    19 #ifndef C_CATALOGSHTTPDOWNLOAD_H
    19 #ifndef C_CATALOGSHTTPDOWNLOAD_H
    20 #define C_CATALOGSHTTPDOWNLOAD_H
    20 #define C_CATALOGSHTTPDOWNLOAD_H
    21 
    21 
    22 #include <downloadmgrclient.h>
    22 // HLA: #include <DownloadMgrClient.h>
    23 
    23 #include <download.h>
       
    24 #include <downloadevent.h>
    24 #include <s32file.h>
    25 #include <s32file.h>
    25 
    26 
    26 #include "catalogshttpoperation.h"
    27 #include "catalogshttpoperation.h"
    27 #include "catalogstransportoperationid.h"
    28 #include "catalogstransportoperationid.h"
    28 #include "catalogshttpconfigobserver.h"
    29 #include "catalogshttpconfigobserver.h"
    31 class MCatalogsHttpConfig;
    32 class MCatalogsHttpConfig;
    32 class CCatalogsHttpConfig;
    33 class CCatalogsHttpConfig;
    33 class CCatalogsHttpHeaders;
    34 class CCatalogsHttpHeaders;
    34 class CCatalogsKeyValuePair;
    35 class CCatalogsKeyValuePair;
    35 class CCatalogsHttpDownloadManager;
    36 class CCatalogsHttpDownloadManager;
    36 
    37 class CCatalogsHttpQTDownload;
       
    38 using namespace WRT;
    37 /**
    39 /**
    38 * HTTP file download implementation
    40 * HTTP file download implementation
    39 *
    41 *
    40 * @note Due to insufficient access to HTTP response headers through the 
    42 * @note Due to insufficient access to HTTP response headers through the 
    41 * Download manager, Download uses CCatalogsHttpTransaction with HTTP HEAD
    43 * Download manager, Download uses CCatalogsHttpTransaction with HTTP HEAD
    75     * @param aConfig Configuration
    77     * @param aConfig Configuration
    76     * @return A new HTTP download
    78     * @return A new HTTP download
    77     */
    79     */
    78     static CCatalogsHttpDownload* NewLC( 
    80     static CCatalogsHttpDownload* NewLC( 
    79         CCatalogsHttpDownloadManager& aOwner, 
    81         CCatalogsHttpDownloadManager& aOwner, 
    80         RHttpDownload* aDownload,
    82         Download* aDownload,
    81         const CCatalogsHttpConfig& aConfig );
    83         const CCatalogsHttpConfig& aConfig );
    82 
    84 
    83 
    85 
    84     /**
    86     /**
    85     * Destructor
    87     * Destructor
   236      * Not supported
   238      * Not supported
   237      * @see MCatalogsHttpOperation::StatusCode()
   239      * @see MCatalogsHttpOperation::StatusCode()
   238      */
   240      */
   239     TInt StatusCode() const;        
   241     TInt StatusCode() const;        
   240     
   242     
   241     
   243     TDownloadDeleteState GetStatusState();
       
   244     Download* GetDownload();
   242     /**
   245     /**
   243      * Not supported
   246      * Not supported
   244      * @see MCatalogsHttpOperation::StatusText()
   247      * @see MCatalogsHttpOperation::StatusText()
   245      */
   248      */
   246     const TDesC8& StatusText() const;
   249     const TDesC8& StatusText() const;
   280     void HandleHttpEventL( MCatalogsHttpOperation& aOperation,
   283     void HandleHttpEventL( MCatalogsHttpOperation& aOperation,
   281         TCatalogsHttpEvent aEvent );
   284         TCatalogsHttpEvent aEvent );
   282         
   285         
   283     TBool HandleHttpError( MCatalogsHttpOperation& aOperation, 
   286     TBool HandleHttpError( MCatalogsHttpOperation& aOperation, 
   284         TCatalogsHttpError aError );
   287         TCatalogsHttpError aError );
   285             
   288 
       
   289      void HandledownloadEventL(DownloadEvent& aEvent);   
       
   290               
   286 public:     
   291 public:     
   287 
   292 
   288     /**
   293     /**
   289     * Handles events from Download Manager
   294     * Handles events from Download Manager
   290     *
   295     *
   291     * @param aEvent Download Manager event
   296     * @param aEvent Download Manager event
   292     */
   297     */
       
   298      /* HLa
   293     void HandleEventL( THttpDownloadEvent aEvent );
   299     void HandleEventL( THttpDownloadEvent aEvent );
   294     
   300     */
   295     
   301     
   296     /**
   302     /**
   297      * Set file server session
   303      * Set file server session
   298      *
   304      *
   299      * @param aFs File server session
   305      * @param aFs File server session
   319     /**
   325     /**
   320     * Constructor
   326     * Constructor
   321     */
   327     */
   322     CCatalogsHttpDownload( 
   328     CCatalogsHttpDownload( 
   323         CCatalogsHttpDownloadManager& aOwner, 
   329         CCatalogsHttpDownloadManager& aOwner, 
   324         RHttpDownload* aDownload );
   330         Download* aDownload );
   325     
   331     
   326     /**
   332     /**
   327     * 2nd phase constructor
   333     * 2nd phase constructor
   328     */
   334     */
   329     void ConstructL( const CCatalogsHttpConfig* aConfig );
   335     void ConstructL( const CCatalogsHttpConfig* aConfig );
   342 private: // New methods
   348 private: // New methods
   343 
   349 
   344     /**
   350     /**
   345     * Handles event progress
   351     * Handles event progress
   346     * @param aEvent The event that has progressed
   352     * @param aEvent The event that has progressed
   347     */            
   353     */
       
   354     /* HLa
   348     void HandleEventProgressL( const THttpDownloadEvent& aEvent );
   355     void HandleEventProgressL( const THttpDownloadEvent& aEvent );
   349 
   356     */
   350     
   357     
   351     /**
   358     /**
   352     * Updates the target filename from Content-Disposition -header
   359     * Updates the target filename from Content-Disposition -header
   353     * @throw KErrNotFound if the header doesn't exist
   360     * @throw KErrNotFound if the header doesn't exist
   354     */
   361     */
   480     void UpdateExtensionL();
   487     void UpdateExtensionL();
   481     
   488     
   482     /**
   489     /**
   483      *  Replace current extension at aName with extension given (eExt).
   490      *  Replace current extension at aName with extension given (eExt).
   484      */
   491      */
   485     void CCatalogsHttpDownload::ReplaceExtension( TDes& aName, const TDesC& aExt );
   492     void ReplaceExtension( TDes& aName, const TDesC& aExt );
   486     
   493     
   487     /**
   494     /**
   488      * Checks the preset content-type and forces HEAD request if
   495      * Checks the preset content-type and forces HEAD request if
   489      * content is OMA DD, JAD or some DRM file
   496      * content is OMA DD, JAD or some DRM file
   490      */
   497      */
   507     
   514     
   508 private:
   515 private:
   509 
   516 
   510     CCatalogsHttpDownloadManager& iOwner;
   517     CCatalogsHttpDownloadManager& iOwner;
   511     TCatalogsTransportOperationId iId;  // Operation id
   518     TCatalogsTransportOperationId iId;  // Operation id
   512     RHttpDownload* iDownload;           // Platform download
   519     Download* iDownload;           // Platform download
   513     CCatalogsHttpConfig* iConfig;       // Configuration
   520     CCatalogsHttpConfig* iConfig;       // Configuration
   514     MCatalogsHttpObserver* iObserver;   // Observer        
   521     MCatalogsHttpObserver* iObserver;   // Observer        
   515     TCatalogsHttpEvent iState;          // State of the download
   522     TCatalogsHttpEvent iState;          // State of the download
   516     HBufC8* iUri;                       // Current URI
   523     HBufC8* iUri;                       // Current URI
   517     HBufC8* iEncodedUri;                // Current URI as encoded
   524     HBufC8* iEncodedUri;                // Current URI as encoded
   518     CCatalogsHttpHeaders* iResponseHeaders; // Headers from HTTP response
   525     CCatalogsHttpHeaders* iResponseHeaders; // Headers from HTTP response
       
   526     CCatalogsHttpQTDownload* iQTDownload;
   519     
   527     
   520     // added request headers not supported by DL man
   528     // added request headers not supported by DL man
   521     HBufC8* iAddedRequestHeaders;       
   529     HBufC8* iAddedRequestHeaders;       
   522     TInt iRefCount;        
   530     TInt iRefCount;        
   523     TBool iNormalDelete;
   531     TBool iNormalDelete;
   524     TBuf8<KMaxContentTypeLength> iContentType;
   532 
       
   533     // HLa: TBuf8<KMaxContentTypeLength> iContentType;
       
   534     TBuf8<256> iContentType;
   525         
   535         
   526     // Transaction for retrieving all of the response headers
   536     // Transaction for retrieving all of the response headers
   527     MCatalogsHttpOperation* iTransaction;
   537     MCatalogsHttpOperation* iTransaction;
   528     TCatalogsHttpHeaderMode iMode;    
   538     TCatalogsHttpHeaderMode iMode;    
   529         
   539         
   553 #endif    
   563 #endif    
   554     
   564     
   555     // For managing async pause with dlmgr.
   565     // For managing async pause with dlmgr.
   556     TBool iPausePending;
   566     TBool iPausePending;
   557     TBool iQueuedResume;
   567     TBool iQueuedResume;
   558     
   568     TDownloadDeleteState iStatus;
   559 protected:
   569 protected:
   560 
   570 
   561     // Grant access to UpdateContentType
   571     // Grant access to UpdateContentType
   562     friend class CCatalogsHttpDownloadManager;
   572     friend class CCatalogsHttpDownloadManager;
   563     
   573     
   564     };
   574     };
   565 
   575 
       
   576 class  CCatalogsHttpQTDownload: public QObject
       
   577 	{
       
   578 		 Q_OBJECT
       
   579 		 	public:
       
   580 		 		CCatalogsHttpQTDownload(CCatalogsHttpDownload* aHttpDownload,Download* aDownload);
       
   581 	    public slots:
       
   582     	void downloadEventHandler(DownloadEvent*);
       
   583     	void downloadErrorHandler(Error);
       
   584 	    public:
       
   585 	    	CCatalogsHttpDownload* iCatalogsHttpDownload;
       
   586 	    	Download* iDownload;           // Platform download
       
   587 	};
       
   588 	
       
   589 	
   566 #endif // C_CATALOGSHTTPDOWNLOAD_H
   590 #endif // C_CATALOGSHTTPDOWNLOAD_H