mirror of
https://github.com/mozilla/gecko-dev.git
synced 2025-01-31 19:10:36 +00:00
Modified nsStreamManager::LoadURL so that nsIXPFCCanvas parameter is
replaced by generic nsISupports. Added nsIXPFCContentSink interface to implement the SetContentSinkContainer method.
This commit is contained in:
parent
dccc95beb4
commit
9ea41a8491
@ -32,9 +32,11 @@
|
||||
#include "nsXPFCXMLDTD.h"
|
||||
#include "nsIXMLParserObject.h"
|
||||
#include "nsIXPFCXMLContentSink.h"
|
||||
#include "nsIXPFCContentSink.h"
|
||||
|
||||
class nsXPFCXMLContentSink : public nsIHTMLContentSink,
|
||||
public nsIXPFCXMLContentSink
|
||||
public nsIXPFCXMLContentSink,
|
||||
public nsIXPFCContentSink
|
||||
{
|
||||
|
||||
public:
|
||||
@ -47,6 +49,7 @@ public:
|
||||
NS_IMETHOD Init();
|
||||
NS_IMETHOD SetViewerContainer(nsIWebViewerContainer * aViewerContainer);
|
||||
NS_IMETHOD SetRootCanvas(nsIXPFCCanvas * aCanvas);
|
||||
NS_IMETHOD SetContentSinkContainer(nsISupports * aContentSinkContainer);
|
||||
|
||||
// nsIContentSink
|
||||
NS_IMETHOD OpenContainer(const nsIParserNode& aNode);
|
||||
|
@ -15,7 +15,9 @@ EXPORTS = \
|
||||
nsIMenuManager.h \
|
||||
nsIXPFCToolbarManager.h \
|
||||
nsIXPFCXMLContentSink.h \
|
||||
$(NULL)
|
||||
nsIXPFCICalContentSink.h \
|
||||
nsIXPFCContentSink.h \
|
||||
$(NULL)
|
||||
|
||||
PRIVATE_EXPORTS = \
|
||||
$(NULL)
|
||||
|
42
xpfc/parser/public/nsIXPFCContentSink.h
Normal file
42
xpfc/parser/public/nsIXPFCContentSink.h
Normal file
@ -0,0 +1,42 @@
|
||||
/* -*- 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 nsIXPFCContentSink_h___
|
||||
#define nsIXPFCContentSink_h___
|
||||
|
||||
#include "nsISupports.h"
|
||||
#include "nsIWebViewerContainer.h"
|
||||
//#include "nsIXPFCContentSinkContainer.h"
|
||||
|
||||
// c0718b70-7515-11d2-943f-006008268c31
|
||||
#define NS_IXPFC_CONTENT_SINK_IID \
|
||||
{ 0xc0c10130, 0x7515, 0x11d2, \
|
||||
{ 0x94, 0x3f, 0x00, 0x60, 0x08, 0x26, 0x8c, 0x31 } }
|
||||
|
||||
class nsIXPFCContentSink : public nsISupports
|
||||
{
|
||||
public:
|
||||
NS_IMETHOD Init() = 0;
|
||||
NS_IMETHOD SetViewerContainer(nsIWebViewerContainer * aViewerContainer) = 0;
|
||||
//NS_IMETHOD SetContentSinkContainer(nsIXPFCContentSinkContainer * aContentSinkContainer) = 0;
|
||||
NS_IMETHOD SetContentSinkContainer(nsISupports * aContentSinkContainer) = 0;
|
||||
};
|
||||
|
||||
#endif
|
||||
|
||||
|
44
xpfc/parser/public/nsIXPFCICalContentSink.h
Normal file
44
xpfc/parser/public/nsIXPFCICalContentSink.h
Normal file
@ -0,0 +1,44 @@
|
||||
/* -*- 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 nsIXPFCICalContentSink_h___
|
||||
#define nsIXPFCICalContentSink_h___
|
||||
|
||||
#include "nsISupports.h"
|
||||
#include "nsIArray.h"
|
||||
|
||||
//ca581fe0-743f-11d2-943f-006008268c31
|
||||
#define NS_IXPFC_ICAL_CONTENT_SINK_IID \
|
||||
{ 0xca581fe0, 0x743f, 0x11d2, \
|
||||
{ 0x94, 0x3f, 0x00, 0x60, 0x08, 0x26, 0x8c, 0x31 } }
|
||||
|
||||
class nsIXPFCICalContentSink : public nsISupports
|
||||
{
|
||||
|
||||
public:
|
||||
|
||||
NS_IMETHOD Init() = 0 ;
|
||||
NS_IMETHOD SetCalendarList(nsIArray * aCalendarList) = 0;
|
||||
|
||||
};
|
||||
|
||||
#endif /* nsIXPFCICalContentSink_h___ */
|
||||
|
||||
|
||||
|
||||
|
@ -31,6 +31,7 @@
|
||||
#include "nsWidgetsCID.h"
|
||||
#include "nsXPFCToolkit.h"
|
||||
|
||||
|
||||
static NS_DEFINE_IID(kISupportsIID, NS_ISUPPORTS_IID);
|
||||
static NS_DEFINE_IID(kIContentSinkIID, NS_ICONTENT_SINK_IID);
|
||||
static NS_DEFINE_IID(kClassIID, NS_XPFCXMLCONTENTSINK_IID);
|
||||
@ -56,6 +57,7 @@ static NS_DEFINE_IID(kCXPButtonCID, NS_XP_BUTTON_CID);
|
||||
static NS_DEFINE_IID(kCXPFCTabWidgetCID, NS_XPFC_TABWIDGET_CID);
|
||||
static NS_DEFINE_IID(kCXPFCTextWidgetCID, NS_XPFC_TEXTWIDGET_CID);
|
||||
static NS_DEFINE_IID(kIXPFCXMLContentSinkIID, NS_IXPFC_XML_CONTENT_SINK_IID);
|
||||
static NS_DEFINE_IID(kIXPFCContentSinkIID, NS_IXPFC_CONTENT_SINK_IID);
|
||||
|
||||
#define XPFC_PARSING_STATE_UNKNOWN 0
|
||||
#define XPFC_PARSING_STATE_TOOLBAR 1
|
||||
@ -182,6 +184,9 @@ nsresult nsXPFCXMLContentSink::QueryInterface(const nsIID& aIID, void** aInstanc
|
||||
else if(aIID.Equals(kIXPFCXMLContentSinkIID)) { //do this class...
|
||||
*aInstancePtr = (nsIXPFCXMLContentSink*)(this);
|
||||
}
|
||||
else if(aIID.Equals(kIXPFCContentSinkIID)) { //do this class...
|
||||
*aInstancePtr = (nsIXPFCContentSink*)(this);
|
||||
}
|
||||
else {
|
||||
*aInstancePtr=0;
|
||||
return NS_NOINTERFACE;
|
||||
@ -947,6 +952,21 @@ NS_IMETHODIMP nsXPFCXMLContentSink::AddToHierarchy(nsIXMLParserObject& aObject,
|
||||
}
|
||||
|
||||
|
||||
nsresult nsXPFCXMLContentSink::SetContentSinkContainer(nsISupports *
|
||||
aContentSinkContainer)
|
||||
{
|
||||
nsresult res;
|
||||
nsIXPFCCanvas * canvas;
|
||||
static NS_DEFINE_IID(kIXPFCCanvasIID, NS_IXPFC_CANVAS_IID);
|
||||
res = aContentSinkContainer->QueryInterface(kIXPFCCanvasIID, (void **)&canvas);
|
||||
if (NS_OK == res)
|
||||
{
|
||||
res = SetRootCanvas(canvas);
|
||||
NS_RELEASE(canvas);
|
||||
}
|
||||
return res;
|
||||
}
|
||||
|
||||
nsresult nsXPFCXMLContentSink::SetRootCanvas(nsIXPFCCanvas * aCanvas)
|
||||
{
|
||||
PushComponent(aCanvas);
|
||||
|
@ -21,7 +21,8 @@
|
||||
#include "nsIArray.h"
|
||||
#include "nsIIterator.h"
|
||||
#include "nsIStreamManager.h"
|
||||
#include "nsIXPFCCanvas.h"
|
||||
#include "nsIXPFCContentSinkContainer.h"
|
||||
//#include "nsIXPFCCanvas.h"
|
||||
|
||||
class nsStreamManager : public nsIStreamManager
|
||||
{
|
||||
@ -45,10 +46,20 @@ public:
|
||||
*/
|
||||
NS_IMETHOD Init();
|
||||
|
||||
#if 0
|
||||
NS_IMETHOD LoadURL(nsIWebViewerContainer * aWebViewerContainer,
|
||||
nsIXPFCCanvas * aParentCanvas,
|
||||
const nsString& aURLSpec,
|
||||
nsIPostData * aPostData,
|
||||
nsIArray * aCalendarVector,
|
||||
nsIID *aDTDIID = nsnull,
|
||||
nsIID *aSinkIID = nsnull);
|
||||
#endif
|
||||
|
||||
NS_IMETHOD LoadURL(nsIWebViewerContainer * aWebViewerContainer,
|
||||
nsISupports * aContentSinkContainer,
|
||||
const nsString& aURLSpec,
|
||||
nsIPostData * aPostData,
|
||||
nsIID *aDTDIID = nsnull,
|
||||
nsIID *aSinkIID = nsnull);
|
||||
|
||||
|
@ -25,6 +25,7 @@
|
||||
#include "nsIWebViewerContainer.h"
|
||||
#include "nsIURL.h"
|
||||
#include "nsIStreamListener.h"
|
||||
#include "nsIXPFCContentSinkContainer.h"
|
||||
|
||||
class nsIXPFCCanvas;
|
||||
|
||||
@ -44,10 +45,24 @@ public:
|
||||
*/
|
||||
NS_IMETHOD Init() = 0;
|
||||
|
||||
#if 0
|
||||
NS_IMETHOD LoadURL(nsIWebViewerContainer * aWebViewerContainer,
|
||||
nsIXPFCCanvas * aParentCanvas,
|
||||
const nsString& aURLSpec,
|
||||
nsIPostData * aPostData,
|
||||
nsIArray * aCalendarVector,
|
||||
nsIID *aDTDIID = nsnull,
|
||||
nsIID *aSinkIID = nsnull) = 0;
|
||||
#endif
|
||||
|
||||
/**
|
||||
* aContainer is generic variable used to pass information to sink variable.
|
||||
* replaces aParentCanvas.
|
||||
*/
|
||||
NS_IMETHOD LoadURL(nsIWebViewerContainer * aWebViewerContainer,
|
||||
nsISupports * aContentSinkContainer,
|
||||
const nsString& aURLSpec,
|
||||
nsIPostData * aPostData,
|
||||
nsIID *aDTDIID = nsnull,
|
||||
nsIID *aSinkIID = nsnull) = 0;
|
||||
|
||||
|
@ -27,6 +27,7 @@
|
||||
#include "nspr.h"
|
||||
#include "nsParserCIID.h"
|
||||
#include "nsXPFCXMLContentSink.h"
|
||||
#include "nsIXPFCICalContentSink.h"
|
||||
#include "nsStreamObject.h"
|
||||
|
||||
static NS_DEFINE_IID(kISupportsIID, NS_ISUPPORTS_IID);
|
||||
@ -77,11 +78,11 @@ NS_IMPL_ISUPPORTS(nsStreamManager,kIStreamManagerIID);
|
||||
|
||||
nsresult nsStreamManager::Init()
|
||||
{
|
||||
static NS_DEFINE_IID(kCVectorCID, NS_ARRAY_CID);
|
||||
static NS_DEFINE_IID(kCArrayCID, NS_ARRAY_CID);
|
||||
|
||||
nsresult res = nsRepository::CreateInstance(kCVectorCID,
|
||||
nsresult res = nsRepository::CreateInstance(kCArrayCID,
|
||||
nsnull,
|
||||
kCVectorCID,
|
||||
kCArrayCID,
|
||||
(void **)&mStreamObjects);
|
||||
|
||||
if (NS_OK != res)
|
||||
@ -93,7 +94,7 @@ nsresult nsStreamManager::Init()
|
||||
}
|
||||
|
||||
nsresult nsStreamManager::LoadURL(nsIWebViewerContainer * aWebViewerContainer,
|
||||
nsIXPFCCanvas * aParentCanvas,
|
||||
nsISupports * aContentSinkContainer,
|
||||
const nsString& aURLSpec,
|
||||
nsIPostData * aPostData,
|
||||
nsIID *aDTDIID,
|
||||
@ -184,27 +185,23 @@ nsresult nsStreamManager::LoadURL(nsIWebViewerContainer * aWebViewerContainer,
|
||||
return res;
|
||||
}
|
||||
|
||||
nsIXPFCXMLContentSink * sink ;
|
||||
|
||||
static NS_DEFINE_IID(kIXPFCXMLContentSinkIID, NS_IXPFC_XML_CONTENT_SINK_IID);
|
||||
|
||||
res = stream_object->mSink->QueryInterface(kIXPFCXMLContentSinkIID,(void**)&sink);
|
||||
|
||||
nsIXPFCContentSink * xpfc_sink;
|
||||
static NS_DEFINE_IID(kIXPFCContentSinkIID, NS_IXPFC_CONTENT_SINK_IID);
|
||||
static NS_DEFINE_IID(kIXPFCContentSinkContainerIID, NS_IXPFC_CONTENT_SINK_CONTAINER_IID);
|
||||
|
||||
res = stream_object->mSink->QueryInterface(kIXPFCContentSinkIID, (void**)&xpfc_sink);
|
||||
if (NS_OK == res)
|
||||
{
|
||||
sink->SetViewerContainer(aWebViewerContainer);
|
||||
|
||||
xpfc_sink->SetViewerContainer(aWebViewerContainer);
|
||||
|
||||
/*
|
||||
* Push Top of stack
|
||||
*/
|
||||
|
||||
if (nsnull != aParentCanvas)
|
||||
if (nsnull != aContentSinkContainer)
|
||||
{
|
||||
sink->SetRootCanvas(aParentCanvas);
|
||||
|
||||
xpfc_sink->SetContentSinkContainer(aContentSinkContainer);
|
||||
}
|
||||
|
||||
NS_RELEASE(sink);
|
||||
NS_RELEASE(xpfc_sink);
|
||||
}
|
||||
|
||||
/*
|
||||
@ -241,4 +238,4 @@ nsresult nsStreamManager::LoadURL(nsIWebViewerContainer * aWebViewerContainer,
|
||||
|
||||
return res;
|
||||
|
||||
}
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user