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