1.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000 1.2 +++ b/dom/plugins/ipc/StreamNotifyChild.h Wed Dec 31 06:09:35 2014 +0100 1.3 @@ -0,0 +1,64 @@ 1.4 +/* -*- Mode: C++; c-basic-offset: 2; indent-tabs-mode: nil; tab-width: 8 -*- */ 1.5 +/* vim: set sw=2 ts=2 et : */ 1.6 +/* This Source Code Form is subject to the terms of the Mozilla Public 1.7 + * License, v. 2.0. If a copy of the MPL was not distributed with this 1.8 + * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ 1.9 + 1.10 +#ifndef mozilla_plugins_StreamNotifyChild_h 1.11 +#define mozilla_plugins_StreamNotifyChild_h 1.12 + 1.13 +#include "mozilla/plugins/PStreamNotifyChild.h" 1.14 + 1.15 +namespace mozilla { 1.16 +namespace plugins { 1.17 + 1.18 +class BrowserStreamChild; 1.19 + 1.20 +class StreamNotifyChild : public PStreamNotifyChild 1.21 +{ 1.22 + friend class PluginInstanceChild; 1.23 + friend class BrowserStreamChild; 1.24 + 1.25 +public: 1.26 + StreamNotifyChild(const nsCString& aURL) 1.27 + : mURL(aURL) 1.28 + , mClosure(nullptr) 1.29 + , mBrowserStream(nullptr) 1.30 + { } 1.31 + 1.32 + virtual void ActorDestroy(ActorDestroyReason why) MOZ_OVERRIDE; 1.33 + 1.34 + void SetValid(void* aClosure) { 1.35 + mClosure = aClosure; 1.36 + } 1.37 + 1.38 + void NPP_URLNotify(NPReason reason); 1.39 + 1.40 +private: 1.41 + virtual bool Recv__delete__(const NPReason& reason) MOZ_OVERRIDE; 1.42 + 1.43 + bool RecvRedirectNotify(const nsCString& url, const int32_t& status) MOZ_OVERRIDE; 1.44 + 1.45 + /** 1.46 + * If a stream is created for this this URLNotify, we associate the objects 1.47 + * so that the NPP_URLNotify call is not fired before the stream data is 1.48 + * completely delivered. The BrowserStreamChild takes responsibility for 1.49 + * calling NPP_URLNotify and deleting this object. 1.50 + */ 1.51 + void SetAssociatedStream(BrowserStreamChild* bs); 1.52 + 1.53 + nsCString mURL; 1.54 + void* mClosure; 1.55 + 1.56 + /** 1.57 + * If mBrowserStream is true, it is responsible for deleting this C++ object 1.58 + * and DeallocPStreamNotify is not, so that the delayed delivery of 1.59 + * NPP_URLNotify is possible. 1.60 + */ 1.61 + BrowserStreamChild* mBrowserStream; 1.62 +}; 1.63 + 1.64 +} // namespace plugins 1.65 +} // namespace mozilla 1.66 + 1.67 +#endif