/work/obj-fuzz/dist/include/mozilla/net/WyciwygChannelChild.h
Line | Count | Source (jump to first uncovered line) |
1 | | /* This Source Code Form is subject to the terms of the Mozilla Public |
2 | | * License, v. 2.0. If a copy of the MPL was not distributed with this |
3 | | * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ |
4 | | |
5 | | #ifndef mozilla_net_WyciwygChannelChild_h |
6 | | #define mozilla_net_WyciwygChannelChild_h |
7 | | |
8 | | #include "mozilla/net/NeckoTargetHolder.h" |
9 | | #include "mozilla/net/PWyciwygChannelChild.h" |
10 | | #include "nsIWyciwygChannel.h" |
11 | | #include "nsIChannel.h" |
12 | | #include "nsILoadInfo.h" |
13 | | #include "PrivateBrowsingChannel.h" |
14 | | |
15 | | class nsIProgressEventSink; |
16 | | |
17 | | namespace mozilla { |
18 | | namespace net { |
19 | | |
20 | | class ChannelEventQueue; |
21 | | |
22 | | // TODO: replace with IPDL states |
23 | | enum WyciwygChannelChildState { |
24 | | WCC_NEW, |
25 | | WCC_INIT, |
26 | | |
27 | | // States when reading from the channel |
28 | | WCC_OPENED, |
29 | | WCC_ONSTART, |
30 | | WCC_ONDATA, |
31 | | WCC_ONSTOP, |
32 | | |
33 | | // States when writing to the cache |
34 | | WCC_ONWRITE, |
35 | | WCC_ONCLOSED |
36 | | }; |
37 | | |
38 | | |
39 | | // Header file contents |
40 | | class WyciwygChannelChild final : public PWyciwygChannelChild |
41 | | , public nsIWyciwygChannel |
42 | | , public PrivateBrowsingChannel<WyciwygChannelChild> |
43 | | , public NeckoTargetHolder |
44 | | { |
45 | | public: |
46 | | NS_DECL_ISUPPORTS |
47 | | NS_DECL_NSIREQUEST |
48 | | NS_DECL_NSICHANNEL |
49 | | NS_DECL_NSIWYCIWYGCHANNEL |
50 | | |
51 | | explicit WyciwygChannelChild(nsIEventTarget *aNeckoTarget); |
52 | | |
53 | | void AddIPDLReference(); |
54 | | void ReleaseIPDLReference(); |
55 | | |
56 | | nsresult Init(nsIURI *uri); |
57 | | |
58 | | bool IsSuspended(); |
59 | | |
60 | | protected: |
61 | | virtual ~WyciwygChannelChild(); |
62 | | |
63 | | mozilla::ipc::IPCResult RecvOnStartRequest(const nsresult& statusCode, |
64 | | const int64_t& contentLength, |
65 | | const int32_t& source, |
66 | | const nsCString& charset, |
67 | | const nsCString& securityInfo) override; |
68 | | mozilla::ipc::IPCResult RecvOnDataAvailable(const nsCString& data, |
69 | | const uint64_t& offset) override; |
70 | | mozilla::ipc::IPCResult RecvOnStopRequest(const nsresult& statusCode) override; |
71 | | mozilla::ipc::IPCResult RecvCancelEarly(const nsresult& statusCode) override; |
72 | | |
73 | | void OnStartRequest(const nsresult& statusCode, |
74 | | const int64_t& contentLength, |
75 | | const int32_t& source, |
76 | | const nsCString& charset, |
77 | | const nsCString& securityInfo); |
78 | | void OnDataAvailable(const nsCString& data, |
79 | | const uint64_t& offset); |
80 | | void OnStopRequest(const nsresult& statusCode); |
81 | | void CancelEarly(const nsresult& statusCode); |
82 | | |
83 | | friend class PrivateBrowsingChannel<WyciwygChannelChild>; |
84 | | |
85 | | private: |
86 | | nsresult mStatus; |
87 | | bool mIsPending; |
88 | | bool mCanceled; |
89 | | uint32_t mLoadFlags; |
90 | | int64_t mContentLength; |
91 | | int32_t mCharsetSource; |
92 | | nsCString mCharset; |
93 | | nsCOMPtr<nsIURI> mURI; |
94 | | nsCOMPtr<nsIURI> mOriginalURI; |
95 | | nsCOMPtr<nsISupports> mOwner; |
96 | | nsCOMPtr<nsILoadInfo> mLoadInfo; |
97 | | nsCOMPtr<nsIInterfaceRequestor> mCallbacks; |
98 | | nsCOMPtr<nsIProgressEventSink> mProgressSink; |
99 | | nsCOMPtr<nsILoadGroup> mLoadGroup; |
100 | | nsCOMPtr<nsIStreamListener> mListener; |
101 | | nsCOMPtr<nsISupports> mListenerContext; |
102 | | nsCOMPtr<nsISupports> mSecurityInfo; |
103 | | |
104 | | // FIXME: replace with IPDL states (bug 536319) |
105 | | enum WyciwygChannelChildState mState; |
106 | | |
107 | | bool mIPCOpen; |
108 | | bool mSentAppData; |
109 | | RefPtr<ChannelEventQueue> mEventQ; |
110 | | |
111 | | friend class WyciwygStartRequestEvent; |
112 | | friend class WyciwygDataAvailableEvent; |
113 | | friend class WyciwygStopRequestEvent; |
114 | | friend class WyciwygCancelEvent; |
115 | | friend class NeckoTargetChannelEvent<WyciwygChannelChild>; |
116 | | }; |
117 | | |
118 | | inline bool |
119 | | WyciwygChannelChild::IsSuspended() |
120 | 0 | { |
121 | 0 | return false; |
122 | 0 | } |
123 | | |
124 | | } // namespace net |
125 | | } // namespace mozilla |
126 | | |
127 | | #endif // mozilla_net_WyciwygChannelChild_h |