Stubs for the OutBox Manager

This commit is contained in:
eyork%netscape.com 1998-11-10 02:27:51 +00:00
parent a70be7844d
commit cb0615db0b
11 changed files with 345 additions and 26 deletions

View File

@ -102,6 +102,11 @@
{ 0x10ed1f50, 0x5caf, 0x11d2, \
{0x80, 0xa1, 0x00, 0x60, 0x08, 0x32, 0xd6, 0x88} }
// 3e12c390-7439-11d2-80a8-00600832d688
#define NS_XPFCOUTBOX_MANAGER_CID \
{ 0x3e12c390, 0x7439, 0x11d2, \
{0x80, 0xa8, 0x00, 0x60, 0x08, 0x32, 0xd6, 0x88} }
// 6c4e09a0-2f54-11d2-bede-00805f8a8dbd
#define NS_XPFCMENUCONTAINER_CID \
{ 0x6c4e09a0, 0x2f54, 0x11d2, \

View File

@ -85,6 +85,7 @@ static NS_DEFINE_IID(kCXPFCContentSink, NS_XPFCXMLCONTENTSINK_IID);
static NS_DEFINE_IID(kCXPFCToolbar, NS_XPFC_TOOLBAR_CID);
static NS_DEFINE_IID(kCXPFCToolbarManager, NS_XPFCTOOLBAR_MANAGER_CID);
static NS_DEFINE_IID(kCXPFCDataCollectionManager, NS_XPFCDATACOLLECTION_MANAGER_CID);
static NS_DEFINE_IID(kCXPFCOutBoxManager, NS_XPFCOUTBOX_MANAGER_CID);
static NS_DEFINE_IID(kCXPFCDialog, NS_XPFC_DIALOG_CID);
static NS_DEFINE_IID(kCXPFCButton, NS_XPFC_BUTTON_CID);
static NS_DEFINE_IID(kCXPButton, NS_XP_BUTTON_CID);

View File

@ -14,6 +14,7 @@ EXPORTS = \
nsApplicationManager.h \
nsStreamManager.h \
nsStreamObject.h \
nsXPFCOutBoxManager.h \
nsXPFCDataCollectionManager.h \
$(NULL)

View File

@ -30,6 +30,7 @@ class nsIStreamManager;
class nsIXPFCToolbarManager;
class nsIDeviceContext;
class nsIXPFCDataCollectionManager;
class nsIXPFCOutBoxManager;
// platform independent native handle to application instance
typedef void * nsNativeApplicationInstance ;
@ -141,7 +142,9 @@ public:
NS_IMETHOD_(nsIXPFCToolbarManager *) GetToolbarManager();
NS_IMETHOD_(nsIXPFCDataCollectionManager *) GetDataCollectionManager();
NS_IMETHOD_(nsIXPFCOutBoxManager *) GetOutBoxManager();
NS_IMETHOD_(EVENT_CALLBACK) GetShellEventCallback() ;
NS_IMETHOD LaunchApplication(nsString& aApplication,nsString& aArgument) ;
@ -150,14 +153,15 @@ public:
private:
nsNativeApplicationInstance mNativeInstance ;
nsIApplicationShell * mApplicationShell ;
nsIWidget * mApplicationWindow ;
nsIPref * mPref;
nsIStreamManager * mStreamManager;
nsIXPFCToolbarManager * mToolbarManager;
nsNativeApplicationInstance mNativeInstance ;
nsIApplicationShell * mApplicationShell ;
nsIWidget * mApplicationWindow ;
nsIPref * mPref;
nsIStreamManager * mStreamManager;
nsIXPFCToolbarManager * mToolbarManager;
nsIXPFCDataCollectionManager* mDataCollectionManager;
nsIDeviceContext * mDeviceContext;
nsIXPFCOutBoxManager* mOutBoxManager;
nsIDeviceContext * mDeviceContext;
public:
PLOptState * mOptState;

View File

@ -0,0 +1,84 @@
/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*-
*
* 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 nsXPFCOutBoxManager_h___
#define nsXPFCOutBoxManager_h___
#include "nsIXPFCOutBoxManager.h"
#include "nsArray.h"
class nsXPFCOutBoxItem
{
public:
nsXPFCOutBoxItem();
~nsXPFCOutBoxItem();
NS_IMETHOD GetMimeType(nsString& aMimeType);
NS_IMETHOD GetOffset(PRInt32* aOffset);
NS_IMETHOD GetData(char* aTheData);
NS_IMETHOD DeleteMe();
NS_IMETHOD ReWriteMe();
private:
nsString m_mimeType;
PRInt32 m_offset;
char* m_theData;
};
class nsXPFCOutBoxItemHandler : public nsIXPFCOutBoxItemHandler
{
public:
nsXPFCOutBoxItemHandler();
NS_IMETHOD GetMimeType(nsString& mimeType);
NS_IMETHOD HandleItem(nsIApplicationShell* HostShell, nsIXPFCOutBoxItem* AnOutBoxitem);
private:
nsString m_mimeType;
NS_IMETHOD SetMimeType(nsString& mimeType);
protected:
~nsXPFCOutBoxItemHandler();
};
class nsXPFCOutBoxManager : public nsIXPFCOutBoxManager
{
public:
nsXPFCOutBoxManager();
NS_DECL_ISUPPORTS
NS_IMETHOD Init();
NS_IMETHOD AddItem(nsString& mimeType, nsIInputStream& inStream) ;
NS_IMETHOD FindItem(nsString& mimeType, nsIOutputStream* outSteam);
NS_IMETHOD ItemsCount(PRInt32 *OutBoxItems);
NS_IMETHOD ItemsCount(nsString& mimeType, PRInt32 *OutBoxItems);
NS_IMETHOD ItemsSize(PRInt32 *OutBoxItemsSize);
NS_IMETHOD AddHandler(nsIXPFCOutBoxItemHandler*& AnOutBoxHandler, nsIXPFCOutBoxItemHandlerCallback*& host);
NS_IMETHOD SendItems();
private:
nsVoidArray m_theDataSource; // Array of nsXPFCOutBoxItem
nsVoidArray m_theHandlers; // Array of nsXPFCOutBoxItemHandler
protected:
~nsXPFCOutBoxManager();
};
#endif

View File

@ -16,6 +16,7 @@ EXPORTS = \
nsIWebViewerContainer.h\
nsIStreamManager.h \
nsIStreamObject.h \
nsIXPFCOutBoxManager.h \
nsIXPFCDataCollectionManager.h \
$(NULL)

View File

@ -26,6 +26,7 @@
class nsIXPFCDataCollection;
class nsIApplicationShell;
class nsIShellInstance;
//a2e85d80-5ca8-11d2-80a1-00600832d688
#define NS_IXPFCDATACOLLECTION_MANAGER_IID \
@ -43,8 +44,6 @@ typedef struct CollectedData
nsString Value;
} *CollectedDataPtr;
class nsIShellInstance;
class nsICollectedData : public nsISupports
{
public:
@ -62,11 +61,8 @@ class nsIXPFCDataCollectionManager : public nsISupports
public:
NS_IMETHOD Init() = 0 ;
// NS_IMETHOD AddDataCollection(nsString& DataHandlerName, DataCollectionHandlerFunc *aDataCollectionHandler) = 0;
NS_IMETHOD AddDataCollection(nsString& DataHandlerName, nsIApplicationShell *aHostShell) = 0;
NS_IMETHOD CallDataHandler(nsString& DataHandlerName, nsICollectedData* TheCollectedData) = 0;
};
#endif /* nsIXPFCToolbarManager_h___ */

View File

@ -0,0 +1,135 @@
/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*-
*
* 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 nsIXPFCOutBoxManager_h___
#define nsIXPFCOutBoxManager_h___
#include "nsISupports.h"
#include "nsIXPFCCommandReceiver.h"
#include "nsIInputStream.h"
#include "nsIOutputStream.h"
#include "nsIApplicationShell.h"
#include "nsIMIMEMessage.h"
#include "nsIIterator.h"
#include "nsString.h"
//a8d3fc10-7420-11d2-80a5-00600832d688
#define NS_IXPFCOUTBOX_MANAGER_IID \
{ 0xa8d3fc10, 0x7420, 0x11d2, \
{ 0x80, 0xa5, 0x00, 0x60, 0x08, 0x32, 0xd6, 0x88 } }
//dec1f3a0-74ee-11d2-80ab-00600832d688
#define NS_IXPFCOUTBOX_ITEMHANDLER_IID \
{ 0xdec1f3a0, 0x74ee, 0x11d2, \
{ 0x80, 0xab, 0x00, 0x60, 0x08, 0x32, 0xd6, 0x88 } }
//e8a78080-74ee-11d2-80ab-00600832d688
#define NS_IXPFCOUTBOX_ITEMHANDLER_CALLBACK_IID \
{ 0xe8a78080, 0x74ee, 0x11d2, \
{ 0x80, 0xab, 0x00, 0x60, 0x08, 0x32, 0xd6, 0x88 } }
/*
** Class nsXPFCOutBoxItem is used by
*/
class nsIXPFCOutBoxItem : public nsISupports
{
public:
NS_IMETHOD GetMimeType(nsString& aMimeType) = 0;
NS_IMETHOD GetOffset(PRInt32* aOffset) = 0;
NS_IMETHOD GetData(char* aTheData) = 0;
NS_IMETHOD DeleteMe() = 0;
NS_IMETHOD ReWriteMe() = 0;
};
class nsIXPFCOutBoxItemHandler : public nsISupports
{
public:
NS_IMETHOD GetMimeType(nsString& aMimeType) = 0;
NS_IMETHOD HandleItem(nsIApplicationShell*& aHostShell, nsIXPFCOutBoxItem*& aOutBoxItem) = 0;
};
class nsIXPFCOutBoxItemHandlerCallback : public nsISupports
{
public:
NS_IMETHOD XPFCOutBoxCallback(nsIXPFCOutBoxItemHandler* aHandler, nsIXPFCOutBoxItem* aOutBoxItem) = 0;
};
/*
**
** OutBox Manager
**
** The idea here is any time the application will need to send or store data either to a local file
** or over the network, it will first store that data in the outbox. For each type of data there will
** be a handler who job in life is to take that data and put or send it to the right place. The OutBox
** will manage this. The data must in a mime format.
**
** Thread Use:
**
** The methods AddItem and SendItems maybe called from any thread. They will not block. They will call the
** modal thread to do any real work. There will be only one running thread for this manager.
*/
class nsIXPFCOutBoxManager : public nsISupports
{
public:
NS_IMETHOD Init() = 0 ;
/*
** Add an item to the outbox. Caller must provide inStream. Outbox assumes all data
** is text based.
*/
NS_IMETHOD AddItem(nsString& aMimeType, nsIMIMEMessage*& aMimeData) = 0;
/*
** Get an item from the outbox. After the stream is closed this item will be
** removed from the outbox. Caller must free outSteam.
*/
// NS_IMETHOD GetItems(nsString& aMimeType, nsIMIMEMessage*& aMimeData) = 0;
NS_IMETHOD GetItems(nsString& aMimeType, nsIIterator* aListMimeData) = 0;
/*
** Get the count of all the items stored in the outbox
*/
NS_IMETHOD ItemsCount(PRInt32 *OutBoxItems) = 0;
/*
** Get the count of the items with this mimeType that are stored in the outbox
*/
NS_IMETHOD ItemsCount(nsString& aMimeType, PRInt32 *aOutBoxItemsCount) = 0;
/*
** Get the size in bytes of all the items stored in the outbox
*/
NS_IMETHOD ItemsSize(PRInt32 *aOutBoxItemsSize) = 0;
/*
** Set up a handler for an outbox item
*/
NS_IMETHOD AddHandler(nsIXPFCOutBoxItemHandler*& AnOutBoxHandler, nsIXPFCOutBoxItemHandlerCallback*& host) = 0;
/*
** Tell the OutBox Manager to dispatch any stored items
*/
NS_IMETHOD SendItems() = 0;
};
#endif

View File

@ -25,6 +25,7 @@ CPPSRCS = \
nsStreamManager.cpp \
nsStreamObject.cpp \
nsXPFCDataCollectionManager.cpp \
nsXPFCOutBoxManager.cpp \
$(NULL)
REQUIRES = dom xpcom raptor pref js netlib

View File

@ -53,6 +53,7 @@
#include "nsIServiceManager.h"
#include "nsIXPFCDataCollectionManager.h"
#include "nsIXPFCOutBoxManager.h"
#ifdef NS_WIN32
#include "direct.h"
@ -97,6 +98,8 @@ static NS_DEFINE_IID(kDeviceContextCID, NS_DEVICE_CONTEXT_CID);
static NS_DEFINE_IID(kDeviceContextIID, NS_IDEVICE_CONTEXT_IID);
static NS_DEFINE_IID(kCXPFCDataCollectionManager, NS_XPFCDATACOLLECTION_MANAGER_CID);
static NS_DEFINE_IID(kIXPFCDataCollectionManager, NS_IXPFCDATACOLLECTION_MANAGER_IID);
static NS_DEFINE_IID(kCXPFCOutBoxManagerCID, NS_XPFCOUTBOX_MANAGER_CID);
static NS_DEFINE_IID(kIXPFCOutBoxManagerIID, NS_IXPFCOUTBOX_MANAGER_IID);
nsEventStatus PR_CALLBACK HandleEventApplication(nsGUIEvent *aEvent);
nsShellInstance * gShellInstance = nsnull;
@ -131,6 +134,8 @@ nsShellInstance::~nsShellInstance()
NS_IF_RELEASE(mPref);
NS_IF_RELEASE(mStreamManager);
NS_IF_RELEASE(mToolbarManager);
NS_IF_RELEASE(mDataCollectionManager);
NS_IF_RELEASE(mOutBoxManager);
}
NS_DEFINE_IID(kIShellInstanceIID, NS_IXPFC_SHELL_INSTANCE_IID);
@ -178,21 +183,12 @@ nsresult nsShellInstance::Init()
mToolbarManager->Init();
// Create a DataCollection Manager
#if 0
res = nsRepository::CreateInstance(kCXPFCDataCollectionManager,
NULL,
kIXPFCDataCollectionManager,
(void **) &mDataCollectionManager);
mDataCollectionManager = new nsXPFCDataCollectionManager();
#else
nsServiceManager::GetService(kCXPFCDataCollectionManager, kIXPFCDataCollectionManager, (nsISupports**)&mDataCollectionManager);
res = NS_OK;
if (mDataCollectionManager) mDataCollectionManager->Init();
#endif
if (NS_OK != res)
return res;
mDataCollectionManager->Init();
// Create the Outbox manager
nsServiceManager::GetService(kCXPFCOutBoxManagerCID, kIXPFCOutBoxManagerIID, (nsISupports**)&mOutBoxManager);
if (mOutBoxManager) mOutBoxManager->Init();
return res;
}
@ -235,6 +231,11 @@ nsIXPFCDataCollectionManager * nsShellInstance::GetDataCollectionManager()
return (mDataCollectionManager) ;
}
nsIXPFCOutBoxManager * nsShellInstance::GetOutBoxManager()
{
return (mOutBoxManager) ;
}
void * nsShellInstance::GetNativeInstance()
{
return mNativeInstance ;
@ -417,6 +418,8 @@ nsRepository::RegisterFactory(kCMenuCID, WIDGET_DLL, PR_FALSE, PR_FALSE);
nsRepository::RegisterFactory(kCMenuItemCID, WIDGET_DLL, PR_FALSE, PR_FALSE);
nsRepository::RegisterFactory(kCXPFCDataCollectionManager, XPFC_DLL, PR_FALSE, PR_FALSE);
nsRepository::RegisterFactory(kCXPFCOutBoxManagerCID , XPFC_DLL, PR_FALSE, PR_FALSE);
static NS_DEFINE_IID(kCParserNodeCID, NS_PARSER_NODE_IID);
nsRepository::RegisterFactory(kCParserNodeCID, PARSER_DLL, PR_FALSE, PR_FALSE);

View File

@ -0,0 +1,88 @@
/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*-
*
* 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 "nsXPFCOutBoxManager.h"
#include "nsxpfcCIID.h"
#include "nsxpfcutil.h"
static NS_DEFINE_IID(kISupportsIID, NS_ISUPPORTS_IID);
static NS_DEFINE_IID(kCXPFCOutBoxManagerCID, NS_XPFCOUTBOX_MANAGER_CID);
static NS_DEFINE_IID(kIXPFCOutBoxManagerIID, NS_IXPFCOUTBOX_MANAGER_IID);
nsXPFCOutBoxManager :: nsXPFCOutBoxManager()
{
NS_INIT_REFCNT();
}
nsXPFCOutBoxManager :: ~nsXPFCOutBoxManager()
{
}
NS_IMPL_QUERY_INTERFACE(nsXPFCOutBoxManager, kIXPFCOutBoxManagerIID)
NS_IMPL_ADDREF(nsXPFCOutBoxManager)
NS_IMPL_RELEASE(nsXPFCOutBoxManager)
nsresult
nsXPFCOutBoxManager :: Init()
{
return NS_OK ;
}
nsresult
nsXPFCOutBoxManager :: AddItem(nsString& mimeType, nsIInputStream& inStream)
{
return NS_OK ;
}
nsresult
nsXPFCOutBoxManager :: FindItem(nsString& mimeType, nsIOutputStream* outSteam)
{
return NS_OK ;
}
nsresult
nsXPFCOutBoxManager :: ItemsCount(PRInt32 *OutBoxItems)
{
return NS_OK ;
}
nsresult
nsXPFCOutBoxManager :: ItemsCount(nsString& mimeType, PRInt32 *OutBoxItems)
{
return NS_OK ;
}
nsresult
nsXPFCOutBoxManager :: ItemsSize(PRInt32 *OutBoxItemsSize)
{
return NS_OK ;
}
nsresult
nsXPFCOutBoxManager :: AddHandler(nsIXPFCOutBoxItemHandler*& AnOutBoxHandler, nsIXPFCOutBoxItemHandlerCallback*& host)
{
return NS_OK ;
}
nsresult
nsXPFCOutBoxManager :: SendItems()
{
return NS_OK ;
}