summaryrefslogtreecommitdiffstats
path: root/security/manager/ssl/PSMContentListener.h
diff options
context:
space:
mode:
authorMatt A. Tobin <mattatobin@localhost.localdomain>2018-02-02 04:16:08 -0500
committerMatt A. Tobin <mattatobin@localhost.localdomain>2018-02-02 04:16:08 -0500
commit5f8de423f190bbb79a62f804151bc24824fa32d8 (patch)
tree10027f336435511475e392454359edea8e25895d /security/manager/ssl/PSMContentListener.h
parent49ee0794b5d912db1f95dce6eb52d781dc210db5 (diff)
downloadUXP-5f8de423f190bbb79a62f804151bc24824fa32d8.tar
UXP-5f8de423f190bbb79a62f804151bc24824fa32d8.tar.gz
UXP-5f8de423f190bbb79a62f804151bc24824fa32d8.tar.lz
UXP-5f8de423f190bbb79a62f804151bc24824fa32d8.tar.xz
UXP-5f8de423f190bbb79a62f804151bc24824fa32d8.zip
Add m-esr52 at 52.6.0
Diffstat (limited to 'security/manager/ssl/PSMContentListener.h')
-rw-r--r--security/manager/ssl/PSMContentListener.h111
1 files changed, 111 insertions, 0 deletions
diff --git a/security/manager/ssl/PSMContentListener.h b/security/manager/ssl/PSMContentListener.h
new file mode 100644
index 000000000..d948383a4
--- /dev/null
+++ b/security/manager/ssl/PSMContentListener.h
@@ -0,0 +1,111 @@
+/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*-
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
+
+#ifndef mozilla_psm_PSMCOntentListener_h_
+#define mozilla_psm_PSMCOntentListener_h_
+
+#include "nsCOMPtr.h"
+#include "nsIURIContentListener.h"
+#include "nsWeakReference.h"
+#include "mozilla/psm/PPSMContentDownloaderChild.h"
+#include "mozilla/psm/PPSMContentDownloaderParent.h"
+
+#define NS_PSMCONTENTLISTEN_CID {0xc94f4a30, 0x64d7, 0x11d4, {0x99, 0x60, 0x00, 0xb0, 0xd0, 0x23, 0x54, 0xa0}}
+#define NS_PSMCONTENTLISTEN_CONTRACTID "@mozilla.org/security/psmdownload;1"
+
+namespace mozilla {
+namespace net {
+
+class PChannelDiverterParent;
+
+} // namespace net
+} // namespace mozilla
+
+namespace mozilla { namespace psm {
+
+// PSMContentStreamListener for parent-process downloading.
+class PSMContentStreamListener : public nsIStreamListener
+{
+public:
+ explicit PSMContentStreamListener(uint32_t type);
+ NS_DECL_ISUPPORTS
+ NS_DECL_NSIREQUESTOBSERVER
+ NS_DECL_NSISTREAMLISTENER
+
+ void ImportCertificate();
+
+protected:
+ virtual ~PSMContentStreamListener();
+
+ nsCString mByteData;
+ uint32_t mType;
+};
+
+// Parent actor for importing a remote cert when the load was started by the
+// child.
+class PSMContentDownloaderParent : public PPSMContentDownloaderParent
+ , public PSMContentStreamListener
+{
+public:
+ explicit PSMContentDownloaderParent(uint32_t type);
+
+ virtual bool RecvOnStartRequest(const uint32_t &contentLength) override;
+ virtual bool RecvOnDataAvailable(const nsCString &data,
+ const uint64_t &offset,
+ const uint32_t &count) override;
+ virtual bool RecvOnStopRequest(const nsresult &code) override;
+
+ // We inherit most of nsIStreamListener from PSMContentStreamListener, but
+ // we have to override OnStopRequest to know when we're done with our IPC
+ // ref.
+ NS_IMETHOD OnStopRequest(nsIRequest *request, nsISupports *aContext, nsresult code) override;
+
+ virtual bool RecvDivertToParentUsing(mozilla::net::PChannelDiverterParent *diverter) override;
+
+protected:
+ virtual ~PSMContentDownloaderParent();
+
+ virtual void ActorDestroy(ActorDestroyReason why) override;
+ bool mIPCOpen;
+};
+
+// Child actor for importing a cert.
+class PSMContentDownloaderChild : public nsIStreamListener
+ , public PPSMContentDownloaderChild
+{
+public:
+ PSMContentDownloaderChild();
+
+ NS_DECL_ISUPPORTS
+ NS_DECL_NSIREQUESTOBSERVER
+ NS_DECL_NSISTREAMLISTENER
+
+private:
+ ~PSMContentDownloaderChild();
+};
+
+
+class PSMContentListener : public nsIURIContentListener,
+ public nsSupportsWeakReference
+{
+public:
+ PSMContentListener();
+ nsresult init();
+
+ NS_DECL_ISUPPORTS
+ NS_DECL_NSIURICONTENTLISTENER
+
+protected:
+ virtual ~PSMContentListener();
+
+private:
+ nsCOMPtr<nsISupports> mLoadCookie;
+ nsCOMPtr<nsIURIContentListener> mParentContentListener;
+};
+
+} } // namespace mozilla::psm
+
+#endif // mozilla_psm_PSMCOntentListener_h