Decouple api::Window initialization from api::WebContents construction.

This commit is contained in:
Thiago de Arruda 2016-08-15 20:58:07 -03:00
parent 1d228446db
commit 1b1541fe1a
2 changed files with 12 additions and 0 deletions

View file

@ -86,6 +86,14 @@ Window::Window(v8::Isolate* isolate, v8::Local<v8::Object> wrapper,
web_preferences.Set("transparent", transparent); web_preferences.Set("transparent", transparent);
// Creates the WebContents used by BrowserWindow. // Creates the WebContents used by BrowserWindow.
auto web_contents = WebContents::Create(isolate, web_preferences); auto web_contents = WebContents::Create(isolate, web_preferences);
Init(isolate, wrapper, options, web_contents);
}
void Window::Init(v8::Isolate* isolate,
v8::Local<v8::Object> wrapper,
const mate::Dictionary& options,
mate::Handle<class WebContents> web_contents) {
web_contents_.Reset(isolate, web_contents.ToV8()); web_contents_.Reset(isolate, web_contents.ToV8());
api_web_contents_ = web_contents.get(); api_web_contents_ = web_contents.get();

View file

@ -89,6 +89,10 @@ class Window : public mate::TrackableObject<Window>,
#endif #endif
private: private:
void Init(v8::Isolate* isolate,
v8::Local<v8::Object> wrapper,
const mate::Dictionary& options,
mate::Handle<class WebContents> web_contents);
// APIs for NativeWindow. // APIs for NativeWindow.
void Close(); void Close();
void Focus(); void Focus();