Enable a subset of plugins

Having problems with building or using CEF's C/C++ APIs? This forum is here to help. Please do not post bug reports or feature requests here.

Enable a subset of plugins

Postby callum » Thu Nov 19, 2015 6:57 pm

Is is possible to enable/disable a subset of the built in Chrome plugins?

For example, I want the user to decide whether to allow Flash to run or not but I would always like the Chrome PDF one to be available.

At the moment they are all turned off - I didn't realize PDF rendering was via a plugin - took me much longer than it should have to figure it out why navigating to a PDF just did nothing at all :)
callum
Expert
 
Posts: 326
Joined: Mon Feb 23, 2015 6:19 pm

Re: Enable a subset of plugins

Postby magreenblatt » Thu Nov 19, 2015 8:59 pm

Newer CEF versions have CefRequestContextHandler::OnBeforePluginLoad.
magreenblatt
Site Admin
 
Posts: 12409
Joined: Fri May 29, 2009 6:57 pm

Re: Enable a subset of plugins

Postby callum » Thu Nov 19, 2015 11:14 pm

Got it.

I implemented that method, set CefBrowserSettings::plugins to false in my setup code and in my overridden OnBeforePluginLoad(..) method, for mime_types of application.pdf, I set *plugin_policy = PLUGIN_POLICY_ALLOW; and return true to indicate I am changing the policy. The PDF does not render though. It does if I set CefBrowserSettings::plugins to true.

What am I doing wrong?
callum
Expert
 
Posts: 326
Joined: Mon Feb 23, 2015 6:19 pm

Re: Enable a subset of plugins

Postby magreenblatt » Thu Nov 19, 2015 11:23 pm

Don't set CefBrowserSettings::plugins to false.
magreenblatt
Site Admin
 
Posts: 12409
Joined: Fri May 29, 2009 6:57 pm

Re: Enable a subset of plugins

Postby callum » Fri Nov 20, 2015 12:01 am

Great - got it working.

The piece I was missing to test Flash on/off as well as PDF on was adding the command line "enable-system-flash" in OnBeforeCommandLineProcessing.

Works as I want now - thanks Marshall.
callum
Expert
 
Posts: 326
Joined: Mon Feb 23, 2015 6:19 pm


Return to Support Forum

Who is online

Users browsing this forum: No registered users and 101 guests