Bug 1915351 part 1 - make GetNativeClipboardSequenceNumber public r=geckoview-reviewers,win-reviewers,handyman,m_kato

This is used in later patches to determine whether we have run
content analysis on the current clipboard contents.

Differential Revision: https://phabricator.services.mozilla.com/D223410
This commit is contained in:
Greg Stoll 2024-10-28 22:37:56 +00:00
parent 2b56bf1bac
commit 2a54251771
6 changed files with 14 additions and 12 deletions

View File

@ -20,6 +20,9 @@ class nsClipboard final : public nsBaseClipboard {
static nsresult GetTextFromTransferable(nsITransferable* aTransferable,
nsString& aText, nsString& aHTML);
mozilla::Result<int32_t, nsresult> GetNativeClipboardSequenceNumber(
ClipboardType aWhichClipboard) override;
protected:
// Implement the native clipboard behavior.
NS_IMETHOD SetNativeClipboardData(nsITransferable* aTransferable,
@ -27,8 +30,6 @@ class nsClipboard final : public nsBaseClipboard {
NS_IMETHOD GetNativeClipboardData(nsITransferable* aTransferable,
ClipboardType aWhichClipboard) override;
nsresult EmptyNativeClipboardData(ClipboardType aWhichClipboard) override;
mozilla::Result<int32_t, nsresult> GetNativeClipboardSequenceNumber(
ClipboardType aWhichClipboard) override;
mozilla::Result<bool, nsresult> HasNativeClipboardDataMatchingFlavors(
const nsTArray<nsCString>& aFlavorList,
ClipboardType aWhichClipboard) override;

View File

@ -39,6 +39,8 @@ class nsClipboard : public nsBaseClipboard {
static NSString* WrapHtmlForSystemPasteboard(NSString* aString);
static nsresult TransferableFromPasteboard(nsITransferable* aTransferable,
NSPasteboard* pboard);
mozilla::Result<int32_t, nsresult> GetNativeClipboardSequenceNumber(
ClipboardType aWhichClipboard) override;
protected:
// Implement the native clipboard behavior.
@ -47,8 +49,6 @@ class nsClipboard : public nsBaseClipboard {
NS_IMETHOD GetNativeClipboardData(nsITransferable* aTransferable,
ClipboardType aWhichClipboard) override;
nsresult EmptyNativeClipboardData(ClipboardType aWhichClipboard) override;
mozilla::Result<int32_t, nsresult> GetNativeClipboardSequenceNumber(
ClipboardType aWhichClipboard) override;
mozilla::Result<bool, nsresult> HasNativeClipboardDataMatchingFlavors(
const nsTArray<nsCString>& aFlavorList,
ClipboardType aWhichClipboard) override;

View File

@ -114,6 +114,9 @@ class nsClipboard : public nsBaseClipboard, public nsIObserver {
void OwnerChangedEvent(GtkClipboard* aGtkClipboard,
GdkEventOwnerChange* aEvent);
mozilla::Result<int32_t, nsresult> GetNativeClipboardSequenceNumber(
ClipboardType aWhichClipboard) override;
protected:
// Implement the native clipboard behavior.
NS_IMETHOD SetNativeClipboardData(nsITransferable* aTransferable,
@ -124,8 +127,6 @@ class nsClipboard : public nsBaseClipboard, public nsIObserver {
ClipboardType aWhichClipboard,
GetDataCallback&& aCallback) override;
nsresult EmptyNativeClipboardData(ClipboardType aWhichClipboard) override;
mozilla::Result<int32_t, nsresult> GetNativeClipboardSequenceNumber(
ClipboardType aWhichClipboard) override;
mozilla::Result<bool, nsresult> HasNativeClipboardDataMatchingFlavors(
const nsTArray<nsCString>& aFlavorList,
ClipboardType aWhichClipboard) override;

View File

@ -19,6 +19,8 @@ class HeadlessClipboard final : public nsBaseClipboard {
HeadlessClipboard();
NS_DECL_ISUPPORTS_INHERITED
mozilla::Result<int32_t, nsresult> GetNativeClipboardSequenceNumber(
ClipboardType aWhichClipboard) override;
protected:
~HeadlessClipboard() = default;
@ -29,8 +31,6 @@ class HeadlessClipboard final : public nsBaseClipboard {
NS_IMETHOD GetNativeClipboardData(nsITransferable* aTransferable,
ClipboardType aWhichClipboard) override;
nsresult EmptyNativeClipboardData(ClipboardType aWhichClipboard) override;
mozilla::Result<int32_t, nsresult> GetNativeClipboardSequenceNumber(
ClipboardType aWhichClipboard) override;
mozilla::Result<bool, nsresult> HasNativeClipboardDataMatchingFlavors(
const nsTArray<nsCString>& aFlavorList,
ClipboardType aWhichClipboard) override;

View File

@ -82,6 +82,8 @@ class nsBaseClipboard : public nsIClipboard {
mozilla::Maybe<uint64_t> GetClipboardCacheInnerWindowId(
ClipboardType aClipboardType);
virtual mozilla::Result<int32_t, nsresult> GetNativeClipboardSequenceNumber(
ClipboardType aWhichClipboard) = 0;
protected:
virtual ~nsBaseClipboard();
@ -95,8 +97,6 @@ class nsBaseClipboard : public nsIClipboard {
ClipboardType aWhichClipboard,
GetDataCallback&& aCallback);
virtual nsresult EmptyNativeClipboardData(ClipboardType aWhichClipboard) = 0;
virtual mozilla::Result<int32_t, nsresult> GetNativeClipboardSequenceNumber(
ClipboardType aWhichClipboard) = 0;
virtual mozilla::Result<bool, nsresult> HasNativeClipboardDataMatchingFlavors(
const nsTArray<nsCString>& aFlavorList,
ClipboardType aWhichClipboard) = 0;

View File

@ -64,6 +64,8 @@ class nsClipboard : public nsBaseClipboard, public nsIObserver {
static UINT GetClipboardFileDescriptorFormatW();
static UINT GetHtmlClipboardFormat();
static UINT GetCustomClipboardFormat();
mozilla::Result<int32_t, nsresult> GetNativeClipboardSequenceNumber(
ClipboardType aWhichClipboard) override;
protected:
// @param aDataObject must be non-nullptr.
@ -76,8 +78,6 @@ class nsClipboard : public nsBaseClipboard, public nsIObserver {
NS_IMETHOD GetNativeClipboardData(nsITransferable* aTransferable,
ClipboardType aWhichClipboard) override;
nsresult EmptyNativeClipboardData(ClipboardType aWhichClipboard) override;
mozilla::Result<int32_t, nsresult> GetNativeClipboardSequenceNumber(
ClipboardType aWhichClipboard) override;
mozilla::Result<bool, nsresult> HasNativeClipboardDataMatchingFlavors(
const nsTArray<nsCString>& aFlavorList,
ClipboardType aWhichClipboard) override;