webengine/osswebengine/cache/inc/HttpCacheManager.h
changeset 0 dd21522fd290
child 8 7c90e6132015
equal deleted inserted replaced
-1:000000000000 0:dd21522fd290
       
     1 /*
       
     2 * Copyright (c) 2006 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:  Definition of CHttpCacheManager
       
    15 *
       
    16 */
       
    17 
       
    18 #ifndef CHTTPCACHEMANAGER_H
       
    19 #define CHTTPCACHEMANAGER_H
       
    20 
       
    21 //  INCLUDES
       
    22 #include <e32base.h>
       
    23 #include <CenRepNotifyHandler.h>
       
    24 #include <BrCtlDefs.h>
       
    25 #include <http/rhttpsession.h>
       
    26 
       
    27 // CONSTANTS
       
    28 
       
    29 // MACROS
       
    30 
       
    31 // DATA TYPES
       
    32 
       
    33 // FUNCTION PROTOTYPES
       
    34 
       
    35 // FORWARD DECLARATIONS
       
    36 class CHttpCacheEntry;
       
    37 class CHttpCacheHandler;
       
    38 class CCenRepNotifyHandler;
       
    39 class CRepository;
       
    40 class RHTTPTransaction;
       
    41 class MHTTPDataSupplier;
       
    42 
       
    43 // CLASS DECLARATION
       
    44 
       
    45 /**
       
    46 *
       
    47 *  @lib
       
    48 *  @since 3.1
       
    49 */
       
    50 class THttpCacheEntry
       
    51     {
       
    52     public:
       
    53 
       
    54         //
       
    55         CHttpCacheHandler*  iCacheHandler;
       
    56 
       
    57         //
       
    58         CHttpCacheEntry*    iCacheEntry;
       
    59     };
       
    60 
       
    61 /**
       
    62 *
       
    63 *  @lib
       
    64 *  @since 3.1
       
    65 */
       
    66 class CHttpCacheManager : public CBase, public MCenRepNotifyHandlerCallback
       
    67     {
       
    68     public:  // Constructors and destructor
       
    69 
       
    70         /**
       
    71         * Two-phased constructor.
       
    72         * @since 3.1
       
    73         * @param
       
    74         * @param
       
    75         * @return CacheHandler object.
       
    76         */
       
    77         IMPORT_C static CHttpCacheManager* NewL();
       
    78 
       
    79         /**
       
    80         * Destructor.
       
    81         */
       
    82         virtual ~CHttpCacheManager();
       
    83 
       
    84     public: // new functions
       
    85 
       
    86         /**
       
    87         *
       
    88         * @since 3.1
       
    89         * @param
       
    90         * @return
       
    91         */
       
    92         IMPORT_C TInt RequestL( RHTTPTransaction& aTrans, TBrCtlDefs::TBrCtlCacheMode aCacheMode,
       
    93             THttpCacheEntry& aCacheEntry );
       
    94 
       
    95         /**
       
    96         *
       
    97         * @since 3.1
       
    98         * @param
       
    99         * @return
       
   100         */
       
   101         IMPORT_C TInt RequestHeadersL( RHTTPTransaction& aTrans, THttpCacheEntry& aCacheEntry );
       
   102 
       
   103         /**
       
   104         *
       
   105         * @since 3.1
       
   106         * @param
       
   107         * @return
       
   108         */
       
   109         IMPORT_C HBufC8* RequestNextChunkL( RHTTPTransaction& aTrans, TBool& aLastChunk, THttpCacheEntry& aCacheEntry );
       
   110 
       
   111         /**
       
   112         *
       
   113         * @since 3.1
       
   114         * @param
       
   115         * @return
       
   116         */
       
   117         IMPORT_C void ReceivedResponseHeadersL( RHTTPTransaction& aTrans, THttpCacheEntry& aCacheEntry );
       
   118 
       
   119         /**
       
   120         *
       
   121         * @since 3.1
       
   122         * @param
       
   123         * @return
       
   124         */
       
   125     IMPORT_C void ReceivedResponseBodyDataL( RHTTPTransaction& aTrans, MHTTPDataSupplier& aBodyDataSupplier, THttpCacheEntry& aCacheEntry );
       
   126 
       
   127         /**
       
   128         *
       
   129         * @since 3.1
       
   130         * @param
       
   131         * @return
       
   132         */
       
   133     IMPORT_C void ResponseComplete( RHTTPTransaction& aTrans, THttpCacheEntry& aCacheEntry );
       
   134 
       
   135         /**
       
   136         *
       
   137         * @since 3.1
       
   138         * @param
       
   139         * @return
       
   140         */
       
   141     IMPORT_C void RequestClosed( RHTTPTransaction* aTrans, THttpCacheEntry& aCacheEntry );
       
   142 
       
   143         /**
       
   144         *
       
   145         * @since 3.1
       
   146         * @param
       
   147         * @return
       
   148         */
       
   149         IMPORT_C TInt RemoveAllL();
       
   150 
       
   151         /**
       
   152         *
       
   153         * @since 3.1
       
   154         * @param
       
   155         * @return
       
   156         */
       
   157         IMPORT_C TInt RemoveL( const TDesC8& aUrl );
       
   158 
       
   159         /**
       
   160         *
       
   161         * @since 3.1
       
   162         * @param
       
   163         * @return
       
   164         */
       
   165         IMPORT_C TBool Find( const TDesC8& aUrl );
       
   166 
       
   167         /**
       
   168         *
       
   169         * @since 3.1
       
   170         * @param
       
   171         * @return
       
   172         */
       
   173         IMPORT_C TBool SaveL( const TDesC8& aUrl, const TDesC8& aHeader,
       
   174                      const TDesC8& aContent, const TDesC8&  aHttpHeaderString );
       
   175 
       
   176         /**
       
   177         *
       
   178         * @since 3.1
       
   179         * @param
       
   180         * @return
       
   181         */
       
   182         IMPORT_C TInt AddHeaderL( const TDesC8& aUrl, const TDesC8& aName, const TDesC8& aValue );
       
   183 
       
   184     public: // from MCenRepNotifyHandlerCallback
       
   185 
       
   186         /**
       
   187         *
       
   188         * @since 3.1
       
   189         * @param
       
   190         * @return
       
   191         */
       
   192         void HandleNotifyString( const TUint32 aKeyId, const TDesC& aValue );
       
   193 
       
   194     private:
       
   195 
       
   196         /**
       
   197         * Construct.
       
   198         * @since 3.1
       
   199         * @param
       
   200         * @param
       
   201         * @return CacheHandler object.
       
   202         */
       
   203         CHttpCacheManager();
       
   204 
       
   205         /**
       
   206         * By default Symbian 2nd phase constructor is private.
       
   207         */
       
   208         void ConstructL();
       
   209 
       
   210     private:
       
   211 
       
   212         /**
       
   213         *
       
   214         * @since 3.1
       
   215         * @param
       
   216         * @return
       
   217         */
       
   218         void CreateCacheHandlersL();
       
   219 
       
   220          /**
       
   221         *
       
   222         * @since 7.1
       
   223         * @param
       
   224         * @return
       
   225         */
       
   226         void RemoveOrphanedFilesL(); 
       
   227         
       
   228         /**
       
   229         *
       
   230         * @since 3.1
       
   231         * @param
       
   232         * @return
       
   233         */
       
   234         CHttpCacheHandler* CacheHandler( const TDesC8& aUrl,  TDes8* aHttpHeaderString ) const;
       
   235 
       
   236 
       
   237     /**
       
   238         *
       
   239         * @since 3.1
       
   240         * @param
       
   241         * @return
       
   242         */
       
   243         TBool VSSRequestCheck( const RHTTPTransaction& aTrans,
       
   244                                const RHTTPHeaders& aHttpHeader, const TDesC8& aUrl );
       
   245     /**
       
   246         *
       
   247         * @since 3.1
       
   248         * @param
       
   249         * @return
       
   250         */
       
   251 
       
   252         TBool VSSHeaderCheck(  TDes8*  aHttpHeaderString ) const ;
       
   253     private:    // Data
       
   254 
       
   255         CHttpCacheHandler*                         iCache;      // owned
       
   256         
       
   257         TPath	                                   iCacheFolder;
       
   258         
       
   259         CHttpCacheHandler*                         iOperatorCache;      // owned
       
   260         //
       
   261         CHttpCacheHandler*                         iphoneSpecificCache;      // owned
       
   262         //
       
   263 
       
   264 
       
   265         HBufC8*                                    iOpDomain;       // owned
       
   266         //
       
   267         CCenRepNotifyHandler*                      iOfflineNotifyHandler; // owned
       
   268         //
       
   269         CRepository*                               iOfflineRepository; // owned
       
   270         //
       
   271         TBool                                      iOfflineMode;
       
   272         //
       
   273         TBool                                      iCacheEnabled;
       
   274         //
       
   275         HBufC8*                                    iVSSWhiteList;       // owned
       
   276         //
       
   277         TBool                                      iVSSCacheEnabled;
       
   278         TBool                                      iVSSTransaction;
       
   279     };
       
   280 
       
   281 #endif      // CHttpCacheManager_H
       
   282 
       
   283 // End of File