2010-08-18 07:19:24 +04:00
|
|
|
/* -*- Mode: C++; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
|
|
|
|
/* vim: set ts=2 et sw=2 tw=80: */
|
2012-05-21 15:12:37 +04:00
|
|
|
/* This Source Code Form is subject to the terms of the Mozilla Public
|
|
|
|
* License, v. 2.0. If a copy of the MPL was not distributed with this
|
|
|
|
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
|
2010-08-18 07:19:24 +04:00
|
|
|
|
|
|
|
#include "mozilla/dom/PExternalHelperAppParent.h"
|
|
|
|
#include "nsIChannel.h"
|
2010-09-13 22:17:00 +04:00
|
|
|
#include "nsIMultiPartChannel.h"
|
2010-08-23 20:29:33 +04:00
|
|
|
#include "nsIResumableChannel.h"
|
2014-03-12 02:41:48 +04:00
|
|
|
#include "nsIStreamListener.h"
|
2010-08-18 07:19:24 +04:00
|
|
|
#include "nsHashPropertyBag.h"
|
2015-11-23 17:20:50 +03:00
|
|
|
#include "PrivateBrowsingChannel.h"
|
2010-08-18 07:19:24 +04:00
|
|
|
|
|
|
|
namespace IPC {
|
|
|
|
class URI;
|
2015-07-13 18:25:42 +03:00
|
|
|
} // namespace IPC
|
2010-08-18 07:19:24 +04:00
|
|
|
|
|
|
|
namespace mozilla {
|
2012-08-23 23:33:46 +04:00
|
|
|
|
|
|
|
namespace ipc {
|
|
|
|
class OptionalURIParams;
|
|
|
|
} // namespace ipc
|
|
|
|
|
2014-03-12 02:41:48 +04:00
|
|
|
namespace net {
|
|
|
|
class PChannelDiverterParent;
|
|
|
|
} // namespace net
|
|
|
|
|
2010-08-18 07:19:24 +04:00
|
|
|
namespace dom {
|
|
|
|
|
2017-01-11 04:49:16 +03:00
|
|
|
#define NS_IEXTERNALHELPERAPPPARENT_IID \
|
|
|
|
{ 0x127a01bc, 0x2a49, 0x46a8, \
|
|
|
|
{ 0x8c, 0x63, 0x4b, 0x5d, 0x3c, 0xa4, 0x07, 0x9c } }
|
|
|
|
|
|
|
|
class nsIExternalHelperAppParent : public nsISupports
|
|
|
|
{
|
|
|
|
public:
|
|
|
|
NS_DECLARE_STATIC_IID_ACCESSOR(NS_IEXTERNALHELPERAPPPARENT_IID)
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Returns true if this fake channel represented a file channel in the child.
|
|
|
|
*/
|
|
|
|
virtual bool WasFileChannel() = 0;
|
|
|
|
};
|
|
|
|
|
|
|
|
NS_DEFINE_STATIC_IID_ACCESSOR(nsIExternalHelperAppParent, NS_IEXTERNALHELPERAPPPARENT_IID)
|
|
|
|
|
2010-09-16 02:55:08 +04:00
|
|
|
class ContentParent;
|
2013-09-12 23:24:10 +04:00
|
|
|
class PBrowserParent;
|
2010-08-18 07:19:24 +04:00
|
|
|
|
|
|
|
class ExternalHelperAppParent : public PExternalHelperAppParent
|
|
|
|
, public nsHashPropertyBag
|
|
|
|
, public nsIChannel
|
2010-09-13 22:17:00 +04:00
|
|
|
, public nsIMultiPartChannel
|
2010-08-23 20:29:33 +04:00
|
|
|
, public nsIResumableChannel
|
2014-03-12 02:41:48 +04:00
|
|
|
, public nsIStreamListener
|
2015-11-23 17:20:50 +03:00
|
|
|
, public net::PrivateBrowsingChannel<ExternalHelperAppParent>
|
2017-01-11 04:49:16 +03:00
|
|
|
, public nsIExternalHelperAppParent
|
2010-08-18 07:19:24 +04:00
|
|
|
{
|
2012-08-23 23:33:46 +04:00
|
|
|
typedef mozilla::ipc::OptionalURIParams OptionalURIParams;
|
|
|
|
|
2010-08-18 07:19:24 +04:00
|
|
|
public:
|
2014-07-14 23:21:34 +04:00
|
|
|
NS_DECL_ISUPPORTS_INHERITED
|
2010-08-18 07:19:24 +04:00
|
|
|
NS_DECL_NSIREQUEST
|
|
|
|
NS_DECL_NSICHANNEL
|
2010-09-13 22:17:00 +04:00
|
|
|
NS_DECL_NSIMULTIPARTCHANNEL
|
2010-08-23 20:29:33 +04:00
|
|
|
NS_DECL_NSIRESUMABLECHANNEL
|
2014-03-12 02:41:48 +04:00
|
|
|
NS_DECL_NSISTREAMLISTENER
|
|
|
|
NS_DECL_NSIREQUESTOBSERVER
|
2010-08-18 07:19:24 +04:00
|
|
|
|
2017-03-24 03:01:30 +03:00
|
|
|
mozilla::ipc::IPCResult RecvOnStartRequest(const nsCString& entityID,
|
|
|
|
PBrowserParent* aBrowser) override;
|
2016-11-15 06:26:00 +03:00
|
|
|
mozilla::ipc::IPCResult RecvOnDataAvailable(const nsCString& data,
|
|
|
|
const uint64_t& offset,
|
|
|
|
const uint32_t& count) override;
|
|
|
|
mozilla::ipc::IPCResult RecvOnStopRequest(const nsresult& code) override;
|
2012-08-23 23:33:46 +04:00
|
|
|
|
2017-03-24 03:01:30 +03:00
|
|
|
mozilla::ipc::IPCResult RecvDivertToParentUsing(PChannelDiverterParent* diverter,
|
|
|
|
PBrowserParent* aBrowser) override;
|
2014-03-12 02:41:48 +04:00
|
|
|
|
2017-01-11 04:49:16 +03:00
|
|
|
bool WasFileChannel() override {
|
|
|
|
return mWasFileChannel;
|
|
|
|
}
|
|
|
|
|
|
|
|
ExternalHelperAppParent(const OptionalURIParams& uri, const int64_t& contentLength,
|
|
|
|
const bool& wasFileChannel);
|
2010-09-16 02:55:08 +04:00
|
|
|
void Init(ContentParent *parent,
|
2010-08-18 07:19:24 +04:00
|
|
|
const nsCString& aMimeContentType,
|
2010-09-13 22:17:00 +04:00
|
|
|
const nsCString& aContentDisposition,
|
2014-02-14 02:43:58 +04:00
|
|
|
const uint32_t& aContentDispositionHint,
|
|
|
|
const nsString& aContentDispositionFilename,
|
2011-09-29 10:19:26 +04:00
|
|
|
const bool& aForceSave,
|
2013-09-12 23:24:10 +04:00
|
|
|
const OptionalURIParams& aReferrer,
|
|
|
|
PBrowserParent* aBrowser);
|
2010-08-18 07:19:24 +04:00
|
|
|
|
2014-03-12 02:41:48 +04:00
|
|
|
protected:
|
2014-07-09 01:23:17 +04:00
|
|
|
virtual ~ExternalHelperAppParent();
|
|
|
|
|
2015-03-21 19:28:04 +03:00
|
|
|
virtual void ActorDestroy(ActorDestroyReason why) override;
|
2014-03-12 02:41:48 +04:00
|
|
|
void Delete();
|
|
|
|
|
2010-08-18 07:19:24 +04:00
|
|
|
private:
|
|
|
|
nsCOMPtr<nsIStreamListener> mListener;
|
|
|
|
nsCOMPtr<nsIURI> mURI;
|
2011-09-29 10:19:26 +04:00
|
|
|
bool mPending;
|
2016-02-26 18:52:08 +03:00
|
|
|
#ifdef DEBUG
|
|
|
|
bool mDiverted;
|
|
|
|
#endif
|
2014-03-12 02:41:48 +04:00
|
|
|
bool mIPCClosed;
|
2010-08-18 07:19:24 +04:00
|
|
|
nsLoadFlags mLoadFlags;
|
|
|
|
nsresult mStatus;
|
2012-08-22 19:56:38 +04:00
|
|
|
int64_t mContentLength;
|
2017-01-11 04:49:16 +03:00
|
|
|
bool mWasFileChannel;
|
2012-08-22 19:56:38 +04:00
|
|
|
uint32_t mContentDisposition;
|
2011-09-10 02:41:04 +04:00
|
|
|
nsString mContentDispositionFilename;
|
|
|
|
nsCString mContentDispositionHeader;
|
2010-08-23 20:29:33 +04:00
|
|
|
nsCString mEntityID;
|
2010-08-18 07:19:24 +04:00
|
|
|
};
|
|
|
|
|
|
|
|
} // namespace dom
|
2012-09-06 06:41:02 +04:00
|
|
|
} // namespace mozilla
|