如何删除或禁用 CefSharp 中的插件

How to remove or disable plugin in CefSharp

我需要禁用 Flash Player。 我尝试通过 RequestContextHandler 执行此操作,但没有成功:

public class RequestContextHandler : IRequestContextHandler
{
    public ICookieManager GetCookieManager()
    {
        return null;
    }

    public bool OnBeforePluginLoad(string mimeType, string url, bool isMainFrame, string topOriginUrl, WebPluginInfo pluginInfo, ref PluginPolicy pluginPolicy)
    {
        bool blockPluginLoad = pluginInfo.Name.ToLower().Contains("flash");
        return blockPluginLoad;
    }
}

Whoer.net 说明 Flash 没有被禁用。

如何禁用 "pepflashplayer" 插件?

-还需要配置插件策略:

public class RequestContextHandler : IRequestContextHandler
{
    public ICookieManager GetCookieManager()
    {
        return null;
    }

    public bool OnBeforePluginLoad(string mimeType, string url, bool isMainFrame, string topOriginUrl, WebPluginInfo pluginInfo, ref PluginPolicy pluginPolicy)
    {

        bool blockPluginLoad = pluginInfo.Name.ToLower().Contains("flash");
        if (blockPluginLoad)
        {
            pluginPolicy = PluginPolicy.Disable;
        }
        return blockPluginLoad;
    }
} 

感谢@stuartd