]> khamidou — GitHub mirrors - electron.git/commitdiff
Use options['web-preferences'] to create WebContents
authorCheng Zhao <zcbenz@gmail.com>
Fri, 4 Sep 2015 16:51:14 +0000 (01:51 +0900)
committerCheng Zhao <zcbenz@gmail.com>
Sun, 6 Sep 2015 02:53:03 +0000 (10:53 +0800)
atom/browser/api/atom_api_window.cc

index e6d16fe6fa594d0638cc12913e257e80ee9a533b..c8c6437530e9cd91472e782cbe10770801f5179f 100644 (file)
@@ -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();