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