Thu, 22 Jan 2015 13:21:57 +0100
Incorporate requested changes from Mozilla in review:
https://bugzilla.mozilla.org/show_bug.cgi?id=1123480#c6
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/. */
7 #ifndef mozilla_plugins_StreamNotifyChild_h
8 #define mozilla_plugins_StreamNotifyChild_h
10 #include "mozilla/plugins/PStreamNotifyChild.h"
12 namespace mozilla {
13 namespace plugins {
15 class BrowserStreamChild;
17 class StreamNotifyChild : public PStreamNotifyChild
18 {
19 friend class PluginInstanceChild;
20 friend class BrowserStreamChild;
22 public:
23 StreamNotifyChild(const nsCString& aURL)
24 : mURL(aURL)
25 , mClosure(nullptr)
26 , mBrowserStream(nullptr)
27 { }
29 virtual void ActorDestroy(ActorDestroyReason why) MOZ_OVERRIDE;
31 void SetValid(void* aClosure) {
32 mClosure = aClosure;
33 }
35 void NPP_URLNotify(NPReason reason);
37 private:
38 virtual bool Recv__delete__(const NPReason& reason) MOZ_OVERRIDE;
40 bool RecvRedirectNotify(const nsCString& url, const int32_t& status) MOZ_OVERRIDE;
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);
50 nsCString mURL;
51 void* mClosure;
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 };
61 } // namespace plugins
62 } // namespace mozilla
64 #endif