// WEBDHAN.H
//
// Copyright (c) 1997-1999 Symbian Ltd.  All rights reserved.
//

// Header for MWebDatahandler.
//
//=============================================================================
// The interface class for a web data handler.
// A data handler receives data from an active object polling a CWtlDocument.
//
// The active object notifies the handler by calling the appropriate of the
// "On" methods. The handler may propogate these events up. The "aSource"
// parameter contains a pointer to the ORIGINAL handler (not to the active
// object).
//=============================================================================
//=============================================================================


#ifndef __WEBDHAN_H__
#define __WEBDHAN_H__

#if !defined(__WEBMOBSV_H__)
#include "webmobsv.h" // for TWebModelObserverStatus
#endif

class CWtlDocument;
class CWebDataCollector;

class MWebDataHandler
	{
public:
	// Return a pointer to the document owned by the data handler
	virtual CWtlDocument* Document() const = 0;

	// Return a pointer to the active object owned by the data handler.
	virtual CWebDataCollector* ActiveObject() const = 0;

	// Routines to instruct or query the active object.
	virtual void  StartGettingDataL() = 0;
	virtual void  StopGettingData()   = 0;
	virtual TBool GettingData() const = 0;

	// Return true if the document is ready (EReady has been received)
	virtual TBool IsReady() const = 0;

	// called when an iterator can be created and the URL is known
	virtual void OnReadyL   (MWebDataHandler* aSource, MWebDataHandler* aTarget) = 0;

	// called when the document size is known
	virtual void OnSizeL    (MWebDataHandler* aSource, MWebDataHandler* aTarget) = 0;
	
	// called when the document type is known
	virtual void OnTypeL    (MWebDataHandler* aSource, MWebDataHandler* aTarget) = 0;
	
	// called when new data has arrived after polling
	virtual void OnNewDataL (MWebDataHandler* aSource, MWebDataHandler* aTarget) = 0;
	
	// called after all data has arrived
	virtual void OnCompleteL(MWebDataHandler* aSource, MWebDataHandler* aTarget) = 0;
	
	// called when an error has occurred during polling
	virtual void OnErrorL   (MWebDataHandler* aSource, MWebDataHandler* aTarget, TInt aCode) = 0;
	
	// called when the connection status has changed
	virtual void OnStatusL  (MWebDataHandler* aSource, MWebDataHandler* aTarget, MWebModelObserver::TWebModelObserverStatus aStatus) = 0;
																		
	// called when authentication has succeeded
	virtual void OnAuthenticationSuccessL(MWebDataHandler* aSource, MWebDataHandler* aTarget) = 0;
	
	// called when authentication has failed
	virtual void OnAuthenticationFailureL(MWebDataHandler* aSource, MWebDataHandler* aTarget) = 0;

	// called when the document mime type is known
	virtual void OnMimeTypeL    (MWebDataHandler* aSource, MWebDataHandler* aTarget) = 0;
	
	// called when the document has unparsed tokens
	virtual void OnUnparsedTokensL    (MWebDataHandler* aSource, MWebDataHandler* aTarget) = 0;
	
	// called when the document needs credentials
	virtual void OnNeedsCredentialsL    (MWebDataHandler* aSource, MWebDataHandler* aTarget) = 0;
	
	// called when the document has moved (HTTP redirection)
	virtual void OnResourceMovedL    (MWebDataHandler* aSource, MWebDataHandler* aTarget) = 0;
	
	IMPORT_C virtual void MWebDataHandler_Reserved1();
	IMPORT_C virtual void MWebDataHandler_Reserved2();

	};

#endif __WEBDHAN_H__
