зеркало из https://github.com/mozilla/gecko-dev.git
Bug 910436 - Electrolysis: Pass PBrowser to the PExternalHelperAppParent so that we can get a window for the download box. r=jdm
This commit is contained in:
Родитель
f29d9f5c20
Коммит
5de50e9d38
|
@ -868,7 +868,8 @@ ContentChild::AllocPExternalHelperAppChild(const OptionalURIParams& uri,
|
|||
const nsCString& aContentDisposition,
|
||||
const bool& aForceSave,
|
||||
const int64_t& aContentLength,
|
||||
const OptionalURIParams& aReferrer)
|
||||
const OptionalURIParams& aReferrer,
|
||||
PBrowserChild* aBrowser)
|
||||
{
|
||||
ExternalHelperAppChild *child = new ExternalHelperAppChild();
|
||||
child->AddRef();
|
||||
|
|
|
@ -146,7 +146,8 @@ public:
|
|||
const nsCString& aContentDisposition,
|
||||
const bool& aForceSave,
|
||||
const int64_t& aContentLength,
|
||||
const OptionalURIParams& aReferrer);
|
||||
const OptionalURIParams& aReferrer,
|
||||
PBrowserChild* aBrowser);
|
||||
virtual bool DeallocPExternalHelperAppChild(PExternalHelperAppChild *aService);
|
||||
|
||||
virtual PSmsChild* AllocPSmsChild();
|
||||
|
|
|
@ -2235,11 +2235,12 @@ ContentParent::AllocPExternalHelperAppParent(const OptionalURIParams& uri,
|
|||
const nsCString& aContentDisposition,
|
||||
const bool& aForceSave,
|
||||
const int64_t& aContentLength,
|
||||
const OptionalURIParams& aReferrer)
|
||||
const OptionalURIParams& aReferrer,
|
||||
PBrowserParent* aBrowser)
|
||||
{
|
||||
ExternalHelperAppParent *parent = new ExternalHelperAppParent(uri, aContentLength);
|
||||
parent->AddRef();
|
||||
parent->Init(this, aMimeContentType, aContentDisposition, aForceSave, aReferrer);
|
||||
parent->Init(this, aMimeContentType, aContentDisposition, aForceSave, aReferrer, aBrowser);
|
||||
return parent;
|
||||
}
|
||||
|
||||
|
|
|
@ -316,7 +316,8 @@ private:
|
|||
const nsCString& aContentDisposition,
|
||||
const bool& aForceSave,
|
||||
const int64_t& aContentLength,
|
||||
const OptionalURIParams& aReferrer);
|
||||
const OptionalURIParams& aReferrer,
|
||||
PBrowserParent* aBrowser);
|
||||
virtual bool DeallocPExternalHelperAppParent(PExternalHelperAppParent* aService);
|
||||
|
||||
virtual PSmsParent* AllocPSmsParent();
|
||||
|
|
|
@ -397,7 +397,8 @@ parent:
|
|||
|
||||
PExternalHelperApp(OptionalURIParams uri, nsCString aMimeContentType,
|
||||
nsCString aContentDisposition, bool aForceSave,
|
||||
int64_t aContentLength, OptionalURIParams aReferrer);
|
||||
int64_t aContentLength, OptionalURIParams aReferrer,
|
||||
nullable PBrowser aBrowser);
|
||||
|
||||
AddGeolocationListener(Principal principal, bool highAccuracy);
|
||||
RemoveGeolocationListener();
|
||||
|
|
|
@ -11,6 +11,8 @@
|
|||
#include "nsCExternalHandlerService.h"
|
||||
#include "nsIExternalHelperAppService.h"
|
||||
#include "mozilla/dom/ContentParent.h"
|
||||
#include "mozilla/dom/Element.h"
|
||||
#include "mozilla/dom/TabParent.h"
|
||||
#include "nsIBrowserDOMWindow.h"
|
||||
#include "nsStringStream.h"
|
||||
#include "mozilla/ipc/URIUtils.h"
|
||||
|
@ -45,7 +47,8 @@ ExternalHelperAppParent::Init(ContentParent *parent,
|
|||
const nsCString& aMimeContentType,
|
||||
const nsCString& aContentDispositionHeader,
|
||||
const bool& aForceSave,
|
||||
const OptionalURIParams& aReferrer)
|
||||
const OptionalURIParams& aReferrer,
|
||||
PBrowserParent* aBrowser)
|
||||
{
|
||||
nsCOMPtr<nsIExternalHelperAppService> helperAppService =
|
||||
do_GetService(NS_EXTERNALHELPERAPPSERVICE_CONTRACTID);
|
||||
|
@ -58,7 +61,15 @@ ExternalHelperAppParent::Init(ContentParent *parent,
|
|||
mContentDispositionHeader = aContentDispositionHeader;
|
||||
NS_GetFilenameFromDisposition(mContentDispositionFilename, mContentDispositionHeader, mURI);
|
||||
mContentDisposition = NS_GetContentDispositionFromHeader(mContentDispositionHeader, this);
|
||||
helperAppService->DoContent(aMimeContentType, this, nullptr,
|
||||
|
||||
nsCOMPtr<nsIInterfaceRequestor> window;
|
||||
if (aBrowser) {
|
||||
TabParent* tabParent = static_cast<TabParent*>(aBrowser);
|
||||
if (tabParent->GetOwnerElement())
|
||||
window = do_QueryInterface(tabParent->GetOwnerElement()->OwnerDoc()->GetWindow());
|
||||
}
|
||||
|
||||
helperAppService->DoContent(aMimeContentType, this, window,
|
||||
aForceSave, getter_AddRefs(mListener));
|
||||
}
|
||||
|
||||
|
|
|
@ -23,6 +23,7 @@ class OptionalURIParams;
|
|||
namespace dom {
|
||||
|
||||
class ContentParent;
|
||||
class PBrowserParent;
|
||||
|
||||
class ExternalHelperAppParent : public PExternalHelperAppParent
|
||||
, public nsHashPropertyBag
|
||||
|
@ -48,7 +49,8 @@ public:
|
|||
const nsCString& aMimeContentType,
|
||||
const nsCString& aContentDisposition,
|
||||
const bool& aForceSave,
|
||||
const OptionalURIParams& aReferrer);
|
||||
const OptionalURIParams& aReferrer,
|
||||
PBrowserParent* aBrowser);
|
||||
virtual ~ExternalHelperAppParent();
|
||||
|
||||
private:
|
||||
|
|
|
@ -613,7 +613,8 @@ NS_IMETHODIMP nsExternalHelperAppService::DoContent(const nsACString& aMimeConte
|
|||
child->SendPExternalHelperAppConstructor(uriParams,
|
||||
nsCString(aMimeContentType),
|
||||
disp, aForceSave, contentLength,
|
||||
referrerParams);
|
||||
referrerParams,
|
||||
mozilla::dom::TabChild::GetFrom(window));
|
||||
ExternalHelperAppChild *childListener = static_cast<ExternalHelperAppChild *>(pc);
|
||||
|
||||
NS_ADDREF(*aStreamListener = childListener);
|
||||
|
|
Загрузка…
Ссылка в новой задаче