mirror of
https://bitbucket.org/chromiumembedded/cef
synced 2024-12-28 02:20:04 +01:00
c295931b1e
- Add CefBrowser::Get*Frame() methods for retrieving the appropriate CefFrame instance. - Add a CefFrame attribute to CefHandler callback methods where appropriate. - Add support for V8 JavaScript extensions and values via CefV8Value and CefV8Handler. Native C++ and user-defined JavaScript object hierarchies may now be created and accessed using the CEF API. - Remove the CefHandler and CefVariant classes and related CefBrowser methods that have been obsoleted by the addition of CEF V8 support. - Add the CefRegisterExtension() function for registering system-wide V8 extensions. - Add the CefHandler::HandleJSBinding() callback method for attaching V8 values to the global frame JavaScript object. This method replaces the previous technique of calling CefBrowser::AddJSHandler(). - Add new wrapper template methods for simplifying DLL wrapper implementations. - Move cef_string* files from libcef_dll to libcef so that projects can link libcef statically without errors. - Fix crashes when CEF exits due to object constructors being executed on non-UI threads if the application is closed while a page is still loading. - Update the cefclient project to reflect changes and demonstrate the new APIs. git-svn-id: https://chromiumembedded.googlecode.com/svn/trunk@26 5089003a-bbd8-11dd-ad1f-f1f9622dbc98
117 lines
2.9 KiB
C++
117 lines
2.9 KiB
C++
// Copyright (c) 2009 The Chromium Embedded Framework Authors. All rights
|
|
// reserved. Use of this source code is governed by a BSD-style license that
|
|
// can be found in the LICENSE file.
|
|
|
|
#include "../precompiled_libcef.h"
|
|
#include "cpptoc/stream_cpptoc.h"
|
|
|
|
|
|
size_t CEF_CALLBACK stream_reader_read(struct _cef_stream_reader_t* stream,
|
|
void *ptr, size_t size, size_t n)
|
|
{
|
|
DCHECK(stream);
|
|
if(!stream)
|
|
return 0;
|
|
|
|
return CefStreamReaderCppToC::Get(stream)->Read(ptr, size, n);
|
|
}
|
|
|
|
int CEF_CALLBACK stream_reader_seek(struct _cef_stream_reader_t* stream,
|
|
long offset, int whence)
|
|
{
|
|
DCHECK(stream);
|
|
if(!stream)
|
|
return 0;
|
|
|
|
return CefStreamReaderCppToC::Get(stream)->Seek(offset, whence);
|
|
}
|
|
|
|
long CEF_CALLBACK stream_reader_tell(struct _cef_stream_reader_t* stream)
|
|
{
|
|
DCHECK(stream);
|
|
if(!stream)
|
|
return 0;
|
|
|
|
return CefStreamReaderCppToC::Get(stream)->Tell();
|
|
}
|
|
|
|
int CEF_CALLBACK stream_reader_eof(struct _cef_stream_reader_t* stream)
|
|
{
|
|
DCHECK(stream);
|
|
if(!stream)
|
|
return 0;
|
|
|
|
return CefStreamReaderCppToC::Get(stream)->Eof();
|
|
}
|
|
|
|
|
|
CefStreamReaderCppToC::CefStreamReaderCppToC(CefStreamReader* cls)
|
|
: CefCppToC<CefStreamReaderCppToC, CefStreamReader,
|
|
cef_stream_reader_t>(cls)
|
|
{
|
|
struct_.struct_.read = stream_reader_read;
|
|
struct_.struct_.seek = stream_reader_seek;
|
|
struct_.struct_.tell = stream_reader_tell;
|
|
struct_.struct_.eof = stream_reader_eof;
|
|
}
|
|
|
|
#ifdef _DEBUG
|
|
long CefCppToC<CefStreamReaderCppToC, CefStreamReader,
|
|
cef_stream_reader_t>::DebugObjCt = 0;
|
|
#endif
|
|
|
|
|
|
size_t CEF_CALLBACK stream_writer_write(struct _cef_stream_writer_t* stream,
|
|
const void *ptr, size_t size, size_t n)
|
|
{
|
|
DCHECK(stream);
|
|
if(!stream)
|
|
return 0;
|
|
|
|
return CefStreamWriterCppToC::Get(stream)->Write(ptr, size, n);
|
|
}
|
|
|
|
int CEF_CALLBACK stream_writer_seek(struct _cef_stream_writer_t* stream,
|
|
long offset, int whence)
|
|
{
|
|
DCHECK(stream);
|
|
if(!stream)
|
|
return 0;
|
|
|
|
return CefStreamWriterCppToC::Get(stream)->Seek(offset, whence);
|
|
}
|
|
|
|
long CEF_CALLBACK stream_writer_tell(struct _cef_stream_writer_t* stream)
|
|
{
|
|
DCHECK(stream);
|
|
if(!stream)
|
|
return 0;
|
|
|
|
return CefStreamWriterCppToC::Get(stream)->Tell();
|
|
}
|
|
|
|
int CEF_CALLBACK stream_writer_flush(struct _cef_stream_writer_t* stream)
|
|
{
|
|
DCHECK(stream);
|
|
if(!stream)
|
|
return 0;
|
|
|
|
return CefStreamWriterCppToC::Get(stream)->Flush();
|
|
}
|
|
|
|
|
|
CefStreamWriterCppToC::CefStreamWriterCppToC(CefStreamWriter* cls)
|
|
: CefCppToC<CefStreamWriterCppToC, CefStreamWriter,
|
|
cef_stream_writer_t>(cls)
|
|
{
|
|
struct_.struct_.write = stream_writer_write;
|
|
struct_.struct_.seek = stream_writer_seek;
|
|
struct_.struct_.tell = stream_writer_tell;
|
|
struct_.struct_.flush = stream_writer_flush;
|
|
}
|
|
|
|
#ifdef _DEBUG
|
|
long CefCppToC<CefStreamWriterCppToC, CefStreamWriter,
|
|
cef_stream_writer_t>::DebugObjCt = 0;
|
|
#endif
|