CEF CustomSchemeHandler for 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.

CEF CustomSchemeHandler for plugins

Postby kidwonder » Tue Mar 19, 2013 12:18 am

Hello world! It's my first post in the CEF community!

I would like create a CEF enabled application that supports user generated plugins, similar to the spotify implementation. I do not know the mime type of the files included in a plugin unless I opened and read the file contents. I would like to register a domain for each plugin on my custom scheme i.e. app://plugin1/index.html. Plugins would not ship with the application, they would be downloaded and saved to the application data/plugin folder. I would like to convert the app://plugin1/index.html url into a file:// url then have chromium or cef load the contents (no redirect, the address bar should be in the plugin1 scope and not reveal the local file path).

Code: Select all
class ApplicationPluginSchemeHandlerFactory : public CefResourceHandler {
  private:
    CefString plugin_;
  public:
    virtual bool ProcessRequest(CefRefPtr<CefRequest> request,
                              CefRefPtr<CefCallback> callback)
                              OVERRIDE {
      REQUIRE_IO_THREAD();

      // load file:///C:/Users/build/Release/plugins/plugin_/index.html


Is it currently possible to kick resource processing back to chromium rather than the scheme handler factory accessing plugin files directly? (I do not want to open the file, read contents and determine mime type myself. I'm guessing chromium framework is capable of doing this as-is.)

Any advise is much appreciated!
kidwonder
Newbie
 
Posts: 2
Joined: Mon Mar 18, 2013 11:38 pm

Re: CEF CustomSchemeHandler for plugins

Postby magreenblatt » Tue Mar 19, 2013 12:34 pm

You should consider using a custom scheme handler instead of the file:// scheme. Otherwise your apps will not behave like HTTP-hosted pages. See viewtopic.php?f=6&t=406#p1599 for more information.

You can determine the mime type in your code by looking at the file extension.
magreenblatt
Site Admin
 
Posts: 12409
Joined: Fri May 29, 2009 6:57 pm

Re: CEF CustomSchemeHandler for plugins

Postby kidwonder » Tue Mar 19, 2013 3:17 pm

magreenblatt, thank you for taking time to respond. Your responses are greatly appreciated!
kidwonder
Newbie
 
Posts: 2
Joined: Mon Mar 18, 2013 11:38 pm


Return to Support Forum

Who is online

Users browsing this forum: No registered users and 177 guests