refactor: simplify ShowSaveDialog, make consistent with ShowOpenDialog (#19924)
This commit is contained in:
parent
f6c523db13
commit
94c6b256de
1 changed files with 3 additions and 7 deletions
|
@ -64,16 +64,12 @@ class FileSelectHelper : public base::RefCounted<FileSelectHelper>,
|
|||
|
||||
void ShowSaveDialog(const file_dialog::DialogSettings& settings) {
|
||||
v8::Isolate* isolate = v8::Isolate::GetCurrent();
|
||||
v8::Local<v8::Context> context = isolate->GetCurrentContext();
|
||||
electron::util::Promise<mate::Dictionary> promise(isolate);
|
||||
v8::Local<v8::Promise> handle = promise.GetHandle();
|
||||
|
||||
auto callback = base::BindOnce(&FileSelectHelper::OnSaveDialogDone, this);
|
||||
ignore_result(promise.Then(std::move(callback)));
|
||||
|
||||
file_dialog::ShowSaveDialog(settings, std::move(promise));
|
||||
ignore_result(handle->Then(
|
||||
context,
|
||||
v8::Local<v8::Function>::Cast(mate::ConvertToV8(
|
||||
isolate,
|
||||
base::BindOnce(&FileSelectHelper::OnSaveDialogDone, this)))));
|
||||
}
|
||||
|
||||
private:
|
||||
|
|
Loading…
Reference in a new issue