nsBaseParentChannel.h (1291B)
1 /* -*- Mode: C++; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ 2 /* vim: set ts=8 sts=2 et sw=2 tw=80: */ 3 /* This Source Code Form is subject to the terms of the Mozilla Public 4 * License, v. 2.0. If a copy of the MPL was not distributed with this file, 5 * You can obtain one at http://mozilla.org/MPL/2.0/. */ 6 7 #ifndef nsBaseParentChannel_h 8 #define nsBaseParentChannel_h 9 10 #include "nsIParentChannel.h" 11 12 // Basic type which implements a no-op nsIParentChannel instance. 13 // 14 // nsBaseChannel can be used when implementing simple channels which need to 15 // support cross-process redirects, and do not need the other features 16 // nsIParentChannel supports. 17 // 18 // The default behaviour if nothing is overridden is to close the channel as 19 // soon as `OnStartRequest` is received. The implementations of 20 // `nsIRequestObserver` and `nsIStreamListener` can be overridden to change this 21 // behaviour. 22 class nsBaseParentChannel : public nsIParentChannel { 23 public: 24 NS_DECL_ISUPPORTS 25 NS_DECL_NSIPARENTCHANNEL 26 NS_DECL_NSIREQUESTOBSERVER 27 NS_DECL_NSISTREAMLISTENER 28 29 explicit nsBaseParentChannel(const nsACString& aRemoteType) 30 : mRemoteType(aRemoteType) {} 31 32 protected: 33 virtual ~nsBaseParentChannel() = default; 34 35 nsCString mRemoteType; 36 }; 37 38 #endif // nsBaseParentChannel_h