diff --git a/libcef/browser/content_browser_client.cc b/libcef/browser/content_browser_client.cc index e8f95e827..d231b8bf4 100644 --- a/libcef/browser/content_browser_client.cc +++ b/libcef/browser/content_browser_client.cc @@ -680,11 +680,17 @@ void CefContentBrowserClient::AppendExtraCommandLineSwitches( // Propagate the following switches to the renderer command line (along with // any associated values) if present in the browser command line. static const char* const kSwitchNames[] = { - switches::kDisableExtensions, switches::kDisablePdfExtension, - switches::kDisableScrollBounce, switches::kDisableSpellChecking, - switches::kEnableSpeechInput, switches::kEnableSystemFlash, - switches::kPpapiFlashArgs, switches::kPpapiFlashPath, - switches::kPpapiFlashVersion, switches::kUncaughtExceptionStackSize, + switches::kDisableExtensions, + switches::kDisablePdfExtension, + switches::kDisablePlugins, + switches::kDisableScrollBounce, + switches::kDisableSpellChecking, + switches::kEnableSpeechInput, + switches::kEnableSystemFlash, + switches::kPpapiFlashArgs, + switches::kPpapiFlashPath, + switches::kPpapiFlashVersion, + switches::kUncaughtExceptionStackSize, }; command_line->CopySwitchesFrom(*browser_cmd, kSwitchNames, arraysize(kSwitchNames)); diff --git a/libcef/browser/prefs/renderer_prefs.cc b/libcef/browser/prefs/renderer_prefs.cc index d780d7ca7..68065dd1e 100644 --- a/libcef/browser/prefs/renderer_prefs.cc +++ b/libcef/browser/prefs/renderer_prefs.cc @@ -288,6 +288,8 @@ void SetCommandLinePrefDefaults(CommandLinePrefStore* prefs) { SetBool(prefs, prefs::kWebKitLoadsImagesAutomatically, false); if (command_line->HasSwitch(switches::kDisableTabToLinks)) SetBool(prefs, prefs::kWebkitTabsToLinks, false); + if (command_line->HasSwitch(switches::kDisablePlugins)) + SetBool(prefs, prefs::kWebKitPluginsEnabled, false); } void RegisterProfilePrefs(user_prefs::PrefRegistrySyncable* registry) { diff --git a/libcef/common/cef_switches.cc b/libcef/common/cef_switches.cc index dee4e9288..e4b055223 100644 --- a/libcef/common/cef_switches.cc +++ b/libcef/common/cef_switches.cc @@ -57,6 +57,9 @@ const char kDisableTextAreaResize[] = "disable-text-area-resize"; // Disable using the tab key to advance focus to links. const char kDisableTabToLinks[] = "disable-tab-to-links"; +// Disable plugins. +const char kDisablePlugins[] = "disable-plugins"; + // Persist session cookies. const char kPersistSessionCookies[] = "persist-session-cookies"; diff --git a/libcef/common/cef_switches.h b/libcef/common/cef_switches.h index 7dd77334a..c56dfb4e9 100644 --- a/libcef/common/cef_switches.h +++ b/libcef/common/cef_switches.h @@ -31,6 +31,7 @@ extern const char kDisableImageLoading[]; extern const char kImageShrinkStandaloneToFit[]; extern const char kDisableTextAreaResize[]; extern const char kDisableTabToLinks[]; +extern const char kDisablePlugins[]; extern const char kPersistSessionCookies[]; extern const char kPersistUserPreferences[]; extern const char kEnableMediaStream[]; diff --git a/libcef/common/main_delegate.cc b/libcef/common/main_delegate.cc index 88e77e503..ee8eaed41 100644 --- a/libcef/common/main_delegate.cc +++ b/libcef/common/main_delegate.cc @@ -717,7 +717,8 @@ void CefMainDelegate::InitializeResourceBundle() { } } - if (extensions::ExtensionsEnabled()) { + if (extensions::ExtensionsEnabled() || + !command_line->HasSwitch(switches::kDisablePlugins)) { if (base::PathExists(cef_extensions_pak_file)) { resource_bundle.AddDataPackFromPath(cef_extensions_pak_file, ui::SCALE_FACTOR_NONE); diff --git a/patch/patches/chrome_plugins.patch b/patch/patches/chrome_plugins.patch index daaf56bbb..4a65f3dc3 100644 --- a/patch/patches/chrome_plugins.patch +++ b/patch/patches/chrome_plugins.patch @@ -187,3 +187,21 @@ index 5dc888bfb2df..297737be682e 100644 break; } case chrome::mojom::PluginStatus::kComponentUpdateRequired: { +diff --git chrome/renderer/plugins/chrome_plugin_placeholder.cc chrome/renderer/plugins/chrome_plugin_placeholder.cc +index 7a814bb072dc..79c7d65118cb 100644 +--- chrome/renderer/plugins/chrome_plugin_placeholder.cc ++++ chrome/renderer/plugins/chrome_plugin_placeholder.cc +@@ -349,8 +349,11 @@ void ChromePluginPlaceholder::OnBlockedContent( + + if (status == + content::RenderFrame::PeripheralContentStatus::CONTENT_STATUS_TINY) { +- ContentSettingsObserver::Get(render_frame()) +- ->DidBlockContentType(CONTENT_SETTINGS_TYPE_PLUGINS, title_); ++ ContentSettingsObserver* observer = ++ ContentSettingsObserver::Get(render_frame()); ++ if (observer) { ++ observer->DidBlockContentType(CONTENT_SETTINGS_TYPE_PLUGINS, title_); ++ } + } + + std::string message = base::StringPrintf(