/*
 * DO NOT EDIT.  THIS FILE IS GENERATED FROM e:/builds/tinderbox/XR-Trunk/WINNT_5.2_Depend/mozilla/docshell/base/nsIChannelClassifier.idl
 */

#ifndef __gen_nsIChannelClassifier_h__
#define __gen_nsIChannelClassifier_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 nsIChannel; /* forward declaration */


/* starting interface:    nsIChannelClassifier */
#define NS_ICHANNELCLASSIFIER_IID_STR "d17f8f74-d403-4dea-b124-3ace5dbe44dc"

#define NS_ICHANNELCLASSIFIER_IID \
  {0xd17f8f74, 0xd403, 0x4dea, \
    { 0xb1, 0x24, 0x3a, 0xce, 0x5d, 0xbe, 0x44, 0xdc }}

/**
 * An nsIChannelClassifier object checks a channel's URI against the
 * URI classifier service, and cancels the channel before OnStartRequest
 * if it is found on a blacklist.
 */
class NS_NO_VTABLE NS_SCRIPTABLE nsIChannelClassifier : public nsISupports {
 public: 

  NS_DECLARE_STATIC_IID_ACCESSOR(NS_ICHANNELCLASSIFIER_IID)

  /**
   * Checks a channel against the URI classifier service (if it exists).
   *
   * The channel will be suspended while the classifier is checked.  The
   * channel may be cancelled with an error code determined by the classifier
   * before it is resumed.
   *
   * If there is no URI classifier service, NS_ERROR_FACTORY_NOT_REGISTERED
   * will be returned.
   *
   * @param aChannel
   *        The channel to suspend.
   */
  /* void start (in nsIChannel aChannel); */
  NS_SCRIPTABLE NS_IMETHOD Start(nsIChannel *aChannel) = 0;

  /**
   * Notify the classifier that the channel was redirected.  The new channel
   * will be suspended pending a new classifier lookup.
   *
   * @param aOldChannel
   *        The channel that's being redirected.
   * @param aNewChannel
   *        The new channel. This channel is not opened yet.
   */
  /* void onRedirect (in nsIChannel aOldChannel, in nsIChannel aNewChannel); */
  NS_SCRIPTABLE NS_IMETHOD OnRedirect(nsIChannel *aOldChannel, nsIChannel *aNewChannel) = 0;

  /**
   * Cancel an existing query.  If a channel has been suspended, it will
   * be resumed.
   */
  /* void cancel (); */
  NS_SCRIPTABLE NS_IMETHOD Cancel(void) = 0;

};

  NS_DEFINE_STATIC_IID_ACCESSOR(nsIChannelClassifier, NS_ICHANNELCLASSIFIER_IID)

/* Use this macro when declaring classes that implement this interface. */
#define NS_DECL_NSICHANNELCLASSIFIER \
  NS_SCRIPTABLE NS_IMETHOD Start(nsIChannel *aChannel); \
  NS_SCRIPTABLE NS_IMETHOD OnRedirect(nsIChannel *aOldChannel, nsIChannel *aNewChannel); \
  NS_SCRIPTABLE NS_IMETHOD Cancel(void); 

/* Use this macro to declare functions that forward the behavior of this interface to another object. */
#define NS_FORWARD_NSICHANNELCLASSIFIER(_to) \
  NS_SCRIPTABLE NS_IMETHOD Start(nsIChannel *aChannel) { return _to Start(aChannel); } \
  NS_SCRIPTABLE NS_IMETHOD OnRedirect(nsIChannel *aOldChannel, nsIChannel *aNewChannel) { return _to OnRedirect(aOldChannel, aNewChannel); } \
  NS_SCRIPTABLE NS_IMETHOD Cancel(void) { return _to Cancel(); } 

/* Use this macro to declare functions that forward the behavior of this interface to another object in a safe way. */
#define NS_FORWARD_SAFE_NSICHANNELCLASSIFIER(_to) \
  NS_SCRIPTABLE NS_IMETHOD Start(nsIChannel *aChannel) { return !_to ? NS_ERROR_NULL_POINTER : _to->Start(aChannel); } \
  NS_SCRIPTABLE NS_IMETHOD OnRedirect(nsIChannel *aOldChannel, nsIChannel *aNewChannel) { return !_to ? NS_ERROR_NULL_POINTER : _to->OnRedirect(aOldChannel, aNewChannel); } \
  NS_SCRIPTABLE NS_IMETHOD Cancel(void) { return !_to ? NS_ERROR_NULL_POINTER : _to->Cancel(); } 

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

/* Header file */
class nsChannelClassifier : public nsIChannelClassifier
{
public:
  NS_DECL_ISUPPORTS
  NS_DECL_NSICHANNELCLASSIFIER

  nsChannelClassifier();

private:
  ~nsChannelClassifier();

protected:
  /* additional members */
};

/* Implementation file */
NS_IMPL_ISUPPORTS1(nsChannelClassifier, nsIChannelClassifier)

nsChannelClassifier::nsChannelClassifier()
{
  /* member initializers and constructor code */
}

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

/* void start (in nsIChannel aChannel); */
NS_IMETHODIMP nsChannelClassifier::Start(nsIChannel *aChannel)
{
    return NS_ERROR_NOT_IMPLEMENTED;
}

/* void onRedirect (in nsIChannel aOldChannel, in nsIChannel aNewChannel); */
NS_IMETHODIMP nsChannelClassifier::OnRedirect(nsIChannel *aOldChannel, nsIChannel *aNewChannel)
{
    return NS_ERROR_NOT_IMPLEMENTED;
}

/* void cancel (); */
NS_IMETHODIMP nsChannelClassifier::Cancel()
{
    return NS_ERROR_NOT_IMPLEMENTED;
}

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


#endif /* __gen_nsIChannelClassifier_h__ */
