feat: add signal option to dialog.showMessageBox (#26102)

* mac: add dialog.closeMessageBox API

* win: Implement dialog.closeMessageBox

* mac: Return cancelId with closeMessageBox

* gtk: Implement dialog.closeMessageBox

* win: Fix 32bit build

* win: Reduce the scope of lock

* fix: Build error after rebase

* feat: Use AbortSignal to close message box

* chore: silently handle duplicate ID

* win: Add more notes about the threads

* chore: apply reviews

* fix: base::NoDestructor should be warpped in function

* chore: fix style on windows
This commit is contained in:
Cheng Zhao 2021-07-15 07:59:27 +09:00 committed by GitHub
parent 4b780f9770
commit 05ba6359d0
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
9 changed files with 276 additions and 24 deletions

View file

@ -4,9 +4,9 @@
#include "shell/common/gin_converters/message_box_converter.h"
#include "gin/dictionary.h"
#include "shell/common/gin_converters/image_converter.h"
#include "shell/common/gin_converters/native_window_converter.h"
#include "shell/common/gin_helper/dictionary.h"
namespace gin {
@ -14,7 +14,7 @@ bool Converter<electron::MessageBoxSettings>::FromV8(
v8::Isolate* isolate,
v8::Local<v8::Value> val,
electron::MessageBoxSettings* out) {
gin::Dictionary dict(nullptr);
gin_helper::Dictionary dict;
int type = 0;
if (!ConvertFromV8(isolate, val, &dict))
return false;
@ -22,6 +22,7 @@ bool Converter<electron::MessageBoxSettings>::FromV8(
dict.Get("messageBoxType", &type);
out->type = static_cast<electron::MessageBoxType>(type);
dict.Get("buttons", &out->buttons);
dict.GetOptional("id", &out->id);
dict.Get("defaultId", &out->default_id);
dict.Get("cancelId", &out->cancel_id);
dict.Get("title", &out->title);