summaryrefslogtreecommitdiffstats
path: root/widget/headless/HeadlessClipboard.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 /widget/headless/HeadlessClipboard.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 'widget/headless/HeadlessClipboard.h')
-rw-r--r--widget/headless/HeadlessClipboard.h52
1 files changed, 52 insertions, 0 deletions
diff --git a/widget/headless/HeadlessClipboard.h b/widget/headless/HeadlessClipboard.h
new file mode 100644
index 0000000000..da68cfe8a7
--- /dev/null
+++ b/widget/headless/HeadlessClipboard.h
@@ -0,0 +1,52 @@
+/* -*- 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_widget_HeadlessClipboard_h
+#define mozilla_widget_HeadlessClipboard_h
+
+#include "nsBaseClipboard.h"
+#include "nsIClipboard.h"
+#include "mozilla/UniquePtr.h"
+#include "HeadlessClipboardData.h"
+
+namespace mozilla {
+namespace widget {
+
+class HeadlessClipboard final : public ClipboardSetDataHelper {
+ public:
+ HeadlessClipboard();
+
+ NS_DECL_ISUPPORTS_INHERITED
+
+ // nsIClipboard
+ NS_IMETHOD GetData(nsITransferable* aTransferable,
+ int32_t aWhichClipboard) override;
+ NS_IMETHOD EmptyClipboard(int32_t aWhichClipboard) override;
+ NS_IMETHOD HasDataMatchingFlavors(const nsTArray<nsCString>& aFlavorList,
+ int32_t aWhichClipboard,
+ bool* _retval) override;
+ NS_IMETHOD IsClipboardTypeSupported(int32_t aWhichClipboard,
+ bool* _retval) override;
+ RefPtr<mozilla::GenericPromise> AsyncGetData(
+ nsITransferable* aTransferable, int32_t aWhichClipboard) override;
+ RefPtr<DataFlavorsPromise> AsyncHasDataMatchingFlavors(
+ const nsTArray<nsCString>& aFlavorList, int32_t aWhichClipboard) override;
+
+ protected:
+ ~HeadlessClipboard() = default;
+
+ // Implement the native clipboard behavior.
+ NS_IMETHOD SetNativeClipboardData(nsITransferable* aTransferable,
+ nsIClipboardOwner* aOwner,
+ int32_t aWhichClipboard) override;
+
+ private:
+ UniquePtr<HeadlessClipboardData> mClipboard;
+};
+
+} // namespace widget
+} // namespace mozilla
+
+#endif