Fri, 16 Jan 2015 18:13:44 +0100
Integrate suggestion from review to improve consistency with existing code.
michael@0 | 1 | /* -*- Mode: C++; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ |
michael@0 | 2 | /* vim: set ts=2 et sw=2 tw=80: */ |
michael@0 | 3 | /* This Source Code Form is subject to the terms of the Mozilla Public |
michael@0 | 4 | * License, v. 2.0. If a copy of the MPL was not distributed with this |
michael@0 | 5 | * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ |
michael@0 | 6 | |
michael@0 | 7 | #include "mozilla/dom/PExternalHelperAppParent.h" |
michael@0 | 8 | #include "nsIChannel.h" |
michael@0 | 9 | #include "nsIMultiPartChannel.h" |
michael@0 | 10 | #include "nsIResumableChannel.h" |
michael@0 | 11 | #include "nsIStreamListener.h" |
michael@0 | 12 | #include "nsHashPropertyBag.h" |
michael@0 | 13 | |
michael@0 | 14 | namespace IPC { |
michael@0 | 15 | class URI; |
michael@0 | 16 | } |
michael@0 | 17 | |
michael@0 | 18 | namespace mozilla { |
michael@0 | 19 | |
michael@0 | 20 | namespace ipc { |
michael@0 | 21 | class OptionalURIParams; |
michael@0 | 22 | } // namespace ipc |
michael@0 | 23 | |
michael@0 | 24 | namespace net { |
michael@0 | 25 | class PChannelDiverterParent; |
michael@0 | 26 | } // namespace net |
michael@0 | 27 | |
michael@0 | 28 | namespace dom { |
michael@0 | 29 | |
michael@0 | 30 | class ContentParent; |
michael@0 | 31 | class PBrowserParent; |
michael@0 | 32 | |
michael@0 | 33 | class ExternalHelperAppParent : public PExternalHelperAppParent |
michael@0 | 34 | , public nsHashPropertyBag |
michael@0 | 35 | , public nsIChannel |
michael@0 | 36 | , public nsIMultiPartChannel |
michael@0 | 37 | , public nsIResumableChannel |
michael@0 | 38 | , public nsIStreamListener |
michael@0 | 39 | { |
michael@0 | 40 | typedef mozilla::ipc::OptionalURIParams OptionalURIParams; |
michael@0 | 41 | |
michael@0 | 42 | public: |
michael@0 | 43 | NS_DECL_ISUPPORTS |
michael@0 | 44 | NS_DECL_NSIREQUEST |
michael@0 | 45 | NS_DECL_NSICHANNEL |
michael@0 | 46 | NS_DECL_NSIMULTIPARTCHANNEL |
michael@0 | 47 | NS_DECL_NSIRESUMABLECHANNEL |
michael@0 | 48 | NS_DECL_NSISTREAMLISTENER |
michael@0 | 49 | NS_DECL_NSIREQUESTOBSERVER |
michael@0 | 50 | |
michael@0 | 51 | bool RecvOnStartRequest(const nsCString& entityID) MOZ_OVERRIDE; |
michael@0 | 52 | bool RecvOnDataAvailable(const nsCString& data, |
michael@0 | 53 | const uint64_t& offset, |
michael@0 | 54 | const uint32_t& count) MOZ_OVERRIDE; |
michael@0 | 55 | bool RecvOnStopRequest(const nsresult& code) MOZ_OVERRIDE; |
michael@0 | 56 | |
michael@0 | 57 | bool RecvDivertToParentUsing(PChannelDiverterParent* diverter) MOZ_OVERRIDE; |
michael@0 | 58 | |
michael@0 | 59 | ExternalHelperAppParent(const OptionalURIParams& uri, const int64_t& contentLength); |
michael@0 | 60 | void Init(ContentParent *parent, |
michael@0 | 61 | const nsCString& aMimeContentType, |
michael@0 | 62 | const nsCString& aContentDisposition, |
michael@0 | 63 | const uint32_t& aContentDispositionHint, |
michael@0 | 64 | const nsString& aContentDispositionFilename, |
michael@0 | 65 | const bool& aForceSave, |
michael@0 | 66 | const OptionalURIParams& aReferrer, |
michael@0 | 67 | PBrowserParent* aBrowser); |
michael@0 | 68 | virtual ~ExternalHelperAppParent(); |
michael@0 | 69 | |
michael@0 | 70 | protected: |
michael@0 | 71 | virtual void ActorDestroy(ActorDestroyReason why) MOZ_OVERRIDE; |
michael@0 | 72 | void Delete(); |
michael@0 | 73 | |
michael@0 | 74 | private: |
michael@0 | 75 | nsCOMPtr<nsIStreamListener> mListener; |
michael@0 | 76 | nsCOMPtr<nsIURI> mURI; |
michael@0 | 77 | bool mPending; |
michael@0 | 78 | DebugOnly<bool> mDiverted; |
michael@0 | 79 | bool mIPCClosed; |
michael@0 | 80 | nsLoadFlags mLoadFlags; |
michael@0 | 81 | nsresult mStatus; |
michael@0 | 82 | int64_t mContentLength; |
michael@0 | 83 | uint32_t mContentDisposition; |
michael@0 | 84 | nsString mContentDispositionFilename; |
michael@0 | 85 | nsCString mContentDispositionHeader; |
michael@0 | 86 | nsCString mEntityID; |
michael@0 | 87 | }; |
michael@0 | 88 | |
michael@0 | 89 | } // namespace dom |
michael@0 | 90 | } // namespace mozilla |