mirror of
https://github.com/mozilla/gecko-dev.git
synced 2025-11-12 14:20:14 +02:00
Changed storage of of the container to hold simply nsISupports as the mContainer instead of nsIContentViewerContainer. Changed calls to QueryCapability to use the nsIInterfaceRequestor::GetInterface(). r=scc
This commit is contained in:
parent
00b82b3c85
commit
131348416b
7 changed files with 107 additions and 97 deletions
|
|
@ -55,6 +55,7 @@
|
||||||
#include "nsIPageSequenceFrame.h"
|
#include "nsIPageSequenceFrame.h"
|
||||||
#include "nsIURL.h"
|
#include "nsIURL.h"
|
||||||
#include "nsIWebShell.h"
|
#include "nsIWebShell.h"
|
||||||
|
#include "nsIInterfaceRequestor.h"
|
||||||
|
|
||||||
|
|
||||||
#include "nsIServiceManager.h"
|
#include "nsIServiceManager.h"
|
||||||
|
|
@ -139,7 +140,7 @@ protected:
|
||||||
// (ie, non owning) references. If you add any members to this
|
// (ie, non owning) references. If you add any members to this
|
||||||
// class, please make the ownership explicit (pinkerton, scc).
|
// class, please make the ownership explicit (pinkerton, scc).
|
||||||
|
|
||||||
nsIContentViewerContainer* mContainer; // [WEAK] it owns me!
|
nsISupports* mContainer; // [WEAK] it owns me!
|
||||||
nsCOMPtr<nsIDeviceContext> mDeviceContext; // ??? can't hurt, but...
|
nsCOMPtr<nsIDeviceContext> mDeviceContext; // ??? can't hurt, but...
|
||||||
nsIView* mView; // [WEAK] cleaned up by view mgr
|
nsIView* mView; // [WEAK] cleaned up by view mgr
|
||||||
|
|
||||||
|
|
@ -309,8 +310,10 @@ DocumentViewerImpl::SetContainer(nsIContentViewerContainer* aContainer)
|
||||||
NS_IMETHODIMP
|
NS_IMETHODIMP
|
||||||
DocumentViewerImpl::GetContainer(nsIContentViewerContainer*& aResult)
|
DocumentViewerImpl::GetContainer(nsIContentViewerContainer*& aResult)
|
||||||
{
|
{
|
||||||
aResult = mContainer;
|
if(mContainer)
|
||||||
NS_IF_ADDREF(aResult);
|
return CallQueryInterface(mContainer, &aResult);
|
||||||
|
else
|
||||||
|
aResult = nsnull;
|
||||||
return NS_OK;
|
return NS_OK;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -341,31 +344,28 @@ DocumentViewerImpl::Init(nsNativeWidget aNativeParent,
|
||||||
makeCX = PR_TRUE;
|
makeCX = PR_TRUE;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (nsnull != mContainer) {
|
nsCOMPtr<nsIInterfaceRequestor> requestor(do_QueryInterface(mContainer));
|
||||||
nsILinkHandler* linkHandler = nsnull;
|
if (requestor) {
|
||||||
mContainer->QueryCapability(kILinkHandlerIID, (void**)&linkHandler);
|
nsCOMPtr<nsILinkHandler> linkHandler;
|
||||||
|
requestor->GetInterface(NS_GET_IID(nsILinkHandler),
|
||||||
|
getter_AddRefs(linkHandler));
|
||||||
mPresContext->SetContainer(mContainer);
|
mPresContext->SetContainer(mContainer);
|
||||||
mPresContext->SetLinkHandler(linkHandler);
|
mPresContext->SetLinkHandler(linkHandler);
|
||||||
NS_IF_RELEASE(linkHandler);
|
|
||||||
|
|
||||||
// Set script-context-owner in the document
|
// Set script-context-owner in the document
|
||||||
nsIScriptContextOwner* owner = nsnull;
|
nsCOMPtr<nsIScriptContextOwner> owner;
|
||||||
mContainer->QueryCapability(kIScriptContextOwnerIID, (void**)&owner);
|
requestor->GetInterface(NS_GET_IID(nsIScriptContextOwner),
|
||||||
|
getter_AddRefs(owner));
|
||||||
if (nsnull != owner) {
|
if (nsnull != owner) {
|
||||||
mDocument->SetScriptContextOwner(owner);
|
mDocument->SetScriptContextOwner(owner);
|
||||||
nsIScriptGlobalObject* global;
|
nsCOMPtr<nsIScriptGlobalObject> global;
|
||||||
rv = owner->GetScriptGlobalObject(&global);
|
rv = owner->GetScriptGlobalObject(getter_AddRefs(global));
|
||||||
if (NS_SUCCEEDED(rv) && (nsnull != global)) {
|
if (NS_SUCCEEDED(rv) && (nsnull != global)) {
|
||||||
nsIDOMDocument *domdoc = nsnull;
|
nsCOMPtr<nsIDOMDocument> domdoc(do_QueryInterface(mDocument));
|
||||||
mDocument->QueryInterface(kIDOMDocumentIID,
|
|
||||||
(void**) &domdoc);
|
|
||||||
if (nsnull != domdoc) {
|
if (nsnull != domdoc) {
|
||||||
global->SetNewDocument(domdoc);
|
global->SetNewDocument(domdoc);
|
||||||
NS_RELEASE(domdoc);
|
|
||||||
}
|
}
|
||||||
NS_RELEASE(global);
|
|
||||||
}
|
}
|
||||||
NS_RELEASE(owner);
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -55,6 +55,7 @@
|
||||||
#include "nsIPageSequenceFrame.h"
|
#include "nsIPageSequenceFrame.h"
|
||||||
#include "nsIURL.h"
|
#include "nsIURL.h"
|
||||||
#include "nsIWebShell.h"
|
#include "nsIWebShell.h"
|
||||||
|
#include "nsIInterfaceRequestor.h"
|
||||||
|
|
||||||
|
|
||||||
#include "nsIServiceManager.h"
|
#include "nsIServiceManager.h"
|
||||||
|
|
@ -139,7 +140,7 @@ protected:
|
||||||
// (ie, non owning) references. If you add any members to this
|
// (ie, non owning) references. If you add any members to this
|
||||||
// class, please make the ownership explicit (pinkerton, scc).
|
// class, please make the ownership explicit (pinkerton, scc).
|
||||||
|
|
||||||
nsIContentViewerContainer* mContainer; // [WEAK] it owns me!
|
nsISupports* mContainer; // [WEAK] it owns me!
|
||||||
nsCOMPtr<nsIDeviceContext> mDeviceContext; // ??? can't hurt, but...
|
nsCOMPtr<nsIDeviceContext> mDeviceContext; // ??? can't hurt, but...
|
||||||
nsIView* mView; // [WEAK] cleaned up by view mgr
|
nsIView* mView; // [WEAK] cleaned up by view mgr
|
||||||
|
|
||||||
|
|
@ -309,8 +310,10 @@ DocumentViewerImpl::SetContainer(nsIContentViewerContainer* aContainer)
|
||||||
NS_IMETHODIMP
|
NS_IMETHODIMP
|
||||||
DocumentViewerImpl::GetContainer(nsIContentViewerContainer*& aResult)
|
DocumentViewerImpl::GetContainer(nsIContentViewerContainer*& aResult)
|
||||||
{
|
{
|
||||||
aResult = mContainer;
|
if(mContainer)
|
||||||
NS_IF_ADDREF(aResult);
|
return CallQueryInterface(mContainer, &aResult);
|
||||||
|
else
|
||||||
|
aResult = nsnull;
|
||||||
return NS_OK;
|
return NS_OK;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -341,31 +344,28 @@ DocumentViewerImpl::Init(nsNativeWidget aNativeParent,
|
||||||
makeCX = PR_TRUE;
|
makeCX = PR_TRUE;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (nsnull != mContainer) {
|
nsCOMPtr<nsIInterfaceRequestor> requestor(do_QueryInterface(mContainer));
|
||||||
nsILinkHandler* linkHandler = nsnull;
|
if (requestor) {
|
||||||
mContainer->QueryCapability(kILinkHandlerIID, (void**)&linkHandler);
|
nsCOMPtr<nsILinkHandler> linkHandler;
|
||||||
|
requestor->GetInterface(NS_GET_IID(nsILinkHandler),
|
||||||
|
getter_AddRefs(linkHandler));
|
||||||
mPresContext->SetContainer(mContainer);
|
mPresContext->SetContainer(mContainer);
|
||||||
mPresContext->SetLinkHandler(linkHandler);
|
mPresContext->SetLinkHandler(linkHandler);
|
||||||
NS_IF_RELEASE(linkHandler);
|
|
||||||
|
|
||||||
// Set script-context-owner in the document
|
// Set script-context-owner in the document
|
||||||
nsIScriptContextOwner* owner = nsnull;
|
nsCOMPtr<nsIScriptContextOwner> owner;
|
||||||
mContainer->QueryCapability(kIScriptContextOwnerIID, (void**)&owner);
|
requestor->GetInterface(NS_GET_IID(nsIScriptContextOwner),
|
||||||
|
getter_AddRefs(owner));
|
||||||
if (nsnull != owner) {
|
if (nsnull != owner) {
|
||||||
mDocument->SetScriptContextOwner(owner);
|
mDocument->SetScriptContextOwner(owner);
|
||||||
nsIScriptGlobalObject* global;
|
nsCOMPtr<nsIScriptGlobalObject> global;
|
||||||
rv = owner->GetScriptGlobalObject(&global);
|
rv = owner->GetScriptGlobalObject(getter_AddRefs(global));
|
||||||
if (NS_SUCCEEDED(rv) && (nsnull != global)) {
|
if (NS_SUCCEEDED(rv) && (nsnull != global)) {
|
||||||
nsIDOMDocument *domdoc = nsnull;
|
nsCOMPtr<nsIDOMDocument> domdoc(do_QueryInterface(mDocument));
|
||||||
mDocument->QueryInterface(kIDOMDocumentIID,
|
|
||||||
(void**) &domdoc);
|
|
||||||
if (nsnull != domdoc) {
|
if (nsnull != domdoc) {
|
||||||
global->SetNewDocument(domdoc);
|
global->SetNewDocument(domdoc);
|
||||||
NS_RELEASE(domdoc);
|
|
||||||
}
|
}
|
||||||
NS_RELEASE(global);
|
|
||||||
}
|
}
|
||||||
NS_RELEASE(owner);
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -55,6 +55,7 @@
|
||||||
#include "nsIPageSequenceFrame.h"
|
#include "nsIPageSequenceFrame.h"
|
||||||
#include "nsIURL.h"
|
#include "nsIURL.h"
|
||||||
#include "nsIWebShell.h"
|
#include "nsIWebShell.h"
|
||||||
|
#include "nsIInterfaceRequestor.h"
|
||||||
|
|
||||||
|
|
||||||
#include "nsIServiceManager.h"
|
#include "nsIServiceManager.h"
|
||||||
|
|
@ -139,7 +140,7 @@ protected:
|
||||||
// (ie, non owning) references. If you add any members to this
|
// (ie, non owning) references. If you add any members to this
|
||||||
// class, please make the ownership explicit (pinkerton, scc).
|
// class, please make the ownership explicit (pinkerton, scc).
|
||||||
|
|
||||||
nsIContentViewerContainer* mContainer; // [WEAK] it owns me!
|
nsISupports* mContainer; // [WEAK] it owns me!
|
||||||
nsCOMPtr<nsIDeviceContext> mDeviceContext; // ??? can't hurt, but...
|
nsCOMPtr<nsIDeviceContext> mDeviceContext; // ??? can't hurt, but...
|
||||||
nsIView* mView; // [WEAK] cleaned up by view mgr
|
nsIView* mView; // [WEAK] cleaned up by view mgr
|
||||||
|
|
||||||
|
|
@ -309,8 +310,10 @@ DocumentViewerImpl::SetContainer(nsIContentViewerContainer* aContainer)
|
||||||
NS_IMETHODIMP
|
NS_IMETHODIMP
|
||||||
DocumentViewerImpl::GetContainer(nsIContentViewerContainer*& aResult)
|
DocumentViewerImpl::GetContainer(nsIContentViewerContainer*& aResult)
|
||||||
{
|
{
|
||||||
aResult = mContainer;
|
if(mContainer)
|
||||||
NS_IF_ADDREF(aResult);
|
return CallQueryInterface(mContainer, &aResult);
|
||||||
|
else
|
||||||
|
aResult = nsnull;
|
||||||
return NS_OK;
|
return NS_OK;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -341,31 +344,28 @@ DocumentViewerImpl::Init(nsNativeWidget aNativeParent,
|
||||||
makeCX = PR_TRUE;
|
makeCX = PR_TRUE;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (nsnull != mContainer) {
|
nsCOMPtr<nsIInterfaceRequestor> requestor(do_QueryInterface(mContainer));
|
||||||
nsILinkHandler* linkHandler = nsnull;
|
if (requestor) {
|
||||||
mContainer->QueryCapability(kILinkHandlerIID, (void**)&linkHandler);
|
nsCOMPtr<nsILinkHandler> linkHandler;
|
||||||
|
requestor->GetInterface(NS_GET_IID(nsILinkHandler),
|
||||||
|
getter_AddRefs(linkHandler));
|
||||||
mPresContext->SetContainer(mContainer);
|
mPresContext->SetContainer(mContainer);
|
||||||
mPresContext->SetLinkHandler(linkHandler);
|
mPresContext->SetLinkHandler(linkHandler);
|
||||||
NS_IF_RELEASE(linkHandler);
|
|
||||||
|
|
||||||
// Set script-context-owner in the document
|
// Set script-context-owner in the document
|
||||||
nsIScriptContextOwner* owner = nsnull;
|
nsCOMPtr<nsIScriptContextOwner> owner;
|
||||||
mContainer->QueryCapability(kIScriptContextOwnerIID, (void**)&owner);
|
requestor->GetInterface(NS_GET_IID(nsIScriptContextOwner),
|
||||||
|
getter_AddRefs(owner));
|
||||||
if (nsnull != owner) {
|
if (nsnull != owner) {
|
||||||
mDocument->SetScriptContextOwner(owner);
|
mDocument->SetScriptContextOwner(owner);
|
||||||
nsIScriptGlobalObject* global;
|
nsCOMPtr<nsIScriptGlobalObject> global;
|
||||||
rv = owner->GetScriptGlobalObject(&global);
|
rv = owner->GetScriptGlobalObject(getter_AddRefs(global));
|
||||||
if (NS_SUCCEEDED(rv) && (nsnull != global)) {
|
if (NS_SUCCEEDED(rv) && (nsnull != global)) {
|
||||||
nsIDOMDocument *domdoc = nsnull;
|
nsCOMPtr<nsIDOMDocument> domdoc(do_QueryInterface(mDocument));
|
||||||
mDocument->QueryInterface(kIDOMDocumentIID,
|
|
||||||
(void**) &domdoc);
|
|
||||||
if (nsnull != domdoc) {
|
if (nsnull != domdoc) {
|
||||||
global->SetNewDocument(domdoc);
|
global->SetNewDocument(domdoc);
|
||||||
NS_RELEASE(domdoc);
|
|
||||||
}
|
}
|
||||||
NS_RELEASE(global);
|
|
||||||
}
|
}
|
||||||
NS_RELEASE(owner);
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -19,6 +19,7 @@
|
||||||
*
|
*
|
||||||
* Contributor(s):
|
* Contributor(s):
|
||||||
*/
|
*/
|
||||||
|
#include "nsCOMPtr.h"
|
||||||
#include "nscore.h"
|
#include "nscore.h"
|
||||||
#include "nsCRT.h"
|
#include "nsCRT.h"
|
||||||
#include "nsIContentViewer.h"
|
#include "nsIContentViewer.h"
|
||||||
|
|
@ -36,6 +37,7 @@
|
||||||
#include "nsIBrowserWindow.h"
|
#include "nsIBrowserWindow.h"
|
||||||
#include "nsIContent.h"
|
#include "nsIContent.h"
|
||||||
#include "nsIDocument.h"
|
#include "nsIDocument.h"
|
||||||
|
#include "nsIInterfaceRequestor.h"
|
||||||
|
|
||||||
// Class IDs
|
// Class IDs
|
||||||
static NS_DEFINE_IID(kChildWindowCID, NS_CHILD_CID);
|
static NS_DEFINE_IID(kChildWindowCID, NS_CHILD_CID);
|
||||||
|
|
@ -159,7 +161,7 @@ public:
|
||||||
|
|
||||||
nsIWidget* mWindow;
|
nsIWidget* mWindow;
|
||||||
nsIDocument* mDocument;
|
nsIDocument* mDocument;
|
||||||
nsIContentViewerContainer* mContainer;
|
nsCOMPtr<nsISupports> mContainer;
|
||||||
nsIChannel* mChannel;
|
nsIChannel* mChannel;
|
||||||
pluginInstanceOwner *mOwner;
|
pluginInstanceOwner *mOwner;
|
||||||
PRBool mEnableRendering;
|
PRBool mEnableRendering;
|
||||||
|
|
@ -236,7 +238,6 @@ PluginViewerImpl::~PluginViewerImpl()
|
||||||
NS_RELEASE(mWindow);
|
NS_RELEASE(mWindow);
|
||||||
}
|
}
|
||||||
NS_IF_RELEASE(mDocument);
|
NS_IF_RELEASE(mDocument);
|
||||||
NS_IF_RELEASE(mContainer);
|
|
||||||
NS_IF_RELEASE(mChannel);
|
NS_IF_RELEASE(mChannel);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -258,17 +259,17 @@ PluginViewerImpl::BindToDocument(nsISupports *aDoc, const char *aCommand)
|
||||||
NS_IMETHODIMP
|
NS_IMETHODIMP
|
||||||
PluginViewerImpl::SetContainer(nsIContentViewerContainer* aContainer)
|
PluginViewerImpl::SetContainer(nsIContentViewerContainer* aContainer)
|
||||||
{
|
{
|
||||||
NS_IF_RELEASE(mContainer);
|
|
||||||
mContainer = aContainer;
|
mContainer = aContainer;
|
||||||
NS_IF_ADDREF(mContainer);
|
|
||||||
return NS_OK;
|
return NS_OK;
|
||||||
}
|
}
|
||||||
|
|
||||||
NS_IMETHODIMP
|
NS_IMETHODIMP
|
||||||
PluginViewerImpl::GetContainer(nsIContentViewerContainer*& aResult)
|
PluginViewerImpl::GetContainer(nsIContentViewerContainer*& aResult)
|
||||||
{
|
{
|
||||||
aResult = mContainer;
|
if(mContainer)
|
||||||
NS_IF_ADDREF(mContainer);
|
return CallQueryInterface(mContainer, &aResult);
|
||||||
|
else
|
||||||
|
aResult = nsnull;
|
||||||
return NS_OK;
|
return NS_OK;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -308,13 +309,16 @@ PluginViewerImpl::StartLoad(nsIChannel* channel, nsIStreamListener*& aResult)
|
||||||
aResult = nsnull;
|
aResult = nsnull;
|
||||||
|
|
||||||
// Only instantiate the plugin if our container can host it
|
// Only instantiate the plugin if our container can host it
|
||||||
nsIPluginHost* host;
|
nsCOMPtr<nsIPluginHost> host;
|
||||||
nsresult rv = mContainer->QueryCapability(kIPluginHostIID, (void **)&host);
|
nsCOMPtr<nsIInterfaceRequestor> requestor(do_QueryInterface(mContainer));
|
||||||
|
NS_ENSURE_TRUE(requestor, NS_ERROR_FAILURE);
|
||||||
|
|
||||||
|
nsresult rv = requestor->GetInterface(NS_GET_IID(nsIPluginHost),
|
||||||
|
getter_AddRefs(host));
|
||||||
if (NS_OK == rv) {
|
if (NS_OK == rv) {
|
||||||
nsRect r;
|
nsRect r;
|
||||||
mWindow->GetClientBounds(r);
|
mWindow->GetClientBounds(r);
|
||||||
rv = CreatePlugin(host, nsRect(0, 0, r.width, r.height), aResult);
|
rv = CreatePlugin(host, nsRect(0, 0, r.width, r.height), aResult);
|
||||||
NS_RELEASE(host);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
return rv;
|
return rv;
|
||||||
|
|
|
||||||
|
|
@ -19,6 +19,7 @@
|
||||||
*
|
*
|
||||||
* Contributor(s):
|
* Contributor(s):
|
||||||
*/
|
*/
|
||||||
|
#include "nsCOMPtr.h"
|
||||||
#include "nscore.h"
|
#include "nscore.h"
|
||||||
#include "nsCRT.h"
|
#include "nsCRT.h"
|
||||||
#include "nsIContentViewer.h"
|
#include "nsIContentViewer.h"
|
||||||
|
|
@ -36,6 +37,7 @@
|
||||||
#include "nsIBrowserWindow.h"
|
#include "nsIBrowserWindow.h"
|
||||||
#include "nsIContent.h"
|
#include "nsIContent.h"
|
||||||
#include "nsIDocument.h"
|
#include "nsIDocument.h"
|
||||||
|
#include "nsIInterfaceRequestor.h"
|
||||||
|
|
||||||
// Class IDs
|
// Class IDs
|
||||||
static NS_DEFINE_IID(kChildWindowCID, NS_CHILD_CID);
|
static NS_DEFINE_IID(kChildWindowCID, NS_CHILD_CID);
|
||||||
|
|
@ -159,7 +161,7 @@ public:
|
||||||
|
|
||||||
nsIWidget* mWindow;
|
nsIWidget* mWindow;
|
||||||
nsIDocument* mDocument;
|
nsIDocument* mDocument;
|
||||||
nsIContentViewerContainer* mContainer;
|
nsCOMPtr<nsISupports> mContainer;
|
||||||
nsIChannel* mChannel;
|
nsIChannel* mChannel;
|
||||||
pluginInstanceOwner *mOwner;
|
pluginInstanceOwner *mOwner;
|
||||||
PRBool mEnableRendering;
|
PRBool mEnableRendering;
|
||||||
|
|
@ -236,7 +238,6 @@ PluginViewerImpl::~PluginViewerImpl()
|
||||||
NS_RELEASE(mWindow);
|
NS_RELEASE(mWindow);
|
||||||
}
|
}
|
||||||
NS_IF_RELEASE(mDocument);
|
NS_IF_RELEASE(mDocument);
|
||||||
NS_IF_RELEASE(mContainer);
|
|
||||||
NS_IF_RELEASE(mChannel);
|
NS_IF_RELEASE(mChannel);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -258,17 +259,17 @@ PluginViewerImpl::BindToDocument(nsISupports *aDoc, const char *aCommand)
|
||||||
NS_IMETHODIMP
|
NS_IMETHODIMP
|
||||||
PluginViewerImpl::SetContainer(nsIContentViewerContainer* aContainer)
|
PluginViewerImpl::SetContainer(nsIContentViewerContainer* aContainer)
|
||||||
{
|
{
|
||||||
NS_IF_RELEASE(mContainer);
|
|
||||||
mContainer = aContainer;
|
mContainer = aContainer;
|
||||||
NS_IF_ADDREF(mContainer);
|
|
||||||
return NS_OK;
|
return NS_OK;
|
||||||
}
|
}
|
||||||
|
|
||||||
NS_IMETHODIMP
|
NS_IMETHODIMP
|
||||||
PluginViewerImpl::GetContainer(nsIContentViewerContainer*& aResult)
|
PluginViewerImpl::GetContainer(nsIContentViewerContainer*& aResult)
|
||||||
{
|
{
|
||||||
aResult = mContainer;
|
if(mContainer)
|
||||||
NS_IF_ADDREF(mContainer);
|
return CallQueryInterface(mContainer, &aResult);
|
||||||
|
else
|
||||||
|
aResult = nsnull;
|
||||||
return NS_OK;
|
return NS_OK;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -308,13 +309,16 @@ PluginViewerImpl::StartLoad(nsIChannel* channel, nsIStreamListener*& aResult)
|
||||||
aResult = nsnull;
|
aResult = nsnull;
|
||||||
|
|
||||||
// Only instantiate the plugin if our container can host it
|
// Only instantiate the plugin if our container can host it
|
||||||
nsIPluginHost* host;
|
nsCOMPtr<nsIPluginHost> host;
|
||||||
nsresult rv = mContainer->QueryCapability(kIPluginHostIID, (void **)&host);
|
nsCOMPtr<nsIInterfaceRequestor> requestor(do_QueryInterface(mContainer));
|
||||||
|
NS_ENSURE_TRUE(requestor, NS_ERROR_FAILURE);
|
||||||
|
|
||||||
|
nsresult rv = requestor->GetInterface(NS_GET_IID(nsIPluginHost),
|
||||||
|
getter_AddRefs(host));
|
||||||
if (NS_OK == rv) {
|
if (NS_OK == rv) {
|
||||||
nsRect r;
|
nsRect r;
|
||||||
mWindow->GetClientBounds(r);
|
mWindow->GetClientBounds(r);
|
||||||
rv = CreatePlugin(host, nsRect(0, 0, r.width, r.height), aResult);
|
rv = CreatePlugin(host, nsRect(0, 0, r.width, r.height), aResult);
|
||||||
NS_RELEASE(host);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
return rv;
|
return rv;
|
||||||
|
|
|
||||||
|
|
@ -19,6 +19,7 @@
|
||||||
*
|
*
|
||||||
* Contributor(s):
|
* Contributor(s):
|
||||||
*/
|
*/
|
||||||
|
#include "nsCOMPtr.h"
|
||||||
#include "nscore.h"
|
#include "nscore.h"
|
||||||
#include "nsCRT.h"
|
#include "nsCRT.h"
|
||||||
#include "nsIContentViewer.h"
|
#include "nsIContentViewer.h"
|
||||||
|
|
@ -36,6 +37,7 @@
|
||||||
#include "nsIBrowserWindow.h"
|
#include "nsIBrowserWindow.h"
|
||||||
#include "nsIContent.h"
|
#include "nsIContent.h"
|
||||||
#include "nsIDocument.h"
|
#include "nsIDocument.h"
|
||||||
|
#include "nsIInterfaceRequestor.h"
|
||||||
|
|
||||||
// Class IDs
|
// Class IDs
|
||||||
static NS_DEFINE_IID(kChildWindowCID, NS_CHILD_CID);
|
static NS_DEFINE_IID(kChildWindowCID, NS_CHILD_CID);
|
||||||
|
|
@ -159,7 +161,7 @@ public:
|
||||||
|
|
||||||
nsIWidget* mWindow;
|
nsIWidget* mWindow;
|
||||||
nsIDocument* mDocument;
|
nsIDocument* mDocument;
|
||||||
nsIContentViewerContainer* mContainer;
|
nsCOMPtr<nsISupports> mContainer;
|
||||||
nsIChannel* mChannel;
|
nsIChannel* mChannel;
|
||||||
pluginInstanceOwner *mOwner;
|
pluginInstanceOwner *mOwner;
|
||||||
PRBool mEnableRendering;
|
PRBool mEnableRendering;
|
||||||
|
|
@ -236,7 +238,6 @@ PluginViewerImpl::~PluginViewerImpl()
|
||||||
NS_RELEASE(mWindow);
|
NS_RELEASE(mWindow);
|
||||||
}
|
}
|
||||||
NS_IF_RELEASE(mDocument);
|
NS_IF_RELEASE(mDocument);
|
||||||
NS_IF_RELEASE(mContainer);
|
|
||||||
NS_IF_RELEASE(mChannel);
|
NS_IF_RELEASE(mChannel);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -258,17 +259,17 @@ PluginViewerImpl::BindToDocument(nsISupports *aDoc, const char *aCommand)
|
||||||
NS_IMETHODIMP
|
NS_IMETHODIMP
|
||||||
PluginViewerImpl::SetContainer(nsIContentViewerContainer* aContainer)
|
PluginViewerImpl::SetContainer(nsIContentViewerContainer* aContainer)
|
||||||
{
|
{
|
||||||
NS_IF_RELEASE(mContainer);
|
|
||||||
mContainer = aContainer;
|
mContainer = aContainer;
|
||||||
NS_IF_ADDREF(mContainer);
|
|
||||||
return NS_OK;
|
return NS_OK;
|
||||||
}
|
}
|
||||||
|
|
||||||
NS_IMETHODIMP
|
NS_IMETHODIMP
|
||||||
PluginViewerImpl::GetContainer(nsIContentViewerContainer*& aResult)
|
PluginViewerImpl::GetContainer(nsIContentViewerContainer*& aResult)
|
||||||
{
|
{
|
||||||
aResult = mContainer;
|
if(mContainer)
|
||||||
NS_IF_ADDREF(mContainer);
|
return CallQueryInterface(mContainer, &aResult);
|
||||||
|
else
|
||||||
|
aResult = nsnull;
|
||||||
return NS_OK;
|
return NS_OK;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -308,13 +309,16 @@ PluginViewerImpl::StartLoad(nsIChannel* channel, nsIStreamListener*& aResult)
|
||||||
aResult = nsnull;
|
aResult = nsnull;
|
||||||
|
|
||||||
// Only instantiate the plugin if our container can host it
|
// Only instantiate the plugin if our container can host it
|
||||||
nsIPluginHost* host;
|
nsCOMPtr<nsIPluginHost> host;
|
||||||
nsresult rv = mContainer->QueryCapability(kIPluginHostIID, (void **)&host);
|
nsCOMPtr<nsIInterfaceRequestor> requestor(do_QueryInterface(mContainer));
|
||||||
|
NS_ENSURE_TRUE(requestor, NS_ERROR_FAILURE);
|
||||||
|
|
||||||
|
nsresult rv = requestor->GetInterface(NS_GET_IID(nsIPluginHost),
|
||||||
|
getter_AddRefs(host));
|
||||||
if (NS_OK == rv) {
|
if (NS_OK == rv) {
|
||||||
nsRect r;
|
nsRect r;
|
||||||
mWindow->GetClientBounds(r);
|
mWindow->GetClientBounds(r);
|
||||||
rv = CreatePlugin(host, nsRect(0, 0, r.width, r.height), aResult);
|
rv = CreatePlugin(host, nsRect(0, 0, r.width, r.height), aResult);
|
||||||
NS_RELEASE(host);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
return rv;
|
return rv;
|
||||||
|
|
|
||||||
|
|
@ -56,6 +56,7 @@
|
||||||
#include "nsVoidArray.h"
|
#include "nsVoidArray.h"
|
||||||
#include "nsXPIDLString.h"
|
#include "nsXPIDLString.h"
|
||||||
#include "rdf.h"
|
#include "rdf.h"
|
||||||
|
#include "nsIInterfaceRequestor.h"
|
||||||
|
|
||||||
|
|
||||||
////////////////////////////////////////////////////////////////////////
|
////////////////////////////////////////////////////////////////////////
|
||||||
|
|
@ -83,19 +84,19 @@ protected:
|
||||||
// in the script context _after_ the XUL doc has been embedded into
|
// in the script context _after_ the XUL doc has been embedded into
|
||||||
// content viewer. We'll know that this has happened once we receive
|
// content viewer. We'll know that this has happened once we receive
|
||||||
// an OnStartRequest() notification
|
// an OnStartRequest() notification
|
||||||
nsIContentViewerContainer* mContainer; // [WEAK]
|
nsISupports* mContainer; // [WEAK]
|
||||||
|
|
||||||
nsCString mBaseURL;
|
nsCString mBaseURL;
|
||||||
|
|
||||||
nsCOMPtr<nsIRDFDataSource> mDataSource;
|
nsCOMPtr<nsIRDFDataSource> mDataSource;
|
||||||
|
|
||||||
nsHTTPIndex(nsIContentViewerContainer* aContainer);
|
nsHTTPIndex(nsISupports* aContainer);
|
||||||
nsresult Init(nsIURI* aBaseURL);
|
nsresult Init(nsIURI* aBaseURL);
|
||||||
virtual ~nsHTTPIndex();
|
virtual ~nsHTTPIndex();
|
||||||
|
|
||||||
public:
|
public:
|
||||||
|
|
||||||
static nsresult Create(nsIURI* aBaseURI, nsIContentViewerContainer* aContainer, nsIHTTPIndex** aResult);
|
static nsresult Create(nsIURI* aBaseURI, nsISupports* aContainer, nsIHTTPIndex** aResult);
|
||||||
|
|
||||||
// nsISupports interface
|
// nsISupports interface
|
||||||
NS_DECL_ISUPPORTS
|
NS_DECL_ISUPPORTS
|
||||||
|
|
@ -150,7 +151,7 @@ protected:
|
||||||
|
|
||||||
nsVoidArray mFormat;
|
nsVoidArray mFormat;
|
||||||
|
|
||||||
nsHTTPIndexParser(nsHTTPIndex* aHTTPIndex, nsIContentViewerContainer* aContainer);
|
nsHTTPIndexParser(nsHTTPIndex* aHTTPIndex, nsISupports* aContainer);
|
||||||
nsresult Init();
|
nsresult Init();
|
||||||
|
|
||||||
virtual ~nsHTTPIndexParser();
|
virtual ~nsHTTPIndexParser();
|
||||||
|
|
@ -159,11 +160,11 @@ protected:
|
||||||
// the global object when we get an OnStartRequest() notification
|
// the global object when we get an OnStartRequest() notification
|
||||||
// (at this point, we'll know that the XUL document has been
|
// (at this point, we'll know that the XUL document has been
|
||||||
// embedded and the global object won't get clobbered.
|
// embedded and the global object won't get clobbered.
|
||||||
nsIContentViewerContainer* mContainer;
|
nsISupports* mContainer;
|
||||||
|
|
||||||
public:
|
public:
|
||||||
static nsresult Create(nsHTTPIndex* aHTTPIndex,
|
static nsresult Create(nsHTTPIndex* aHTTPIndex,
|
||||||
nsIContentViewerContainer* aContainer,
|
nsISupports* aContainer,
|
||||||
nsIStreamListener** aResult);
|
nsIStreamListener** aResult);
|
||||||
|
|
||||||
NS_DECL_ISUPPORTS
|
NS_DECL_ISUPPORTS
|
||||||
|
|
@ -190,9 +191,7 @@ nsHTTPIndexParser::gFieldTable[] = {
|
||||||
{ nsnull, nsHTTPIndexParser::ParseLiteral, nsnull },
|
{ nsnull, nsHTTPIndexParser::ParseLiteral, nsnull },
|
||||||
};
|
};
|
||||||
|
|
||||||
|
nsHTTPIndexParser::nsHTTPIndexParser(nsHTTPIndex* aHTTPIndex, nsISupports* aContainer)
|
||||||
|
|
||||||
nsHTTPIndexParser::nsHTTPIndexParser(nsHTTPIndex* aHTTPIndex, nsIContentViewerContainer* aContainer)
|
|
||||||
: mHTTPIndex(aHTTPIndex),
|
: mHTTPIndex(aHTTPIndex),
|
||||||
mContainer(aContainer)
|
mContainer(aContainer)
|
||||||
{
|
{
|
||||||
|
|
@ -267,7 +266,7 @@ nsHTTPIndexParser::~nsHTTPIndexParser()
|
||||||
|
|
||||||
nsresult
|
nsresult
|
||||||
nsHTTPIndexParser::Create(nsHTTPIndex* aHTTPIndex,
|
nsHTTPIndexParser::Create(nsHTTPIndex* aHTTPIndex,
|
||||||
nsIContentViewerContainer* aContainer,
|
nsISupports* aContainer,
|
||||||
nsIStreamListener** aResult)
|
nsIStreamListener** aResult)
|
||||||
{
|
{
|
||||||
NS_PRECONDITION(aHTTPIndex != nsnull, "null ptr");
|
NS_PRECONDITION(aHTTPIndex != nsnull, "null ptr");
|
||||||
|
|
@ -323,7 +322,8 @@ nsHTTPIndexParser::OnStartRequest(nsIChannel* aChannel, nsISupports* aContext)
|
||||||
{
|
{
|
||||||
nsresult rv;
|
nsresult rv;
|
||||||
|
|
||||||
if (mContainer) {
|
nsCOMPtr<nsIInterfaceRequestor> requestor(do_QueryInterface(mContainer));
|
||||||
|
if (requestor) {
|
||||||
// We need to undo the AddRef() on the nsHTTPIndex object that
|
// We need to undo the AddRef() on the nsHTTPIndex object that
|
||||||
// happened in nsDirectoryViewerFactory::CreateInstance(). We'll
|
// happened in nsDirectoryViewerFactory::CreateInstance(). We'll
|
||||||
// stuff it into an nsCOMPtr (because we _know_ it'll get release
|
// stuff it into an nsCOMPtr (because we _know_ it'll get release
|
||||||
|
|
@ -335,7 +335,7 @@ nsHTTPIndexParser::OnStartRequest(nsIChannel* aChannel, nsISupports* aContext)
|
||||||
|
|
||||||
// Now get the content viewer container's script object.
|
// Now get the content viewer container's script object.
|
||||||
nsCOMPtr<nsIScriptContextOwner> contextowner;
|
nsCOMPtr<nsIScriptContextOwner> contextowner;
|
||||||
rv = mContainer->QueryCapability(nsCOMTypeInfo<nsIScriptContextOwner>::GetIID(),
|
rv = requestor->GetInterface(NS_GET_IID(nsIScriptContextOwner),
|
||||||
getter_AddRefs(contextowner));
|
getter_AddRefs(contextowner));
|
||||||
|
|
||||||
NS_ASSERTION(NS_SUCCEEDED(rv), "unable to get script context owner from document");
|
NS_ASSERTION(NS_SUCCEEDED(rv), "unable to get script context owner from document");
|
||||||
|
|
@ -802,9 +802,7 @@ nsHTTPIndexParser::ParseInt(nsIRDFResource *arc, nsString& aValue, nsIRDFNode**
|
||||||
////////////////////////////////////////////////////////////////////////
|
////////////////////////////////////////////////////////////////////////
|
||||||
// nsHTTPIndex implementation
|
// nsHTTPIndex implementation
|
||||||
|
|
||||||
|
nsHTTPIndex::nsHTTPIndex(nsISupports* aContainer)
|
||||||
|
|
||||||
nsHTTPIndex::nsHTTPIndex(nsIContentViewerContainer* aContainer)
|
|
||||||
: mContainer(aContainer)
|
: mContainer(aContainer)
|
||||||
{
|
{
|
||||||
NS_INIT_REFCNT();
|
NS_INIT_REFCNT();
|
||||||
|
|
@ -839,7 +837,7 @@ nsHTTPIndex::Init(nsIURI* aBaseURL)
|
||||||
|
|
||||||
|
|
||||||
nsresult
|
nsresult
|
||||||
nsHTTPIndex::Create(nsIURI* aBaseURL, nsIContentViewerContainer* aContainer, nsIHTTPIndex** aResult)
|
nsHTTPIndex::Create(nsIURI* aBaseURL, nsISupports* aContainer, nsIHTTPIndex** aResult)
|
||||||
{
|
{
|
||||||
nsHTTPIndex* result = new nsHTTPIndex(aContainer);
|
nsHTTPIndex* result = new nsHTTPIndex(aContainer);
|
||||||
if (! result)
|
if (! result)
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue