browserutilities/downloadmgr/DownloadMgrServEng/Inc/HttpClientApp.h
changeset 0 dd21522fd290
equal deleted inserted replaced
-1:000000000000 0:dd21522fd290
       
     1 /*
       
     2 * Copyright (c) 2002-2004 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 the License "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:  ?Description
       
    15 *
       
    16 */
       
    17 
       
    18 
       
    19 
       
    20 #ifndef HTTPCLIENTAPP_H
       
    21 #define HTTPCLIENTAPP_H
       
    22 
       
    23 //  INCLUDES
       
    24 #include <e32base.h>
       
    25 
       
    26 // CONSTANTS
       
    27 _LIT( KInfoFilesDirName, "downloads" );
       
    28 _LIT( KContentsDirName, "contents" );
       
    29 _LIT( KCodsDirName, "cod" );
       
    30 _LIT( KInfoFilesCodDirName, "codinfo" );
       
    31 
       
    32 // MACROS
       
    33 //#define ?macro ?macro_def
       
    34 
       
    35 // DATA TYPES
       
    36 //enum ?declaration
       
    37 //typedef ?declaration
       
    38 //extern ?data_type;
       
    39 
       
    40 // FUNCTION PROTOTYPES
       
    41 //?type ?function_name(?arg_list);
       
    42 
       
    43 // FORWARD DECLARATIONS
       
    44 class CHttpDownloadManagerServerEngine;
       
    45 class CHttpConnHandler;
       
    46 class CHttpDownload;
       
    47 class MDownloadStateObserver;
       
    48 class CHttpClientAppInstance;
       
    49 
       
    50 // CLASS DECLARATION
       
    51 
       
    52 /**
       
    53 *  ?one_line_short_description.
       
    54 *  ?other_description_lines
       
    55 *
       
    56 *  @lib ?library
       
    57 *  @since Series 60 v2.8
       
    58 */
       
    59 NONSHARABLE_CLASS( CHttpClientApp ) : public CBase
       
    60     {
       
    61     public:  // Constructors and destructor
       
    62         
       
    63         /**
       
    64         * Two-phased constructor.
       
    65         */
       
    66         static CHttpClientApp* NewL( TUint32 aAppUid, 
       
    67                                      CHttpDownloadManagerServerEngine* aEngine );
       
    68         
       
    69         /**
       
    70         * Destructor.
       
    71         */
       
    72         virtual ~CHttpClientApp();
       
    73 
       
    74     public: // New functions
       
    75         
       
    76          /**
       
    77         * Removes the given download from downloads array.
       
    78         * This download is deleted!
       
    79         * @since Series 60 v2.8
       
    80         * @param aDownload download to be unregistered
       
    81         * @return none.
       
    82         */
       
    83         IMPORT_C void UnregisterDownload( CHttpDownload* aDownload );
       
    84 
       
    85         /**
       
    86         * Creates a new client instances.
       
    87         * @since Series 60 v2.8
       
    88         * @param aObserver pointer to a download state observer. Not owned.
       
    89         * @param aGetAllPendingDownloads this client instance gets all non-attached downloads.
       
    90         * @return created client instance.
       
    91         */
       
    92         CHttpClientAppInstance* CreateNewInstanceL( MDownloadStateObserver* aObserver,
       
    93                                                     TBool aGetAllPendingDownloads );
       
    94 
       
    95         /**
       
    96         * Closes the given client instance.
       
    97         * @since Series 60 v2.8
       
    98         * @param aInstance client instance to be closed
       
    99         * @return none.
       
   100         */
       
   101         void CloseInstance( CHttpClientAppInstance* aInstance );
       
   102 
       
   103         /**
       
   104         * Closes the entire client app with its instances and downloads
       
   105         * @since Series 60 v2.8
       
   106         * @param bStore if ETrue the current state is stored.
       
   107         * @return none.
       
   108         */
       
   109         void CloseClientApp( TBool bStore = ETrue );
       
   110 
       
   111         /**
       
   112         * Creates a new download.
       
   113         * @since Series 60 v2.8
       
   114         * @param aClAppInstance new download attached to this client instance
       
   115         * @param aUrl URL of the new download
       
   116         * @return pointer to the new download. Ownership is not passed.
       
   117         */
       
   118         CHttpDownload* CreateNewDownloadL( CHttpClientAppInstance* aClAppInstance,
       
   119                                            const TDesC8& aUrl );
       
   120 
       
   121         /**
       
   122         * Returns the client applications's UId.
       
   123         * @since Series 60 v2.8
       
   124         * @return UId of the client application
       
   125         */
       
   126         TUint32 AppUid() const;
       
   127 
       
   128         /**
       
   129         * Returns the array of the instance of the client application
       
   130         * @since Series 60 v2.8
       
   131         * @return array of the instances. Ownership is not passed.
       
   132         */
       
   133         CArrayPtrFlat<CHttpClientAppInstance>* Instances() const;
       
   134 
       
   135         /**
       
   136         * Returns the array of the all the downloads within this client
       
   137         * @since Series 60 v2.8
       
   138         * @return array of all the downloads within this client. Ownership is not passed.
       
   139         */
       
   140         CArrayPtrFlat<CHttpDownload>* Downloads() const;
       
   141 
       
   142         /**
       
   143         * Returns the engine where this client applications is created.
       
   144         * @since Series 60 v2.8
       
   145         * @return pointer to the engine. Ownership is not passed.
       
   146         */
       
   147         CHttpDownloadManagerServerEngine* Engine() const;
       
   148 
       
   149         /**
       
   150         * Registers the given download in the downloads array
       
   151         * @since Series 60 v2.8
       
   152         * @param aDownload download to be registered
       
   153         * @return none. Leaves on error.
       
   154         */
       
   155         void RegisterDownloadL( CHttpDownload* aDownload );
       
   156 
       
   157        
       
   158         /**
       
   159         * Returns the number of downloads attached to the master
       
   160         * instance.
       
   161         * @since Series 60 v2.8
       
   162         * @param aNoMediasOnly only downloads of which EDlAttrNoMedia attribute is ETrue
       
   163         * @return number of downloads attached to the master instance
       
   164         */
       
   165         TInt32 DownloadsInMaster( TBool aNoMediasOnly );
       
   166 
       
   167         /**
       
   168         * This connhandler is not assign to any client instance
       
   169         * and already disconnected. To avoid memory leak it
       
   170         * has to be destroyed.
       
   171         * @since Series 60 v2.8
       
   172         * @param aConnHandler ConnHandler to be deleted
       
   173         * @return none
       
   174         */
       
   175         void DestroyConnHandler( CHttpConnHandler* aConnHandler );
       
   176         
       
   177         /**
       
   178         * Loads info of this client application.
       
   179         * @since Series 60 v2.8
       
   180         * @param aFolder Folder where the info file stored
       
   181         * @return none. Leaves on error.
       
   182         */
       
   183         void LoadClientInfoL( const TDesC& aFolder );
       
   184 
       
   185     public: // Functions from base classes
       
   186     protected:  // New functions
       
   187         /**
       
   188         * Stores info of this client application.
       
   189         * @since Series 60 v2.8
       
   190         * @return none. Leaves on error.
       
   191         */
       
   192         void StoreClientInfoL();
       
   193 
       
   194         /**
       
   195         * Load all downloads from disk.
       
   196         * @since Series 60 v2.8
       
   197         * @return none. Leaves on error.
       
   198         */
       
   199         void LoadDownloadsL();
       
   200 
       
   201         /**
       
   202         * Converts filename to download id.
       
   203         * @since Series 60 v2.8
       
   204         * @param aFilename download filename
       
   205         * @return id of the download. Leaves on error.
       
   206         */
       
   207         TInt32 DownloadIdL( const TDesC& aFilename ) const;
       
   208 
       
   209     protected:  // Functions from base classes
       
   210         
       
   211     private:
       
   212 
       
   213         /**
       
   214         * C++ default constructor.
       
   215         */
       
   216         CHttpClientApp( TUint32 aAppUid, 
       
   217                         CHttpDownloadManagerServerEngine* aEngine );
       
   218 
       
   219         /**
       
   220         * By default Symbian 2nd phase constructor is private.
       
   221         */
       
   222         void ConstructL();
       
   223 
       
   224         // Prohibit copy constructor if not deriving from CBase.
       
   225         // CHttpClientApp( const CHttpClientApp& );
       
   226         // Prohibit assigment operator if not deriving from CBase.
       
   227         // CHttpClientApp& operator=( const CHttpClientApp& );
       
   228         
       
   229         /**
       
   230         * Checks whether the downlod is already loaded or not.
       
   231         * @returns whether the downlod is already loaded or not
       
   232         */
       
   233         TBool IsDownloadAlreadyLoaded( TInt32 aId ) const;
       
   234 
       
   235     public:     // Data
       
   236 
       
   237         // ?one_line_short_description_of_data
       
   238     
       
   239     protected:  // Data
       
   240 
       
   241         // ?one_line_short_description_of_data
       
   242         TUint32 iAppUid;
       
   243         CHttpDownloadManagerServerEngine* iEngine;          // not owned
       
   244         CArrayPtrFlat<CHttpClientAppInstance>* iInstances;  // owner
       
   245         CArrayPtrFlat<CHttpDownload>* iDownloads;           // owner
       
   246         CArrayPtrFlat<CHttpConnHandler>* iConnections;      // owned
       
   247 
       
   248     private:    // Data
       
   249         // ?one_line_short_description_of_data
       
   250         //?data_declaration;
       
   251          
       
   252         // Reserved pointer for future extension
       
   253         //TAny* iReserved;
       
   254 
       
   255     public:     // Friend classes
       
   256         //?friend_class_declaration;
       
   257     protected:  // Friend classes
       
   258         //?friend_class_declaration;
       
   259     private:    // Friend classes
       
   260         //?friend_class_declaration;
       
   261 
       
   262     };
       
   263 
       
   264 #endif      // HTTPCLIENTAPP_H
       
   265             
       
   266 // End of File