From 0e92a3e3333fc98a69170f7b202e78bc6b8895e7 Mon Sep 17 00:00:00 2001 From: Cheng Zhao Date: Sat, 5 Sep 2015 01:51:14 +0900 Subject: [PATCH] Use options['web-preferences'] to create WebContents --- atom/browser/api/atom_api_window.cc | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/atom/browser/api/atom_api_window.cc b/atom/browser/api/atom_api_window.cc index e6d16fe6..c8c64375 100644 --- a/atom/browser/api/atom_api_window.cc +++ b/atom/browser/api/atom_api_window.cc @@ -13,6 +13,7 @@ #include "atom/common/native_mate_converters/gurl_converter.h" #include "atom/common/native_mate_converters/image_converter.h" #include "atom/common/native_mate_converters/string16_converter.h" +#include "atom/common/options_switches.h" #include "content/public/browser/render_process_host.h" #include "native_mate/constructor.h" #include "native_mate/dictionary.h" @@ -64,9 +65,12 @@ void OnCapturePageDone( Window::Window(v8::Isolate* isolate, const mate::Dictionary& options) { + // Use options['web-preferences'] to create WebContents. + mate::Dictionary web_preferences = mate::Dictionary::CreateEmpty(isolate); + options.Get(switches::kWebPreferences, &web_preferences); + // Creates the WebContents used by BrowserWindow. - mate::Dictionary web_contents_options(isolate, v8::Object::New(isolate)); - auto web_contents = WebContents::Create(isolate, web_contents_options); + auto web_contents = WebContents::Create(isolate, web_preferences); web_contents_.Reset(isolate, web_contents.ToV8()); api_web_contents_ = web_contents.get(); -- 2.43.0