Added nsILoadGroup. Changed load attribute strategy to flags.

git-svn-id: svn://10.0.0.236/trunk@36753 18797224-902f-48f8-a5cc-f745e15eee43
This commit is contained in:
warren%netscape.com
1999-06-24 22:58:42 +00:00
parent b6ddc33395
commit 741b9ebc71
21 changed files with 450 additions and 106 deletions

View File

@@ -48,6 +48,7 @@ XPIDLSRCS = \
.\nsINetModRegEntry.idl \
.\nsINetModuleMgr.idl \
.\nsINetNotify.idl \
.\nsILoadGroup.idl \
$(NULL)
include <$(DEPTH)/config/rules.mak>

View File

@@ -88,10 +88,22 @@ interface nsIChannel : nsIRequest
in nsIStreamObserver observer);
/**
* Setting this attribute causes the loading process to not deliver status
* notifications to the program performing the load.
* Load attribute flags. These may be or'd together.
*
* Note that more will follow for each protocol's implementation of a channel,
* although channel writers have to be careful to not let the flag bits
* overlap. Otherwise, users won't be able to create a single flag word
* of load attributes that applies to a number of different channel types.
*/
attribute boolean LoadQuiet;
const unsigned long LOAD_NORMAL = 0; /* no special load attributes -- use defaults */
const unsigned long LOAD_QUIET = 1 << 0; /* don't deliver status notifications to the nsIProgressEventSink */
/**
* Accesses the load attributes for the channel. E.g. setting the load
* attributes with the LOAD_QUIET bit set causes the loading process to
* not deliver status notifications to the program performing the load.
*/
attribute unsigned long LoadAttributes;
/**
* Returns the content MIME type of the channel if available. Note that the

View File

@@ -28,6 +28,7 @@ interface nsIEventQueue;
interface nsIBufferInputStream;
interface nsIBufferOutputStream;
interface nsIFileChannel;
interface nsILoadGroup;
[scriptable, uuid(01f0a170-1881-11d3-9337-00104ba0fd40)]
interface nsIIOService : nsISupports
@@ -130,6 +131,14 @@ interface nsIIOService : nsISupports
* then uses it to construct a file channel from a native path string.
*/
nsIFileChannel NewChannelFromNativePath(in string nativePath);
/**
* Returns a new load group. Load groups can be used to manage collections
* of channels so that they can be reloaded or canceled en mass. Note that
* their use is not required by other parts of the system, they are primarily
* a convenience for the caller.
*/
nsILoadGroup NewLoadGroup();
};
%{C++

View File

@@ -0,0 +1,79 @@
/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 4 -*-
*
* The contents of this file are subject to the Netscape Public License
* Version 1.0 (the "NPL"); you may not use this file except in
* compliance with the NPL. You may obtain a copy of the NPL at
* http://www.mozilla.org/NPL/
*
* Software distributed under the NPL is distributed on an "AS IS" basis,
* WITHOUT WARRANTY OF ANY KIND, either express or implied. See the NPL
* for the specific language governing rights and limitations under the
* NPL.
*
* The Initial Developer of this code under the NPL is Netscape
* Communications Corporation. Portions created by Netscape are
* Copyright (C) 1998 Netscape Communications Corporation. All Rights
* Reserved.
*/
#include "nsIRequest.idl"
interface nsIChannel;
interface nsISimpleEnumerator;
[scriptable, uuid(19845248-29ab-11d3-8cce-0060b0fc14a3)]
interface nsILoadGroup : nsIRequest
{
/**
* Accesses the default load attributes for the group, returned as
* a flag word. Setting the default load attributes will cause them
* to be applied to each new channel inserted into the group.
*/
attribute unsigned long DefaultLoadAttributes;
/**
* Adds a new channel to the group. This will cause the default load
* attributes to be applied to that channel.
*/
void AddChannel(in nsIChannel channel);
/**
* Removes a channel from the group.
*/
void RemoveChannel(in nsIChannel channel);
/**
* Returns the channels contained directly in this group.
* Enumerator element type: nsIChannel.
*/
readonly attribute nsISimpleEnumerator Channels;
/**
* Adds a new sub-group to the group.
*/
void AddSubGroup(in nsILoadGroup group);
/**
* Removes a sub-group from the group.
*/
void RemoveSubGroup(in nsILoadGroup group);
/**
* Returns the sub-groups of a group.
* Enumerator element type: nsILoadGroup.
*/
readonly attribute nsISimpleEnumerator SubGroups;
};
%{C++
#define NS_LOADGROUP_CID \
{ /* e1c61582-2a84-11d3-8cce-0060b0fc14a3 */ \
0xe1c61582, \
0x2a84, \
0x11d3, \
{0x8c, 0xce, 0x00, 0x60, 0xb0, 0xfc, 0x14, 0xa3} \
} \
%}

View File

@@ -34,6 +34,7 @@ CPPSRCS = \
nsStandardUrl.cpp \
nsNetModuleMgr.cpp \
nsNetModRegEntry.cpp \
nsLoadGroup.cpp \
$(NULL)
include $(topsrcdir)/config/config.mk

View File

@@ -36,6 +36,7 @@ CPP_OBJS = \
.\$(OBJDIR)\nsStandardUrl.obj \
.\$(OBJDIR)\nsNetModuleMgr.obj \
.\$(OBJDIR)\nsNetModRegEntry.obj \
.\$(OBJDIR)\nsLoadGroup.obj \
$(NULL)
INCS = $(INCS) \

View File

@@ -30,6 +30,7 @@
#include "prmem.h" // for PR_Malloc
#include <ctype.h> // for isalpha
#include "nsIFileProtocolHandler.h" // for NewChannelFromNativePath
#include "nsLoadGroup.h"
static NS_DEFINE_CID(kFileTransportService, NS_FILETRANSPORTSERVICE_CID);
static NS_DEFINE_CID(kEventQueueService, NS_EVENTQUEUESERVICE_CID);
@@ -324,36 +325,13 @@ nsIOService::NewChannelFromNativePath(const char *nativePath, nsIFileChannel **r
return NS_OK;
}
////////////////////////////////////////////////////////////////////////////////
// HELPER ROUTINES
////////////////////////////////////////////////////////////////////////////////
#if 0
static NS_DEFINE_IID(kNetServiceCID, NS_NETSERVICE_CID);
static NS_DEFINE_IID(kINetServiceIID, NS_INETSERVICE_IID);
nsresult NS_NewURI(nsIURI** aInstancePtrResult,
const char *aSpec,
nsIURI* aBaseURI)
NS_IMETHODIMP
nsIOService::NewLoadGroup(nsILoadGroup **result)
{
NS_PRECONDITION(nsnull != aInstancePtrResult, "null ptr");
if (nsnull == aInstancePtrResult) {
return NS_ERROR_NULL_POINTER;
}
nsINetService *inet = nsnull;
nsresult rv = nsServiceManager::GetService(kNetServiceCID,
kINetServiceIID,
(nsISupports **)&inet);
if (NS_FAILED(rv)) return rv;
rv = inet->NewURI(aSpec, aInstancePtrResult, aBaseURI);
if (NS_FAILED(rv)) return rv;
nsServiceManager::ReleaseService(kNetServiceCID, inet);
return rv;
return nsLoadGroup::Create(nsnull, nsILoadGroup::GetIID(),
(void**)result);
}
#endif
////////////////////////////////////////////////////////////////////////////////

View File

@@ -52,6 +52,7 @@ public:
NS_IMETHOD NewAsyncStreamListener(nsIStreamListener *receiver, nsIEventQueue *eventQueue, nsIStreamListener **_retval);
NS_IMETHOD NewSyncStreamListener(nsIBufferInputStream **inStream, nsIBufferOutputStream **outStream, nsIStreamListener **_retval);
NS_IMETHOD NewChannelFromNativePath(const char *nativePath, nsIFileChannel **_retval);
NS_IMETHOD NewLoadGroup(nsILoadGroup **result);
// nsIOService methods:
nsIOService();

View File

@@ -0,0 +1,197 @@
/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 4 -*-
*
* The contents of this file are subject to the Netscape Public License
* Version 1.0 (the "NPL"); you may not use this file except in
* compliance with the NPL. You may obtain a copy of the NPL at
* http://www.mozilla.org/NPL/
*
* Software distributed under the NPL is distributed on an "AS IS" basis,
* WITHOUT WARRANTY OF ANY KIND, either express or implied. See the NPL
* for the specific language governing rights and limitations under the
* NPL.
*
* The Initial Developer of this code under the NPL is Netscape
* Communications Corporation. Portions created by Netscape are
* Copyright (C) 1998 Netscape Communications Corporation. All Rights
* Reserved.
*/
#include "nsLoadGroup.h"
#include "nsIIOService.h"
#include "nsIChannel.h"
#include "nsIServiceManager.h"
#include "nsISupportsArray.h"
#include "nsEnumeratorUtils.h"
static NS_DEFINE_CID(kIOServiceCID, NS_IOSERVICE_CID);
////////////////////////////////////////////////////////////////////////////////
nsLoadGroup::nsLoadGroup(nsISupports* outer)
: mChannels(nsnull), mSubGroups(nsnull),
mDefaultLoadAttributes(nsIChannel::LOAD_NORMAL)
{
NS_INIT_AGGREGATED(outer);
}
nsLoadGroup::~nsLoadGroup()
{
NS_IF_RELEASE(mChannels);
NS_IF_RELEASE(mSubGroups);
}
NS_METHOD
nsLoadGroup::Create(nsISupports *aOuter, REFNSIID aIID, void **aResult)
{
nsLoadGroup* group = new nsLoadGroup(aOuter);
if (group == nsnull)
return NS_ERROR_OUT_OF_MEMORY;
NS_ADDREF(group);
nsresult rv = group->QueryInterface(aIID, aResult);
NS_RELEASE(group);
return rv;
}
NS_IMPL_AGGREGATED(nsLoadGroup);
NS_IMETHODIMP
nsLoadGroup::AggregatedQueryInterface(const nsIID& aIID, void** aInstancePtr)
{
NS_ASSERTION(aInstancePtr, "no instance pointer");
if (aIID.Equals(nsILoadGroup::GetIID()) ||
aIID.Equals(nsIRequest::GetIID()) ||
aIID.Equals(nsISupports::GetIID())) {
*aInstancePtr = NS_STATIC_CAST(nsILoadGroup*, this);
NS_ADDREF_THIS();
return NS_OK;
}
return NS_NOINTERFACE;
}
////////////////////////////////////////////////////////////////////////////////
// nsIRequest methods:
nsresult
nsLoadGroup::Iterate(IterateFun fun)
{
nsresult rv;
PRUint32 i;
PRUint32 count;
rv = mChannels->Count(&count);
if (NS_FAILED(rv)) return rv;
for (i = 0; i < count; i++) {
nsIRequest* req = NS_STATIC_CAST(nsIRequest*, mChannels->ElementAt(i));
if (req == nsnull)
return NS_ERROR_FAILURE;
rv = fun(req);
NS_RELEASE(req);
if (NS_FAILED(rv)) return rv;
}
rv = mSubGroups->Count(&count);
if (NS_FAILED(rv)) return rv;
for (i = 0; i < count; i++) {
nsIRequest* req = NS_STATIC_CAST(nsIRequest*, mSubGroups->ElementAt(i));
if (req == nsnull)
return NS_ERROR_FAILURE;
rv = fun(req);
NS_RELEASE(req);
if (NS_FAILED(rv)) return rv;
}
return NS_OK;
}
static nsresult
CancelFun(nsIRequest* req)
{
return req->Cancel();
}
NS_IMETHODIMP
nsLoadGroup::Cancel()
{
return Iterate(CancelFun);
}
static nsresult
SuspendFun(nsIRequest* req)
{
return req->Suspend();
}
NS_IMETHODIMP
nsLoadGroup::Suspend()
{
return Iterate(SuspendFun);
}
static nsresult
ResumeFun(nsIRequest* req)
{
return req->Resume();
}
NS_IMETHODIMP
nsLoadGroup::Resume()
{
return Iterate(ResumeFun);
}
////////////////////////////////////////////////////////////////////////////////
// nsILoadGroup methods:
NS_IMETHODIMP
nsLoadGroup::GetDefaultLoadAttributes(PRUint32 *aDefaultLoadAttributes)
{
*aDefaultLoadAttributes = mDefaultLoadAttributes;
return NS_OK;
}
NS_IMETHODIMP
nsLoadGroup::SetDefaultLoadAttributes(PRUint32 aDefaultLoadAttributes)
{
mDefaultLoadAttributes = aDefaultLoadAttributes;
return NS_OK;
}
NS_IMETHODIMP
nsLoadGroup::AddChannel(nsIChannel *channel)
{
nsresult rv = mChannels->AppendElement(channel);
if (NS_FAILED(rv)) return rv;
rv = channel->SetLoadAttributes(mDefaultLoadAttributes);
return NS_OK;
}
NS_IMETHODIMP
nsLoadGroup::RemoveChannel(nsIChannel *channel)
{
return mChannels->RemoveElement(channel);
}
NS_IMETHODIMP
nsLoadGroup::GetChannels(nsISimpleEnumerator * *aChannels)
{
return NS_NewArrayEnumerator(aChannels, mChannels);
}
NS_IMETHODIMP
nsLoadGroup::AddSubGroup(nsILoadGroup *group)
{
return mSubGroups->AppendElement(group);
}
NS_IMETHODIMP
nsLoadGroup::RemoveSubGroup(nsILoadGroup *group)
{
return mSubGroups->RemoveElement(group);
}
NS_IMETHODIMP
nsLoadGroup::GetSubGroups(nsISimpleEnumerator * *aSubGroups)
{
return NS_NewArrayEnumerator(aSubGroups, mSubGroups);
}
////////////////////////////////////////////////////////////////////////////////

View File

@@ -0,0 +1,88 @@
/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 4 -*-
*
* The contents of this file are subject to the Netscape Public License
* Version 1.0 (the "NPL"); you may not use this file except in
* compliance with the NPL. You may obtain a copy of the NPL at
* http://www.mozilla.org/NPL/
*
* Software distributed under the NPL is distributed on an "AS IS" basis,
* WITHOUT WARRANTY OF ANY KIND, either express or implied. See the NPL
* for the specific language governing rights and limitations under the
* NPL.
*
* The Initial Developer of this code under the NPL is Netscape
* Communications Corporation. Portions created by Netscape are
* Copyright (C) 1998 Netscape Communications Corporation. All Rights
* Reserved.
*/
#ifndef nsLoadGroup_h__
#define nsLoadGroup_h__
#include "nsILoadGroup.h"
#include "nsAgg.h"
class nsISupportsArray;
class nsLoadGroup : public nsILoadGroup
{
public:
NS_DECL_AGGREGATED
////////////////////////////////////////////////////////////////////////////
// nsIRequest methods:
/* void Cancel (); */
NS_IMETHOD Cancel();
/* void Suspend (); */
NS_IMETHOD Suspend();
/* void Resume (); */
NS_IMETHOD Resume();
////////////////////////////////////////////////////////////////////////////
// nsILoadGroup methods:
/* attribute unsigned long DefaultLoadAttributes; */
NS_IMETHOD GetDefaultLoadAttributes(PRUint32 *aDefaultLoadAttributes);
NS_IMETHOD SetDefaultLoadAttributes(PRUint32 aDefaultLoadAttributes);
/* void AddChannel (in nsIChannel channel); */
NS_IMETHOD AddChannel(nsIChannel *channel);
/* void RemoveChannel (in nsIChannel channel); */
NS_IMETHOD RemoveChannel(nsIChannel *channel);
/* readonly attribute nsISimpleEnumerator Channels; */
NS_IMETHOD GetChannels(nsISimpleEnumerator * *aChannels);
/* void AddSubGroup (in nsILoadGroup group); */
NS_IMETHOD AddSubGroup(nsILoadGroup *group);
/* void RemoveSubGroup (in nsILoadGroup group); */
NS_IMETHOD RemoveSubGroup(nsILoadGroup *group);
/* readonly attribute nsISimpleEnumerator SubGroups; */
NS_IMETHOD GetSubGroups(nsISimpleEnumerator * *aSubGroups);
////////////////////////////////////////////////////////////////////////////
// nsLoadGroup methods:
nsLoadGroup(nsISupports* outer);
virtual ~nsLoadGroup();
static NS_METHOD
Create(nsISupports *aOuter, REFNSIID aIID, void **aResult);
protected:
typedef nsresult (*IterateFun)(nsIRequest* request);
nsresult Iterate(IterateFun fun);
protected:
PRUint32 mDefaultLoadAttributes;
nsISupportsArray* mChannels;
nsISupportsArray* mSubGroups;
};
#endif // nsLoadGroup_h__

View File

@@ -147,6 +147,7 @@ nsSocketTransport::nsSocketTransport()
mWriteCount = 0;
mSourceOffset = 0;
mService = nsnull;
mLoadAttributes = LOAD_NORMAL;
//
// Set up Internet defaults...
@@ -1241,16 +1242,16 @@ nsSocketTransport::OpenOutputStream(PRUint32 startPosition, nsIOutputStream* *re
}
NS_IMETHODIMP
nsSocketTransport::GetLoadQuiet(PRBool *aLoadQuiet)
nsSocketTransport::GetLoadAttributes(PRUint32 *aLoadAttributes)
{
*aLoadQuiet = mLoadQuiet;
*aLoadAttributes = mLoadAttributes;
return NS_OK;
}
NS_IMETHODIMP
nsSocketTransport::SetLoadQuiet(PRBool aLoadQuiet)
nsSocketTransport::SetLoadAttributes(PRUint32 aLoadAttributes)
{
mLoadQuiet = aLoadQuiet;
mLoadAttributes = aLoadAttributes;
return NS_OK;
}

View File

@@ -91,8 +91,8 @@ public:
nsISupports *ctxt,
nsIEventQueue *eventQueue,
nsIStreamObserver *observer);
NS_IMETHOD GetLoadQuiet(PRBool *aLoadQuiet);
NS_IMETHOD SetLoadQuiet(PRBool aLoadQuiet);
NS_IMETHOD GetLoadAttributes(PRUint32 *aLoadAttributes);
NS_IMETHOD SetLoadAttributes(PRUint32 aLoadAttributes);
NS_IMETHOD GetContentType(char * *aContentType);
// nsIBufferObserver methods:
@@ -153,7 +153,7 @@ protected:
PRUint32 mSourceOffset;
nsSocketTransportService* mService;
PRBool mLoadQuiet;
PRUint32 mLoadAttributes;
};

View File

@@ -22,13 +22,12 @@
#include "nsIURL.h"
#include "nsAgg.h"
// XXX regenerate:
#define NS_THIS_STANDARDURL_IMPLEMENTATION_CID \
{ /* 905ed480-f11f-11d2-9322-000000000000 */ \
0x905ed480, \
0xf11f, \
0x11d2, \
{0x93, 0x22, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00} \
{ /* e3939dc8-29ab-11d3-8cce-0060b0fc14a3 */ \
0xe3939dc8, \
0x29ab, \
0x11d3, \
{0x8c, 0xce, 0x00, 0x60, 0xb0, 0xfc, 0x14, 0xa3} \
}
class nsStandardURL : public nsIURI

View File

@@ -26,6 +26,7 @@
#include "nscore.h"
#include "nsStandardUrl.h"
#include "nsDnsService.h"
#include "nsLoadGroup.h"
static NS_DEFINE_CID(kComponentManagerCID, NS_COMPONENTMANAGER_CID);
static NS_DEFINE_CID(kIOServiceCID, NS_IOSERVICE_CID);
@@ -34,6 +35,7 @@ static NS_DEFINE_CID(kStandardURLCID, NS_STANDARDURL_CID);
static NS_DEFINE_CID(kSocketTransportServiceCID, NS_SOCKETTRANSPORTSERVICE_CID);
static NS_DEFINE_CID(kExternalModuleManagerCID, NS_NETMODULEMGR_CID);
static NS_DEFINE_CID(kDNSServiceCID, NS_DNSSERVICE_CID);
static NS_DEFINE_CID(kLoadGroupCID, NS_LOADGROUP_CID);
////////////////////////////////////////////////////////////////////////////////
@@ -72,6 +74,9 @@ NSGetFactory(nsISupports* aServMgr,
else if (aClass.Equals(kDNSServiceCID)) {
rv = NS_NewGenericFactory(&fact, nsDNSService::Create);
}
else if (aClass.Equals(kLoadGroupCID)) {
rv = NS_NewGenericFactory(&fact, nsLoadGroup::Create);
}
else {
rv = NS_ERROR_FAILURE;
}

View File

@@ -45,7 +45,8 @@ nsFileChannel::nsFileChannel()
mContext(nsnull), mState(QUIESCENT),
mSuspended(PR_FALSE), mFileStream(nsnull),
mBufferInputStream(nsnull), mBufferOutputStream(nsnull),
mStatus(NS_OK), mHandler(nsnull), mSourceOffset(0)
mStatus(NS_OK), mHandler(nsnull), mSourceOffset(0),
mLoadAttributes(LOAD_NORMAL)
{
NS_INIT_REFCNT();
}
@@ -418,16 +419,16 @@ nsFileChannel::AsyncWrite(nsIInputStream *fromStream,
}
NS_IMETHODIMP
nsFileChannel::GetLoadQuiet(PRBool *aLoadQuiet)
nsFileChannel::GetLoadAttributes(PRUint32 *aLoadAttributes)
{
*aLoadQuiet = mLoadQuiet;
*aLoadAttributes = mLoadAttributes;
return NS_OK;
}
NS_IMETHODIMP
nsFileChannel::SetLoadQuiet(PRBool aLoadQuiet)
nsFileChannel::SetLoadAttributes(PRUint32 aLoadAttributes)
{
mLoadQuiet = aLoadQuiet;
mLoadAttributes = aLoadAttributes;
return NS_OK;
}

View File

@@ -68,8 +68,8 @@ public:
NS_IMETHOD AsyncWrite(nsIInputStream *fromStream, PRUint32 startPosition, PRInt32 writeCount, nsISupports *ctxt, nsIEventQueue *eventQueue, nsIStreamObserver *observer);
/* attribute boolean LoadQuiet; */
NS_IMETHOD GetLoadQuiet(PRBool *aLoadQuiet);
NS_IMETHOD SetLoadQuiet(PRBool aLoadQuiet);
NS_IMETHOD GetLoadAttributes(PRUint32 *aLoadAttributes);
NS_IMETHOD SetLoadAttributes(PRUint32 aLoadAttributes);
/* readonly attribute string ContentType; */
NS_IMETHOD GetContentType(char * *aContentType);
@@ -181,7 +181,7 @@ protected:
PRInt32 mAmount;
PRLock* mLock;
PRBool mLoadQuiet;
PRUint32 mLoadAttributes;
};
#define NS_FILE_TRANSPORT_SEGMENT_SIZE (4*1024)

View File

@@ -41,7 +41,9 @@ static NS_DEFINE_CID(kEventQueueService, NS_EVENTQUEUESERVICE_CID);
// Client initiation is the most command case and is attempted first.
nsFTPChannel::nsFTPChannel()
: mUrl(nsnull), mConnected(PR_FALSE), mListener(nsnull) {
: mUrl(nsnull), mConnected(PR_FALSE), mListener(nsnull),
mLoadAttributes(LOAD_NORMAL)
{
nsresult rv;
@@ -187,16 +189,16 @@ nsFTPChannel::AsyncWrite(nsIInputStream *fromStream,
}
NS_IMETHODIMP
nsFTPChannel::GetLoadQuiet(PRBool *aLoadQuiet)
nsFTPChannel::GetLoadAttributes(PRUint32 *aLoadAttributes)
{
*aLoadQuiet = mLoadQuiet;
*aLoadAttributes = mLoadAttributes;
return NS_OK;
}
NS_IMETHODIMP
nsFTPChannel::SetLoadQuiet(PRBool aLoadQuiet)
nsFTPChannel::SetLoadAttributes(PRUint32 aLoadAttributes)
{
mLoadQuiet = aLoadQuiet;
mLoadAttributes = aLoadAttributes;
return NS_OK;
}

View File

@@ -55,8 +55,8 @@ public:
nsISupports *ctxt,
nsIEventQueue *eventQueue,
nsIStreamObserver *observer);
NS_IMETHOD GetLoadQuiet(PRBool *aLoadQuiet);
NS_IMETHOD SetLoadQuiet(PRBool aLoadQuiet);
NS_IMETHOD GetLoadAttributes(PRUint32 *aLoadAttributes);
NS_IMETHOD SetLoadAttributes(PRUint32 aLoadAttributes);
NS_IMETHOD GetContentType(char * *aContentType);
// nsIFTPChannel methods:
@@ -98,7 +98,7 @@ protected:
PRBool mConnected;
nsIStreamListener* mListener;
PRBool mLoadQuiet;
PRUint32 mLoadAttributes;
};
#endif /* nsFTPChannel_h___ */

View File

@@ -24,6 +24,12 @@ interface nsIStreamListener;
[scriptable, uuid(35c00430-1938-11d3-933a-000064657374)]
interface nsIHTTPChannel : nsIChannel
{
/**
* More load attributes for http.
*/
const unsigned long BYPASS_CACHE = 1 << 1;
const unsigned long BYPASS_PROXY = 1 << 2;
/*
Request functions-
These functions set/get parameters on the outbound request and may only
@@ -49,10 +55,6 @@ interface nsIHTTPChannel : nsIChannel
readonly attribute nsIHTTPEventSink EventSink;
readonly attribute nsIStreamListener ResponseDataListener;
attribute boolean BypassCache;
attribute boolean BypassProxy;
};

View File

@@ -52,7 +52,8 @@ nsHTTPChannel::nsHTTPChannel(nsIURI* i_URL,
m_pEventSink(dont_QueryInterface(i_HTTPEventSink)),
m_pResponse(nsnull),
m_pEventQ(dont_QueryInterface(i_EQ)),
m_pResponseDataListener(nsnull)
m_pResponseDataListener(nsnull),
mLoadAttributes(LOAD_NORMAL)
{
NS_INIT_REFCNT();
}
@@ -216,16 +217,16 @@ nsHTTPChannel::AsyncWrite(nsIInputStream *fromStream,
}
NS_IMETHODIMP
nsHTTPChannel::GetLoadQuiet(PRBool *aLoadQuiet)
nsHTTPChannel::GetLoadAttributes(PRUint32 *aLoadAttributes)
{
*aLoadQuiet = mLoadQuiet;
*aLoadAttributes = mLoadAttributes;
return NS_OK;
}
NS_IMETHODIMP
nsHTTPChannel::SetLoadQuiet(PRBool aLoadQuiet)
nsHTTPChannel::SetLoadAttributes(PRUint32 aLoadAttributes)
{
mLoadQuiet = aLoadQuiet;
mLoadAttributes = aLoadAttributes;
return NS_OK;
}
@@ -329,34 +330,6 @@ nsHTTPChannel::GetResponseDataListener(nsIStreamListener* *aListener)
return rv;
}
NS_IMETHODIMP
nsHTTPChannel::GetBypassCache(PRBool *aBypassCache)
{
*aBypassCache = mBypassCache;
return NS_OK;
}
NS_IMETHODIMP
nsHTTPChannel::SetBypassCache(PRBool aBypassCache)
{
mBypassCache = aBypassCache;
return NS_OK;
}
NS_IMETHODIMP
nsHTTPChannel::GetBypassProxy(PRBool *aBypassProxy)
{
*aBypassProxy = mBypassProxy;
return NS_OK;
}
NS_IMETHODIMP
nsHTTPChannel::SetBypassProxy(PRBool aBypassProxy)
{
mBypassProxy = aBypassProxy;
return NS_OK;
}
static NS_DEFINE_IID(kProxyObjectManagerIID, NS_IPROXYEVENT_MANAGER_IID);
static NS_DEFINE_CID(kEventQueueService, NS_EVENTQUEUESERVICE_CID);
static NS_DEFINE_CID(kNetModuleMgrCID, NS_NETMODULEMGR_CID);

View File

@@ -74,8 +74,8 @@ public:
nsISupports *ctxt,
nsIEventQueue *eventQueue,
nsIStreamObserver *observer);
NS_IMETHOD GetLoadQuiet(PRBool *aLoadQuiet);
NS_IMETHOD SetLoadQuiet(PRBool aLoadQuiet);
NS_IMETHOD GetLoadAttributes(PRUint32 *aLoadAttributes);
NS_IMETHOD SetLoadAttributes(PRUint32 aLoadAttributes);
NS_IMETHOD GetContentType(char * *aContentType);
NS_IMETHOD Open();
@@ -88,10 +88,6 @@ public:
NS_IMETHOD GetResponseString(char * *aResponseString);
NS_IMETHOD GetEventSink(nsIHTTPEventSink* *eventSink);
NS_IMETHOD GetResponseDataListener(nsIStreamListener* *aListener);
NS_IMETHOD GetBypassCache(PRBool *aBypassCache);
NS_IMETHOD SetBypassCache(PRBool aBypassCache);
NS_IMETHOD GetBypassProxy(PRBool *aBypassProxy);
NS_IMETHOD SetBypassProxy(PRBool aBypassProxy);
// nsHTTPChannel methods:
nsresult Init();
@@ -108,9 +104,7 @@ protected:
nsHTTPRequest* m_pRequest;
nsHTTPResponse* m_pResponse;
nsIStreamListener* m_pResponseDataListener;
PRBool mLoadQuiet;
PRBool mBypassCache;
PRBool mBypassProxy;
PRUint32 mLoadAttributes;
};
#endif /* _nsHTTPChannel_h_ */