netwerk/protocol/http/HttpChannelParentListener.h

changeset 0
6474c204b198
     1.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
     1.2 +++ b/netwerk/protocol/http/HttpChannelParentListener.h	Wed Dec 31 06:09:35 2014 +0100
     1.3 @@ -0,0 +1,59 @@
     1.4 +/* -*- Mode: C++; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
     1.5 +/* vim: set sw=2 ts=8 et tw=80 : */
     1.6 +
     1.7 +/* This Source Code Form is subject to the terms of the Mozilla Public
     1.8 + * License, v. 2.0. If a copy of the MPL was not distributed with this
     1.9 + * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
    1.10 +
    1.11 +#ifndef mozilla_net_HttpChannelCallbackWrapper_h
    1.12 +#define mozilla_net_HttpChannelCallbackWrapper_h
    1.13 +
    1.14 +#include "nsIInterfaceRequestor.h"
    1.15 +#include "nsIChannelEventSink.h"
    1.16 +#include "nsIRedirectResultListener.h"
    1.17 +
    1.18 +class nsIParentChannel;
    1.19 +
    1.20 +namespace mozilla {
    1.21 +namespace net {
    1.22 +
    1.23 +class HttpChannelParent;
    1.24 +
    1.25 +class HttpChannelParentListener : public nsIInterfaceRequestor
    1.26 +                                 , public nsIChannelEventSink
    1.27 +                                 , public nsIRedirectResultListener
    1.28 +                                 , public nsIStreamListener
    1.29 +{
    1.30 +public:
    1.31 +  NS_DECL_ISUPPORTS
    1.32 +  NS_DECL_NSIINTERFACEREQUESTOR
    1.33 +  NS_DECL_NSICHANNELEVENTSINK
    1.34 +  NS_DECL_NSIREDIRECTRESULTLISTENER
    1.35 +  NS_DECL_NSIREQUESTOBSERVER
    1.36 +  NS_DECL_NSISTREAMLISTENER
    1.37 +
    1.38 +  HttpChannelParentListener(HttpChannelParent* aInitialChannel);
    1.39 +  virtual ~HttpChannelParentListener();
    1.40 +
    1.41 +  // For channel diversion from child to parent.
    1.42 +  nsresult DivertTo(nsIStreamListener *aListener);
    1.43 +  nsresult SuspendForDiversion();
    1.44 +
    1.45 +private:
    1.46 +  // Private partner function to SuspendForDiversion.
    1.47 +  nsresult ResumeForDiversion();
    1.48 +
    1.49 +  // Can be the original HttpChannelParent that created this object (normal
    1.50 +  // case), a different {HTTP|FTP}ChannelParent that we've been redirected to,
    1.51 +  // or some other listener that we have been diverted to via
    1.52 +  // nsIDivertableChannel.
    1.53 +  nsCOMPtr<nsIStreamListener> mNextListener;
    1.54 +  uint32_t mRedirectChannelId;
    1.55 +  // When set, no OnStart/OnData/OnStop calls should be received.
    1.56 +  bool mSuspendedForDiversion;
    1.57 +};
    1.58 +
    1.59 +} // namespace net
    1.60 +} // namespace mozilla
    1.61 +
    1.62 +#endif // mozilla_net_HttpChannelParent_h

mercurial