chore: eliminate a few uses of base::AdaptCallbackForRepeating() (#38293)
This commit is contained in:
parent
642950a00e
commit
2acb97aa85
5 changed files with 12 additions and 16 deletions
|
@ -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))));
|
||||||
|
|
|
@ -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)));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -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({});
|
||||||
|
|
|
@ -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);
|
||||||
|
|
|
@ -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);
|
||||||
|
|
Loading…
Reference in a new issue