From 1b1541fe1abda3c9059e34f682e86b7416342b2e Mon Sep 17 00:00:00 2001 From: Thiago de Arruda Date: Mon, 15 Aug 2016 20:58:07 -0300 Subject: [PATCH] Decouple api::Window initialization from api::WebContents construction. --- atom/browser/api/atom_api_window.cc | 8 ++++++++ atom/browser/api/atom_api_window.h | 4 ++++ 2 files changed, 12 insertions(+) diff --git a/atom/browser/api/atom_api_window.cc b/atom/browser/api/atom_api_window.cc index 92e5e5b56280..d16200086402 100644 --- a/atom/browser/api/atom_api_window.cc +++ b/atom/browser/api/atom_api_window.cc @@ -86,6 +86,14 @@ Window::Window(v8::Isolate* isolate, v8::Local wrapper, web_preferences.Set("transparent", transparent); // Creates the WebContents used by BrowserWindow. auto web_contents = WebContents::Create(isolate, web_preferences); + + Init(isolate, wrapper, options, web_contents); +} + +void Window::Init(v8::Isolate* isolate, + v8::Local wrapper, + const mate::Dictionary& options, + mate::Handle web_contents) { web_contents_.Reset(isolate, web_contents.ToV8()); api_web_contents_ = web_contents.get(); diff --git a/atom/browser/api/atom_api_window.h b/atom/browser/api/atom_api_window.h index d2c41c288165..37508b024fd6 100644 --- a/atom/browser/api/atom_api_window.h +++ b/atom/browser/api/atom_api_window.h @@ -89,6 +89,10 @@ class Window : public mate::TrackableObject, #endif private: + void Init(v8::Isolate* isolate, + v8::Local wrapper, + const mate::Dictionary& options, + mate::Handle web_contents); // APIs for NativeWindow. void Close(); void Focus();