webengine/osswebengine/WebCore/platform/network/symbian/FileConnection.h
author Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
Mon, 18 Jan 2010 21:20:18 +0200
changeset 27 6297cdf66332
parent 0 dd21522fd290
child 48 79859ed3eea9
permissions -rw-r--r--
Revision: 201001 Kit: 201003

/*
* Copyright (c) 2007 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:  
*
*/

#ifndef __FILECONNECTION_H__
#define __FILECONNECTION_H__

#include <e32base.h>
#include <f32file.h>
#include "UrlConnection.h"

class CFileReader;

class FileConnection : public MUrlConnection
{
public:
    /**
    */
    FileConnection(WebCore::ResourceHandle* _handle);
    /**
    */
    virtual ~FileConnection();
    /**
    */
    virtual int submit();
    /**
    */
    virtual void cancel();
    /**
    */
    virtual void download(WebCore::ResourceHandle* handle, const WebCore::ResourceRequest& request, const WebCore::ResourceResponse& response);

    virtual int totalContentSize() { return m_maxSize; }
    /**
    */
    void response();
    /**
    */
    void complete(int error);

private:
    /**
    */
    void submitL();
    /**
    */
    void responseL();
    /**
    */
    HBufC* parseFileNameLC(const TDesC8& aUrl );
    /**
    * Determine the content type of the file.
    */
    HBufC8* contentTypeL();
    /**
    * Determine the content type of the file from PluginHandler.
    */
    HBufC8* contentTypeFromPluginsL();

    /**
    * Determine the content encoding of the file.
    */
    TPtrC8 contentEncoding(const TDesC8& aContentTypeString ) const;
private:
    HBufC* m_fileName;
    RFile m_file;
    int m_maxSize;
    CFileReader* m_fileReader;
    int m_chunkIndex;
	HBufC* m_charset;
	HBufC* m_contentType;
};


#endif // __FILECONNECTION_H__
// end of file