2019-08-01 07:57:41 -07:00
|
|
|
// Copyright (c) 2019 GitHub, Inc.
|
2019-06-14 08:26:25 -07:00
|
|
|
// Use of this source code is governed by the MIT license that can be
|
|
|
|
// found in the LICENSE file.
|
|
|
|
|
2019-08-01 07:57:41 -07:00
|
|
|
#include "shell/common/gin_converters/message_box_converter.h"
|
2019-06-14 08:26:25 -07:00
|
|
|
|
2019-08-14 19:18:34 -07:00
|
|
|
#include "shell/common/gin_converters/image_converter.h"
|
2019-08-09 13:43:18 -07:00
|
|
|
#include "shell/common/gin_converters/native_window_converter.h"
|
2021-07-15 07:59:27 +09:00
|
|
|
#include "shell/common/gin_helper/dictionary.h"
|
2019-06-14 08:26:25 -07:00
|
|
|
|
2019-08-01 07:57:41 -07:00
|
|
|
namespace gin {
|
2019-06-14 08:26:25 -07:00
|
|
|
|
|
|
|
bool Converter<electron::MessageBoxSettings>::FromV8(
|
|
|
|
v8::Isolate* isolate,
|
|
|
|
v8::Local<v8::Value> val,
|
|
|
|
electron::MessageBoxSettings* out) {
|
2021-07-15 07:59:27 +09:00
|
|
|
gin_helper::Dictionary dict;
|
2019-06-14 08:26:25 -07:00
|
|
|
int type = 0;
|
|
|
|
if (!ConvertFromV8(isolate, val, &dict))
|
|
|
|
return false;
|
|
|
|
dict.Get("window", &out->parent_window);
|
2019-07-22 08:19:24 -07:00
|
|
|
dict.Get("messageBoxType", &type);
|
2019-06-14 08:26:25 -07:00
|
|
|
out->type = static_cast<electron::MessageBoxType>(type);
|
|
|
|
dict.Get("buttons", &out->buttons);
|
2021-07-15 07:59:27 +09:00
|
|
|
dict.GetOptional("id", &out->id);
|
2019-06-14 08:26:25 -07:00
|
|
|
dict.Get("defaultId", &out->default_id);
|
|
|
|
dict.Get("cancelId", &out->cancel_id);
|
|
|
|
dict.Get("title", &out->title);
|
|
|
|
dict.Get("message", &out->message);
|
|
|
|
dict.Get("detail", &out->detail);
|
|
|
|
dict.Get("checkboxLabel", &out->checkbox_label);
|
2019-12-05 13:38:57 -08:00
|
|
|
dict.Get("noLink", &out->no_link);
|
2019-06-14 08:26:25 -07:00
|
|
|
dict.Get("checkboxChecked", &out->checkbox_checked);
|
|
|
|
dict.Get("icon", &out->icon);
|
2021-09-23 12:56:14 +02:00
|
|
|
dict.Get("textWidth", &out->text_width);
|
2019-06-14 08:26:25 -07:00
|
|
|
return true;
|
|
|
|
}
|
|
|
|
|
2019-08-01 07:57:41 -07:00
|
|
|
} // namespace gin
|