refactor: move native window gin converter (#19577)

* move native window gin converter

* extract to new file
This commit is contained in:
Micha Hanselmann 2019-08-09 13:43:18 -07:00 committed by Shelley Vohr
parent 7861e9f728
commit 57507ca37c
10 changed files with 67 additions and 36 deletions

View file

@ -13,6 +13,7 @@
#include "shell/common/api/gin_utils.h"
#include "shell/common/gin_converters/file_dialog_converter_gin_adapter.h"
#include "shell/common/gin_converters/message_box_converter.h"
#include "shell/common/gin_converters/native_window_converter.h"
#include "shell/common/gin_converters/net_converter_gin_adapter.h"
#include "shell/common/node_includes.h"
#include "shell/common/promise_util.h"

View file

@ -10,9 +10,9 @@
#include "base/bind.h"
#include "native_mate/dictionary.h"
#include "native_mate/object_template_builder.h"
#include "shell/browser/api/atom_api_browser_window.h"
#include "shell/browser/browser.h"
#include "shell/common/native_mate_converters/gfx_converter.h"
#include "shell/common/native_mate_converters/native_window_converter.h"
#include "shell/common/node_includes.h"
#include "ui/display/display.h"
#include "ui/display/screen.h"

View file

@ -20,6 +20,7 @@
#include "shell/common/native_mate_converters/file_path_converter.h"
#include "shell/common/native_mate_converters/gfx_converter.h"
#include "shell/common/native_mate_converters/image_converter.h"
#include "shell/common/native_mate_converters/native_window_converter.h"
#include "shell/common/native_mate_converters/string16_converter.h"
#include "shell/common/native_mate_converters/value_converter.h"
#include "shell/common/node_includes.h"

View file

@ -261,28 +261,4 @@ class TopLevelWindow : public mate::TrackableObject<TopLevelWindow>,
} // namespace electron
namespace mate {
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 (!Converter<electron::api::TopLevelWindow*>::FromV8(isolate, val,
&window))
return false;
*out = window->window();
return true;
}
};
} // namespace mate
#endif // SHELL_BROWSER_API_ATOM_API_TOP_LEVEL_WINDOW_H_