diff --git a/atom/browser/native_window.cc b/atom/browser/native_window.cc index 96085846bc..b0b99081e3 100644 --- a/atom/browser/native_window.cc +++ b/atom/browser/native_window.cc @@ -424,7 +424,6 @@ void NativeWindow::OverrideWebkitPrefs(content::WebPreferences* prefs) { return; bool b; - std::vector list; if (web_preferences_.Get("javascript", &b)) prefs->javascript_enabled = b; if (web_preferences_.Get("images", &b)) @@ -446,14 +445,6 @@ void NativeWindow::OverrideWebkitPrefs(content::WebPreferences* prefs) { prefs->allow_displaying_insecure_content = b; if (web_preferences_.Get("allow-running-insecure-content", &b)) prefs->allow_running_insecure_content = b; - if (web_preferences_.Get("extra-plugin-dirs", &list)) { - if (content::PluginService::GetInstance()->NPAPIPluginsSupported()) { - for (size_t i = 0; i < list.size(); ++i) - content::PluginService::GetInstance()->AddExtraPluginDir(list[i]); - } else { - LOG(WARNING) << "NPAPI plugins not supported on this platform"; - } - } } void NativeWindow::NotifyWindowClosed() { diff --git a/atom/browser/web_contents_preferences.cc b/atom/browser/web_contents_preferences.cc index 8b956c1b41..fbd2c7661a 100644 --- a/atom/browser/web_contents_preferences.cc +++ b/atom/browser/web_contents_preferences.cc @@ -22,4 +22,11 @@ WebContentsPreferences::WebContentsPreferences( WebContentsPreferences::~WebContentsPreferences() { } +// static +WebContentsPreferences* WebContentsPreferences::From( + content::WebContents* web_contents) { + return static_cast( + web_contents->GetUserData(kWebPreferencesKey)); +} + } // namespace atom diff --git a/atom/browser/web_contents_preferences.h b/atom/browser/web_contents_preferences.h index bbbc4cf5e2..c4c50dc070 100644 --- a/atom/browser/web_contents_preferences.h +++ b/atom/browser/web_contents_preferences.h @@ -10,9 +10,13 @@ namespace atom { +// Stores and applies the preferences of WebContents. class WebContentsPreferences : public content::WebContentsUserData { public: + // Get the preferences of |web_contents|. + static WebContentsPreferences* From(content::WebContents* web_contents); + WebContentsPreferences(content::WebContents* web_contents, base::DictionaryValue&& web_preferences); ~WebContentsPreferences() override;