2003-03-22 02:22:03 +00:00
|
|
|
/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
|
|
|
|
/* ***** BEGIN LICENSE BLOCK *****
|
2004-04-17 21:52:36 +00:00
|
|
|
* Version: MPL 1.1/GPL 2.0/LGPL 2.1
|
2003-03-22 02:22:03 +00:00
|
|
|
*
|
2004-04-17 21:52:36 +00:00
|
|
|
* The contents of this file are subject to the Mozilla 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/MPL/
|
2003-03-22 02:22:03 +00:00
|
|
|
*
|
|
|
|
* 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
|
2004-04-17 21:52:36 +00:00
|
|
|
* either of 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"),
|
2003-03-22 02:22:03 +00:00
|
|
|
* 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
|
2004-04-17 21:52:36 +00:00
|
|
|
* use your version of this file under the terms of the MPL, indicate your
|
2003-03-22 02:22:03 +00:00
|
|
|
* 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
|
2004-04-17 21:52:36 +00:00
|
|
|
* the terms of any one of the MPL, the GPL or the LGPL.
|
2003-03-22 02:22:03 +00:00
|
|
|
*
|
|
|
|
* ***** END LICENSE BLOCK ***** */
|
|
|
|
|
|
|
|
#include "nsMediaDocument.h"
|
|
|
|
#include "nsIPluginDocument.h"
|
2006-12-26 17:47:52 +00:00
|
|
|
#include "nsGkAtoms.h"
|
2003-03-22 02:22:03 +00:00
|
|
|
#include "nsIPresShell.h"
|
|
|
|
#include "nsIObjectFrame.h"
|
|
|
|
#include "nsIPluginInstance.h"
|
|
|
|
#include "nsIDocShellTreeItem.h"
|
2004-06-25 12:26:02 +00:00
|
|
|
#include "nsNodeInfoManager.h"
|
2006-05-23 15:33:15 +00:00
|
|
|
#include "nsContentCreatorFunctions.h"
|
2007-08-20 22:55:06 +00:00
|
|
|
#include "nsContentPolicyUtils.h"
|
|
|
|
#include "nsIPropertyBag2.h"
|
2003-03-22 02:22:03 +00:00
|
|
|
|
|
|
|
class nsPluginDocument : public nsMediaDocument,
|
|
|
|
public nsIPluginDocument
|
|
|
|
{
|
|
|
|
public:
|
|
|
|
nsPluginDocument();
|
|
|
|
virtual ~nsPluginDocument();
|
|
|
|
|
2007-08-20 22:55:06 +00:00
|
|
|
NS_DECL_ISUPPORTS_INHERITED
|
2003-03-22 02:22:03 +00:00
|
|
|
NS_DECL_NSIPLUGINDOCUMENT
|
|
|
|
|
2004-01-09 23:54:21 +00:00
|
|
|
virtual nsresult StartDocumentLoad(const char* aCommand,
|
|
|
|
nsIChannel* aChannel,
|
|
|
|
nsILoadGroup* aLoadGroup,
|
|
|
|
nsISupports* aContainer,
|
|
|
|
nsIStreamListener** aDocListener,
|
|
|
|
PRBool aReset = PR_TRUE,
|
|
|
|
nsIContentSink* aSink = nsnull);
|
2003-03-22 02:22:03 +00:00
|
|
|
|
2003-10-22 06:09:48 +00:00
|
|
|
virtual void SetScriptGlobalObject(nsIScriptGlobalObject* aScriptGlobalObject);
|
2005-05-04 20:22:32 +00:00
|
|
|
virtual PRBool CanSavePresentation(nsIRequest *aNewRequest);
|
2003-04-04 00:26:33 +00:00
|
|
|
|
2005-09-21 19:14:30 +00:00
|
|
|
const nsCString& GetType() const { return mMimeType; }
|
|
|
|
nsIContent* GetPluginContent() { return mPluginContent; }
|
|
|
|
|
2008-12-03 14:41:09 +00:00
|
|
|
void AllowNormalInstantiation() {
|
2008-10-07 18:53:23 +00:00
|
|
|
mWillHandleInstantiation = PR_FALSE;
|
|
|
|
}
|
|
|
|
|
2009-01-09 17:54:23 +00:00
|
|
|
void StartLayout() { nsMediaDocument::StartLayout(); }
|
|
|
|
|
2008-12-03 10:30:26 +00:00
|
|
|
NS_DECL_CYCLE_COLLECTION_CLASS_INHERITED(nsPluginDocument, nsMediaDocument)
|
2003-03-22 02:22:03 +00:00
|
|
|
protected:
|
2003-04-13 00:40:26 +00:00
|
|
|
nsresult CreateSyntheticPluginDocument();
|
2003-03-22 02:22:03 +00:00
|
|
|
|
2005-01-12 19:45:38 +00:00
|
|
|
nsCOMPtr<nsIContent> mPluginContent;
|
2003-03-22 02:22:03 +00:00
|
|
|
nsRefPtr<nsMediaDocumentStreamListener> mStreamListener;
|
2003-04-13 00:40:26 +00:00
|
|
|
nsCString mMimeType;
|
2008-10-07 18:53:23 +00:00
|
|
|
|
|
|
|
// Hack to handle the fact that plug-in loading lives in frames and that the
|
|
|
|
// frames may not be around when we need to instantiate. Once plug-in
|
|
|
|
// loading moves to content, this can all go away.
|
|
|
|
PRBool mWillHandleInstantiation;
|
2003-03-22 02:22:03 +00:00
|
|
|
};
|
|
|
|
|
2005-09-21 19:14:30 +00:00
|
|
|
class nsPluginStreamListener : public nsMediaDocumentStreamListener
|
|
|
|
{
|
2009-01-09 17:54:23 +00:00
|
|
|
public:
|
|
|
|
nsPluginStreamListener(nsPluginDocument* doc) :
|
|
|
|
nsMediaDocumentStreamListener(doc), mPluginDoc(doc) {}
|
|
|
|
NS_IMETHOD OnStartRequest(nsIRequest* request, nsISupports *ctxt);
|
|
|
|
private:
|
|
|
|
nsresult SetupPlugin();
|
|
|
|
|
|
|
|
nsRefPtr<nsPluginDocument> mPluginDoc;
|
2005-09-21 19:14:30 +00:00
|
|
|
};
|
|
|
|
|
|
|
|
|
|
|
|
NS_IMETHODIMP
|
|
|
|
nsPluginStreamListener::OnStartRequest(nsIRequest* request, nsISupports *ctxt)
|
|
|
|
{
|
2009-01-09 17:54:23 +00:00
|
|
|
// Have to set up our plugin stuff before we call OnStartRequest, so
|
|
|
|
// that the plugin listener can get that call.
|
|
|
|
nsresult rv = SetupPlugin();
|
|
|
|
|
|
|
|
NS_ASSERTION(NS_FAILED(rv) || mNextStream,
|
|
|
|
"We should have a listener by now");
|
|
|
|
nsresult rv2 = nsMediaDocumentStreamListener::OnStartRequest(request, ctxt);
|
|
|
|
return NS_SUCCEEDED(rv) ? rv2 : rv;
|
|
|
|
}
|
|
|
|
|
|
|
|
nsresult
|
|
|
|
nsPluginStreamListener::SetupPlugin()
|
|
|
|
{
|
|
|
|
NS_ENSURE_TRUE(mDocument, NS_ERROR_FAILURE);
|
|
|
|
mPluginDoc->StartLayout();
|
2005-09-21 19:14:30 +00:00
|
|
|
|
2007-08-02 17:54:36 +00:00
|
|
|
nsCOMPtr<nsIContent> embed = mPluginDoc->GetPluginContent();
|
2005-09-21 19:14:30 +00:00
|
|
|
|
|
|
|
// Now we have a frame for our <embed>, start the load
|
2009-04-24 13:36:58 +00:00
|
|
|
nsCOMPtr<nsIPresShell> shell = mDocument->GetPrimaryShell();
|
2005-09-23 17:35:08 +00:00
|
|
|
if (!shell) {
|
|
|
|
// Can't instantiate w/o a shell
|
2008-12-03 14:41:09 +00:00
|
|
|
mPluginDoc->AllowNormalInstantiation();
|
2005-09-23 17:35:08 +00:00
|
|
|
return NS_BINDING_ABORTED;
|
|
|
|
}
|
|
|
|
|
2007-08-02 17:54:36 +00:00
|
|
|
// Flush out layout before we go to instantiate, because some
|
|
|
|
// plug-ins depend on NPP_SetWindow() being called early enough and
|
|
|
|
// nsObjectFrame does that at the end of reflow.
|
|
|
|
shell->FlushPendingNotifications(Flush_Layout);
|
|
|
|
|
2005-09-23 17:35:08 +00:00
|
|
|
nsIFrame* frame = shell->GetPrimaryFrameFor(embed);
|
2005-09-21 19:14:30 +00:00
|
|
|
if (!frame) {
|
2008-12-03 14:41:09 +00:00
|
|
|
mPluginDoc->AllowNormalInstantiation();
|
2009-01-09 17:54:23 +00:00
|
|
|
return NS_OK;
|
2005-09-21 19:14:30 +00:00
|
|
|
}
|
|
|
|
|
2009-01-12 19:20:59 +00:00
|
|
|
nsIObjectFrame* objFrame = do_QueryFrame(frame);
|
2005-09-21 19:14:30 +00:00
|
|
|
if (!objFrame) {
|
2008-12-03 14:41:09 +00:00
|
|
|
mPluginDoc->AllowNormalInstantiation();
|
2005-09-21 19:14:30 +00:00
|
|
|
return NS_ERROR_UNEXPECTED;
|
|
|
|
}
|
|
|
|
|
2009-01-09 17:54:23 +00:00
|
|
|
nsresult rv = objFrame->Instantiate(mPluginDoc->GetType().get(),
|
|
|
|
mDocument->nsIDocument::GetDocumentURI());
|
2005-09-21 19:14:30 +00:00
|
|
|
if (NS_FAILED(rv)) {
|
|
|
|
return rv;
|
|
|
|
}
|
|
|
|
|
2008-12-03 14:41:09 +00:00
|
|
|
// Now that we're done, allow normal instantiation in the future
|
|
|
|
// (say if there's a reframe of this entire presentation).
|
|
|
|
mPluginDoc->AllowNormalInstantiation();
|
|
|
|
|
2009-01-09 17:54:23 +00:00
|
|
|
return NS_OK;
|
2005-09-21 19:14:30 +00:00
|
|
|
}
|
|
|
|
|
2003-03-26 07:41:30 +00:00
|
|
|
|
|
|
|
// NOTE! nsDocument::operator new() zeroes out all members, so don't
|
|
|
|
// bother initializing members to 0.
|
|
|
|
|
2003-03-22 02:22:03 +00:00
|
|
|
nsPluginDocument::nsPluginDocument()
|
2008-10-07 18:53:23 +00:00
|
|
|
: mWillHandleInstantiation(PR_TRUE)
|
2003-03-22 02:22:03 +00:00
|
|
|
{
|
|
|
|
}
|
2003-03-26 07:41:30 +00:00
|
|
|
|
2003-03-22 02:22:03 +00:00
|
|
|
nsPluginDocument::~nsPluginDocument()
|
|
|
|
{
|
|
|
|
}
|
|
|
|
|
2008-12-03 10:30:26 +00:00
|
|
|
NS_IMPL_CYCLE_COLLECTION_CLASS(nsPluginDocument)
|
|
|
|
|
|
|
|
NS_IMPL_CYCLE_COLLECTION_TRAVERSE_BEGIN_INHERITED(nsPluginDocument, nsMediaDocument)
|
|
|
|
NS_IMPL_CYCLE_COLLECTION_TRAVERSE_NSCOMPTR(mPluginContent)
|
|
|
|
NS_IMPL_CYCLE_COLLECTION_TRAVERSE_END
|
|
|
|
|
|
|
|
NS_IMPL_CYCLE_COLLECTION_UNLINK_BEGIN_INHERITED(nsPluginDocument, nsMediaDocument)
|
|
|
|
NS_IMPL_CYCLE_COLLECTION_UNLINK_NSCOMPTR(mPluginContent)
|
|
|
|
NS_IMPL_CYCLE_COLLECTION_UNLINK_END
|
|
|
|
|
2007-08-20 22:55:06 +00:00
|
|
|
NS_IMPL_ISUPPORTS_INHERITED1(nsPluginDocument, nsMediaDocument,
|
|
|
|
nsIPluginDocument)
|
2003-03-22 02:22:03 +00:00
|
|
|
|
2003-10-22 06:09:48 +00:00
|
|
|
void
|
|
|
|
nsPluginDocument::SetScriptGlobalObject(nsIScriptGlobalObject* aScriptGlobalObject)
|
2003-04-04 00:26:33 +00:00
|
|
|
{
|
|
|
|
if (!aScriptGlobalObject) {
|
|
|
|
mStreamListener = nsnull;
|
|
|
|
}
|
|
|
|
|
2003-10-22 06:09:48 +00:00
|
|
|
nsMediaDocument::SetScriptGlobalObject(aScriptGlobalObject);
|
2003-04-04 00:26:33 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
|
2005-05-04 20:22:32 +00:00
|
|
|
PRBool
|
|
|
|
nsPluginDocument::CanSavePresentation(nsIRequest *aNewRequest)
|
|
|
|
{
|
|
|
|
// Full-page plugins cannot be cached, currently, because we don't have
|
|
|
|
// the stream listener data to feed to the plugin instance.
|
|
|
|
return PR_FALSE;
|
|
|
|
}
|
|
|
|
|
|
|
|
|
2004-01-09 23:54:21 +00:00
|
|
|
nsresult
|
2003-03-22 02:22:03 +00:00
|
|
|
nsPluginDocument::StartDocumentLoad(const char* aCommand,
|
|
|
|
nsIChannel* aChannel,
|
|
|
|
nsILoadGroup* aLoadGroup,
|
|
|
|
nsISupports* aContainer,
|
|
|
|
nsIStreamListener** aDocListener,
|
|
|
|
PRBool aReset,
|
|
|
|
nsIContentSink* aSink)
|
|
|
|
{
|
2003-03-26 07:41:30 +00:00
|
|
|
nsresult rv =
|
|
|
|
nsMediaDocument::StartDocumentLoad(aCommand, aChannel, aLoadGroup,
|
|
|
|
aContainer, aDocListener, aReset,
|
|
|
|
aSink);
|
2003-03-22 02:22:03 +00:00
|
|
|
if (NS_FAILED(rv)) {
|
|
|
|
return rv;
|
|
|
|
}
|
|
|
|
|
2003-04-13 00:40:26 +00:00
|
|
|
rv = aChannel->GetContentType(mMimeType);
|
2003-03-22 02:22:03 +00:00
|
|
|
if (NS_FAILED(rv)) {
|
|
|
|
return rv;
|
|
|
|
}
|
|
|
|
|
|
|
|
// Create synthetic document
|
2003-04-13 00:40:26 +00:00
|
|
|
rv = CreateSyntheticPluginDocument();
|
2003-03-22 02:22:03 +00:00
|
|
|
if (NS_FAILED(rv)) {
|
|
|
|
return rv;
|
|
|
|
}
|
|
|
|
|
2005-09-21 19:14:30 +00:00
|
|
|
mStreamListener = new nsPluginStreamListener(this);
|
|
|
|
if (!mStreamListener) {
|
2003-03-22 02:22:03 +00:00
|
|
|
return NS_ERROR_OUT_OF_MEMORY;
|
2005-09-21 19:14:30 +00:00
|
|
|
}
|
2003-03-22 02:22:03 +00:00
|
|
|
NS_ASSERTION(aDocListener, "null aDocListener");
|
|
|
|
NS_ADDREF(*aDocListener = mStreamListener);
|
|
|
|
|
|
|
|
return rv;
|
|
|
|
}
|
|
|
|
|
2003-03-26 07:41:30 +00:00
|
|
|
nsresult
|
2003-04-13 00:40:26 +00:00
|
|
|
nsPluginDocument::CreateSyntheticPluginDocument()
|
2003-03-22 02:22:03 +00:00
|
|
|
{
|
|
|
|
// do not allow message panes to host full-page plugins
|
|
|
|
// returning an error causes helper apps to take over
|
|
|
|
nsCOMPtr<nsIDocShellTreeItem> dsti (do_QueryReferent(mDocumentContainer));
|
|
|
|
if (dsti) {
|
|
|
|
PRBool isMsgPane = PR_FALSE;
|
|
|
|
dsti->NameEquals(NS_LITERAL_STRING("messagepane").get(), &isMsgPane);
|
2005-09-21 19:14:30 +00:00
|
|
|
if (isMsgPane) {
|
2003-03-22 02:22:03 +00:00
|
|
|
return NS_ERROR_FAILURE;
|
2005-09-21 19:14:30 +00:00
|
|
|
}
|
2003-03-22 02:22:03 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
// make our generic document
|
|
|
|
nsresult rv = nsMediaDocument::CreateSyntheticDocument();
|
|
|
|
NS_ENSURE_SUCCESS(rv, rv);
|
|
|
|
// then attach our plugin
|
|
|
|
|
2007-12-12 02:26:09 +00:00
|
|
|
nsIContent* body = GetBodyContent();
|
2003-03-22 02:22:03 +00:00
|
|
|
if (!body) {
|
|
|
|
NS_WARNING("no body on plugin document!");
|
|
|
|
return NS_ERROR_FAILURE;
|
|
|
|
}
|
|
|
|
|
|
|
|
// remove margins from body
|
2004-02-24 23:55:18 +00:00
|
|
|
NS_NAMED_LITERAL_STRING(zero, "0");
|
2006-12-26 17:47:52 +00:00
|
|
|
body->SetAttr(kNameSpaceID_None, nsGkAtoms::marginwidth, zero, PR_FALSE);
|
|
|
|
body->SetAttr(kNameSpaceID_None, nsGkAtoms::marginheight, zero, PR_FALSE);
|
2003-03-22 02:22:03 +00:00
|
|
|
|
|
|
|
|
|
|
|
// make plugin content
|
|
|
|
nsCOMPtr<nsINodeInfo> nodeInfo;
|
2008-09-12 22:32:18 +00:00
|
|
|
nodeInfo = mNodeInfoManager->GetNodeInfo(nsGkAtoms::embed, nsnull,
|
2009-03-13 08:48:05 +00:00
|
|
|
kNameSpaceID_XHTML);
|
2008-09-25 22:46:52 +00:00
|
|
|
NS_ENSURE_TRUE(nodeInfo, NS_ERROR_OUT_OF_MEMORY);
|
2008-04-17 22:30:51 +00:00
|
|
|
rv = NS_NewHTMLElement(getter_AddRefs(mPluginContent), nodeInfo, PR_FALSE);
|
2006-05-23 15:33:15 +00:00
|
|
|
NS_ENSURE_SUCCESS(rv, rv);
|
2003-03-22 02:22:03 +00:00
|
|
|
|
|
|
|
// make it a named element
|
2006-12-26 17:47:52 +00:00
|
|
|
mPluginContent->SetAttr(kNameSpaceID_None, nsGkAtoms::name,
|
2004-02-24 23:55:18 +00:00
|
|
|
NS_LITERAL_STRING("plugin"), PR_FALSE);
|
2003-03-22 02:22:03 +00:00
|
|
|
|
2004-02-24 23:55:18 +00:00
|
|
|
// fill viewport and auto-resize
|
|
|
|
NS_NAMED_LITERAL_STRING(percent100, "100%");
|
2006-12-26 17:47:52 +00:00
|
|
|
mPluginContent->SetAttr(kNameSpaceID_None, nsGkAtoms::width, percent100,
|
2004-02-24 23:55:18 +00:00
|
|
|
PR_FALSE);
|
2006-12-26 17:47:52 +00:00
|
|
|
mPluginContent->SetAttr(kNameSpaceID_None, nsGkAtoms::height, percent100,
|
2004-02-24 23:55:18 +00:00
|
|
|
PR_FALSE);
|
2003-03-22 02:22:03 +00:00
|
|
|
|
|
|
|
// set URL
|
|
|
|
nsCAutoString src;
|
2004-01-09 23:54:21 +00:00
|
|
|
mDocumentURI->GetSpec(src);
|
2006-12-26 17:47:52 +00:00
|
|
|
mPluginContent->SetAttr(kNameSpaceID_None, nsGkAtoms::src,
|
2004-02-24 23:55:18 +00:00
|
|
|
NS_ConvertUTF8toUTF16(src), PR_FALSE);
|
2003-03-22 02:22:03 +00:00
|
|
|
|
|
|
|
// set mime type
|
2006-12-26 17:47:52 +00:00
|
|
|
mPluginContent->SetAttr(kNameSpaceID_None, nsGkAtoms::type,
|
2004-02-24 23:55:18 +00:00
|
|
|
NS_ConvertUTF8toUTF16(mMimeType), PR_FALSE);
|
2003-03-22 02:22:03 +00:00
|
|
|
|
2005-09-21 19:14:30 +00:00
|
|
|
// This will not start the load because nsObjectLoadingContent checks whether
|
|
|
|
// its document is an nsIPluginDocument
|
2005-04-18 22:58:35 +00:00
|
|
|
body->AppendChildTo(mPluginContent, PR_FALSE);
|
2003-03-22 02:22:03 +00:00
|
|
|
|
|
|
|
return NS_OK;
|
|
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
NS_IMETHODIMP
|
|
|
|
nsPluginDocument::SetStreamListener(nsIStreamListener *aListener)
|
|
|
|
{
|
2005-09-21 19:14:30 +00:00
|
|
|
if (mStreamListener) {
|
2003-03-22 02:22:03 +00:00
|
|
|
mStreamListener->SetStreamListener(aListener);
|
2005-09-21 19:14:30 +00:00
|
|
|
}
|
2003-03-22 02:22:03 +00:00
|
|
|
|
2003-04-13 00:40:26 +00:00
|
|
|
nsMediaDocument::UpdateTitleAndCharset(mMimeType);
|
2003-03-22 02:22:03 +00:00
|
|
|
|
|
|
|
return NS_OK;
|
|
|
|
}
|
|
|
|
|
|
|
|
NS_IMETHODIMP
|
|
|
|
nsPluginDocument::Print()
|
|
|
|
{
|
|
|
|
NS_ENSURE_TRUE(mPluginContent, NS_ERROR_FAILURE);
|
|
|
|
|
2007-05-01 22:24:20 +00:00
|
|
|
nsIPresShell *shell = GetPrimaryShell();
|
2003-09-27 04:18:26 +00:00
|
|
|
if (!shell) {
|
|
|
|
return NS_OK;
|
|
|
|
}
|
2003-03-22 02:22:03 +00:00
|
|
|
|
2005-08-22 22:24:29 +00:00
|
|
|
nsIFrame* frame = shell->GetPrimaryFrameFor(mPluginContent);
|
|
|
|
NS_ENSURE_TRUE(frame, NS_ERROR_FAILURE);
|
2003-03-22 02:22:03 +00:00
|
|
|
|
2009-01-12 19:20:59 +00:00
|
|
|
nsIObjectFrame* objectFrame = do_QueryFrame(frame);
|
2003-09-27 04:18:26 +00:00
|
|
|
if (objectFrame) {
|
|
|
|
nsCOMPtr<nsIPluginInstance> pi;
|
|
|
|
objectFrame->GetPluginInstance(*getter_AddRefs(pi));
|
2003-03-22 02:22:03 +00:00
|
|
|
|
2003-09-27 04:18:26 +00:00
|
|
|
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;
|
2003-03-22 02:22:03 +00:00
|
|
|
|
2003-09-27 04:18:26 +00:00
|
|
|
pi->Print(&npprint);
|
2003-03-22 02:22:03 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
return NS_OK;
|
|
|
|
}
|
|
|
|
|
2008-10-07 18:53:23 +00:00
|
|
|
NS_IMETHODIMP
|
|
|
|
nsPluginDocument::GetWillHandleInstantiation(PRBool* aWillHandle)
|
|
|
|
{
|
|
|
|
*aWillHandle = mWillHandleInstantiation;
|
|
|
|
return NS_OK;
|
|
|
|
}
|
|
|
|
|
2003-03-22 02:22:03 +00:00
|
|
|
nsresult
|
|
|
|
NS_NewPluginDocument(nsIDocument** aResult)
|
|
|
|
{
|
|
|
|
nsPluginDocument* doc = new nsPluginDocument();
|
|
|
|
if (!doc) {
|
|
|
|
return NS_ERROR_OUT_OF_MEMORY;
|
|
|
|
}
|
|
|
|
|
2005-04-28 17:16:19 +00:00
|
|
|
NS_ADDREF(doc);
|
2003-03-22 02:22:03 +00:00
|
|
|
nsresult rv = doc->Init();
|
|
|
|
|
|
|
|
if (NS_FAILED(rv)) {
|
2005-04-28 17:16:19 +00:00
|
|
|
NS_RELEASE(doc);
|
2003-03-22 02:22:03 +00:00
|
|
|
}
|
|
|
|
|
2005-04-28 17:16:19 +00:00
|
|
|
*aResult = doc;
|
2003-03-22 02:22:03 +00:00
|
|
|
|
2005-04-28 17:16:19 +00:00
|
|
|
return rv;
|
2003-03-22 02:22:03 +00:00
|
|
|
}
|