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:
Marshall Greenblatt
2012-04-12 20:21:50 +00:00
parent b5c62d3bbb
commit 647c74cf96
33 changed files with 535 additions and 302 deletions

View File

@@ -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