Rovango / cefpython

Automatically exported from code.google.com/p/cefpython
0 stars 0 forks source link

Support custom schemes (eg. myapp://) #50

Open GoogleCodeExporter opened 8 years ago

GoogleCodeExporter commented 8 years ago
As suggested in another bug report ( 
https://code.google.com/p/cefpython/issues/detail?id=49 ) - this seems to be 
much better option for serving files from virtual file systems. Turns out we 
can have fake domains for default http scheme therefore this would actually be 
preferred way of achieving the goal.

May i request some pointers on implementing required interfaces? At the moment 
im sort of bouncing around existing stuff trying to figure out what would be 
the best way to do this. Mind i dont have any cython experience.

At the moment my plan looks like this:
create c++ class:
class CustomSchemeHandler : public CefSchemeHandlerFactory, public 
CefSchemeHandler

This would be much like ClientHandler, calling cdef'ed functions that would 
in-turn call methods of python object.

Actual creation of custom scheme handler would look something like:
cdef py_bool RegisterSchemeHandlerFactory(str scheme_name, str domain_name, 
object factory):
    cefFactory = MakeCefFactory(factory)
    cefDomainName = PyToCefString(domain_name)
    CefRegisterSchemeHandlerFactory(PyToCefString(scheme_name), cefDomainName, cefFactory) 
there factory should be stored in c++ object cefFactory and it's functions like 
ProcessRequest would be called later.

Does that sound right?

Original issue reported on code.google.com by roxaz...@gmail.com on 19 Mar 2013 at 12:17

GoogleCodeExporter commented 8 years ago
You should definitely do it in a way that allows to register multiple
scheme handlers. It shouldn't matter whether you write most of the code
in C++ or in Cython, they are interchangeable, it is the final effect 
that is important, the API that is exposed to python.

ClientHandler appears to be the right place, just put the scheme handler 
code in a separate .cpp file.

Yes, sounds fine.

Original comment by czarek.t...@gmail.com on 28 Mar 2013 at 2:01

GoogleCodeExporter commented 8 years ago
[deleted comment]
GoogleCodeExporter commented 8 years ago
In CEF 3 schemes should also be registered in sub-processes, see this post:
http://www.magpcss.org/ceforum/viewtopic.php?f=6&t=10604&view=unread#p16455

Original comment by czarek.t...@gmail.com on 2 May 2013 at 1:42

GoogleCodeExporter commented 8 years ago
[deleted comment]
GoogleCodeExporter commented 8 years ago
[deleted comment]
GoogleCodeExporter commented 8 years ago
Project will move to Github. Find this issue at the new address (soon): 
https://github.com/cztomczak/cefpython/issues/50

Original comment by czarek.t...@gmail.com on 24 Aug 2015 at 6:29