|
1 /* -*- Mode: C++; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ |
|
2 /* vim: set sw=2 ts=8 et tw=80 : */ |
|
3 |
|
4 /* This Source Code Form is subject to the terms of the Mozilla Public |
|
5 * License, v. 2.0. If a copy of the MPL was not distributed with this |
|
6 * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ |
|
7 |
|
8 #ifndef mozilla_net_HttpChannelCallbackWrapper_h |
|
9 #define mozilla_net_HttpChannelCallbackWrapper_h |
|
10 |
|
11 #include "nsIInterfaceRequestor.h" |
|
12 #include "nsIChannelEventSink.h" |
|
13 #include "nsIRedirectResultListener.h" |
|
14 |
|
15 class nsIParentChannel; |
|
16 |
|
17 namespace mozilla { |
|
18 namespace net { |
|
19 |
|
20 class HttpChannelParent; |
|
21 |
|
22 class HttpChannelParentListener : public nsIInterfaceRequestor |
|
23 , public nsIChannelEventSink |
|
24 , public nsIRedirectResultListener |
|
25 , public nsIStreamListener |
|
26 { |
|
27 public: |
|
28 NS_DECL_ISUPPORTS |
|
29 NS_DECL_NSIINTERFACEREQUESTOR |
|
30 NS_DECL_NSICHANNELEVENTSINK |
|
31 NS_DECL_NSIREDIRECTRESULTLISTENER |
|
32 NS_DECL_NSIREQUESTOBSERVER |
|
33 NS_DECL_NSISTREAMLISTENER |
|
34 |
|
35 HttpChannelParentListener(HttpChannelParent* aInitialChannel); |
|
36 virtual ~HttpChannelParentListener(); |
|
37 |
|
38 // For channel diversion from child to parent. |
|
39 nsresult DivertTo(nsIStreamListener *aListener); |
|
40 nsresult SuspendForDiversion(); |
|
41 |
|
42 private: |
|
43 // Private partner function to SuspendForDiversion. |
|
44 nsresult ResumeForDiversion(); |
|
45 |
|
46 // Can be the original HttpChannelParent that created this object (normal |
|
47 // case), a different {HTTP|FTP}ChannelParent that we've been redirected to, |
|
48 // or some other listener that we have been diverted to via |
|
49 // nsIDivertableChannel. |
|
50 nsCOMPtr<nsIStreamListener> mNextListener; |
|
51 uint32_t mRedirectChannelId; |
|
52 // When set, no OnStart/OnData/OnStop calls should be received. |
|
53 bool mSuspendedForDiversion; |
|
54 }; |
|
55 |
|
56 } // namespace net |
|
57 } // namespace mozilla |
|
58 |
|
59 #endif // mozilla_net_HttpChannelParent_h |