/*
 * DO NOT EDIT.  THIS FILE IS GENERATED FROM nsIRequestObserver.idl
 */

#ifndef __gen_nsIRequestObserver_h__
#define __gen_nsIRequestObserver_h__


#ifndef __gen_nsISupports_h__
#include "nsISupports.h"
#endif

/* For IDL files that don't want to include root IDL files. */
#ifndef NS_NO_VTABLE
#define NS_NO_VTABLE
#endif
class nsIRequest; /* forward declaration */


/* starting interface:    nsIRequestObserver */
#define NS_IREQUESTOBSERVER_IID_STR "fd91e2e0-1481-11d3-9333-00104ba0fd40"

#define NS_IREQUESTOBSERVER_IID \
  {0xfd91e2e0, 0x1481, 0x11d3, \
    { 0x93, 0x33, 0x00, 0x10, 0x4b, 0xa0, 0xfd, 0x40 }}

/**
 * nsIRequestObserver
 *
 * @status UNDER_REVIEW
 */
class NS_NO_VTABLE nsIRequestObserver : public nsISupports {
 public: 

  NS_DEFINE_STATIC_IID_ACCESSOR(NS_IREQUESTOBSERVER_IID)

  /**
     * Called to signify the beginning of an asynchronous request.
     *
     * @param request - request being observed
     * @param ctxt - user defined context
     *
     * A failure code returned from onStartRequest has the side-effect of
     * causing the request to be canceled.
     */
  /* void onStartRequest (in nsIRequest request, in nsISupports ctxt); */
  NS_IMETHOD OnStartRequest(nsIRequest *request, nsISupports *ctxt) = 0;

  /**
     * Called to signify the end of an asynchronous request.  This
     * call is always preceded by a call to onStartRequest.
     *
     * @param request - request being observed
     * @param ctxt - user defined context
     * @param statusCode - reason for stopping (NS_OK if completed successfully)
     *
     * A failure code returned from onStopRequest is generally ignored.
     */
  /* void onStopRequest (in nsIRequest request, in nsISupports ctxt, in nsresult statusCode); */
  NS_IMETHOD OnStopRequest(nsIRequest *request, nsISupports *ctxt, nsresult statusCode) = 0;

};

/* Use this macro when declaring classes that implement this interface. */
#define NS_DECL_NSIREQUESTOBSERVER \
  NS_IMETHOD OnStartRequest(nsIRequest *request, nsISupports *ctxt); \
  NS_IMETHOD OnStopRequest(nsIRequest *request, nsISupports *ctxt, nsresult statusCode); 

/* Use this macro to declare functions that forward the behavior of this interface to another object. */
#define NS_FORWARD_NSIREQUESTOBSERVER(_to) \
  NS_IMETHOD OnStartRequest(nsIRequest *request, nsISupports *ctxt) { return _to OnStartRequest(request, ctxt); } \
  NS_IMETHOD OnStopRequest(nsIRequest *request, nsISupports *ctxt, nsresult statusCode) { return _to OnStopRequest(request, ctxt, statusCode); } 

/* Use this macro to declare functions that forward the behavior of this interface to another object in a safe way. */
#define NS_FORWARD_SAFE_NSIREQUESTOBSERVER(_to) \
  NS_IMETHOD OnStartRequest(nsIRequest *request, nsISupports *ctxt) { return !_to ? NS_ERROR_NULL_POINTER : _to->OnStartRequest(request, ctxt); } \
  NS_IMETHOD OnStopRequest(nsIRequest *request, nsISupports *ctxt, nsresult statusCode) { return !_to ? NS_ERROR_NULL_POINTER : _to->OnStopRequest(request, ctxt, statusCode); } 

#if 0
/* Use the code below as a template for the implementation class for this interface. */

/* Header file */
class nsRequestObserver : public nsIRequestObserver
{
public:
  NS_DECL_ISUPPORTS
  NS_DECL_NSIREQUESTOBSERVER

  nsRequestObserver();
  virtual ~nsRequestObserver();
  /* additional members */
};

/* Implementation file */
NS_IMPL_ISUPPORTS1(nsRequestObserver, nsIRequestObserver)

nsRequestObserver::nsRequestObserver()
{
  NS_INIT_ISUPPORTS();
  /* member initializers and constructor code */
}

nsRequestObserver::~nsRequestObserver()
{
  /* destructor code */
}

/* void onStartRequest (in nsIRequest request, in nsISupports ctxt); */
NS_IMETHODIMP nsRequestObserver::OnStartRequest(nsIRequest *request, nsISupports *ctxt)
{
    return NS_ERROR_NOT_IMPLEMENTED;
}

/* void onStopRequest (in nsIRequest request, in nsISupports ctxt, in nsresult statusCode); */
NS_IMETHODIMP nsRequestObserver::OnStopRequest(nsIRequest *request, nsISupports *ctxt, nsresult statusCode)
{
    return NS_ERROR_NOT_IMPLEMENTED;
}

/* End of implementation class template. */
#endif

// Generic status codes for OnStopRequest:
#define NS_BINDING_SUCCEEDED NS_OK
#define NS_BINDING_FAILED    NS_ERROR_GENERATE_FAILURE(NS_ERROR_MODULE_NETWORK, 1)
#define NS_BINDING_ABORTED   NS_ERROR_GENERATE_FAILURE(NS_ERROR_MODULE_NETWORK, 2)
// The binding has been moved to another request in the same load group;
// the request observer should expect another On{Start/Stop}Request pair:
#define NS_BINDING_REDIRECTED NS_ERROR_GENERATE_FAILURE(NS_ERROR_MODULE_NETWORK, 3)
// The binding has been moved to another request in a different load group:
#define NS_BINDING_RETARGETED NS_ERROR_GENERATE_FAILURE(NS_ERROR_MODULE_NETWORK, 4)

#endif /* __gen_nsIRequestObserver_h__ */
