Bug 1861927 - Part 1: Rename nsIAsyncSetClipboardDataCallback to nsIAsyncClipboardRequestCallback; r=nika

It is going to be reused for clipboard read, so make the name more generic.

Differential Revision: https://phabricator.services.mozilla.com/D188526
This commit is contained in:
Edgar Chen 2023-10-30 09:46:19 +00:00
parent 3f852adf17
commit 6103cbd875
10 changed files with 21 additions and 21 deletions

View File

@ -582,7 +582,7 @@ static RefPtr<NativeItemPromise> GetClipboardNativeItem(
return NativeEntryPromise::All(GetCurrentSerialEventTarget(), promises);
}
class ClipboardWriteCallback final : public nsIAsyncSetClipboardDataCallback {
class ClipboardWriteCallback final : public nsIAsyncClipboardRequestCallback {
public:
// This object will never be held by a cycle-collected object, so it doesn't
// need to be cycle-collected despite holding alive cycle-collected objects.
@ -592,7 +592,7 @@ class ClipboardWriteCallback final : public nsIAsyncSetClipboardDataCallback {
ClipboardItem* aClipboardItem)
: mPromise(aPromise), mClipboardItem(aClipboardItem) {}
// nsIAsyncSetClipboardDataCallback
// nsIAsyncClipboardRequestCallback
NS_IMETHOD OnComplete(nsresult aResult) override {
MOZ_ASSERT(mPromise);
@ -625,7 +625,7 @@ class ClipboardWriteCallback final : public nsIAsyncSetClipboardDataCallback {
RefPtr<ClipboardItem> mClipboardItem;
};
NS_IMPL_ISUPPORTS(ClipboardWriteCallback, nsIAsyncSetClipboardDataCallback)
NS_IMPL_ISUPPORTS(ClipboardWriteCallback, nsIAsyncClipboardRequestCallback)
} // namespace

View File

@ -64,7 +64,7 @@ void ClipboardWriteRequestChild::ActorDestroy(ActorDestroyReason aReason) {
void ClipboardWriteRequestChild::MaybeNotifyCallback(nsresult aResult) {
mIsValid = false;
if (nsCOMPtr<nsIAsyncSetClipboardDataCallback> callback =
if (nsCOMPtr<nsIAsyncClipboardRequestCallback> callback =
mCallback.forget()) {
callback->OnComplete(aResult);
}

View File

@ -20,7 +20,7 @@ class ClipboardWriteRequestChild : public PClipboardWriteRequestChild,
NS_DECL_NSIASYNCSETCLIPBOARDDATA
explicit ClipboardWriteRequestChild(
nsIAsyncSetClipboardDataCallback* aCallback)
nsIAsyncClipboardRequestCallback* aCallback)
: mCallback(aCallback) {}
ipc::IPCResult Recv__delete__(nsresult aResult);
@ -32,7 +32,7 @@ class ClipboardWriteRequestChild : public PClipboardWriteRequestChild,
void MaybeNotifyCallback(nsresult aResult);
bool mIsValid = true;
nsCOMPtr<nsIAsyncSetClipboardDataCallback> mCallback;
nsCOMPtr<nsIAsyncClipboardRequestCallback> mCallback;
};
} // namespace mozilla

View File

@ -19,7 +19,7 @@ using mozilla::ipc::IPCResult;
namespace mozilla {
NS_IMPL_ISUPPORTS(ClipboardWriteRequestParent, nsIAsyncSetClipboardDataCallback)
NS_IMPL_ISUPPORTS(ClipboardWriteRequestParent, nsIAsyncClipboardRequestCallback)
ClipboardWriteRequestParent::ClipboardWriteRequestParent(
ContentParent* aManager)

View File

@ -17,13 +17,13 @@ class ContentParent;
class ClipboardWriteRequestParent final
: public PClipboardWriteRequestParent,
public nsIAsyncSetClipboardDataCallback {
public nsIAsyncClipboardRequestCallback {
using IPCResult = mozilla::ipc::IPCResult;
using ContentParent = mozilla::dom::ContentParent;
public:
NS_DECL_ISUPPORTS
NS_DECL_NSIASYNCSETCLIPBOARDDATACALLBACK
NS_DECL_NSIASYNCCLIPBOARDREQUESTCALLBACK
explicit ClipboardWriteRequestParent(ContentParent* aManager);

View File

@ -20,7 +20,7 @@ NS_IMPL_ISUPPORTS(nsBaseClipboard::AsyncSetClipboardData,
nsBaseClipboard::AsyncSetClipboardData::AsyncSetClipboardData(
int32_t aClipboardType, nsBaseClipboard* aClipboard,
nsIAsyncSetClipboardDataCallback* aCallback)
nsIAsyncClipboardRequestCallback* aCallback)
: mClipboardType(aClipboardType),
mClipboard(aClipboard),
mCallback(aCallback) {
@ -81,7 +81,7 @@ void nsBaseClipboard::AsyncSetClipboardData::MaybeNotifyCallback(
// take a reference to mClipboard.
MOZ_ASSERT(IsValid());
if (nsCOMPtr<nsIAsyncSetClipboardDataCallback> callback =
if (nsCOMPtr<nsIAsyncClipboardRequestCallback> callback =
mCallback.forget()) {
callback->OnComplete(aResult);
}
@ -101,7 +101,7 @@ void nsBaseClipboard::RejectPendingAsyncSetDataRequestIfAny(
}
NS_IMETHODIMP nsBaseClipboard::AsyncSetData(
int32_t aWhichClipboard, nsIAsyncSetClipboardDataCallback* aCallback,
int32_t aWhichClipboard, nsIAsyncClipboardRequestCallback* aCallback,
nsIAsyncSetClipboardData** _retval) {
MOZ_CLIPBOARD_LOG("%s: clipboard=%d", __FUNCTION__, aWhichClipboard);

View File

@ -40,7 +40,7 @@ class nsBaseClipboard : public nsIClipboard {
NS_IMETHOD SetData(nsITransferable* aTransferable, nsIClipboardOwner* aOwner,
int32_t aWhichClipboard) override final;
NS_IMETHOD AsyncSetData(int32_t aWhichClipboard,
nsIAsyncSetClipboardDataCallback* aCallback,
nsIAsyncClipboardRequestCallback* aCallback,
nsIAsyncSetClipboardData** _retval) override final;
NS_IMETHOD GetData(nsITransferable* aTransferable,
int32_t aWhichClipboard) override final;
@ -91,7 +91,7 @@ class nsBaseClipboard : public nsIClipboard {
NS_DECL_NSIASYNCSETCLIPBOARDDATA
AsyncSetClipboardData(int32_t aClipboardType, nsBaseClipboard* aClipboard,
nsIAsyncSetClipboardDataCallback* aCallback);
nsIAsyncClipboardRequestCallback* aCallback);
private:
virtual ~AsyncSetClipboardData() = default;
@ -110,7 +110,7 @@ class nsBaseClipboard : public nsIClipboard {
nsBaseClipboard* mClipboard;
// mCallback will be nullified once the callback is notified to ensure the
// callback is only notified once.
nsCOMPtr<nsIAsyncSetClipboardDataCallback> mCallback;
nsCOMPtr<nsIAsyncClipboardRequestCallback> mCallback;
};
class ClipboardCache final {

View File

@ -43,7 +43,7 @@ nsClipboardProxy::SetData(nsITransferable* aTransferable,
}
NS_IMETHODIMP nsClipboardProxy::AsyncSetData(
int32_t aWhichClipboard, nsIAsyncSetClipboardDataCallback* aCallback,
int32_t aWhichClipboard, nsIAsyncClipboardRequestCallback* aCallback,
nsIAsyncSetClipboardData** _retval) {
RefPtr<ClipboardWriteRequestChild> request =
MakeRefPtr<ClipboardWriteRequestChild>(aCallback);

View File

@ -42,11 +42,11 @@ interface nsIAsyncSetClipboardData : nsISupports {
};
[scriptable, uuid(78f7c18e-c8fa-11ed-afa1-0242ac120002)]
interface nsIAsyncSetClipboardDataCallback : nsISupports
interface nsIAsyncClipboardRequestCallback : nsISupports
{
/**
* Indicates that the clipboard asyncSetData request has either succeeded or
* been canceled.
* Indicates that the clipboard request has either succeeded, been canceled or
* rejected.
*
* @param aResult
* The result of the request. NS_OK if successful, or another value
@ -95,7 +95,7 @@ interface nsIClipboard : nsISupports
* data is provided by calling nsIAsyncSetClipboardData::setData().
*/
nsIAsyncSetClipboardData asyncSetData(in long aWhichClipboard,
[optional] in nsIAsyncSetClipboardDataCallback aCallback);
[optional] in nsIAsyncClipboardRequestCallback aCallback);
/**
* Filters the flavors aTransferable can import (see

View File

@ -121,7 +121,7 @@ clipboardTypes.forEach(function (type) {
let result;
let request = clipboard.asyncSetData(type, {
QueryInterface: SpecialPowers.ChromeUtils.generateQI([
"nsIAsyncSetClipboardDataCallback",
"nsIAsyncClipboardRequestCallback",
]),
onComplete(rv) {
result = rv;