From: Cheng Zhao Date: Fri, 4 Sep 2015 16:51:14 +0000 (+0900) Subject: Use options['web-preferences'] to create WebContents X-Git-Tag: v0.32.0~10^2~16 X-Git-Url: http://git.khamidou.com/?a=commitdiff_plain;h=0e92a3e3333fc98a69170f7b202e78bc6b8895e7;p=electron.git Use options['web-preferences'] to create WebContents --- 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();