Line data Source code
1 : /* -*- Mode: C++; c-basic-offset: 2; indent-tabs-mode: nil; tab-width: 8 -*- */
2 : /* vim: set sw=2 ts=2 et : */
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
5 : * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
6 :
7 : #ifndef mozilla_plugins_StreamNotifyChild_h
8 : #define mozilla_plugins_StreamNotifyChild_h
9 :
10 : #include "mozilla/plugins/PStreamNotifyChild.h"
11 :
12 : namespace mozilla {
13 : namespace plugins {
14 :
15 : class BrowserStreamChild;
16 :
17 0 : class StreamNotifyChild : public PStreamNotifyChild
18 : {
19 : friend class PluginInstanceChild;
20 : friend class BrowserStreamChild;
21 :
22 : public:
23 0 : explicit StreamNotifyChild(const nsCString& aURL)
24 0 : : mURL(aURL)
25 : , mClosure(nullptr)
26 0 : , mBrowserStream(nullptr)
27 0 : { }
28 :
29 : virtual void ActorDestroy(ActorDestroyReason why) override;
30 :
31 0 : void SetValid(void* aClosure) {
32 0 : mClosure = aClosure;
33 0 : }
34 :
35 : void NPP_URLNotify(NPReason reason);
36 :
37 : private:
38 : virtual mozilla::ipc::IPCResult Recv__delete__(const NPReason& reason) override;
39 :
40 : mozilla::ipc::IPCResult RecvRedirectNotify(const nsCString& url, const int32_t& status) override;
41 :
42 : /**
43 : * If a stream is created for this this URLNotify, we associate the objects
44 : * so that the NPP_URLNotify call is not fired before the stream data is
45 : * completely delivered. The BrowserStreamChild takes responsibility for
46 : * calling NPP_URLNotify and deleting this object.
47 : */
48 : void SetAssociatedStream(BrowserStreamChild* bs);
49 :
50 : nsCString mURL;
51 : void* mClosure;
52 :
53 : /**
54 : * If mBrowserStream is true, it is responsible for deleting this C++ object
55 : * and DeallocPStreamNotify is not, so that the delayed delivery of
56 : * NPP_URLNotify is possible.
57 : */
58 : BrowserStreamChild* mBrowserStream;
59 : };
60 :
61 : } // namespace plugins
62 : } // namespace mozilla
63 :
64 : #endif
|