|
1 /* -*- Mode: C++; c-basic-offset: 2; indent-tabs-mode: nil; tab-width: 8 -*- */ |
|
2 /* This Source Code Form is subject to the terms of the Mozilla Public |
|
3 * License, v. 2.0. If a copy of the MPL was not distributed with this |
|
4 * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ |
|
5 |
|
6 #ifndef mozilla_plugins_BrowserStreamParent_h |
|
7 #define mozilla_plugins_BrowserStreamParent_h |
|
8 |
|
9 #include "mozilla/plugins/PBrowserStreamParent.h" |
|
10 #include "mozilla/plugins/AStream.h" |
|
11 |
|
12 namespace mozilla { |
|
13 namespace plugins { |
|
14 |
|
15 class PluginInstanceParent; |
|
16 |
|
17 class BrowserStreamParent : public PBrowserStreamParent, public AStream |
|
18 { |
|
19 friend class PluginModuleParent; |
|
20 friend class PluginInstanceParent; |
|
21 |
|
22 public: |
|
23 BrowserStreamParent(PluginInstanceParent* npp, |
|
24 NPStream* stream); |
|
25 virtual ~BrowserStreamParent(); |
|
26 |
|
27 virtual bool IsBrowserStream() MOZ_OVERRIDE { return true; } |
|
28 |
|
29 virtual bool AnswerNPN_RequestRead(const IPCByteRanges& ranges, |
|
30 NPError* result) MOZ_OVERRIDE; |
|
31 |
|
32 virtual bool RecvNPN_DestroyStream(const NPReason& reason) MOZ_OVERRIDE; |
|
33 |
|
34 virtual bool RecvStreamDestroyed() MOZ_OVERRIDE; |
|
35 |
|
36 int32_t WriteReady(); |
|
37 int32_t Write(int32_t offset, int32_t len, void* buffer); |
|
38 void StreamAsFile(const char* fname); |
|
39 |
|
40 void NPP_DestroyStream(NPReason reason); |
|
41 |
|
42 private: |
|
43 using PBrowserStreamParent::SendNPP_DestroyStream; |
|
44 |
|
45 PluginInstanceParent* mNPP; |
|
46 NPStream* mStream; |
|
47 nsCOMPtr<nsISupports> mStreamPeer; |
|
48 |
|
49 enum { |
|
50 ALIVE, |
|
51 DYING, |
|
52 DELETING |
|
53 } mState; |
|
54 }; |
|
55 |
|
56 } // namespace plugins |
|
57 } // namespace mozilla |
|
58 |
|
59 #endif |