2019-08-09 20:43:18 +00:00
|
|
|
// Copyright (c) 2019 GitHub, Inc.
|
|
|
|
// Use of this source code is governed by the MIT license that can be
|
|
|
|
// found in the LICENSE file.
|
|
|
|
|
2021-11-22 07:34:31 +00:00
|
|
|
#ifndef ELECTRON_SHELL_COMMON_GIN_CONVERTERS_NATIVE_WINDOW_CONVERTER_H_
|
|
|
|
#define ELECTRON_SHELL_COMMON_GIN_CONVERTERS_NATIVE_WINDOW_CONVERTER_H_
|
2019-08-09 20:43:18 +00:00
|
|
|
|
|
|
|
#include "gin/converter.h"
|
2020-06-29 07:06:20 +00:00
|
|
|
#include "shell/browser/api/electron_api_base_window.h"
|
2019-08-09 20:43:18 +00:00
|
|
|
|
|
|
|
namespace gin {
|
|
|
|
|
|
|
|
template <>
|
|
|
|
struct Converter<electron::NativeWindow*> {
|
|
|
|
static bool FromV8(v8::Isolate* isolate,
|
|
|
|
v8::Local<v8::Value> val,
|
|
|
|
electron::NativeWindow** out) {
|
2023-10-03 19:26:35 +00:00
|
|
|
// null would be transferred to nullptr.
|
2019-08-09 20:43:18 +00:00
|
|
|
if (val->IsNull()) {
|
2023-10-03 19:26:35 +00:00
|
|
|
*out = nullptr;
|
2019-08-09 20:43:18 +00:00
|
|
|
return true;
|
|
|
|
}
|
|
|
|
|
2020-06-29 07:06:20 +00:00
|
|
|
electron::api::BaseWindow* window;
|
|
|
|
if (!gin::Converter<electron::api::BaseWindow*>::FromV8(isolate, val,
|
|
|
|
&window))
|
2019-08-09 20:43:18 +00:00
|
|
|
return false;
|
|
|
|
*out = window->window();
|
|
|
|
return true;
|
|
|
|
}
|
|
|
|
};
|
|
|
|
|
|
|
|
} // namespace gin
|
|
|
|
|
2021-11-22 07:34:31 +00:00
|
|
|
#endif // ELECTRON_SHELL_COMMON_GIN_CONVERTERS_NATIVE_WINDOW_CONVERTER_H_
|