webengine/osswebengine/WebCore/platform/network/symbian/HttpCacheSupply.h
author Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
Wed, 09 Jun 2010 10:52:50 +0300
branchRCL_3
changeset 42 a1a5d4e727e8
parent 25 0ed94ceaa377
child 48 79859ed3eea9
permissions -rw-r--r--
Revision: 201021 Kit: 2010123

/*
* Copyright (c) 2006 Nokia Corporation and/or its subsidiary(-ies).
* All rights reserved.
* This component and the accompanying materials are made available
* under the terms of the License "Eclipse Public License v1.0"
* which accompanies this distribution, and is available
* at the URL "http://www.eclipse.org/legal/epl-v10.html".
*
* Initial Contributors:
* Nokia Corporation - initial contribution.
*
* Contributors:
*
* Description:  Definition of CHttpCacheSupply
*
*/


#ifndef CHTTPCACHESUPPLY_H
#define CHTTPCACHESUPPLY_H

//  INCLUDES
#include <e32base.h>
#include <brctldefs.h>
#include "httpcachemanager.h"

// CONSTANTS

// MACROS

// DATA TYPES

// FUNCTION PROTOTYPES

// FORWARD DECLARATIONS
class HttpConnection;
class CPeriodic;
class CHttpCacheDataSupplier;

// CLASS DECLARATION

/**
*  This class handles http transactions.
*  @lib resLoader.lib
*  @since 3.1
*/
class CHttpCacheSupply : public CBase
    {
    public:  // Constructors and destructor

        /**
        * Two-phased constructor.
        * @param
        * @param
        * @param
        * @return Http cache  object.
        */
        static CHttpCacheSupply* NewL( HttpConnection* aHttpTransaction );

        /**
        * Destructor.
        */
        virtual ~CHttpCacheSupply();

    public: // new functions

        /**
        *
        * @since 3.1
        * @param
        * @return
        */
        TInt StartRequestL( TBrCtlDefs::TBrCtlCacheMode aCacheMode );

        /**
        *
        * @since 3.1
        * @param
        * @return
        */
        void CloseRequest();

        /**
        *
        * @since 3.1
        * @param
        * @return
        */
        void HeadersReceivedL();

        /**
        *
        * @since 3.1
        * @param
        * @return
        */
        void BodyReceivedL();

        /**
        *
        * @since 3.1
        * @param
        * @return
        */
        void ResponseCompleteL();

        /**
        *
        * @since 3.1
        * @param
        * @return
        */
        TInt ResponseState() const { return m_reponseState;}

        /**
        *
        * @since 3.1
        * @param
        * @return
        */
        TBool IsSupplying()             { return m_responseTimer!=0; }

        /**
        *
        * @since 3.1
        * @param
        * @return
        */
		void PauseSupply();

        /**
        *
        * @since 3.1
        * @param
        * @return
        */
		void ResumeSupply();
		
        /**
        *
        * SetTransaction
        * @param aTransaction
        * @return
        */		
		void SetDownloadTransaction(RHTTPTransaction* aTransaction);

    private:

        /**
        * Construct.
        * @param
        * @param
        * @parem
        * @return
        */
        CHttpCacheSupply( HttpConnection* aHttpTransaction );

        /**
        * By default Symbian 2nd phase constructor is private.
        */
        void ConstructL();

    private: //

        /**
        * Callback for async response
        * @since 3.1
        * @param  aAny this pinter
        * @return TInt KErrNone
        */
        static TInt ResponseCallbackL( TAny* aAny );

        /**
        *
        * @since 3.1
        * @param
        * @return
        */
        void SupplyResponseL();

        /**
        *
        * @since 3.1
        * @param
        * @return
        */
        void SendBodyL();
        
        /**
        *
        * @SupplyToDownloadManager
        * @param
        * @return
        */        
        void SupplyToDownloadManager();

    private:    // Data

        //
        CHttpCacheManager*              m_cacheManager;          // not owned
        //
        HttpConnection*                 m_httpTransaction;       // not owned
        //
        TInt                            m_reponseState;
        //
        CPeriodic*                      m_responseTimer;         // owned
        //
        TBool                           m_failed;
        //
        TBool                           m_notModified;
        //
        THttpCacheEntry                 m_cacheEntry;
        // ETrue if the cache object is closed
        TBool							m_closed;

        CHttpCacheDataSupplier*         m_dataSupplier;
        
        RHTTPTransaction*               m_dlTransaction;
  };

#endif      // CHTTPCACHESUPPLY_H

// End of File