- Add CefReadHandler and CefWriteHandler classes for creating streams handled by the client.

cefclient:
- Add a CefReadHandler test.
- Move tests out of cefclient.cpp and into separate implementation files.

git-svn-id: https://chromiumembedded.googlecode.com/svn/trunk@39 5089003a-bbd8-11dd-ad1f-f1f9622dbc98
This commit is contained in:
Marshall Greenblatt
2009-08-21 17:41:09 +00:00
parent b821811c08
commit 2b7e69d200
34 changed files with 1592 additions and 516 deletions

View File

@ -600,6 +600,30 @@ typedef struct _cef_post_data_element_t
CEF_EXPORT cef_post_data_element_t* cef_post_data_element_create();
// Structure the client can implement to provide a custom stream reader.
typedef struct _cef_read_handler_t
{
// Base structure.
cef_base_t base;
// Read raw binary data.
size_t (CEF_CALLBACK *read)(struct _cef_read_handler_t* self, void* ptr,
size_t size, size_t n);
// Seek to the specified offset position. |whence| may be any one of SEEK_CUR,
// SEEK_END or SEEK_SET.
int (CEF_CALLBACK *seek)(struct _cef_read_handler_t* self, long offset,
int whence);
// Return the current offset position.
long (CEF_CALLBACK *tell)(struct _cef_read_handler_t* self);
// Return non-zero if at end of file.
int (CEF_CALLBACK *eof)(struct _cef_read_handler_t* self);
} cef_read_handler_t;
// Structure used to read data from a stream.
typedef struct _cef_stream_reader_t
{
@ -629,6 +653,32 @@ CEF_EXPORT cef_stream_reader_t* cef_stream_reader_create_for_file(
const wchar_t* fileName);
CEF_EXPORT cef_stream_reader_t* cef_stream_reader_create_for_data(void* data,
size_t size);
CEF_EXPORT cef_stream_reader_t* cef_stream_reader_create_for_handler(
cef_read_handler_t* handler);
// Structure the client can implement to provide a custom stream writer.
typedef struct _cef_write_handler_t
{
// Base structure.
cef_base_t base;
// Write raw binary data.
size_t (CEF_CALLBACK *write)(struct _cef_write_handler_t* self,
const void* ptr, size_t size, size_t n);
// Seek to the specified offset position. |whence| may be any one of SEEK_CUR,
// SEEK_END or SEEK_SET.
int (CEF_CALLBACK *seek)(struct _cef_write_handler_t* self, long offset,
int whence);
// Return the current offset position.
long (CEF_CALLBACK *tell)(struct _cef_write_handler_t* self);
// Flush the stream.
int (CEF_CALLBACK *flush)(struct _cef_write_handler_t* self);
} cef_write_handler_t;
// Structure used to write data to a stream.
@ -655,6 +705,13 @@ typedef struct _cef_stream_writer_t
} cef_stream_writer_t;
// Create a new cef_stream_writer_t object.
CEF_EXPORT cef_stream_writer_t* cef_stream_writer_create_for_file(
const wchar_t* fileName);
CEF_EXPORT cef_stream_writer_t* cef_stream_writer_create_for_handler(
cef_write_handler_t* handler);
// Structure that should be implemented to handle V8 function calls.
typedef struct _cef_v8handler_t
{