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 {
|
|
|
|
|
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>
|
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
|
|
|
|
2015-03-21 19:28:04 +03:00
|
|
|
bool RecvOnStartRequest(const nsCString& entityID) override;
|
2014-01-17 23:49:39 +04:00
|
|
|
bool RecvOnDataAvailable(const nsCString& data,
|
|
|
|
const uint64_t& offset,
|
2015-03-21 19:28:04 +03:00
|
|
|
const uint32_t& count) override;
|
|
|
|
bool RecvOnStopRequest(const nsresult& code) override;
|
2012-08-23 23:33:46 +04:00
|
|
|
|
2015-03-21 19:28:04 +03:00
|
|
|
bool RecvDivertToParentUsing(PChannelDiverterParent* diverter) override;
|
2014-03-12 02:41:48 +04:00
|
|
|
|
2012-08-23 23:33:46 +04:00
|
|
|
ExternalHelperAppParent(const OptionalURIParams& uri, const int64_t& contentLength);
|
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;
|
|
|
|
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
|