Bug 1909986 - For sidebar revamp, only show chatbot entrypoints (context menu, shortc...
[gecko.git] / netwerk / protocol / http / AltDataOutputStreamParent.h
bloba9642b9e45aa85ce40e27ed3fbd85ab88e12c030
1 /* -*- Mode: C++; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
2 /* vim: set sw=2 ts=8 et tw=80 : */
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/. */
8 #ifndef mozilla_net_AltDataOutputStreamParent_h
9 #define mozilla_net_AltDataOutputStreamParent_h
11 #include "mozilla/net/PAltDataOutputStreamParent.h"
12 #include "nsIOutputStream.h"
14 namespace mozilla {
15 namespace net {
17 // Forwards data received from the content process to an output stream.
18 class AltDataOutputStreamParent : public PAltDataOutputStreamParent,
19 public nsISupports {
20 public:
21 NS_DECL_ISUPPORTS
23 // Called from NeckoParent::AllocPAltDataOutputStreamParent which also opens
24 // the output stream.
25 // aStream may be null
26 explicit AltDataOutputStreamParent(nsIOutputStream* aStream);
28 // Called when data is received from the content process.
29 // We proceed to write that data to the output stream.
30 mozilla::ipc::IPCResult RecvWriteData(const nsCString& data);
31 // Called when AltDataOutputStreamChild::Close() is
32 // Closes and nulls the output stream.
33 mozilla::ipc::IPCResult RecvClose(const nsresult& aStatus);
34 virtual void ActorDestroy(ActorDestroyReason aWhy) override;
36 // Sets an error that will be reported to the content process.
37 void SetError(nsresult status) { mStatus = status; }
38 mozilla::ipc::IPCResult RecvDeleteSelf();
40 private:
41 virtual ~AltDataOutputStreamParent();
42 nsCOMPtr<nsIOutputStream> mOutputStream;
43 // In case any error occurs mStatus will be != NS_OK, and this status code
44 // will be sent to the content process asynchronously.
45 nsresult mStatus;
46 bool mIPCOpen;
49 } // namespace net
50 } // namespace mozilla
52 #endif // mozilla_net_AltDataOutputStreamParent_h