diff options
Diffstat (limited to 'widget/nsBaseClipboard.h')
-rw-r--r-- | widget/nsBaseClipboard.h | 25 |
1 files changed, 18 insertions, 7 deletions
diff --git a/widget/nsBaseClipboard.h b/widget/nsBaseClipboard.h index ffa68d6240..625421c342 100644 --- a/widget/nsBaseClipboard.h +++ b/widget/nsBaseClipboard.h @@ -14,11 +14,11 @@ #include "nsITransferable.h" #include "nsCOMPtr.h" -static mozilla::LazyLogModule sWidgetClipboardLog("WidgetClipboard"); +extern mozilla::LazyLogModule gWidgetClipboardLog; #define MOZ_CLIPBOARD_LOG(...) \ - MOZ_LOG(sWidgetClipboardLog, mozilla::LogLevel::Debug, (__VA_ARGS__)) + MOZ_LOG(gWidgetClipboardLog, mozilla::LogLevel::Debug, (__VA_ARGS__)) #define MOZ_CLIPBOARD_LOG_ENABLED() \ - MOZ_LOG_TEST(sWidgetClipboardLog, mozilla::LogLevel::Debug) + MOZ_LOG_TEST(gWidgetClipboardLog, mozilla::LogLevel::Debug) class nsITransferable; class nsIClipboardOwner; @@ -42,9 +42,12 @@ class nsBaseClipboard : public nsIClipboard { NS_DECL_ISUPPORTS // nsIClipboard - NS_IMETHOD SetData(nsITransferable* aTransferable, nsIClipboardOwner* aOwner, - int32_t aWhichClipboard) override final; + NS_IMETHOD SetData( + nsITransferable* aTransferable, nsIClipboardOwner* aOwner, + int32_t aWhichClipboard, + mozilla::dom::WindowContext* aWindowContext) override final; NS_IMETHOD AsyncSetData(int32_t aWhichClipboard, + mozilla::dom::WindowContext* aSettingWindowContext, nsIAsyncClipboardRequestCallback* aCallback, nsIAsyncSetClipboardData** _retval) override final; NS_IMETHOD GetData( @@ -75,6 +78,9 @@ class nsBaseClipboard : public nsIClipboard { using HasMatchingFlavorsCallback = mozilla::MoveOnlyFunction<void( mozilla::Result<nsTArray<nsCString>, nsresult>)>; + mozilla::Maybe<uint64_t> GetClipboardCacheInnerWindowId( + int32_t aClipboardType); + protected: virtual ~nsBaseClipboard(); @@ -106,6 +112,7 @@ class nsBaseClipboard : public nsIClipboard { NS_DECL_NSIASYNCSETCLIPBOARDDATA AsyncSetClipboardData(int32_t aClipboardType, nsBaseClipboard* aClipboard, + mozilla::dom::WindowContext* aRequestingWindowContext, nsIAsyncClipboardRequestCallback* aCallback); private: @@ -123,6 +130,7 @@ class nsBaseClipboard : public nsIClipboard { // NotifyCallback()) once nsBaseClipboard stops tracking us. This is // also used to indicate whether this request is valid. nsBaseClipboard* mClipboard; + RefPtr<mozilla::dom::WindowContext> mWindowContext; // mCallback will be nullified once the callback is notified to ensure the // callback is only notified once. nsCOMPtr<nsIAsyncClipboardRequestCallback> mCallback; @@ -172,22 +180,26 @@ class nsBaseClipboard : public nsIClipboard { */ void Clear(); void Update(nsITransferable* aTransferable, - nsIClipboardOwner* aClipboardOwner, int32_t aSequenceNumber) { + nsIClipboardOwner* aClipboardOwner, int32_t aSequenceNumber, + mozilla::Maybe<uint64_t> aInnerWindowId) { // Clear first to notify the old clipboard owner. Clear(); mTransferable = aTransferable; mClipboardOwner = aClipboardOwner; mSequenceNumber = aSequenceNumber; + mInnerWindowId = aInnerWindowId; } nsITransferable* GetTransferable() const { return mTransferable; } nsIClipboardOwner* GetClipboardOwner() const { return mClipboardOwner; } int32_t GetSequenceNumber() const { return mSequenceNumber; } + mozilla::Maybe<uint64_t> GetInnerWindowId() const { return mInnerWindowId; } nsresult GetData(nsITransferable* aTransferable) const; private: nsCOMPtr<nsITransferable> mTransferable; nsCOMPtr<nsIClipboardOwner> mClipboardOwner; int32_t mSequenceNumber = -1; + mozilla::Maybe<uint64_t> mInnerWindowId; }; void MaybeRetryGetAvailableFlavors( @@ -203,7 +215,6 @@ class nsBaseClipboard : public nsIClipboard { int32_t aClipboardType); nsresult GetDataFromClipboardCache(nsITransferable* aTransferable, int32_t aClipboardType); - void RequestUserConfirmation(int32_t aClipboardType, const nsTArray<nsCString>& aFlavorList, mozilla::dom::WindowContext* aWindowContext, |