From 262f4c8d0a55bbe93506908effa1f6bae938c5fa Mon Sep 17 00:00:00 2001 From: "peterlubczynski%netscape.com" Date: Sat, 22 Mar 2003 02:22:03 +0000 Subject: [PATCH] Creating nsMediaDocument/nsPluginDocument to make full-page plugins scriptable, bug 90256 r=jkeiser sr=jst --- content/base/public/nsContentCID.h | 4 + content/base/src/Makefile.in | 1 + content/html/document/src/nsMediaDocument.cpp | 206 ++++++++++++++ content/html/document/src/nsMediaDocument.h | 86 ++++++ .../html/document/src/nsPluginDocument.cpp | 256 ++++++++++++++++++ layout/build/Makefile.in | 1 + layout/build/nsLayoutCID.h | 5 + modules/plugin/base/public/MANIFEST_IDL | 48 ---- modules/plugin/base/public/Makefile.in | 1 + .../plugin/base/public/nsIPluginDocument.idl | 54 ++++ 10 files changed, 614 insertions(+), 48 deletions(-) create mode 100644 content/html/document/src/nsMediaDocument.cpp create mode 100644 content/html/document/src/nsMediaDocument.h create mode 100644 content/html/document/src/nsPluginDocument.cpp create mode 100644 modules/plugin/base/public/nsIPluginDocument.idl diff --git a/content/base/public/nsContentCID.h b/content/base/public/nsContentCID.h index a0f6f5d5742..3c9bea4cd91 100644 --- a/content/base/public/nsContentCID.h +++ b/content/base/public/nsContentCID.h @@ -325,4 +325,8 @@ #define NS_SYNCLOADDOMSERVICE_CONTRACTID \ "@mozilla.org/content/syncload-dom-service;1" +// {f96f5ec9-755b-447e-b1f3-717d1a84bb41} +#define NS_PLUGINDOCUMENT_CID \ +{ 0xf96f5ec9, 0x755b, 0x447e, { 0xb1, 0xf3, 0x71, 0x7d, 0x1a, 0x84, 0xbb, 0x41 } } + #endif /* nsContentCID_h__ */ diff --git a/content/base/src/Makefile.in b/content/base/src/Makefile.in index 0486711ad31..dce59313641 100644 --- a/content/base/src/Makefile.in +++ b/content/base/src/Makefile.in @@ -56,6 +56,7 @@ REQUIRES = xpcom \ uriloader \ webbrwsr \ debug \ + plugin \ $(NULL) CPPSRCS = \ diff --git a/content/html/document/src/nsMediaDocument.cpp b/content/html/document/src/nsMediaDocument.cpp new file mode 100644 index 00000000000..70b7739599e --- /dev/null +++ b/content/html/document/src/nsMediaDocument.cpp @@ -0,0 +1,206 @@ +/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ +/* ***** BEGIN LICENSE BLOCK ***** + * Version: NPL 1.1/GPL 2.0/LGPL 2.1 + * + * The contents of this file are subject to the Netscape Public License + * Version 1.1 (the "License"); you may not use this file except in + * compliance with the License. You may obtain a copy of the License at + * http://www.mozilla.org/NPL/ + * + * Software distributed under the License is distributed on an "AS IS" basis, + * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License + * for the specific language governing rights and limitations under the + * License. + * + * The Original Code is Mozilla Communicator client code. + * + * The Initial Developer of the Original Code is + * Netscape Communications Corporation. + * Portions created by the Initial Developer are Copyright (C) 1998 + * the Initial Developer. All Rights Reserved. + * + * Contributor(s): + * + * Alternatively, the contents of this file may be used under the terms of + * either the GNU General Public License Version 2 or later (the "GPL"), or + * the GNU Lesser General Public License Version 2.1 or later (the "LGPL"), + * in which case the provisions of the GPL or the LGPL are applicable instead + * of those above. If you wish to allow use of your version of this file only + * under the terms of either the GPL or the LGPL, and not to allow others to + * use your version of this file under the terms of the NPL, indicate your + * decision by deleting the provisions above and replace them with the notice + * and other provisions required by the GPL or the LGPL. If you do not delete + * the provisions above, a recipient may use your version of this file under + * the terms of any one of the NPL, the GPL or the LGPL. + * + * ***** END LICENSE BLOCK ***** */ + +#include "nsMediaDocument.h" +#include "nsHTMLAtoms.h" +#include "nsRect.h" +#include "nsIPresContext.h" +#include "nsIPresShell.h" +#include "nsIScrollable.h" +#include "nsIViewManager.h" + +nsMediaDocumentStreamListener::nsMediaDocumentStreamListener(nsMediaDocument *aDocument) +{ + mDocument = aDocument; +} + +nsMediaDocumentStreamListener::~nsMediaDocumentStreamListener() +{ +} + + +NS_IMPL_THREADSAFE_ISUPPORTS2(nsMediaDocumentStreamListener, + nsIRequestObserver, + nsIStreamListener) + + +void +nsMediaDocumentStreamListener::SetStreamListener(nsIStreamListener *aListener) +{ + mNextStream = aListener; +} + +NS_IMETHODIMP +nsMediaDocumentStreamListener::OnStartRequest(nsIRequest* request, nsISupports *ctxt) +{ + mDocument->StartLayout(); + + if (mNextStream) { + return mNextStream->OnStartRequest(request, ctxt); + } + + return NS_OK; +} + +NS_IMETHODIMP +nsMediaDocumentStreamListener::OnStopRequest(nsIRequest* request, + nsISupports *ctxt, + nsresult status) +{ + if (mNextStream) { + return mNextStream->OnStopRequest(request, ctxt, status); + } + + return NS_OK; +} + +NS_IMETHODIMP +nsMediaDocumentStreamListener::OnDataAvailable(nsIRequest* request, + nsISupports *ctxt, + nsIInputStream *inStr, + PRUint32 sourceOffset, + PRUint32 count) +{ + if (mNextStream) { + return mNextStream->OnDataAvailable(request, ctxt, inStr, sourceOffset, count); + } + + return NS_OK; +} + +nsMediaDocument::nsMediaDocument() +{ +} +nsMediaDocument::~nsMediaDocument() +{ +} + +NS_IMETHODIMP +nsMediaDocument::StartDocumentLoad(const char* aCommand, + nsIChannel* aChannel, + nsILoadGroup* aLoadGroup, + nsISupports* aContainer, + nsIStreamListener** aDocListener, + PRBool aReset, + nsIContentSink* aSink) +{ + nsresult rv = nsDocument::StartDocumentLoad(aCommand, aChannel, aLoadGroup, + aContainer, aDocListener, aReset, + aSink); + if (NS_FAILED(rv)) { + return rv; + } + + RetrieveRelevantHeaders(aChannel); + + return NS_OK; +} + +nsresult +nsMediaDocument::CreateSyntheticDocument() +{ + // Synthesize an empty html document + nsresult rv; + + nsCOMPtr nodeInfo; + rv = mNodeInfoManager->GetNodeInfo(nsHTMLAtoms::html, nsnull, + kNameSpaceID_None, + *getter_AddRefs(nodeInfo)); + NS_ENSURE_SUCCESS(rv, rv); + + nsCOMPtr root; + rv = NS_NewHTMLHtmlElement(getter_AddRefs(root), nodeInfo); + if (NS_FAILED(rv)) { + return rv; + } + root->SetDocument(this, PR_FALSE, PR_TRUE); + SetRootContent(root); + + rv = mNodeInfoManager->GetNodeInfo(nsHTMLAtoms::body, nsnull, + kNameSpaceID_None, + *getter_AddRefs(nodeInfo)); + NS_ENSURE_SUCCESS(rv, rv); + + nsCOMPtr body; + rv = NS_NewHTMLBodyElement(getter_AddRefs(body), nodeInfo); + if (NS_FAILED(rv)) { + return rv; + } + body->SetDocument(this, PR_FALSE, PR_TRUE); + mBodyContent = do_QueryInterface(body); + + root->AppendChildTo(body, PR_FALSE, PR_FALSE); + + return NS_OK; +} + +nsresult +nsMediaDocument::StartLayout() +{ + // Reset scrolling to default settings for this shell. + // This must happen before the initial reflow, when we create the root frame + nsCOMPtr scrollableContainer(do_QueryReferent(mDocumentContainer)); + if (scrollableContainer) { + scrollableContainer->ResetScrollbarPreferences(); + } + + PRInt32 numberOfShells = GetNumberOfShells(); + for (PRInt32 i = 0; i < numberOfShells; i++) { + nsCOMPtr shell; + GetShellAt(i, getter_AddRefs(shell)); + if (shell) { + // Make shell an observer for next time. + shell->BeginObservingDocument(); + + // Initial-reflow this time. + nsCOMPtr context; + shell->GetPresContext(getter_AddRefs(context)); + nsRect visibleArea; + context->GetVisibleArea(visibleArea); + shell->InitialReflow(visibleArea.width, visibleArea.height); + + // Now trigger a refresh. + nsCOMPtr vm; + shell->GetViewManager(getter_AddRefs(vm)); + if (vm) { + vm->EnableRefresh(NS_VMREFRESH_IMMEDIATE); + } + } + } + + return NS_OK; +} diff --git a/content/html/document/src/nsMediaDocument.h b/content/html/document/src/nsMediaDocument.h new file mode 100644 index 00000000000..c37e1efcb93 --- /dev/null +++ b/content/html/document/src/nsMediaDocument.h @@ -0,0 +1,86 @@ +/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ +/* ***** BEGIN LICENSE BLOCK ***** + * Version: NPL 1.1/GPL 2.0/LGPL 2.1 + * + * The contents of this file are subject to the Netscape Public License + * Version 1.1 (the "License"); you may not use this file except in + * compliance with the License. You may obtain a copy of the License at + * http://www.mozilla.org/NPL/ + * + * Software distributed under the License is distributed on an "AS IS" basis, + * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License + * for the specific language governing rights and limitations under the + * License. + * + * The Original Code is Mozilla Communicator client code. + * + * The Initial Developer of the Original Code is + * Netscape Communications Corporation. + * Portions created by the Initial Developer are Copyright (C) 1998 + * the Initial Developer. All Rights Reserved. + * + * Contributor(s): + * + * Alternatively, the contents of this file may be used under the terms of + * either the GNU General Public License Version 2 or later (the "GPL"), or + * the GNU Lesser General Public License Version 2.1 or later (the "LGPL"), + * in which case the provisions of the GPL or the LGPL are applicable instead + * of those above. If you wish to allow use of your version of this file only + * under the terms of either the GPL or the LGPL, and not to allow others to + * use your version of this file under the terms of the NPL, indicate your + * decision by deleting the provisions above and replace them with the notice + * and other provisions required by the GPL or the LGPL. If you do not delete + * the provisions above, a recipient may use your version of this file under + * the terms of any one of the NPL, the GPL or the LGPL. + * + * ***** END LICENSE BLOCK ***** */ + +#ifndef nsMediaDocument_h___ +#define nsMediaDocument_h___ + +#include "nsHTMLDocument.h" +#include "nsGenericHTMLElement.h" +#include "nsAutoPtr.h" + +class nsMediaDocument : public nsHTMLDocument +{ +public: + nsMediaDocument(); + virtual ~nsMediaDocument(); + + NS_IMETHOD StartDocumentLoad(const char* aCommand, + nsIChannel* aChannel, + nsILoadGroup* aLoadGroup, + nsISupports* aContainer, + nsIStreamListener** aDocListener, + PRBool aReset = PR_TRUE, + nsIContentSink* aSink = nsnull); + +protected: + virtual nsresult CreateSyntheticDocument(); + + friend class nsMediaDocumentStreamListener; + nsresult StartLayout(); +}; + + +class nsMediaDocumentStreamListener: public nsIStreamListener +{ +public: + nsMediaDocumentStreamListener(nsMediaDocument *aDocument); + virtual ~nsMediaDocumentStreamListener(); + void SetStreamListener(nsIStreamListener *aListener); + + NS_DECL_ISUPPORTS + + NS_DECL_NSIREQUESTOBSERVER + + NS_DECL_NSISTREAMLISTENER + +protected: + nsRefPtr mDocument; + nsCOMPtr mNextStream; +}; + + +#endif /* nsMediaDocument_h___ */ diff --git a/content/html/document/src/nsPluginDocument.cpp b/content/html/document/src/nsPluginDocument.cpp new file mode 100644 index 00000000000..9020497a1ca --- /dev/null +++ b/content/html/document/src/nsPluginDocument.cpp @@ -0,0 +1,256 @@ +/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ +/* ***** BEGIN LICENSE BLOCK ***** + * Version: NPL 1.1/GPL 2.0/LGPL 2.1 + * + * The contents of this file are subject to the Netscape Public License + * Version 1.1 (the "License"); you may not use this file except in + * compliance with the License. You may obtain a copy of the License at + * http://www.mozilla.org/NPL/ + * + * Software distributed under the License is distributed on an "AS IS" basis, + * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License + * for the specific language governing rights and limitations under the + * License. + * + * The Original Code is Mozilla Communicator client code. + * + * The Initial Developer of the Original Code is + * Netscape Communications Corporation. + * Portions created by the Initial Developer are Copyright (C) 1998 + * the Initial Developer. All Rights Reserved. + * + * Contributor(s): + * + * Alternatively, the contents of this file may be used under the terms of + * either the GNU General Public License Version 2 or later (the "GPL"), or + * the GNU Lesser General Public License Version 2.1 or later (the "LGPL"), + * in which case the provisions of the GPL or the LGPL are applicable instead + * of those above. If you wish to allow use of your version of this file only + * under the terms of either the GPL or the LGPL, and not to allow others to + * use your version of this file under the terms of the NPL, indicate your + * decision by deleting the provisions above and replace them with the notice + * and other provisions required by the GPL or the LGPL. If you do not delete + * the provisions above, a recipient may use your version of this file under + * the terms of any one of the NPL, the GPL or the LGPL. + * + * ***** END LICENSE BLOCK ***** */ + +#include "nsMediaDocument.h" +#include "nsIPluginDocument.h" +#include "nsHTMLAtoms.h" +#include "nsIPresShell.h" +#include "nsIObjectFrame.h" +#include "nsIPluginInstance.h" +#include "nsIDocShellTreeItem.h" + +class nsPluginDocument : public nsMediaDocument, + public nsIPluginDocument +{ +public: + nsPluginDocument(); + virtual ~nsPluginDocument(); + + NS_DECL_ISUPPORTS + NS_DECL_NSIPLUGINDOCUMENT + + NS_IMETHOD StartDocumentLoad(const char* aCommand, + nsIChannel* aChannel, + nsILoadGroup* aLoadGroup, + nsISupports* aContainer, + nsIStreamListener** aDocListener, + PRBool aReset = PR_TRUE, + nsIContentSink* aSink = nsnull); + +protected: + nsresult CreateSyntheticDocument(nsACString &aMimeType); + + nsCOMPtr mPluginContent; + nsRefPtr mStreamListener; +}; + +nsPluginDocument::nsPluginDocument() +{ +} +nsPluginDocument::~nsPluginDocument() +{ +} + +NS_IMPL_ADDREF_INHERITED(nsPluginDocument, nsHTMLDocument) +NS_IMPL_RELEASE_INHERITED(nsPluginDocument, nsHTMLDocument) + +NS_INTERFACE_MAP_BEGIN(nsPluginDocument) + NS_INTERFACE_MAP_ENTRY(nsIPluginDocument) +NS_INTERFACE_MAP_END_INHERITING(nsHTMLDocument) + + +NS_IMETHODIMP +nsPluginDocument::StartDocumentLoad(const char* aCommand, + nsIChannel* aChannel, + nsILoadGroup* aLoadGroup, + nsISupports* aContainer, + nsIStreamListener** aDocListener, + PRBool aReset, + nsIContentSink* aSink) +{ + nsresult rv = nsMediaDocument::StartDocumentLoad(aCommand, aChannel, aLoadGroup, + aContainer, aDocListener, aReset, + aSink); + if (NS_FAILED(rv)) { + return rv; + } + + nsCAutoString mimeType; + rv = aChannel->GetContentType(mimeType); + if (NS_FAILED(rv)) { + return rv; + } + + // Create synthetic document + rv = CreateSyntheticDocument(mimeType); + if (NS_FAILED(rv)) { + return rv; + } + + mStreamListener = new nsMediaDocumentStreamListener(this); + if (!mStreamListener) + return NS_ERROR_OUT_OF_MEMORY; + NS_ASSERTION(aDocListener, "null aDocListener"); + NS_ADDREF(*aDocListener = mStreamListener); + + return rv; +} + +nsresult nsPluginDocument::CreateSyntheticDocument(nsACString &aMimeType) +{ + // do not allow message panes to host full-page plugins + // returning an error causes helper apps to take over + nsCOMPtr dsti (do_QueryReferent(mDocumentContainer)); + if (dsti) { + PRBool isMsgPane = PR_FALSE; + dsti->NameEquals(NS_LITERAL_STRING("messagepane").get(), &isMsgPane); + if (isMsgPane) + return NS_ERROR_FAILURE; + } + + // make our generic document + nsresult rv = nsMediaDocument::CreateSyntheticDocument(); + NS_ENSURE_SUCCESS(rv, rv); + // then attach our plugin + + nsCOMPtr body = do_QueryInterface(mBodyContent); + if (!body) { + NS_WARNING("no body on plugin document!"); + return NS_ERROR_FAILURE; + } + + // remove margins from body + nsHTMLValue zero(0, eHTMLUnit_Pixel); + body->SetHTMLAttribute(nsHTMLAtoms::marginwidth, zero, PR_FALSE); + body->SetHTMLAttribute(nsHTMLAtoms::marginheight, zero, PR_FALSE); + + + // make plugin content + nsCOMPtr nodeInfo; + rv = mNodeInfoManager->GetNodeInfo(nsHTMLAtoms::embed, nsnull, + kNameSpaceID_None, + *getter_AddRefs(nodeInfo)); + NS_ENSURE_SUCCESS(rv, rv); + rv = NS_NewHTMLSharedLeafElement(getter_AddRefs(mPluginContent), nodeInfo); + if (NS_FAILED(rv)) { + return rv; + } + mPluginContent->SetDocument(this, PR_FALSE, PR_TRUE); + + // make it a named element + nsHTMLValue name(NS_ConvertUTF8toUCS2("plugin")); + mPluginContent->SetHTMLAttribute(nsHTMLAtoms::name, name, PR_FALSE); + + // fill viewport and auto-reize + nsHTMLValue percent100 ((float)1.0); + mPluginContent->SetHTMLAttribute(nsHTMLAtoms::width, percent100, PR_FALSE); + mPluginContent->SetHTMLAttribute(nsHTMLAtoms::height, percent100, PR_FALSE); + + // set URL + nsCAutoString src; + mDocumentURL->GetSpec(src); + + NS_ConvertUTF8toUCS2 srcString(src); + nsHTMLValue val(srcString); + mPluginContent->SetHTMLAttribute(nsHTMLAtoms::src, val, PR_FALSE); + + // set mime type + val.SetStringValue(NS_ConvertUTF8toUCS2(aMimeType)); + mPluginContent->SetHTMLAttribute(nsHTMLAtoms::type, val, PR_FALSE); + + body->AppendChildTo(mPluginContent, PR_FALSE, PR_FALSE); + + return NS_OK; + + +} + +NS_IMETHODIMP +nsPluginDocument::SetStreamListener(nsIStreamListener *aListener) +{ + if (mStreamListener) + mStreamListener->SetStreamListener(aListener); + + nsAutoString title; + SetTitle(title); + + return NS_OK; +} + +NS_IMETHODIMP +nsPluginDocument::Print() +{ + NS_ENSURE_TRUE(mPluginContent, NS_ERROR_FAILURE); + + nsCOMPtr shell; + GetShellAt(0, getter_AddRefs(shell)); + if (shell) { + + nsIFrame* frame = nsnull; + shell->GetPrimaryFrameFor(mPluginContent, &frame); + + nsIObjectFrame* objectFrame = nsnull; + CallQueryInterface(frame,&objectFrame); + + if (objectFrame) { + nsCOMPtr pi; + objectFrame->GetPluginInstance(*getter_AddRefs(pi)); + if (pi) { + + nsPluginPrint npprint; + npprint.mode = nsPluginMode_Full; + npprint.print.fullPrint.pluginPrinted = PR_FALSE; + npprint.print.fullPrint.printOne = PR_FALSE; + npprint.print.fullPrint.platformPrint = nsnull; + + pi->Print(&npprint); + } + } + } + + return NS_OK; +} + +nsresult +NS_NewPluginDocument(nsIDocument** aResult) +{ + nsPluginDocument* doc = new nsPluginDocument(); + if (!doc) { + return NS_ERROR_OUT_OF_MEMORY; + } + + nsresult rv = doc->Init(); + + if (NS_FAILED(rv)) { + delete doc; + return rv; + } + + NS_ADDREF(*aResult = doc); + + return NS_OK; +} diff --git a/layout/build/Makefile.in b/layout/build/Makefile.in index ca7bb0260de..92908c4372d 100644 --- a/layout/build/Makefile.in +++ b/layout/build/Makefile.in @@ -66,6 +66,7 @@ REQUIRES = xpcom \ xul \ xultmpl \ lwbrk \ + plugin \ $(NULL) CPPSRCS = \ diff --git a/layout/build/nsLayoutCID.h b/layout/build/nsLayoutCID.h index e0ad4404bfd..fbc64f54dd2 100644 --- a/layout/build/nsLayoutCID.h +++ b/layout/build/nsLayoutCID.h @@ -258,5 +258,10 @@ #define NS_CARET_CID \ { 0xe14b66f6, 0xbfc5, 0x11d2, { 0xb5, 0x7e, 0x0, 0x10, 0x5a, 0xa8, 0x3b, 0x2f } } +// {f96f5ec9-755b-447e-b1f3-717d1a84bb41} +#define NS_PLUGINDOCUMENT_CID \ +{ 0xf96f5ec9, 0x755b, 0x447e, { 0xb1, 0xf3, 0x71, 0x7d, 0x1a, 0x84, 0xbb, 0x41 } } + + #endif /* nsLayoutCID_h__ */ diff --git a/modules/plugin/base/public/MANIFEST_IDL b/modules/plugin/base/public/MANIFEST_IDL index c801b964e86..e69de29bb2d 100644 --- a/modules/plugin/base/public/MANIFEST_IDL +++ b/modules/plugin/base/public/MANIFEST_IDL @@ -1,48 +0,0 @@ -# The contents of this file are subject to the Netscape Public -# License Version 1.1 (the "License"); you may not use this file -# except in compliance with the License. You may obtain a copy of -# the License at http://www.mozilla.org/NPL/ -# -# Software distributed under the License is distributed on an "AS -# IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or -# implied. See the License for the specific language governing -# rights and limitations under the License. -# -# The Original Code is mozilla.org code. -# -# The Initial Developer of the Original Code is Netscape -# Communications Corporation. Portions created by Netscape are -# Copyright (C) 1998 Netscape Communications Corporation. All -# Rights Reserved. -# -# Contributor(s): -# -# This is a list of local files which get copied to the mozilla:dist:??? directory -# - -nspluginroot.idl -nsIPluginStreamInfo.idl -nsIPluginManager.idl -nsIPluginManager2.idl -nsIPluginInstancePeer.idl -nsIPluginInstancePeer2.idl -nsIPluginInstanceOwner.idl -nsIPlugin.idl -nsIHTTPHeaderListener.idl -nsIFileUtilities.idl -nsIEventHandler.idl -nsICookieStorage.idl -nsIClassicPluginFactory.idl -nsIWindowlessPlugInstPeer.idl -nsIScriptablePlugin.idl -nsIPluginTagInfo.idl -nsIPluginTagInfo2.idl -nsIPluginViewer.idl -nsIJRILiveConnectPIPeer.idl -nsIJRILiveConnectPlugin.idl -nsIPluginInputStream.idl -nsIPluginStreamListener.idl -nsIPluginInstance.idl -nsPIPluginHost.idl -nsPIPluginInstancePeer.idl -nsIPluginHost.idl diff --git a/modules/plugin/base/public/Makefile.in b/modules/plugin/base/public/Makefile.in index 4c935fa097c..f560ca0a0d2 100644 --- a/modules/plugin/base/public/Makefile.in +++ b/modules/plugin/base/public/Makefile.in @@ -73,6 +73,7 @@ XPIDLSRCS = \ nsPIPluginHost.idl \ nsPIPluginInstancePeer.idl \ nsIPluginHost.idl \ + nsIPluginDocument.idl \ $(NULL) include $(topsrcdir)/config/rules.mk diff --git a/modules/plugin/base/public/nsIPluginDocument.idl b/modules/plugin/base/public/nsIPluginDocument.idl new file mode 100644 index 00000000000..89510466a3d --- /dev/null +++ b/modules/plugin/base/public/nsIPluginDocument.idl @@ -0,0 +1,54 @@ +/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ +/* ***** BEGIN LICENSE BLOCK ***** + * Version: NPL 1.1/GPL 2.0/LGPL 2.1 + * + * The contents of this file are subject to the Netscape Public License + * Version 1.1 (the "License"); you may not use this file except in + * compliance with the License. You may obtain a copy of the License at + * http://www.mozilla.org/NPL/ + * + * Software distributed under the License is distributed on an "AS IS" basis, + * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License + * for the specific language governing rights and limitations under the + * License. + * + * The Original Code is mozilla.org code. + * + * The Initial Developer of the Original Code is + * Netscape Communications Corporation. + * Portions created by the Initial Developer are Copyright (C) 1998 + * the Initial Developer. All Rights Reserved. + * + * Contributor(s): + * + * Alternatively, the contents of this file may be used under the terms of + * either the GNU General Public License Version 2 or later (the "GPL"), or + * the GNU Lesser General Public License Version 2.1 or later (the "LGPL"), + * in which case the provisions of the GPL or the LGPL are applicable instead + * of those above. If you wish to allow use of your version of this file only + * under the terms of either the GPL or the LGPL, and not to allow others to + * use your version of this file under the terms of the NPL, indicate your + * decision by deleting the provisions above and replace them with the notice + * and other provisions required by the GPL or the LGPL. If you do not delete + * the provisions above, a recipient may use your version of this file under + * the terms of any one of the NPL, the GPL or the LGPL. + * + * ***** END LICENSE BLOCK ***** */ + +#include "nsISupports.idl" +#include "nsIStreamListener.idl" + +[uuid(0d8129f1-5a55-4eaa-851f-15e43ce3d183)] +interface nsIPluginDocument : nsISupports +{ + /** + * Sets the stream listener for this plugin document + */ + void setStreamListener(in nsIStreamListener aStreamListener); + + + /** + * Causes the plugin to print in full-page mode + */ + void print(); +};