rdmenezes / cefpython

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

Implement OnBeforeResourceLoad #49

Closed GoogleCodeExporter closed 9 years ago

GoogleCodeExporter commented 9 years ago
This one is rather important if user wants to load content from virtual file 
systems.
Real-life use-case: games store resources in pak archives. Game UI could be 
implemented in cef and html/css/js files need to be loaded from archive.
Now we are bound to running tiny webserver in order to serve needed files to 
cef. When OnBeforeResourceLoad gets implemented we just could slip-in data from 
archive on loading attempt.

Original issue reported on code.google.com by roxaz...@gmail.com on 18 Mar 2013 at 7:40

GoogleCodeExporter commented 9 years ago
Implementing OnBeforeResourceLoad() requires you to implement CefRequest [1],
CefStreamReader [2], CefReadHandler [2].

OnBeforeResourceLoad is not the only way for a virtual file system, it can also
be accomplished by implementing CefSchemeHandler [3].

Using OnBeforeResourceLoad for the virtual file system will not be as efficient
as CefSchemeHandler, see this post [4] by Marshall CEF C++ forum, but I don't
think this will make any difference in most cases.

[1] 
https://code.google.com/p/cefpython/source/browse/cefpython/cef1/include/cef_req
uest.h?r=1d90e7859a67
[2] 
https://code.google.com/p/cefpython/source/browse/cefpython/cef1/include/cef_str
eam.h?r=1d90e7859a67
[3] 
https://code.google.com/p/cefpython/source/browse/cefpython/cef1/include/cef_sch
eme.h?r=1d90e7859a67
[4] http://magpcss.org/ceforum/viewtopic.php?p=15881#p15881

Original comment by czarek.t...@gmail.com on 18 Mar 2013 at 8:13

GoogleCodeExporter commented 9 years ago
Can scheme handler override requests of http scheme tho? Having 
something like gui:// sounds all nice but it would prevent from 
developing and testing GUI in browser.

rox

Original comment by roxaz...@gmail.com on 19 Mar 2013 at 9:04

GoogleCodeExporter commented 9 years ago
I've asked a question regarding this [1] on the CEF C++ Forum.
You probably can't override http scheme with Scheme Handler, as
this is a built-in scheme, but let's wait for Marshall's response
just to be sure.

[1] http://magpcss.org/ceforum/viewtopic.php?f=6&t=10542

Original comment by czarek.t...@gmail.com on 19 Mar 2013 at 6:27

GoogleCodeExporter commented 9 years ago
Marshall has responded, it turns out that you can override HTTP protocol 
with custom Scheme Handler.

Original comment by czarek.t...@gmail.com on 19 Mar 2013 at 11:43

GoogleCodeExporter commented 9 years ago
Implemented in revision f762a4306845 - development sponsored by Cyan Inc.

Original comment by czarek.t...@gmail.com on 23 May 2013 at 3:14