Added nsIURL argument to the nsIStreamListener interface

This commit is contained in:
rpotts%netscape.com 1998-07-15 22:38:01 +00:00
Родитель 503b4a123d
Коммит 14a8c49f35
18 изменённых файлов: 149 добавлений и 132 удалений

Просмотреть файл

@ -79,14 +79,16 @@ public:
ImageConsumer(ilIURL *aURL, ImageNetContextImpl *aContext);
NS_IMETHOD GetBindInfo(void);
NS_IMETHOD OnProgress(PRInt32 Progress, PRInt32 ProgressMax, const nsString& aMsg);
NS_IMETHOD OnStartBinding(const char *aContentType);
NS_IMETHOD OnDataAvailable(nsIInputStream *pIStream, PRInt32 length);
NS_IMETHOD OnStopBinding(PRInt32 status, const nsString& aMsg);
NS_IMETHOD GetBindInfo(nsIURL* aURL);
NS_IMETHOD OnProgress(nsIURL* aURL, PRInt32 Progress, PRInt32 ProgressMax, const nsString& aMsg);
NS_IMETHOD OnStartBinding(nsIURL* aURL, const char *aContentType);
NS_IMETHOD OnDataAvailable(nsIURL* aURL, nsIInputStream *pIStream, PRInt32 length);
NS_IMETHOD OnStopBinding(nsIURL* aURL, PRInt32 status, const nsString& aMsg);
void Interrupt();
static void KeepPumpingStream(nsITimer *aTimer, void *aClosure);
protected:
~ImageConsumer();
ilIURL *mURL;
@ -118,19 +120,19 @@ NS_DEFINE_IID(kIStreamNotificationIID, NS_ISTREAMLISTENER_IID);
NS_IMPL_ISUPPORTS(ImageConsumer,kIStreamNotificationIID);
NS_IMETHODIMP
ImageConsumer::GetBindInfo(void)
ImageConsumer::GetBindInfo(nsIURL* aURL)
{
return 0;
}
NS_IMETHODIMP
ImageConsumer::OnProgress(PRInt32 Progress, PRInt32 ProgressMax, const nsString& aMsg)
ImageConsumer::OnProgress(nsIURL* aURL, PRInt32 Progress, PRInt32 ProgressMax, const nsString& aMsg)
{
return 0;
}
NS_IMETHODIMP
ImageConsumer::OnStartBinding(const char *aContentType)
ImageConsumer::OnStartBinding(nsIURL* aURL, const char *aContentType)
{
if (mInterrupted) {
mStatus = MK_INTERRUPTED;
@ -158,7 +160,7 @@ ImageConsumer::OnStartBinding(const char *aContentType)
NS_IMETHODIMP
ImageConsumer::OnDataAvailable(nsIInputStream *pIStream, PRInt32 length)
ImageConsumer::OnDataAvailable(nsIURL* aURL, nsIInputStream *pIStream, PRInt32 length)
{
PRInt32 max_read;
PRInt32 bytes_read = 0;
@ -232,17 +234,23 @@ ImageConsumer::OnDataAvailable(nsIInputStream *pIStream, PRInt32 length)
return NS_OK;
}
static void
KeepPumpingStream(nsITimer *aTimer, void *aClosure)
void
ImageConsumer::KeepPumpingStream(nsITimer *aTimer, void *aClosure)
{
nsIURL* url = nsnull;
ImageConsumer *consumer = (ImageConsumer *)aClosure;
nsAutoString status;
consumer->OnStopBinding(NS_BINDING_SUCCEEDED, status);
if (consumer->mURL) {
consumer->mURL->QueryInterface(kIURLIID, (void**)&url);
}
consumer->OnStopBinding(url, NS_BINDING_SUCCEEDED, status);
NS_IF_RELEASE(url);
}
NS_IMETHODIMP
ImageConsumer::OnStopBinding(PRInt32 status, const nsString& aMsg)
ImageConsumer::OnStopBinding(nsIURL* aURL, PRInt32 status, const nsString& aMsg)
{
if (mTimer != nsnull) {
NS_RELEASE(mTimer);
@ -251,12 +259,12 @@ ImageConsumer::OnStopBinding(PRInt32 status, const nsString& aMsg)
// Since we're still holding on to the stream, there's still data
// that needs to be read. So, pump the stream ourselves.
if((mStream != nsnull) && (status == NS_BINDING_SUCCEEDED)) {
nsresult err = OnDataAvailable(mStream, mStream->GetLength());
nsresult err = OnDataAvailable(aURL, mStream, mStream->GetLength());
// If we still have the stream, there's still data to be
// pumped, so we set a timer to call us back again.
if (mStream != nsnull) {
if ((NS_OK != NS_NewTimer(&mTimer)) ||
(NS_OK != mTimer->Init(KeepPumpingStream, this, 0))) {
(NS_OK != mTimer->Init(ImageConsumer::KeepPumpingStream, this, 0))) {
mStatus = MK_IMAGE_LOSSAGE;
NS_RELEASE(mStream);
}

Просмотреть файл

@ -124,12 +124,12 @@ public:
NS_DECL_ISUPPORTS
NS_IMETHOD OnProgress(PRInt32 Progress, PRInt32 ProgressMax, const nsString& aMsg) { return NS_OK; }
NS_IMETHOD OnStartBinding(const char *aContentType) { return NS_OK; }
NS_IMETHOD OnStopBinding(PRInt32 status, const nsString& aMsg);
NS_IMETHOD OnProgress(nsIURL* aURL, PRInt32 Progress, PRInt32 ProgressMax, const nsString& aMsg) { return NS_OK; }
NS_IMETHOD OnStartBinding(nsIURL* aURL, const char *aContentType) { return NS_OK; }
NS_IMETHOD OnStopBinding(nsIURL* aURL, PRInt32 status, const nsString& aMsg);
};
NS_IMETHODIMP CStreamListener::OnStopBinding(PRInt32 status, const nsString& aMsg)
NS_IMETHODIMP CStreamListener::OnStopBinding(nsIURL* aURL, PRInt32 status, const nsString& aMsg)
{
fputs("done.\n",stdout);
g_bReadyForNextUrl = PR_TRUE;

Просмотреть файл

@ -655,7 +655,7 @@ PRInt32 nsParser::CollectSkippedContent(nsCParserNode& aNode,PRInt32& aCount) {
* @param
* @return
*/
nsresult nsParser::GetBindInfo(void){
nsresult nsParser::GetBindInfo(nsIURL* aURL){
nsresult result=0;
return result;
}
@ -668,12 +668,12 @@ nsresult nsParser::GetBindInfo(void){
* @return
*/
nsresult
nsParser::OnProgress(PRInt32 aProgress, PRInt32 aProgressMax,
nsParser::OnProgress(nsIURL* aURL, PRInt32 aProgress, PRInt32 aProgressMax,
const nsString& aMsg)
{
nsresult result=0;
if (nsnull != mObserver) {
mObserver->OnProgress(aProgress, aProgressMax, aMsg);
mObserver->OnProgress(aURL, aProgress, aProgressMax, aMsg);
}
return result;
}
@ -685,9 +685,9 @@ nsParser::OnProgress(PRInt32 aProgress, PRInt32 aProgressMax,
* @param
* @return
*/
nsresult nsParser::OnStartBinding(const char *aSourceType){
nsresult nsParser::OnStartBinding(nsIURL* aURL, const char *aSourceType){
if (nsnull != mObserver) {
mObserver->OnStartBinding(aSourceType);
mObserver->OnStartBinding(aURL, aSourceType);
}
mParserContext->mAutoDetectStatus=eUnknownDetect;
mParserContext->mDTD=0;
@ -703,7 +703,7 @@ nsresult nsParser::OnStartBinding(const char *aSourceType){
* @param length is the number of bytes waiting input
* @return error code (usually 0)
*/
nsresult nsParser::OnDataAvailable(nsIInputStream *pIStream, PRInt32 length){
nsresult nsParser::OnDataAvailable(nsIURL* aURL, nsIInputStream *pIStream, PRInt32 length){
/* if (nsnull != mListener) {
//Rick potts removed this.
//Does it need to be here?
@ -747,10 +747,10 @@ nsresult nsParser::OnDataAvailable(nsIInputStream *pIStream, PRInt32 length){
* @param
* @return
*/
nsresult nsParser::OnStopBinding(PRInt32 status, const nsString& aMsg){
nsresult nsParser::OnStopBinding(nsIURL* aURL, PRInt32 status, const nsString& aMsg){
nsresult result=DidBuildModel(status);
if (nsnull != mObserver) {
mObserver->OnStopBinding(status, aMsg);
mObserver->OnStopBinding(aURL, status, aMsg);
}
return result;
}

Просмотреть файл

@ -205,11 +205,11 @@ friend class CTokenHandler;
// These methods are callback methods used by
// net lib to let us know about our inputstream.
//*********************************************
NS_IMETHOD GetBindInfo(void);
NS_IMETHOD OnProgress(PRInt32 Progress, PRInt32 ProgressMax, const nsString& aMmsg);
NS_IMETHOD OnStartBinding(const char *aContentType);
NS_IMETHOD OnDataAvailable(nsIInputStream *pIStream, PRInt32 length);
NS_IMETHOD OnStopBinding(PRInt32 status, const nsString& aMsg);
NS_IMETHOD GetBindInfo(nsIURL* aURL);
NS_IMETHOD OnProgress(nsIURL* aURL, PRInt32 Progress, PRInt32 ProgressMax, const nsString& aMmsg);
NS_IMETHOD OnStartBinding(nsIURL* aURL, const char *aContentType);
NS_IMETHOD OnDataAvailable(nsIURL* aURL, nsIInputStream *pIStream, PRInt32 length);
NS_IMETHOD OnStopBinding(nsIURL* aURL, PRInt32 status, const nsString& aMsg);
protected:

Просмотреть файл

@ -66,10 +66,10 @@ public:
NS_DECL_ISUPPORTS
// nsIStreamObserver
NS_IMETHOD OnProgress(PRInt32 aProgress, PRInt32 aProgressMax,
NS_IMETHOD OnProgress(nsIURL* aURL, PRInt32 aProgress, PRInt32 aProgressMax,
const nsString& aMsg);
NS_IMETHOD OnStartBinding(const char *aContentType);
NS_IMETHOD OnStopBinding(PRInt32 status, const nsString& aMsg);
NS_IMETHOD OnStartBinding(nsIURL* aURL, const char *aContentType);
NS_IMETHOD OnStopBinding(nsIURL* aURL, PRInt32 status, const nsString& aMsg);
protected:
@ -808,7 +808,7 @@ TempObserver::QueryInterface(const nsIID& aIID,
NS_IMETHODIMP
TempObserver::OnProgress(PRInt32 aProgress, PRInt32 aProgressMax,
TempObserver::OnProgress(nsIURL* aURL, PRInt32 aProgress, PRInt32 aProgressMax,
const nsString& aMsg)
{
fputs("[progress ", stdout);
@ -820,7 +820,7 @@ TempObserver::OnProgress(PRInt32 aProgress, PRInt32 aProgressMax,
}
NS_IMETHODIMP
TempObserver::OnStartBinding(const char *aContentType)
TempObserver::OnStartBinding(nsIURL* aURL, const char *aContentType)
{
fputs("Loading ", stdout);
fputs(mURL, stdout);
@ -829,7 +829,7 @@ TempObserver::OnStartBinding(const char *aContentType)
}
NS_IMETHODIMP
TempObserver::OnStopBinding(PRInt32 status, const nsString& aMsg)
TempObserver::OnStopBinding(nsIURL* aURL, PRInt32 status, const nsString& aMsg)
{
fputs("Done loading ", stdout);
fputs(mURL, stdout);

Просмотреть файл

@ -25,6 +25,7 @@
/* forward declaration */
class nsIInputStream;
class nsString;
class nsIURL;
/* 97566110-ff60-11d1-beb9-00805f8a66dc */
@ -42,12 +43,12 @@ public:
* @return The return value is currently ignored. In the future it may be
* used to cancel the URL load..
*/
NS_IMETHOD OnStartBinding(const char *aContentType) = 0;
NS_IMETHOD OnStartBinding(nsIURL* aURL, const char *aContentType) = 0;
/**
* Notify the client that progress as occurred for the URL load.<BR>
*/
NS_IMETHOD OnProgress(PRInt32 aProgress, PRInt32 aProgressMax,
NS_IMETHOD OnProgress(nsIURL* aURL, PRInt32 aProgress, PRInt32 aProgressMax,
const nsString &aMsg) = 0;
/**
@ -61,7 +62,7 @@ public:
* @param msg A text string describing the error.
* @return The return value is currently ignored.
*/
NS_IMETHOD OnStopBinding(PRInt32 aStatus, const nsString &aMsg) = 0;
NS_IMETHOD OnStopBinding(nsIURL* aURL, PRInt32 aStatus, const nsString &aMsg) = 0;
};
/* Generic status codes for OnStopBinding */
@ -97,7 +98,7 @@ public:
*
* This method is currently not called.
*/
NS_IMETHOD GetBindInfo(void) = 0;
NS_IMETHOD GetBindInfo(nsIURL* aURL) = 0;
/**
* Notify the client that data is available in the input stream. This
@ -109,7 +110,7 @@ public:
* @param length The amount of data that was just pushed into the stream.
* @return The return value is currently ignored.
*/
NS_IMETHOD OnDataAvailable(nsIInputStream *aIStream,
NS_IMETHOD OnDataAvailable(nsIURL* aURL, nsIInputStream *aIStream,
PRInt32 aLength) = 0;
};

Просмотреть файл

@ -472,7 +472,7 @@ static void bam_exit_routine(URL_Struct *URL_s, int status, MWContext *window_id
if (pConn->pConsumer) {
nsAutoString status;
pConn->pConsumer->OnStopBinding(NS_BINDING_FAILED, status);
pConn->pConsumer->OnStopBinding(pConn->pURL, NS_BINDING_FAILED, status);
pConn->pConsumer->Release();
pConn->pConsumer = NULL;
}

Просмотреть файл

@ -63,7 +63,7 @@ PRIVATE void stub_GraphProgressInit(MWContext *context,
if ((NULL != pConn) && (NULL != pConn->pConsumer)) {
nsAutoString status;
pConn->pConsumer->OnProgress(0, content_length, status);
pConn->pConsumer->OnProgress(pConn->pURL, 0, content_length, status);
}
}
}
@ -88,7 +88,8 @@ PRIVATE void stub_GraphProgress(MWContext *context,
if ((NULL != pConn) && (NULL != pConn->pConsumer)) {
nsAutoString status;
pConn->pConsumer->OnProgress(bytes_received, content_length, status);
pConn->pConsumer->OnProgress(pConn->pURL, bytes_received,
content_length, status);
}
}
}
@ -117,7 +118,8 @@ PRIVATE void stub_GraphProgressDestroy(MWContext *context,
if ((NULL != pConn) && (NULL != pConn->pConsumer)) {
nsAutoString status;
pConn->pConsumer->OnProgress(total_bytes_read, content_length, status);
pConn->pConsumer->OnProgress(pConn->pURL, total_bytes_read,
content_length, status);
}
}
}
@ -328,7 +330,7 @@ void stub_complete(NET_StreamClass *stream)
if (pConn->pConsumer) {
nsAutoString status;
pConn->pConsumer->OnStopBinding(NS_BINDING_SUCCEEDED, status);
pConn->pConsumer->OnStopBinding(pConn->pURL, NS_BINDING_SUCCEEDED, status);
pConn->pConsumer->Release();
pConn->pConsumer = NULL;
}
@ -358,7 +360,7 @@ void stub_abort(NET_StreamClass *stream, int status)
if (pConn->pConsumer) {
nsAutoString status;
pConn->pConsumer->OnStopBinding(NS_BINDING_ABORTED, status);
pConn->pConsumer->OnStopBinding(pConn->pURL, NS_BINDING_ABORTED, status);
pConn->pConsumer->Release();
pConn->pConsumer = NULL;
}
@ -390,7 +392,7 @@ int stub_put_block(NET_StreamClass *stream, const char *buffer, int32 length)
/* XXX: check return value to abort connection if necessary */
if (pConn->pConsumer && (0 < bytesWritten)) {
pConn->pConsumer->OnDataAvailable(pConn->pNetStream, bytesWritten);
pConn->pConsumer->OnDataAvailable(pConn->pURL, pConn->pNetStream, bytesWritten);
}
return (bytesWritten == length);
@ -492,7 +494,7 @@ NET_NGLayoutConverter(FO_Present_Types format_out,
if (pConn->pConsumer) {
nsresult rv;
rv = pConn->pConsumer->OnStartBinding(URL_s->content_type);
rv = pConn->pConsumer->OnStartBinding(pConn->pURL, URL_s->content_type);
/*
* If OnStartBinding fails, then tear down the NET_StreamClass
* and release all references...

Просмотреть файл

@ -54,11 +54,11 @@ public:
TestConsumer();
NS_IMETHOD GetBindInfo(void);
NS_IMETHOD OnProgress(PRInt32 Progress, PRInt32 ProgressMax, const nsString& aMsg);
NS_IMETHOD OnStartBinding(const char *aContentType);
NS_IMETHOD OnDataAvailable(nsIInputStream *pIStream, PRInt32 length);
NS_IMETHOD OnStopBinding(PRInt32 status, const nsString& aMsg);
NS_IMETHOD GetBindInfo(nsIURL* aURL);
NS_IMETHOD OnProgress(nsIURL* aURL, PRInt32 Progress, PRInt32 ProgressMax, const nsString& aMsg);
NS_IMETHOD OnStartBinding(nsIURL* aURL, const char *aContentType);
NS_IMETHOD OnDataAvailable(nsIURL* aURL, nsIInputStream *pIStream, PRInt32 length);
NS_IMETHOD OnStopBinding(nsIURL* aURL, PRInt32 status, const nsString& aMsg);
protected:
~TestConsumer();
@ -83,17 +83,17 @@ TestConsumer::~TestConsumer()
}
NS_IMETHODIMP TestConsumer::GetBindInfo(void)
NS_IMETHODIMP TestConsumer::GetBindInfo(nsIURL* aURL)
{
if (bTraceEnabled) {
printf("\n+++ TestConsumer::GetBindInfo\n");
printf("\n+++ TestConsumer::GetBindInfo: URL: %p\n", aURL);
}
return 0;
}
NS_IMETHODIMP TestConsumer::OnProgress(PRInt32 Progress, PRInt32 ProgressMax,
const nsString& aMsg)
NS_IMETHODIMP TestConsumer::OnProgress(nsIURL* aURL, PRInt32 Progress,
PRInt32 ProgressMax, const nsString& aMsg)
{
if (bTraceEnabled) {
if (aMsg.Length()) {
@ -101,29 +101,29 @@ NS_IMETHODIMP TestConsumer::OnProgress(PRInt32 Progress, PRInt32 ProgressMax,
fputs(aMsg, stdout);
fputs("\n", stdout);
} else {
printf("\n+++ TestConsumer::OnProgress: %d of total %d\n", Progress, ProgressMax);
printf("\n+++ TestConsumer::OnProgress: URL: %p - %d of total %d\n", aURL, Progress, ProgressMax);
}
}
return 0;
}
NS_IMETHODIMP TestConsumer::OnStartBinding(const char *aContentType)
NS_IMETHODIMP TestConsumer::OnStartBinding(nsIURL* aURL, const char *aContentType)
{
if (bTraceEnabled) {
printf("\n+++ TestConsumer::OnStartBinding: Content type: %s\n", aContentType);
printf("\n+++ TestConsumer::OnStartBinding: URL: %p, Content type: %s\n", aURL, aContentType);
}
return 0;
}
NS_IMETHODIMP TestConsumer::OnDataAvailable(nsIInputStream *pIStream, PRInt32 length)
NS_IMETHODIMP TestConsumer::OnDataAvailable(nsIURL* aURL, nsIInputStream *pIStream, PRInt32 length)
{
PRInt32 len;
if (bTraceEnabled) {
printf("\n+++ TestConsumer::OnDataAvailable: %d bytes available...\n", length);
printf("\n+++ TestConsumer::OnDataAvailable: URL: %p, %d bytes available...\n", aURL, length);
}
do {
@ -141,10 +141,10 @@ NS_IMETHODIMP TestConsumer::OnDataAvailable(nsIInputStream *pIStream, PRInt32 le
}
NS_IMETHODIMP TestConsumer::OnStopBinding(PRInt32 status, const nsString& aMsg)
NS_IMETHODIMP TestConsumer::OnStopBinding(nsIURL* aURL, PRInt32 status, const nsString& aMsg)
{
if (bTraceEnabled) {
printf("\n+++ TestConsumer::OnStopBinding... status: %d\n", status);
printf("\n+++ TestConsumer::OnStopBinding... URL: %p status: %d\n", aURL, status);
}
/* The document has been loaded, so drop out of the message pump... */

Просмотреть файл

@ -124,12 +124,12 @@ public:
NS_DECL_ISUPPORTS
NS_IMETHOD OnProgress(PRInt32 Progress, PRInt32 ProgressMax, const nsString& aMsg) { return NS_OK; }
NS_IMETHOD OnStartBinding(const char *aContentType) { return NS_OK; }
NS_IMETHOD OnStopBinding(PRInt32 status, const nsString& aMsg);
NS_IMETHOD OnProgress(nsIURL* aURL, PRInt32 Progress, PRInt32 ProgressMax, const nsString& aMsg) { return NS_OK; }
NS_IMETHOD OnStartBinding(nsIURL* aURL, const char *aContentType) { return NS_OK; }
NS_IMETHOD OnStopBinding(nsIURL* aURL, PRInt32 status, const nsString& aMsg);
};
NS_IMETHODIMP CStreamListener::OnStopBinding(PRInt32 status, const nsString& aMsg)
NS_IMETHODIMP CStreamListener::OnStopBinding(nsIURL* aURL, PRInt32 status, const nsString& aMsg)
{
fputs("done.\n",stdout);
g_bReadyForNextUrl = PR_TRUE;

Просмотреть файл

@ -655,7 +655,7 @@ PRInt32 nsParser::CollectSkippedContent(nsCParserNode& aNode,PRInt32& aCount) {
* @param
* @return
*/
nsresult nsParser::GetBindInfo(void){
nsresult nsParser::GetBindInfo(nsIURL* aURL){
nsresult result=0;
return result;
}
@ -668,12 +668,12 @@ nsresult nsParser::GetBindInfo(void){
* @return
*/
nsresult
nsParser::OnProgress(PRInt32 aProgress, PRInt32 aProgressMax,
nsParser::OnProgress(nsIURL* aURL, PRInt32 aProgress, PRInt32 aProgressMax,
const nsString& aMsg)
{
nsresult result=0;
if (nsnull != mObserver) {
mObserver->OnProgress(aProgress, aProgressMax, aMsg);
mObserver->OnProgress(aURL, aProgress, aProgressMax, aMsg);
}
return result;
}
@ -685,9 +685,9 @@ nsParser::OnProgress(PRInt32 aProgress, PRInt32 aProgressMax,
* @param
* @return
*/
nsresult nsParser::OnStartBinding(const char *aSourceType){
nsresult nsParser::OnStartBinding(nsIURL* aURL, const char *aSourceType){
if (nsnull != mObserver) {
mObserver->OnStartBinding(aSourceType);
mObserver->OnStartBinding(aURL, aSourceType);
}
mParserContext->mAutoDetectStatus=eUnknownDetect;
mParserContext->mDTD=0;
@ -703,7 +703,7 @@ nsresult nsParser::OnStartBinding(const char *aSourceType){
* @param length is the number of bytes waiting input
* @return error code (usually 0)
*/
nsresult nsParser::OnDataAvailable(nsIInputStream *pIStream, PRInt32 length){
nsresult nsParser::OnDataAvailable(nsIURL* aURL, nsIInputStream *pIStream, PRInt32 length){
/* if (nsnull != mListener) {
//Rick potts removed this.
//Does it need to be here?
@ -747,10 +747,10 @@ nsresult nsParser::OnDataAvailable(nsIInputStream *pIStream, PRInt32 length){
* @param
* @return
*/
nsresult nsParser::OnStopBinding(PRInt32 status, const nsString& aMsg){
nsresult nsParser::OnStopBinding(nsIURL* aURL, PRInt32 status, const nsString& aMsg){
nsresult result=DidBuildModel(status);
if (nsnull != mObserver) {
mObserver->OnStopBinding(status, aMsg);
mObserver->OnStopBinding(aURL, status, aMsg);
}
return result;
}

Просмотреть файл

@ -205,11 +205,11 @@ friend class CTokenHandler;
// These methods are callback methods used by
// net lib to let us know about our inputstream.
//*********************************************
NS_IMETHOD GetBindInfo(void);
NS_IMETHOD OnProgress(PRInt32 Progress, PRInt32 ProgressMax, const nsString& aMmsg);
NS_IMETHOD OnStartBinding(const char *aContentType);
NS_IMETHOD OnDataAvailable(nsIInputStream *pIStream, PRInt32 length);
NS_IMETHOD OnStopBinding(PRInt32 status, const nsString& aMsg);
NS_IMETHOD GetBindInfo(nsIURL* aURL);
NS_IMETHOD OnProgress(nsIURL* aURL, PRInt32 Progress, PRInt32 ProgressMax, const nsString& aMmsg);
NS_IMETHOD OnStartBinding(nsIURL* aURL, const char *aContentType);
NS_IMETHOD OnDataAvailable(nsIURL* aURL, nsIInputStream *pIStream, PRInt32 length);
NS_IMETHOD OnStopBinding(nsIURL* aURL, PRInt32 status, const nsString& aMsg);
protected:

Просмотреть файл

@ -60,12 +60,12 @@ public:
nsresult Bind(const nsString& aURLSpec, nsIPostData* aPostData);
/* nsIStreamListener interface methods... */
NS_IMETHOD GetBindInfo(void);
NS_IMETHOD OnProgress(PRInt32 aProgress, PRInt32 aProgressMax,
NS_IMETHOD GetBindInfo(nsIURL* aURL);
NS_IMETHOD OnProgress(nsIURL* aURL, PRInt32 aProgress, PRInt32 aProgressMax,
const nsString& aMsg);
NS_IMETHOD OnStartBinding(const char *aContentType);
NS_IMETHOD OnDataAvailable(nsIInputStream *aStream, PRInt32 aLength);
NS_IMETHOD OnStopBinding(PRInt32 aStatus, const nsString& aMsg);
NS_IMETHOD OnStartBinding(nsIURL* aURL, const char *aContentType);
NS_IMETHOD OnDataAvailable(nsIURL* aURL, nsIInputStream *aStream, PRInt32 aLength);
NS_IMETHOD OnStopBinding(nsIURL* aURL, PRInt32 aStatus, const nsString& aMsg);
protected:
virtual ~nsDocumentBindInfo();
@ -365,41 +365,42 @@ nsresult nsDocumentBindInfo::Bind(const nsString& aURLSpec,
}
NS_METHOD nsDocumentBindInfo::GetBindInfo(void)
NS_METHOD nsDocumentBindInfo::GetBindInfo(nsIURL* aURL)
{
nsresult rv = NS_OK;
NS_PRECONDITION(nsnull !=m_NextStream, "DocLoader: No stream for document");
if (nsnull != m_NextStream) {
rv = m_NextStream->GetBindInfo();
rv = m_NextStream->GetBindInfo(aURL);
}
return rv;
}
NS_METHOD nsDocumentBindInfo::OnProgress(PRInt32 aProgress, PRInt32 aProgressMax,
NS_METHOD nsDocumentBindInfo::OnProgress(nsIURL* aURL, PRInt32 aProgress,
PRInt32 aProgressMax,
const nsString& aMsg)
{
nsresult rv = NS_OK;
/* Pass the notification out to the next stream listener... */
if (nsnull != m_NextStream) {
rv = m_NextStream->OnProgress(aProgress, aProgressMax, aMsg);
rv = m_NextStream->OnProgress(aURL, aProgress, aProgressMax, aMsg);
}
/* Pass the notification out to the Observer... */
if (nsnull != m_Observer) {
/* XXX: Should we ignore the return value? */
(void) m_Observer->OnProgress(aProgress, aProgressMax, aMsg);
(void) m_Observer->OnProgress(aURL, aProgress, aProgressMax, aMsg);
}
return rv;
}
NS_METHOD nsDocumentBindInfo::OnStartBinding(const char *aContentType)
NS_METHOD nsDocumentBindInfo::OnStartBinding(nsIURL* aURL, const char *aContentType)
{
nsresult rv = NS_OK;
nsIDocumentWidget* viewer = nsnull;
@ -437,13 +438,13 @@ NS_METHOD nsDocumentBindInfo::OnStartBinding(const char *aContentType)
NS_ASSERTION((nsnull != m_NextStream), "No stream was created!");
if (nsnull != m_NextStream) {
rv = m_NextStream->OnStartBinding(aContentType);
rv = m_NextStream->OnStartBinding(aURL, aContentType);
}
/* Pass the notification out to the Observer... */
if (nsnull != m_Observer) {
/* XXX: Should we ignore the return value? */
(void) m_Observer->OnStartBinding(aContentType);
(void) m_Observer->OnStartBinding(aURL, aContentType);
}
done:
@ -453,32 +454,34 @@ done:
}
NS_METHOD nsDocumentBindInfo::OnDataAvailable(nsIInputStream *aStream, PRInt32 aLength)
NS_METHOD nsDocumentBindInfo::OnDataAvailable(nsIURL* aURL,
nsIInputStream *aStream, PRInt32 aLength)
{
nsresult rv = NS_OK;
NS_PRECONDITION(nsnull !=m_NextStream, "DocLoader: No stream for document");
if (nsnull != m_NextStream) {
rv = m_NextStream->OnDataAvailable(aStream, aLength);
rv = m_NextStream->OnDataAvailable(aURL, aStream, aLength);
}
return rv;
}
NS_METHOD nsDocumentBindInfo::OnStopBinding(PRInt32 aStatus, const nsString& aMsg)
NS_METHOD nsDocumentBindInfo::OnStopBinding(nsIURL* aURL, PRInt32 aStatus,
const nsString& aMsg)
{
nsresult rv = NS_OK;
if (nsnull != m_NextStream) {
rv = m_NextStream->OnStopBinding(aStatus, aMsg);
rv = m_NextStream->OnStopBinding(aURL, aStatus, aMsg);
}
/* Pass the notification out to the Observer... */
if (nsnull != m_Observer) {
/* XXX: Should we ignore the return value? */
(void) m_Observer->OnStopBinding(aStatus, aMsg);
(void) m_Observer->OnStopBinding(aURL, aStatus, aMsg);
}
/*

Просмотреть файл

@ -60,12 +60,12 @@ public:
nsresult Bind(const nsString& aURLSpec, nsIPostData* aPostData);
/* nsIStreamListener interface methods... */
NS_IMETHOD GetBindInfo(void);
NS_IMETHOD OnProgress(PRInt32 aProgress, PRInt32 aProgressMax,
NS_IMETHOD GetBindInfo(nsIURL* aURL);
NS_IMETHOD OnProgress(nsIURL* aURL, PRInt32 aProgress, PRInt32 aProgressMax,
const nsString& aMsg);
NS_IMETHOD OnStartBinding(const char *aContentType);
NS_IMETHOD OnDataAvailable(nsIInputStream *aStream, PRInt32 aLength);
NS_IMETHOD OnStopBinding(PRInt32 aStatus, const nsString& aMsg);
NS_IMETHOD OnStartBinding(nsIURL* aURL, const char *aContentType);
NS_IMETHOD OnDataAvailable(nsIURL* aURL, nsIInputStream *aStream, PRInt32 aLength);
NS_IMETHOD OnStopBinding(nsIURL* aURL, PRInt32 aStatus, const nsString& aMsg);
protected:
virtual ~nsDocumentBindInfo();
@ -365,41 +365,42 @@ nsresult nsDocumentBindInfo::Bind(const nsString& aURLSpec,
}
NS_METHOD nsDocumentBindInfo::GetBindInfo(void)
NS_METHOD nsDocumentBindInfo::GetBindInfo(nsIURL* aURL)
{
nsresult rv = NS_OK;
NS_PRECONDITION(nsnull !=m_NextStream, "DocLoader: No stream for document");
if (nsnull != m_NextStream) {
rv = m_NextStream->GetBindInfo();
rv = m_NextStream->GetBindInfo(aURL);
}
return rv;
}
NS_METHOD nsDocumentBindInfo::OnProgress(PRInt32 aProgress, PRInt32 aProgressMax,
NS_METHOD nsDocumentBindInfo::OnProgress(nsIURL* aURL, PRInt32 aProgress,
PRInt32 aProgressMax,
const nsString& aMsg)
{
nsresult rv = NS_OK;
/* Pass the notification out to the next stream listener... */
if (nsnull != m_NextStream) {
rv = m_NextStream->OnProgress(aProgress, aProgressMax, aMsg);
rv = m_NextStream->OnProgress(aURL, aProgress, aProgressMax, aMsg);
}
/* Pass the notification out to the Observer... */
if (nsnull != m_Observer) {
/* XXX: Should we ignore the return value? */
(void) m_Observer->OnProgress(aProgress, aProgressMax, aMsg);
(void) m_Observer->OnProgress(aURL, aProgress, aProgressMax, aMsg);
}
return rv;
}
NS_METHOD nsDocumentBindInfo::OnStartBinding(const char *aContentType)
NS_METHOD nsDocumentBindInfo::OnStartBinding(nsIURL* aURL, const char *aContentType)
{
nsresult rv = NS_OK;
nsIDocumentWidget* viewer = nsnull;
@ -437,13 +438,13 @@ NS_METHOD nsDocumentBindInfo::OnStartBinding(const char *aContentType)
NS_ASSERTION((nsnull != m_NextStream), "No stream was created!");
if (nsnull != m_NextStream) {
rv = m_NextStream->OnStartBinding(aContentType);
rv = m_NextStream->OnStartBinding(aURL, aContentType);
}
/* Pass the notification out to the Observer... */
if (nsnull != m_Observer) {
/* XXX: Should we ignore the return value? */
(void) m_Observer->OnStartBinding(aContentType);
(void) m_Observer->OnStartBinding(aURL, aContentType);
}
done:
@ -453,32 +454,34 @@ done:
}
NS_METHOD nsDocumentBindInfo::OnDataAvailable(nsIInputStream *aStream, PRInt32 aLength)
NS_METHOD nsDocumentBindInfo::OnDataAvailable(nsIURL* aURL,
nsIInputStream *aStream, PRInt32 aLength)
{
nsresult rv = NS_OK;
NS_PRECONDITION(nsnull !=m_NextStream, "DocLoader: No stream for document");
if (nsnull != m_NextStream) {
rv = m_NextStream->OnDataAvailable(aStream, aLength);
rv = m_NextStream->OnDataAvailable(aURL, aStream, aLength);
}
return rv;
}
NS_METHOD nsDocumentBindInfo::OnStopBinding(PRInt32 aStatus, const nsString& aMsg)
NS_METHOD nsDocumentBindInfo::OnStopBinding(nsIURL* aURL, PRInt32 aStatus,
const nsString& aMsg)
{
nsresult rv = NS_OK;
if (nsnull != m_NextStream) {
rv = m_NextStream->OnStopBinding(aStatus, aMsg);
rv = m_NextStream->OnStopBinding(aURL, aStatus, aMsg);
}
/* Pass the notification out to the Observer... */
if (nsnull != m_Observer) {
/* XXX: Should we ignore the return value? */
(void) m_Observer->OnStopBinding(aStatus, aMsg);
(void) m_Observer->OnStopBinding(aURL, aStatus, aMsg);
}
/*

Просмотреть файл

@ -301,7 +301,7 @@ void nsDocLoader::CancelAll()
NS_IMETHODIMP
nsDocLoader::OnStartBinding(const char *aContentType)
nsDocLoader::OnStartBinding(nsIURL* aURL, const char *aContentType)
{
nsString* url = (nsString*)mURLList->ElementAt(mDocNum);
fputs(*url, stdout);
@ -310,7 +310,7 @@ nsDocLoader::OnStartBinding(const char *aContentType)
}
NS_IMETHODIMP
nsDocLoader::OnProgress(PRInt32 aProgress, PRInt32 aProgressMax,
nsDocLoader::OnProgress(nsIURL* aURL, PRInt32 aProgress, PRInt32 aProgressMax,
const nsString& aMsg)
{
nsString* url = (nsString*)mURLList->ElementAt(mDocNum);
@ -324,7 +324,7 @@ nsDocLoader::OnProgress(PRInt32 aProgress, PRInt32 aProgressMax,
}
NS_IMETHODIMP
nsDocLoader::OnStopBinding(PRInt32 status, const nsString& aMsg)
nsDocLoader::OnStopBinding(nsIURL* aURL, PRInt32 status, const nsString& aMsg)
{
nsString* url = (nsString*)mURLList->ElementAt(mDocNum);
fputs(*url, stdout);

Просмотреть файл

@ -43,10 +43,10 @@ public:
NS_DECL_ISUPPORTS
// nsIStreamObserver
NS_IMETHOD OnStartBinding(const char *aContentType);
NS_IMETHOD OnProgress(PRInt32 aProgress, PRInt32 aProgressMax,
NS_IMETHOD OnStartBinding(nsIURL* aURL, const char *aContentType);
NS_IMETHOD OnProgress(nsIURL* aURL, PRInt32 aProgress, PRInt32 aProgressMax,
const nsString& aMsg);
NS_IMETHOD OnStopBinding(PRInt32 status, const nsString& aMsg);
NS_IMETHOD OnStopBinding(nsIURL* aURL, PRInt32 status, const nsString& aMsg);
// Add a URL to the doc loader
void AddURL(char* aURL);

Просмотреть файл

@ -497,7 +497,7 @@ DocObserver::StyleSheetAdded(nsIStyleSheet* aStyleSheet)
}
NS_IMETHODIMP
DocObserver::OnProgress(PRInt32 aProgress, PRInt32 aProgressMax,
DocObserver::OnProgress(nsIURL* aURL, PRInt32 aProgress, PRInt32 aProgressMax,
const nsString& aMsg)
{
fputs(mURL, stdout);
@ -510,7 +510,7 @@ DocObserver::OnProgress(PRInt32 aProgress, PRInt32 aProgressMax,
}
NS_IMETHODIMP
DocObserver::OnStartBinding(const char *aContentType)
DocObserver::OnStartBinding(nsIURL* aURL, const char *aContentType)
{
//start the throbber...
if (nsnull != mViewer)
@ -522,7 +522,7 @@ DocObserver::OnStartBinding(const char *aContentType)
}
NS_IMETHODIMP
DocObserver::OnStopBinding(PRInt32 status, const nsString& aMsg)
DocObserver::OnStopBinding(nsIURL* aURL, PRInt32 status, const nsString& aMsg)
{
fputs(mURL, stdout);
fputs(": stop\n", stdout);

Просмотреть файл

@ -92,10 +92,10 @@ public:
NS_IMETHOD StyleSheetAdded(nsIStyleSheet* aStyleSheet);
// nsIStreamObserver
NS_IMETHOD OnStartBinding(const char *aContentType);
NS_IMETHOD OnProgress(PRInt32 aProgress, PRInt32 aProgressMax,
NS_IMETHOD OnStartBinding(nsIURL* aURL, const char *aContentType);
NS_IMETHOD OnProgress(nsIURL* aURL, PRInt32 aProgress, PRInt32 aProgressMax,
const nsString& aMsg);
NS_IMETHOD OnStopBinding(PRInt32 status, const nsString& aMsg);
NS_IMETHOD OnStopBinding(nsIURL* aURL, PRInt32 status, const nsString& aMsg);
// nsILinkHandler
NS_IMETHOD Init(nsIWebWidget* aWidget);