michael@0: /* -*- Mode: C++; c-basic-offset: 2; indent-tabs-mode: nil; tab-width: 8 -*- */ michael@0: /* vim: set sw=2 ts=2 et : */ michael@0: /* This Source Code Form is subject to the terms of the Mozilla Public michael@0: * License, v. 2.0. If a copy of the MPL was not distributed with this michael@0: * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ michael@0: michael@0: #ifndef mozilla_plugins_StreamNotifyChild_h michael@0: #define mozilla_plugins_StreamNotifyChild_h michael@0: michael@0: #include "mozilla/plugins/PStreamNotifyChild.h" michael@0: michael@0: namespace mozilla { michael@0: namespace plugins { michael@0: michael@0: class BrowserStreamChild; michael@0: michael@0: class StreamNotifyChild : public PStreamNotifyChild michael@0: { michael@0: friend class PluginInstanceChild; michael@0: friend class BrowserStreamChild; michael@0: michael@0: public: michael@0: StreamNotifyChild(const nsCString& aURL) michael@0: : mURL(aURL) michael@0: , mClosure(nullptr) michael@0: , mBrowserStream(nullptr) michael@0: { } michael@0: michael@0: virtual void ActorDestroy(ActorDestroyReason why) MOZ_OVERRIDE; michael@0: michael@0: void SetValid(void* aClosure) { michael@0: mClosure = aClosure; michael@0: } michael@0: michael@0: void NPP_URLNotify(NPReason reason); michael@0: michael@0: private: michael@0: virtual bool Recv__delete__(const NPReason& reason) MOZ_OVERRIDE; michael@0: michael@0: bool RecvRedirectNotify(const nsCString& url, const int32_t& status) MOZ_OVERRIDE; michael@0: michael@0: /** michael@0: * If a stream is created for this this URLNotify, we associate the objects michael@0: * so that the NPP_URLNotify call is not fired before the stream data is michael@0: * completely delivered. The BrowserStreamChild takes responsibility for michael@0: * calling NPP_URLNotify and deleting this object. michael@0: */ michael@0: void SetAssociatedStream(BrowserStreamChild* bs); michael@0: michael@0: nsCString mURL; michael@0: void* mClosure; michael@0: michael@0: /** michael@0: * If mBrowserStream is true, it is responsible for deleting this C++ object michael@0: * and DeallocPStreamNotify is not, so that the delayed delivery of michael@0: * NPP_URLNotify is possible. michael@0: */ michael@0: BrowserStreamChild* mBrowserStream; michael@0: }; michael@0: michael@0: } // namespace plugins michael@0: } // namespace mozilla michael@0: michael@0: #endif