mirror of
https://bitbucket.org/chromiumembedded/cef
synced 2025-06-05 21:39:12 +02:00
Add JavaScript binding example to cefclient.
git-svn-id: https://chromiumembedded.googlecode.com/svn/trunk@590 5089003a-bbd8-11dd-ad1f-f1f9622dbc98
This commit is contained in:
@@ -5,6 +5,7 @@
|
||||
#include "cefclient/resource_util.h"
|
||||
#include "include/cef_stream.h"
|
||||
#include "include/wrapper/cef_byte_read_handler.h"
|
||||
#include "cefclient/util.h"
|
||||
|
||||
#if defined(OS_WIN)
|
||||
|
||||
@@ -37,4 +38,24 @@ CefRefPtr<CefStreamReader> GetBinaryResourceReader(int binaryId) {
|
||||
return NULL;
|
||||
}
|
||||
|
||||
CefRefPtr<CefStreamReader> GetBinaryResourceReader(const char* resource_name) {
|
||||
// Map of resource labels to BINARY id values.
|
||||
static struct _resource_map {
|
||||
char* name;
|
||||
int id;
|
||||
} resource_map[] = {
|
||||
{"binding.html", IDS_BINDING},
|
||||
{"localstorage.html", IDS_LOCALSTORAGE},
|
||||
{"xmlhttprequest.html", IDS_XMLHTTPREQUEST},
|
||||
};
|
||||
|
||||
for (int i = 0; i < sizeof(resource_map)/sizeof(_resource_map); ++i) {
|
||||
if (!strcmp(resource_map[i].name, resource_name))
|
||||
return GetBinaryResourceReader(resource_map[i].id);
|
||||
}
|
||||
|
||||
ASSERT(FALSE); // The resource should be found.
|
||||
return NULL;
|
||||
}
|
||||
|
||||
#endif // OS_WIN
|
||||
|
Reference in New Issue
Block a user