summaryrefslogtreecommitdiffstats
path: root/mobile/android/components/geckoview/GeckoViewStreamListener.h
diff options
context:
space:
mode:
authorDaniel Baumann <daniel.baumann@progress-linux.org>2024-04-07 17:32:43 +0000
committerDaniel Baumann <daniel.baumann@progress-linux.org>2024-04-07 17:32:43 +0000
commit6bf0a5cb5034a7e684dcc3500e841785237ce2dd (patch)
treea68f146d7fa01f0134297619fbe7e33db084e0aa /mobile/android/components/geckoview/GeckoViewStreamListener.h
parentInitial commit. (diff)
downloadthunderbird-6bf0a5cb5034a7e684dcc3500e841785237ce2dd.tar.xz
thunderbird-6bf0a5cb5034a7e684dcc3500e841785237ce2dd.zip
Adding upstream version 1:115.7.0.upstream/1%115.7.0upstream
Signed-off-by: Daniel Baumann <daniel.baumann@progress-linux.org>
Diffstat (limited to 'mobile/android/components/geckoview/GeckoViewStreamListener.h')
-rw-r--r--mobile/android/components/geckoview/GeckoViewStreamListener.h57
1 files changed, 57 insertions, 0 deletions
diff --git a/mobile/android/components/geckoview/GeckoViewStreamListener.h b/mobile/android/components/geckoview/GeckoViewStreamListener.h
new file mode 100644
index 0000000000..b42249f458
--- /dev/null
+++ b/mobile/android/components/geckoview/GeckoViewStreamListener.h
@@ -0,0 +1,57 @@
+/* -*- Mode: c++; c-basic-offset: 2; tab-width: 2; indent-tabs-mode: nil; -*-
+ * 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 GeckoViewStreamListener_h__
+#define GeckoViewStreamListener_h__
+
+#include "nsIStreamListener.h"
+#include "nsIInterfaceRequestor.h"
+#include "nsIChannelEventSink.h"
+
+#include "mozilla/widget/EventDispatcher.h"
+#include "mozilla/java/GeckoInputStreamNatives.h"
+#include "mozilla/java/WebResponseWrappers.h"
+
+#include "JavaBuiltins.h"
+
+namespace mozilla {
+
+class GeckoViewStreamListener : public nsIStreamListener,
+ public nsIInterfaceRequestor,
+ public nsIChannelEventSink {
+ public:
+ NS_DECL_THREADSAFE_ISUPPORTS
+ NS_DECL_NSIREQUESTOBSERVER
+ NS_DECL_NSISTREAMLISTENER
+ NS_DECL_NSIINTERFACEREQUESTOR
+ NS_DECL_NSICHANNELEVENTSINK
+
+ explicit GeckoViewStreamListener() {}
+
+ static std::tuple<jni::ByteArray::LocalRef, java::sdk::Boolean::LocalRef>
+ CertificateFromChannel(nsIChannel* aChannel);
+
+ protected:
+ virtual ~GeckoViewStreamListener() {}
+
+ java::GeckoInputStream::GlobalRef mStream;
+ java::GeckoInputStream::Support::GlobalRef mSupport;
+
+ void InitializeStreamSupport(nsIRequest* aRequest);
+
+ static nsresult WriteSegment(nsIInputStream* aInputStream, void* aClosure,
+ const char* aFromSegment, uint32_t aToOffset,
+ uint32_t aCount, uint32_t* aWriteCount);
+
+ virtual nsresult HandleWebResponse(nsIRequest* aRequest);
+
+ virtual void SendWebResponse(java::WebResponse::Param aResponse) = 0;
+
+ virtual void CompleteWithError(nsresult aStatus, nsIChannel* aChannel) = 0;
+};
+
+} // namespace mozilla
+
+#endif // GeckoViewStreamListener_h__