зеркало из https://github.com/mozilla/gecko-dev.git
Reflect changes to nsIContentViewer::SetContainer and GetContainer API. r=pavlov
This commit is contained in:
Родитель
9eb64e3cf9
Коммит
d855c6540f
|
@ -90,8 +90,8 @@ public:
|
|||
const nsRect& aBounds,
|
||||
nsScrollPreference aScrolling = nsScrollPreference_kAuto);
|
||||
NS_IMETHOD BindToDocument(nsISupports* aDoc, const char* aCommand);
|
||||
NS_IMETHOD SetContainer(nsIContentViewerContainer* aContainer);
|
||||
NS_IMETHOD GetContainer(nsIContentViewerContainer*& aContainerResult);
|
||||
NS_IMETHOD SetContainer(nsISupports* aContainer);
|
||||
NS_IMETHOD GetContainer(nsISupports** aContainerResult);
|
||||
NS_IMETHOD Stop(void);
|
||||
NS_IMETHOD GetBounds(nsRect& aResult);
|
||||
NS_IMETHOD SetBounds(const nsRect& aBounds);
|
||||
|
@ -298,7 +298,7 @@ DocumentViewerImpl::BindToDocument(nsISupports *aDoc, const char *aCommand)
|
|||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
DocumentViewerImpl::SetContainer(nsIContentViewerContainer* aContainer)
|
||||
DocumentViewerImpl::SetContainer(nsISupports* aContainer)
|
||||
{
|
||||
mContainer = aContainer;
|
||||
if (mPresContext) {
|
||||
|
@ -308,12 +308,13 @@ DocumentViewerImpl::SetContainer(nsIContentViewerContainer* aContainer)
|
|||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
DocumentViewerImpl::GetContainer(nsIContentViewerContainer*& aResult)
|
||||
DocumentViewerImpl::GetContainer(nsISupports** aResult)
|
||||
{
|
||||
if(mContainer)
|
||||
return mContainer->QueryInterface( nsIContentViewerContainer::GetIID(), (void**)&aResult );
|
||||
else
|
||||
aResult = nsnull;
|
||||
NS_ENSURE_ARG_POINTER(aResult);
|
||||
|
||||
*aResult = mContainer;
|
||||
NS_IF_ADDREF(*aResult);
|
||||
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
|
@ -520,7 +521,6 @@ static NS_DEFINE_IID(kDeviceContextSpecFactoryCID, NS_DEVICE_CONTEXT_SPEC_FACTOR
|
|||
NS_IMETHODIMP
|
||||
DocumentViewerImpl::Print(void)
|
||||
{
|
||||
nsCOMPtr<nsIContentViewerContainer> containerResult;
|
||||
nsCOMPtr<nsIWebShell> webContainer;
|
||||
nsCOMPtr<nsIDeviceContextSpecFactory> factory;
|
||||
PRInt32 width,height;
|
||||
|
@ -550,8 +550,7 @@ nsCOMPtr<nsIPref> prefs;
|
|||
NS_RELEASE(devspec);
|
||||
|
||||
// Get the webshell for this documentviewer
|
||||
rv = this->GetContainer(*getter_AddRefs(containerResult));
|
||||
webContainer = do_QueryInterface(containerResult);
|
||||
webContainer = do_QueryInterface(mContainer);
|
||||
if(webContainer) {
|
||||
// load the document and do the initial reflow on the entire document
|
||||
rv = NS_NewPrintContext(&mPrintPC);
|
||||
|
@ -1012,13 +1011,9 @@ void PR_CALLBACK DocumentViewerImpl::DestroyPLEvent(PLEvent* aEvent)
|
|||
|
||||
void DocumentViewerImpl::DocumentReadyForPrinting()
|
||||
{
|
||||
nsresult rv;
|
||||
|
||||
nsCOMPtr<nsIContentViewerContainer> containerResult;
|
||||
nsCOMPtr<nsIWebShell> webContainer;
|
||||
|
||||
rv = this->GetContainer(*getter_AddRefs(containerResult));
|
||||
webContainer = do_QueryInterface(containerResult);
|
||||
webContainer = do_QueryInterface(mContainer);
|
||||
if(webContainer) {
|
||||
//
|
||||
// Remove ourselves as an image group observer...
|
||||
|
|
|
@ -90,8 +90,8 @@ public:
|
|||
const nsRect& aBounds,
|
||||
nsScrollPreference aScrolling = nsScrollPreference_kAuto);
|
||||
NS_IMETHOD BindToDocument(nsISupports* aDoc, const char* aCommand);
|
||||
NS_IMETHOD SetContainer(nsIContentViewerContainer* aContainer);
|
||||
NS_IMETHOD GetContainer(nsIContentViewerContainer*& aContainerResult);
|
||||
NS_IMETHOD SetContainer(nsISupports* aContainer);
|
||||
NS_IMETHOD GetContainer(nsISupports** aContainerResult);
|
||||
NS_IMETHOD Stop(void);
|
||||
NS_IMETHOD GetBounds(nsRect& aResult);
|
||||
NS_IMETHOD SetBounds(const nsRect& aBounds);
|
||||
|
@ -298,7 +298,7 @@ DocumentViewerImpl::BindToDocument(nsISupports *aDoc, const char *aCommand)
|
|||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
DocumentViewerImpl::SetContainer(nsIContentViewerContainer* aContainer)
|
||||
DocumentViewerImpl::SetContainer(nsISupports* aContainer)
|
||||
{
|
||||
mContainer = aContainer;
|
||||
if (mPresContext) {
|
||||
|
@ -308,12 +308,13 @@ DocumentViewerImpl::SetContainer(nsIContentViewerContainer* aContainer)
|
|||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
DocumentViewerImpl::GetContainer(nsIContentViewerContainer*& aResult)
|
||||
DocumentViewerImpl::GetContainer(nsISupports** aResult)
|
||||
{
|
||||
if(mContainer)
|
||||
return mContainer->QueryInterface( nsIContentViewerContainer::GetIID(), (void**)&aResult );
|
||||
else
|
||||
aResult = nsnull;
|
||||
NS_ENSURE_ARG_POINTER(aResult);
|
||||
|
||||
*aResult = mContainer;
|
||||
NS_IF_ADDREF(*aResult);
|
||||
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
|
@ -520,7 +521,6 @@ static NS_DEFINE_IID(kDeviceContextSpecFactoryCID, NS_DEVICE_CONTEXT_SPEC_FACTOR
|
|||
NS_IMETHODIMP
|
||||
DocumentViewerImpl::Print(void)
|
||||
{
|
||||
nsCOMPtr<nsIContentViewerContainer> containerResult;
|
||||
nsCOMPtr<nsIWebShell> webContainer;
|
||||
nsCOMPtr<nsIDeviceContextSpecFactory> factory;
|
||||
PRInt32 width,height;
|
||||
|
@ -550,8 +550,7 @@ nsCOMPtr<nsIPref> prefs;
|
|||
NS_RELEASE(devspec);
|
||||
|
||||
// Get the webshell for this documentviewer
|
||||
rv = this->GetContainer(*getter_AddRefs(containerResult));
|
||||
webContainer = do_QueryInterface(containerResult);
|
||||
webContainer = do_QueryInterface(mContainer);
|
||||
if(webContainer) {
|
||||
// load the document and do the initial reflow on the entire document
|
||||
rv = NS_NewPrintContext(&mPrintPC);
|
||||
|
@ -1012,13 +1011,9 @@ void PR_CALLBACK DocumentViewerImpl::DestroyPLEvent(PLEvent* aEvent)
|
|||
|
||||
void DocumentViewerImpl::DocumentReadyForPrinting()
|
||||
{
|
||||
nsresult rv;
|
||||
|
||||
nsCOMPtr<nsIContentViewerContainer> containerResult;
|
||||
nsCOMPtr<nsIWebShell> webContainer;
|
||||
|
||||
rv = this->GetContainer(*getter_AddRefs(containerResult));
|
||||
webContainer = do_QueryInterface(containerResult);
|
||||
webContainer = do_QueryInterface(mContainer);
|
||||
if(webContainer) {
|
||||
//
|
||||
// Remove ourselves as an image group observer...
|
||||
|
|
|
@ -90,8 +90,8 @@ public:
|
|||
const nsRect& aBounds,
|
||||
nsScrollPreference aScrolling = nsScrollPreference_kAuto);
|
||||
NS_IMETHOD BindToDocument(nsISupports* aDoc, const char* aCommand);
|
||||
NS_IMETHOD SetContainer(nsIContentViewerContainer* aContainer);
|
||||
NS_IMETHOD GetContainer(nsIContentViewerContainer*& aContainerResult);
|
||||
NS_IMETHOD SetContainer(nsISupports* aContainer);
|
||||
NS_IMETHOD GetContainer(nsISupports** aContainerResult);
|
||||
NS_IMETHOD Stop(void);
|
||||
NS_IMETHOD GetBounds(nsRect& aResult);
|
||||
NS_IMETHOD SetBounds(const nsRect& aBounds);
|
||||
|
@ -298,7 +298,7 @@ DocumentViewerImpl::BindToDocument(nsISupports *aDoc, const char *aCommand)
|
|||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
DocumentViewerImpl::SetContainer(nsIContentViewerContainer* aContainer)
|
||||
DocumentViewerImpl::SetContainer(nsISupports* aContainer)
|
||||
{
|
||||
mContainer = aContainer;
|
||||
if (mPresContext) {
|
||||
|
@ -308,12 +308,13 @@ DocumentViewerImpl::SetContainer(nsIContentViewerContainer* aContainer)
|
|||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
DocumentViewerImpl::GetContainer(nsIContentViewerContainer*& aResult)
|
||||
DocumentViewerImpl::GetContainer(nsISupports** aResult)
|
||||
{
|
||||
if(mContainer)
|
||||
return mContainer->QueryInterface( nsIContentViewerContainer::GetIID(), (void**)&aResult );
|
||||
else
|
||||
aResult = nsnull;
|
||||
NS_ENSURE_ARG_POINTER(aResult);
|
||||
|
||||
*aResult = mContainer;
|
||||
NS_IF_ADDREF(*aResult);
|
||||
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
|
@ -520,7 +521,6 @@ static NS_DEFINE_IID(kDeviceContextSpecFactoryCID, NS_DEVICE_CONTEXT_SPEC_FACTOR
|
|||
NS_IMETHODIMP
|
||||
DocumentViewerImpl::Print(void)
|
||||
{
|
||||
nsCOMPtr<nsIContentViewerContainer> containerResult;
|
||||
nsCOMPtr<nsIWebShell> webContainer;
|
||||
nsCOMPtr<nsIDeviceContextSpecFactory> factory;
|
||||
PRInt32 width,height;
|
||||
|
@ -550,8 +550,7 @@ nsCOMPtr<nsIPref> prefs;
|
|||
NS_RELEASE(devspec);
|
||||
|
||||
// Get the webshell for this documentviewer
|
||||
rv = this->GetContainer(*getter_AddRefs(containerResult));
|
||||
webContainer = do_QueryInterface(containerResult);
|
||||
webContainer = do_QueryInterface(mContainer);
|
||||
if(webContainer) {
|
||||
// load the document and do the initial reflow on the entire document
|
||||
rv = NS_NewPrintContext(&mPrintPC);
|
||||
|
@ -1012,13 +1011,9 @@ void PR_CALLBACK DocumentViewerImpl::DestroyPLEvent(PLEvent* aEvent)
|
|||
|
||||
void DocumentViewerImpl::DocumentReadyForPrinting()
|
||||
{
|
||||
nsresult rv;
|
||||
|
||||
nsCOMPtr<nsIContentViewerContainer> containerResult;
|
||||
nsCOMPtr<nsIWebShell> webContainer;
|
||||
|
||||
rv = this->GetContainer(*getter_AddRefs(containerResult));
|
||||
webContainer = do_QueryInterface(containerResult);
|
||||
webContainer = do_QueryInterface(mContainer);
|
||||
if(webContainer) {
|
||||
//
|
||||
// Remove ourselves as an image group observer...
|
||||
|
|
|
@ -129,8 +129,8 @@ public:
|
|||
const nsRect& aBounds,
|
||||
nsScrollPreference aScrolling = nsScrollPreference_kAuto);
|
||||
NS_IMETHOD BindToDocument(nsISupports* aDoc, const char* aCommand);
|
||||
NS_IMETHOD SetContainer(nsIContentViewerContainer* aContainer);
|
||||
NS_IMETHOD GetContainer(nsIContentViewerContainer*& aContainerResult);
|
||||
NS_IMETHOD SetContainer(nsISupports* aContainer);
|
||||
NS_IMETHOD GetContainer(nsISupports** aContainerResult);
|
||||
NS_IMETHOD Stop(void);
|
||||
NS_IMETHOD GetBounds(nsRect& aResult);
|
||||
NS_IMETHOD SetBounds(const nsRect& aBounds);
|
||||
|
@ -257,20 +257,21 @@ PluginViewerImpl::BindToDocument(nsISupports *aDoc, const char *aCommand)
|
|||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
PluginViewerImpl::SetContainer(nsIContentViewerContainer* aContainer)
|
||||
PluginViewerImpl::SetContainer(nsISupports* aContainer)
|
||||
{
|
||||
mContainer = aContainer;
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
PluginViewerImpl::GetContainer(nsIContentViewerContainer*& aResult)
|
||||
PluginViewerImpl::GetContainer(nsISupports** aResult)
|
||||
{
|
||||
if(mContainer)
|
||||
return mContainer->QueryInterface( nsIContentViewerContainer::GetIID(), (void**)&aResult );
|
||||
else
|
||||
aResult = nsnull;
|
||||
return NS_OK;
|
||||
NS_ENSURE_ARG_POINTER(aResult);
|
||||
|
||||
*aResult = mContainer;
|
||||
NS_IF_ADDREF(*aResult);
|
||||
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
|
||||
|
@ -687,27 +688,24 @@ NS_IMETHODIMP pluginInstanceOwner :: GetURL(const char *aURL, const char *aTarge
|
|||
|
||||
if (nsnull != mViewer)
|
||||
{
|
||||
nsIContentViewerContainer *cont;
|
||||
nsCOMPtr<nsISupports> cont;
|
||||
|
||||
rv = mViewer->GetContainer(cont);
|
||||
rv = mViewer->GetContainer(getter_AddRefs(cont));
|
||||
|
||||
if (NS_OK == rv)
|
||||
{
|
||||
nsILinkHandler *lh;
|
||||
nsCOMPtr<nsILinkHandler> lh(do_QueryInterface(cont));
|
||||
|
||||
rv = cont->QueryInterface(kILinkHandlerIID, (void **)&lh);
|
||||
|
||||
if (NS_OK == rv)
|
||||
if (lh)
|
||||
{
|
||||
nsIURI *uri;
|
||||
rv = mViewer->GetURI(&uri);
|
||||
nsCOMPtr<nsIURI> uri;
|
||||
rv = mViewer->GetURI(getter_AddRefs(uri));
|
||||
|
||||
if (NS_OK == rv)
|
||||
{
|
||||
// Create an absolute URL
|
||||
char* absURIStr;
|
||||
rv = NS_MakeAbsoluteURI(aURL, uri, &absURIStr);
|
||||
NS_RELEASE(uri);
|
||||
nsAutoString fullurl(absURIStr);
|
||||
nsCRT::free(absURIStr);
|
||||
|
||||
|
@ -716,11 +714,7 @@ NS_IMETHODIMP pluginInstanceOwner :: GetURL(const char *aURL, const char *aTarge
|
|||
rv = lh->OnLinkClick(nsnull, eLinkVerb_Replace, fullurl.GetUnicode(), unitarget.GetUnicode(), nsnull);
|
||||
}
|
||||
}
|
||||
|
||||
NS_RELEASE(lh);
|
||||
}
|
||||
|
||||
NS_RELEASE(cont);
|
||||
}
|
||||
}
|
||||
else
|
||||
|
@ -735,50 +729,39 @@ NS_IMETHODIMP pluginInstanceOwner :: ShowStatus(const char *aStatusMsg)
|
|||
|
||||
if (nsnull != mViewer)
|
||||
{
|
||||
nsIContentViewerContainer *cont;
|
||||
nsCOMPtr<nsISupports> cont;
|
||||
|
||||
rv = mViewer->GetContainer(cont);
|
||||
rv = mViewer->GetContainer(getter_AddRefs(cont));
|
||||
|
||||
if ((NS_OK == rv) && (nsnull != cont))
|
||||
{
|
||||
nsIWebShell *ws;
|
||||
|
||||
rv = cont->QueryInterface(kIWebShellIID, (void **)&ws);
|
||||
nsCOMPtr<nsIWebShell> ws(do_QueryInterface(cont));
|
||||
|
||||
if (NS_OK == rv)
|
||||
{
|
||||
nsIWebShell *rootWebShell;
|
||||
nsCOMPtr<nsIWebShell> rootWebShell;
|
||||
|
||||
ws->GetRootWebShell(rootWebShell);
|
||||
ws->GetRootWebShell(*getter_AddRefs(rootWebShell));
|
||||
|
||||
if (nsnull != rootWebShell)
|
||||
{
|
||||
nsIWebShellContainer *rootContainer;
|
||||
nsCOMPtr<nsIWebShellContainer> rootContainer;
|
||||
|
||||
rv = rootWebShell->GetContainer(rootContainer);
|
||||
rv = rootWebShell->GetContainer(*getter_AddRefs(rootContainer));
|
||||
|
||||
if (nsnull != rootContainer)
|
||||
{
|
||||
nsIBrowserWindow *browserWindow;
|
||||
nsCOMPtr<nsIBrowserWindow> browserWindow(do_QueryInterface(rootContainer));
|
||||
|
||||
if (NS_OK == rootContainer->QueryInterface(kIBrowserWindowIID, (void**)&browserWindow))
|
||||
if (browserWindow)
|
||||
{
|
||||
nsAutoString msg = nsAutoString(aStatusMsg);
|
||||
|
||||
rv = browserWindow->SetStatus(msg.GetUnicode());
|
||||
NS_RELEASE(browserWindow);
|
||||
}
|
||||
|
||||
NS_RELEASE(rootContainer);
|
||||
}
|
||||
|
||||
NS_RELEASE(rootWebShell);
|
||||
}
|
||||
|
||||
NS_RELEASE(ws);
|
||||
}
|
||||
|
||||
NS_RELEASE(cont);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -129,8 +129,8 @@ public:
|
|||
const nsRect& aBounds,
|
||||
nsScrollPreference aScrolling = nsScrollPreference_kAuto);
|
||||
NS_IMETHOD BindToDocument(nsISupports* aDoc, const char* aCommand);
|
||||
NS_IMETHOD SetContainer(nsIContentViewerContainer* aContainer);
|
||||
NS_IMETHOD GetContainer(nsIContentViewerContainer*& aContainerResult);
|
||||
NS_IMETHOD SetContainer(nsISupports* aContainer);
|
||||
NS_IMETHOD GetContainer(nsISupports** aContainerResult);
|
||||
NS_IMETHOD Stop(void);
|
||||
NS_IMETHOD GetBounds(nsRect& aResult);
|
||||
NS_IMETHOD SetBounds(const nsRect& aBounds);
|
||||
|
@ -257,20 +257,21 @@ PluginViewerImpl::BindToDocument(nsISupports *aDoc, const char *aCommand)
|
|||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
PluginViewerImpl::SetContainer(nsIContentViewerContainer* aContainer)
|
||||
PluginViewerImpl::SetContainer(nsISupports* aContainer)
|
||||
{
|
||||
mContainer = aContainer;
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
PluginViewerImpl::GetContainer(nsIContentViewerContainer*& aResult)
|
||||
PluginViewerImpl::GetContainer(nsISupports** aResult)
|
||||
{
|
||||
if(mContainer)
|
||||
return mContainer->QueryInterface( nsIContentViewerContainer::GetIID(), (void**)&aResult );
|
||||
else
|
||||
aResult = nsnull;
|
||||
return NS_OK;
|
||||
NS_ENSURE_ARG_POINTER(aResult);
|
||||
|
||||
*aResult = mContainer;
|
||||
NS_IF_ADDREF(*aResult);
|
||||
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
|
||||
|
@ -687,27 +688,24 @@ NS_IMETHODIMP pluginInstanceOwner :: GetURL(const char *aURL, const char *aTarge
|
|||
|
||||
if (nsnull != mViewer)
|
||||
{
|
||||
nsIContentViewerContainer *cont;
|
||||
nsCOMPtr<nsISupports> cont;
|
||||
|
||||
rv = mViewer->GetContainer(cont);
|
||||
rv = mViewer->GetContainer(getter_AddRefs(cont));
|
||||
|
||||
if (NS_OK == rv)
|
||||
{
|
||||
nsILinkHandler *lh;
|
||||
nsCOMPtr<nsILinkHandler> lh(do_QueryInterface(cont));
|
||||
|
||||
rv = cont->QueryInterface(kILinkHandlerIID, (void **)&lh);
|
||||
|
||||
if (NS_OK == rv)
|
||||
if (lh)
|
||||
{
|
||||
nsIURI *uri;
|
||||
rv = mViewer->GetURI(&uri);
|
||||
nsCOMPtr<nsIURI> uri;
|
||||
rv = mViewer->GetURI(getter_AddRefs(uri));
|
||||
|
||||
if (NS_OK == rv)
|
||||
{
|
||||
// Create an absolute URL
|
||||
char* absURIStr;
|
||||
rv = NS_MakeAbsoluteURI(aURL, uri, &absURIStr);
|
||||
NS_RELEASE(uri);
|
||||
nsAutoString fullurl(absURIStr);
|
||||
nsCRT::free(absURIStr);
|
||||
|
||||
|
@ -716,11 +714,7 @@ NS_IMETHODIMP pluginInstanceOwner :: GetURL(const char *aURL, const char *aTarge
|
|||
rv = lh->OnLinkClick(nsnull, eLinkVerb_Replace, fullurl.GetUnicode(), unitarget.GetUnicode(), nsnull);
|
||||
}
|
||||
}
|
||||
|
||||
NS_RELEASE(lh);
|
||||
}
|
||||
|
||||
NS_RELEASE(cont);
|
||||
}
|
||||
}
|
||||
else
|
||||
|
@ -735,50 +729,39 @@ NS_IMETHODIMP pluginInstanceOwner :: ShowStatus(const char *aStatusMsg)
|
|||
|
||||
if (nsnull != mViewer)
|
||||
{
|
||||
nsIContentViewerContainer *cont;
|
||||
nsCOMPtr<nsISupports> cont;
|
||||
|
||||
rv = mViewer->GetContainer(cont);
|
||||
rv = mViewer->GetContainer(getter_AddRefs(cont));
|
||||
|
||||
if ((NS_OK == rv) && (nsnull != cont))
|
||||
{
|
||||
nsIWebShell *ws;
|
||||
|
||||
rv = cont->QueryInterface(kIWebShellIID, (void **)&ws);
|
||||
nsCOMPtr<nsIWebShell> ws(do_QueryInterface(cont));
|
||||
|
||||
if (NS_OK == rv)
|
||||
{
|
||||
nsIWebShell *rootWebShell;
|
||||
nsCOMPtr<nsIWebShell> rootWebShell;
|
||||
|
||||
ws->GetRootWebShell(rootWebShell);
|
||||
ws->GetRootWebShell(*getter_AddRefs(rootWebShell));
|
||||
|
||||
if (nsnull != rootWebShell)
|
||||
{
|
||||
nsIWebShellContainer *rootContainer;
|
||||
nsCOMPtr<nsIWebShellContainer> rootContainer;
|
||||
|
||||
rv = rootWebShell->GetContainer(rootContainer);
|
||||
rv = rootWebShell->GetContainer(*getter_AddRefs(rootContainer));
|
||||
|
||||
if (nsnull != rootContainer)
|
||||
{
|
||||
nsIBrowserWindow *browserWindow;
|
||||
nsCOMPtr<nsIBrowserWindow> browserWindow(do_QueryInterface(rootContainer));
|
||||
|
||||
if (NS_OK == rootContainer->QueryInterface(kIBrowserWindowIID, (void**)&browserWindow))
|
||||
if (browserWindow)
|
||||
{
|
||||
nsAutoString msg = nsAutoString(aStatusMsg);
|
||||
|
||||
rv = browserWindow->SetStatus(msg.GetUnicode());
|
||||
NS_RELEASE(browserWindow);
|
||||
}
|
||||
|
||||
NS_RELEASE(rootContainer);
|
||||
}
|
||||
|
||||
NS_RELEASE(rootWebShell);
|
||||
}
|
||||
|
||||
NS_RELEASE(ws);
|
||||
}
|
||||
|
||||
NS_RELEASE(cont);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -129,8 +129,8 @@ public:
|
|||
const nsRect& aBounds,
|
||||
nsScrollPreference aScrolling = nsScrollPreference_kAuto);
|
||||
NS_IMETHOD BindToDocument(nsISupports* aDoc, const char* aCommand);
|
||||
NS_IMETHOD SetContainer(nsIContentViewerContainer* aContainer);
|
||||
NS_IMETHOD GetContainer(nsIContentViewerContainer*& aContainerResult);
|
||||
NS_IMETHOD SetContainer(nsISupports* aContainer);
|
||||
NS_IMETHOD GetContainer(nsISupports** aContainerResult);
|
||||
NS_IMETHOD Stop(void);
|
||||
NS_IMETHOD GetBounds(nsRect& aResult);
|
||||
NS_IMETHOD SetBounds(const nsRect& aBounds);
|
||||
|
@ -257,20 +257,21 @@ PluginViewerImpl::BindToDocument(nsISupports *aDoc, const char *aCommand)
|
|||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
PluginViewerImpl::SetContainer(nsIContentViewerContainer* aContainer)
|
||||
PluginViewerImpl::SetContainer(nsISupports* aContainer)
|
||||
{
|
||||
mContainer = aContainer;
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
PluginViewerImpl::GetContainer(nsIContentViewerContainer*& aResult)
|
||||
PluginViewerImpl::GetContainer(nsISupports** aResult)
|
||||
{
|
||||
if(mContainer)
|
||||
return mContainer->QueryInterface( nsIContentViewerContainer::GetIID(), (void**)&aResult );
|
||||
else
|
||||
aResult = nsnull;
|
||||
return NS_OK;
|
||||
NS_ENSURE_ARG_POINTER(aResult);
|
||||
|
||||
*aResult = mContainer;
|
||||
NS_IF_ADDREF(*aResult);
|
||||
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
|
||||
|
@ -687,27 +688,24 @@ NS_IMETHODIMP pluginInstanceOwner :: GetURL(const char *aURL, const char *aTarge
|
|||
|
||||
if (nsnull != mViewer)
|
||||
{
|
||||
nsIContentViewerContainer *cont;
|
||||
nsCOMPtr<nsISupports> cont;
|
||||
|
||||
rv = mViewer->GetContainer(cont);
|
||||
rv = mViewer->GetContainer(getter_AddRefs(cont));
|
||||
|
||||
if (NS_OK == rv)
|
||||
{
|
||||
nsILinkHandler *lh;
|
||||
nsCOMPtr<nsILinkHandler> lh(do_QueryInterface(cont));
|
||||
|
||||
rv = cont->QueryInterface(kILinkHandlerIID, (void **)&lh);
|
||||
|
||||
if (NS_OK == rv)
|
||||
if (lh)
|
||||
{
|
||||
nsIURI *uri;
|
||||
rv = mViewer->GetURI(&uri);
|
||||
nsCOMPtr<nsIURI> uri;
|
||||
rv = mViewer->GetURI(getter_AddRefs(uri));
|
||||
|
||||
if (NS_OK == rv)
|
||||
{
|
||||
// Create an absolute URL
|
||||
char* absURIStr;
|
||||
rv = NS_MakeAbsoluteURI(aURL, uri, &absURIStr);
|
||||
NS_RELEASE(uri);
|
||||
nsAutoString fullurl(absURIStr);
|
||||
nsCRT::free(absURIStr);
|
||||
|
||||
|
@ -716,11 +714,7 @@ NS_IMETHODIMP pluginInstanceOwner :: GetURL(const char *aURL, const char *aTarge
|
|||
rv = lh->OnLinkClick(nsnull, eLinkVerb_Replace, fullurl.GetUnicode(), unitarget.GetUnicode(), nsnull);
|
||||
}
|
||||
}
|
||||
|
||||
NS_RELEASE(lh);
|
||||
}
|
||||
|
||||
NS_RELEASE(cont);
|
||||
}
|
||||
}
|
||||
else
|
||||
|
@ -735,50 +729,39 @@ NS_IMETHODIMP pluginInstanceOwner :: ShowStatus(const char *aStatusMsg)
|
|||
|
||||
if (nsnull != mViewer)
|
||||
{
|
||||
nsIContentViewerContainer *cont;
|
||||
nsCOMPtr<nsISupports> cont;
|
||||
|
||||
rv = mViewer->GetContainer(cont);
|
||||
rv = mViewer->GetContainer(getter_AddRefs(cont));
|
||||
|
||||
if ((NS_OK == rv) && (nsnull != cont))
|
||||
{
|
||||
nsIWebShell *ws;
|
||||
|
||||
rv = cont->QueryInterface(kIWebShellIID, (void **)&ws);
|
||||
nsCOMPtr<nsIWebShell> ws(do_QueryInterface(cont));
|
||||
|
||||
if (NS_OK == rv)
|
||||
{
|
||||
nsIWebShell *rootWebShell;
|
||||
nsCOMPtr<nsIWebShell> rootWebShell;
|
||||
|
||||
ws->GetRootWebShell(rootWebShell);
|
||||
ws->GetRootWebShell(*getter_AddRefs(rootWebShell));
|
||||
|
||||
if (nsnull != rootWebShell)
|
||||
{
|
||||
nsIWebShellContainer *rootContainer;
|
||||
nsCOMPtr<nsIWebShellContainer> rootContainer;
|
||||
|
||||
rv = rootWebShell->GetContainer(rootContainer);
|
||||
rv = rootWebShell->GetContainer(*getter_AddRefs(rootContainer));
|
||||
|
||||
if (nsnull != rootContainer)
|
||||
{
|
||||
nsIBrowserWindow *browserWindow;
|
||||
nsCOMPtr<nsIBrowserWindow> browserWindow(do_QueryInterface(rootContainer));
|
||||
|
||||
if (NS_OK == rootContainer->QueryInterface(kIBrowserWindowIID, (void**)&browserWindow))
|
||||
if (browserWindow)
|
||||
{
|
||||
nsAutoString msg = nsAutoString(aStatusMsg);
|
||||
|
||||
rv = browserWindow->SetStatus(msg.GetUnicode());
|
||||
NS_RELEASE(browserWindow);
|
||||
}
|
||||
|
||||
NS_RELEASE(rootContainer);
|
||||
}
|
||||
|
||||
NS_RELEASE(rootWebShell);
|
||||
}
|
||||
|
||||
NS_RELEASE(ws);
|
||||
}
|
||||
|
||||
NS_RELEASE(cont);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
Загрузка…
Ссылка в новой задаче