Introduce CefString and cef_string_t implementations that support string type conversions and customization of the API string type (issue #146).

git-svn-id: https://chromiumembedded.googlecode.com/svn/trunk@145 5089003a-bbd8-11dd-ad1f-f1f9622dbc98
This commit is contained in:
Marshall Greenblatt
2010-11-22 17:49:46 +00:00
parent 1e1c2ad8d7
commit 7d60642638
121 changed files with 2598 additions and 3209 deletions

View File

@ -12,27 +12,18 @@
#include "libcef_dll/cpptoc/request_cpptoc.h"
#include "libcef_dll/ctocpp/scheme_handler_ctocpp.h"
#include "libcef_dll/transfer_util.h"
// VIRTUAL METHODS - Body may be edited by hand.
bool CefSchemeHandlerCToCpp::ProcessRequest(CefRefPtr<CefRequest> request,
std::wstring& mime_type, int* response_length)
CefString& mime_type, int* response_length)
{
if(CEF_MEMBER_MISSING(struct_, process_request))
return false;
cef_string_t mimeTypeRet = NULL;
if(!mime_type.empty())
mimeTypeRet = cef_string_alloc(mime_type.c_str());
int rv = struct_->process_request(struct_, CefRequestCppToC::Wrap(request),
&mimeTypeRet, response_length);
transfer_string_contents(mimeTypeRet, mime_type, true);
return rv ? true : false;
return struct_->process_request(struct_, CefRequestCppToC::Wrap(request),
mime_type.GetWritableStruct(), response_length) ? true : false;
}
void CefSchemeHandlerCToCpp::Cancel()
@ -49,8 +40,8 @@ bool CefSchemeHandlerCToCpp::ReadResponse(void* data_out, int bytes_to_read,
if(CEF_MEMBER_MISSING(struct_, read_response))
return false;
return struct_->read_response(struct_, data_out, bytes_to_read, bytes_read)
? true : false;
return struct_->read_response(struct_, data_out, bytes_to_read, bytes_read) ?
true : false;
}