chore: eliminate a few uses of base::AdaptCallbackForRepeating() (#38293)

This commit is contained in:
Milan Burda 2023-05-18 23:01:44 +02:00 committed by GitHub
parent 642950a00e
commit 2acb97aa85
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
5 changed files with 12 additions and 16 deletions

View file

@ -653,8 +653,7 @@ void Session::SetPermissionRequestHandler(v8::Local<v8::Value> val,
blink::PermissionType permission_type, blink::PermissionType permission_type,
ElectronPermissionManager::StatusCallback callback, ElectronPermissionManager::StatusCallback callback,
const base::Value& details) { const base::Value& details) {
handler->Run(web_contents, permission_type, handler->Run(web_contents, permission_type, std::move(callback),
base::AdaptCallbackForRepeating(std::move(callback)),
details); details);
}, },
base::Owned(std::move(handler)))); base::Owned(std::move(handler))));

View file

@ -179,9 +179,9 @@ void ElectronBluetoothDelegate::ShowDevicePairPrompt(
} }
permission_manager->CheckBluetoothDevicePair( permission_manager->CheckBluetoothDevicePair(
details, base::AdaptCallbackForRepeating(base::BindOnce( details,
&ElectronBluetoothDelegate::OnDevicePairPromptResponse, base::BindOnce(&ElectronBluetoothDelegate::OnDevicePairPromptResponse,
weak_factory_.GetWeakPtr(), std::move(callback)))); weak_factory_.GetWeakPtr(), std::move(callback)));
} }
} }

View file

@ -247,9 +247,8 @@ void HidChooserController::OnGotDevices(
.Build(); .Build();
prevent_default = prevent_default =
session->Emit("select-hid-device", details, session->Emit("select-hid-device", details,
base::AdaptCallbackForRepeating( base::BindRepeating(&HidChooserController::OnDeviceChosen,
base::BindOnce(&HidChooserController::OnDeviceChosen, weak_factory_.GetWeakPtr()));
weak_factory_.GetWeakPtr())));
} }
if (!prevent_default) { if (!prevent_default) {
RunCallback({}); RunCallback({});

View file

@ -156,11 +156,10 @@ void SerialChooserController::OnGetDevices(
bool prevent_default = false; bool prevent_default = false;
api::Session* session = GetSession(); api::Session* session = GetSession();
if (session) { if (session) {
prevent_default = prevent_default = session->Emit(
session->Emit("select-serial-port", ports_, web_contents(), "select-serial-port", ports_, web_contents(),
base::AdaptCallbackForRepeating(base::BindOnce( base::BindRepeating(&SerialChooserController::OnDeviceChosen,
&SerialChooserController::OnDeviceChosen, weak_factory_.GetWeakPtr()));
weak_factory_.GetWeakPtr())));
} }
if (!prevent_default) { if (!prevent_default) {
RunCallback(/*port=*/nullptr); RunCallback(/*port=*/nullptr);

View file

@ -126,9 +126,8 @@ void UsbChooserController::GotUsbDeviceList(
prevent_default = prevent_default =
session->Emit("select-usb-device", details, session->Emit("select-usb-device", details,
base::AdaptCallbackForRepeating( base::BindRepeating(&UsbChooserController::OnDeviceChosen,
base::BindOnce(&UsbChooserController::OnDeviceChosen, weak_factory_.GetWeakPtr()));
weak_factory_.GetWeakPtr())));
} }
if (!prevent_default) { if (!prevent_default) {
RunCallback(/*device_info=*/nullptr); RunCallback(/*device_info=*/nullptr);