electron/shell/common/gin_converters/native_window_converter.h
Cheng Zhao 0a741670a9
chore: remove native_mate (Part 14) (#21365)
* chore: remove uses of mate::Dictionary and mate::Handle

* chore: move CreateConstructor to gin_helper

* chore: remove native_mate

* chore: remove unneeded gin patch
2019-12-05 18:46:34 +09:00

35 lines
1 KiB
C++

// Copyright (c) 2019 GitHub, Inc.
// Use of this source code is governed by the MIT license that can be
// found in the LICENSE file.
#ifndef SHELL_COMMON_GIN_CONVERTERS_NATIVE_WINDOW_CONVERTER_H_
#define SHELL_COMMON_GIN_CONVERTERS_NATIVE_WINDOW_CONVERTER_H_
#include "gin/converter.h"
#include "shell/browser/api/atom_api_top_level_window.h"
namespace gin {
template <>
struct Converter<electron::NativeWindow*> {
static bool FromV8(v8::Isolate* isolate,
v8::Local<v8::Value> val,
electron::NativeWindow** out) {
// null would be tranfered to NULL.
if (val->IsNull()) {
*out = NULL;
return true;
}
electron::api::TopLevelWindow* window;
if (!gin::Converter<electron::api::TopLevelWindow*>::FromV8(isolate, val,
&window))
return false;
*out = window->window();
return true;
}
};
} // namespace gin
#endif // SHELL_COMMON_GIN_CONVERTERS_NATIVE_WINDOW_CONVERTER_H_