ADivertableParentChannel.h 1.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445
  1. /* -*- Mode: C++; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
  2. /* This Source Code Form is subject to the terms of the Mozilla Public
  3. * License, v. 2.0. If a copy of the MPL was not distributed with this
  4. * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
  5. #ifndef _adivertablechannelparent_h_
  6. #define _adivertablechannelparent_h_
  7. #include "nsISupports.h"
  8. class nsIStreamListener;
  9. namespace mozilla {
  10. namespace net {
  11. // To be implemented by a channel's parent actors, e.g. HttpChannelParent
  12. // and FTPChannelParent. Used by ChannelDiverterParent to divert
  13. // nsIStreamListener callbacks from the child process to a new
  14. // listener in the parent process.
  15. class ADivertableParentChannel : public nsISupports
  16. {
  17. public:
  18. // Called by ChannelDiverterParent::DivertTo(nsIStreamListener*).
  19. // The listener should now be used to received nsIStreamListener callbacks,
  20. // i.e. OnStartRequest, OnDataAvailable and OnStopRequest, as if it had been
  21. // passed to AsyncOpen for the channel. A reference to the listener will be
  22. // added and kept until OnStopRequest has completed.
  23. virtual void DivertTo(nsIStreamListener *aListener) = 0;
  24. // Called to suspend parent channel in ChannelDiverterParent constructor.
  25. virtual nsresult SuspendForDiversion() = 0;
  26. // While messages are diverted back from the child to the parent calls to
  27. // suspend/resume the channel must also suspend/resume the message diversion.
  28. // These two functions will be called by nsHttpChannel and nsFtpChannel
  29. // Suspend()/Resume() functions.
  30. virtual nsresult SuspendMessageDiversion() = 0;
  31. virtual nsresult ResumeMessageDiversion() = 0;
  32. };
  33. } // namespace net
  34. } // namespace mozilla
  35. #endif