michael@0: /* -*- Mode: C++; c-basic-offset: 2; indent-tabs-mode: nil; tab-width: 8 -*- */ 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_BrowserStreamParent_h michael@0: #define mozilla_plugins_BrowserStreamParent_h michael@0: michael@0: #include "mozilla/plugins/PBrowserStreamParent.h" michael@0: #include "mozilla/plugins/AStream.h" michael@0: michael@0: namespace mozilla { michael@0: namespace plugins { michael@0: michael@0: class PluginInstanceParent; michael@0: michael@0: class BrowserStreamParent : public PBrowserStreamParent, public AStream michael@0: { michael@0: friend class PluginModuleParent; michael@0: friend class PluginInstanceParent; michael@0: michael@0: public: michael@0: BrowserStreamParent(PluginInstanceParent* npp, michael@0: NPStream* stream); michael@0: virtual ~BrowserStreamParent(); michael@0: michael@0: virtual bool IsBrowserStream() MOZ_OVERRIDE { return true; } michael@0: michael@0: virtual bool AnswerNPN_RequestRead(const IPCByteRanges& ranges, michael@0: NPError* result) MOZ_OVERRIDE; michael@0: michael@0: virtual bool RecvNPN_DestroyStream(const NPReason& reason) MOZ_OVERRIDE; michael@0: michael@0: virtual bool RecvStreamDestroyed() MOZ_OVERRIDE; michael@0: michael@0: int32_t WriteReady(); michael@0: int32_t Write(int32_t offset, int32_t len, void* buffer); michael@0: void StreamAsFile(const char* fname); michael@0: michael@0: void NPP_DestroyStream(NPReason reason); michael@0: michael@0: private: michael@0: using PBrowserStreamParent::SendNPP_DestroyStream; michael@0: michael@0: PluginInstanceParent* mNPP; michael@0: NPStream* mStream; michael@0: nsCOMPtr mStreamPeer; michael@0: michael@0: enum { michael@0: ALIVE, michael@0: DYING, michael@0: DELETING michael@0: } mState; michael@0: }; michael@0: michael@0: } // namespace plugins michael@0: } // namespace mozilla michael@0: michael@0: #endif