mirror of
https://bitbucket.org/chromiumembedded/cef
synced 2025-06-05 21:39:12 +02:00
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:
@@ -13,43 +13,40 @@
|
||||
#include "libcef_dll/cpptoc/browser_cpptoc.h"
|
||||
#include "libcef_dll/cpptoc/frame_cpptoc.h"
|
||||
#include "libcef_dll/ctocpp/handler_ctocpp.h"
|
||||
#include "libcef_dll/transfer_util.h"
|
||||
|
||||
|
||||
// GLOBAL FUNCTIONS - Body may be edited by hand.
|
||||
|
||||
CEF_EXPORT int cef_browser_create(cef_window_info_t* windowInfo, int popup,
|
||||
struct _cef_handler_t* handler, const wchar_t* url)
|
||||
struct _cef_handler_t* handler, const cef_string_t* url)
|
||||
{
|
||||
DCHECK(windowInfo);
|
||||
|
||||
CefRefPtr<CefHandler> handlerPtr;
|
||||
std::wstring urlStr;
|
||||
CefWindowInfo wi = *windowInfo;
|
||||
|
||||
if(handler)
|
||||
handlerPtr = CefHandlerCToCpp::Wrap(handler);
|
||||
if(url)
|
||||
urlStr = url;
|
||||
|
||||
return CefBrowser::CreateBrowser(wi, popup?true:false, handlerPtr, urlStr);
|
||||
return CefBrowser::CreateBrowser(wi, popup?true:false, handlerPtr,
|
||||
CefString(url));
|
||||
}
|
||||
|
||||
CEF_EXPORT cef_browser_t* cef_browser_create_sync(cef_window_info_t* windowInfo,
|
||||
int popup, struct _cef_handler_t* handler, const wchar_t* url)
|
||||
int popup, struct _cef_handler_t* handler, const cef_string_t* url)
|
||||
{
|
||||
DCHECK(windowInfo);
|
||||
|
||||
CefRefPtr<CefHandler> handlerPtr;
|
||||
std::wstring urlStr;
|
||||
CefWindowInfo wi = *windowInfo;
|
||||
|
||||
if(handler)
|
||||
handlerPtr = CefHandlerCToCpp::Wrap(handler);
|
||||
if(url)
|
||||
urlStr = url;
|
||||
|
||||
CefRefPtr<CefBrowser> browserPtr(
|
||||
CefBrowser::CreateBrowserSync(wi, popup?true:false, handlerPtr, urlStr));
|
||||
CefBrowser::CreateBrowserSync(wi, popup?true:false, handlerPtr,
|
||||
CefString(url)));
|
||||
if(browserPtr.get())
|
||||
return CefBrowserCppToC::Wrap(browserPtr);
|
||||
return NULL;
|
||||
@@ -193,20 +190,14 @@ struct _cef_frame_t* CEF_CALLBACK browser_get_focused_frame(
|
||||
}
|
||||
|
||||
struct _cef_frame_t* CEF_CALLBACK browser_get_frame(struct _cef_browser_t* self,
|
||||
const wchar_t* name)
|
||||
const cef_string_t* name)
|
||||
{
|
||||
DCHECK(self);
|
||||
if(!self)
|
||||
return NULL;
|
||||
|
||||
std::wstring nameStr;
|
||||
if(name)
|
||||
nameStr = name;
|
||||
if(nameStr.empty())
|
||||
return NULL;
|
||||
|
||||
CefRefPtr<CefBrowser> browserPtr = CefBrowserCppToC::Get(self);
|
||||
CefRefPtr<CefFrame> framePtr = browserPtr->GetFrame(nameStr);
|
||||
CefRefPtr<CefFrame> framePtr = browserPtr->GetFrame(CefString(name));
|
||||
if(framePtr.get())
|
||||
return CefFrameCppToC::Wrap(framePtr);
|
||||
return NULL;
|
||||
@@ -221,25 +212,19 @@ void CEF_CALLBACK browser_get_frame_names(struct _cef_browser_t* self,
|
||||
return;
|
||||
|
||||
CefRefPtr<CefBrowser> browserPtr = CefBrowserCppToC::Get(self);
|
||||
std::vector<std::wstring> stringList;
|
||||
std::vector<CefString> stringList;
|
||||
browserPtr->GetFrameNames(stringList);
|
||||
size_t size = stringList.size();
|
||||
for(size_t i = 0; i < size; ++i)
|
||||
cef_string_list_append(names, stringList[i].c_str());
|
||||
transfer_string_list_contents(stringList, names);
|
||||
}
|
||||
|
||||
void CEF_CALLBACK browser_find(struct _cef_browser_t* self, int identifier,
|
||||
const wchar_t* searchText, int forward, int matchCase, int findNext)
|
||||
const cef_string_t* searchText, int forward, int matchCase, int findNext)
|
||||
{
|
||||
DCHECK(self);
|
||||
if(!self)
|
||||
return;
|
||||
|
||||
std::wstring searchTextStr;
|
||||
if(searchText)
|
||||
searchTextStr = searchText;
|
||||
|
||||
CefBrowserCppToC::Get(self)->Find(identifier, searchTextStr,
|
||||
CefBrowserCppToC::Get(self)->Find(identifier, CefString(searchText),
|
||||
forward?true:false, matchCase?true:false, findNext?true:false);
|
||||
}
|
||||
|
||||
|
@@ -98,28 +98,24 @@ void CEF_CALLBACK frame_view_source(struct _cef_frame_t* self)
|
||||
CefFrameCppToC::Get(self)->ViewSource();
|
||||
}
|
||||
|
||||
cef_string_t CEF_CALLBACK frame_get_source(struct _cef_frame_t* self)
|
||||
cef_string_userfree_t CEF_CALLBACK frame_get_source(struct _cef_frame_t* self)
|
||||
{
|
||||
DCHECK(self);
|
||||
if(!self)
|
||||
return NULL;
|
||||
|
||||
std::wstring sourceStr = CefFrameCppToC::Get(self)->GetSource();
|
||||
if(!sourceStr.empty())
|
||||
return cef_string_alloc(sourceStr.c_str());
|
||||
return NULL;
|
||||
CefString sourceStr = CefFrameCppToC::Get(self)->GetSource();
|
||||
return sourceStr.DetachToUserFree();
|
||||
}
|
||||
|
||||
cef_string_t CEF_CALLBACK frame_get_text(struct _cef_frame_t* self)
|
||||
cef_string_userfree_t CEF_CALLBACK frame_get_text(struct _cef_frame_t* self)
|
||||
{
|
||||
DCHECK(self);
|
||||
if(!self)
|
||||
return NULL;
|
||||
|
||||
std::wstring textStr = CefFrameCppToC::Get(self)->GetText();
|
||||
if(!textStr.empty())
|
||||
return cef_string_alloc(textStr.c_str());
|
||||
return NULL;
|
||||
CefString textStr = CefFrameCppToC::Get(self)->GetText();
|
||||
return textStr.DetachToUserFree();
|
||||
}
|
||||
|
||||
void CEF_CALLBACK frame_load_request(struct _cef_frame_t* self,
|
||||
@@ -134,64 +130,47 @@ void CEF_CALLBACK frame_load_request(struct _cef_frame_t* self,
|
||||
CefFrameCppToC::Get(self)->LoadRequest(requestPtr);
|
||||
}
|
||||
|
||||
void CEF_CALLBACK frame_load_url(struct _cef_frame_t* self, const wchar_t* url)
|
||||
void CEF_CALLBACK frame_load_url(struct _cef_frame_t* self,
|
||||
const cef_string_t* url)
|
||||
{
|
||||
DCHECK(self);
|
||||
if(!self)
|
||||
return;
|
||||
|
||||
std::wstring urlStr;
|
||||
if(url)
|
||||
urlStr = url;
|
||||
CefFrameCppToC::Get(self)->LoadURL(urlStr);
|
||||
CefFrameCppToC::Get(self)->LoadURL(CefString(url));
|
||||
}
|
||||
|
||||
void CEF_CALLBACK frame_load_string(struct _cef_frame_t* self,
|
||||
const wchar_t* string, const wchar_t* url)
|
||||
const cef_string_t* string, const cef_string_t* url)
|
||||
{
|
||||
DCHECK(self);
|
||||
if(!self)
|
||||
return;
|
||||
|
||||
std::wstring stringStr, urlStr;
|
||||
if(string)
|
||||
stringStr = string;
|
||||
if(url)
|
||||
urlStr = url;
|
||||
CefFrameCppToC::Get(self)->LoadString(stringStr, urlStr);
|
||||
CefFrameCppToC::Get(self)->LoadString(CefString(string), CefString(url));
|
||||
}
|
||||
|
||||
void CEF_CALLBACK frame_load_stream(struct _cef_frame_t* self,
|
||||
struct _cef_stream_reader_t* stream, const wchar_t* url)
|
||||
struct _cef_stream_reader_t* stream, const cef_string_t* url)
|
||||
{
|
||||
DCHECK(self);
|
||||
DCHECK(stream);
|
||||
if(!self || !stream)
|
||||
return;
|
||||
|
||||
CefRefPtr<CefStreamReader> streamPtr = CefStreamReaderCppToC::Unwrap(stream);
|
||||
std::wstring urlStr;
|
||||
if(url)
|
||||
urlStr = url;
|
||||
|
||||
CefFrameCppToC::Get(self)->LoadStream(streamPtr, urlStr);
|
||||
CefFrameCppToC::Get(self)->LoadStream(CefStreamReaderCppToC::Unwrap(stream),
|
||||
CefString(url));
|
||||
}
|
||||
|
||||
void CEF_CALLBACK frame_execute_java_script(struct _cef_frame_t* self,
|
||||
const wchar_t* jsCode, const wchar_t* scriptUrl, int startLine)
|
||||
const cef_string_t* jsCode, const cef_string_t* scriptUrl, int startLine)
|
||||
{
|
||||
DCHECK(self);
|
||||
if(!self)
|
||||
return;
|
||||
|
||||
std::wstring jsCodeStr, scriptUrlStr;
|
||||
if(jsCode)
|
||||
jsCodeStr = jsCode;
|
||||
if(scriptUrl)
|
||||
scriptUrlStr = scriptUrl;
|
||||
|
||||
CefFrameCppToC::Get(self)->ExecuteJavaScript(jsCodeStr, scriptUrlStr,
|
||||
startLine);
|
||||
CefFrameCppToC::Get(self)->ExecuteJavaScript(CefString(jsCode),
|
||||
CefString(scriptUrl), startLine);
|
||||
}
|
||||
|
||||
int CEF_CALLBACK frame_is_main(struct _cef_frame_t* self)
|
||||
@@ -212,28 +191,24 @@ int CEF_CALLBACK frame_is_focused(struct _cef_frame_t* self)
|
||||
return CefFrameCppToC::Get(self)->IsFocused();
|
||||
}
|
||||
|
||||
cef_string_t CEF_CALLBACK frame_get_name(struct _cef_frame_t* self)
|
||||
cef_string_userfree_t CEF_CALLBACK frame_get_name(struct _cef_frame_t* self)
|
||||
{
|
||||
DCHECK(self);
|
||||
if(!self)
|
||||
return 0;
|
||||
|
||||
std::wstring nameStr = CefFrameCppToC::Get(self)->GetName();
|
||||
if(!nameStr.empty())
|
||||
return cef_string_alloc(nameStr.c_str());
|
||||
return NULL;
|
||||
CefString nameStr = CefFrameCppToC::Get(self)->GetName();
|
||||
return nameStr.DetachToUserFree();
|
||||
}
|
||||
|
||||
cef_string_t CEF_CALLBACK frame_get_url(struct _cef_frame_t* self)
|
||||
cef_string_userfree_t CEF_CALLBACK frame_get_url(struct _cef_frame_t* self)
|
||||
{
|
||||
DCHECK(self);
|
||||
if(!self)
|
||||
return NULL;
|
||||
|
||||
std::wstring urlStr = CefFrameCppToC::Get(self)->GetURL();
|
||||
if(!urlStr.empty())
|
||||
return cef_string_alloc(urlStr.c_str());
|
||||
return NULL;
|
||||
CefString urlStr = CefFrameCppToC::Get(self)->GetURL();
|
||||
return urlStr.DetachToUserFree();
|
||||
}
|
||||
|
||||
|
||||
|
@@ -17,7 +17,6 @@
|
||||
#include "libcef_dll/ctocpp/request_ctocpp.h"
|
||||
#include "libcef_dll/ctocpp/stream_reader_ctocpp.h"
|
||||
#include "libcef_dll/ctocpp/v8value_ctocpp.h"
|
||||
#include "libcef_dll/transfer_util.h"
|
||||
|
||||
|
||||
// MEMBER FUNCTIONS - Body may be edited by hand.
|
||||
@@ -54,17 +53,11 @@ enum cef_retval_t CEF_CALLBACK handler_handle_before_created(
|
||||
if(parentBrowser)
|
||||
browserPtr = CefBrowserCToCpp::Wrap(parentBrowser);
|
||||
|
||||
std::wstring urlStr;
|
||||
if(*url)
|
||||
urlStr = *url;
|
||||
|
||||
enum cef_retval_t rv = CefHandlerCppToC::Get(self)->HandleBeforeCreated(
|
||||
browserPtr, wndInfo, popup?true:false, features, handlerPtr, urlStr,
|
||||
browserSettings);
|
||||
browserPtr, wndInfo, popup?true:false, features, handlerPtr,
|
||||
CefString(url), browserSettings);
|
||||
|
||||
transfer_string_contents(urlStr, url);
|
||||
|
||||
if(handlerPtr.get() != origHandler) {
|
||||
if(handlerPtr.get() != origHandler) {
|
||||
// The handler has been changed.
|
||||
*handler = CefHandlerCppToC::Wrap(handlerPtr);
|
||||
}
|
||||
@@ -97,7 +90,7 @@ enum cef_retval_t CEF_CALLBACK handler_handle_after_created(
|
||||
|
||||
enum cef_retval_t CEF_CALLBACK handler_handle_address_change(
|
||||
struct _cef_handler_t* self, cef_browser_t* browser, cef_frame_t* frame,
|
||||
const wchar_t* url)
|
||||
const cef_string_t* url)
|
||||
{
|
||||
DCHECK(self);
|
||||
DCHECK(browser);
|
||||
@@ -105,28 +98,22 @@ enum cef_retval_t CEF_CALLBACK handler_handle_address_change(
|
||||
if(!self || !browser || !frame)
|
||||
return RV_CONTINUE;
|
||||
|
||||
std::wstring urlStr;
|
||||
if(url)
|
||||
urlStr = url;
|
||||
|
||||
return CefHandlerCppToC::Get(self)->HandleAddressChange(
|
||||
CefBrowserCToCpp::Wrap(browser), CefFrameCToCpp::Wrap(frame), urlStr);
|
||||
CefBrowserCToCpp::Wrap(browser), CefFrameCToCpp::Wrap(frame),
|
||||
CefString(url));
|
||||
}
|
||||
|
||||
enum cef_retval_t CEF_CALLBACK handler_handle_title_change(
|
||||
struct _cef_handler_t* self, cef_browser_t* browser, const wchar_t* title)
|
||||
struct _cef_handler_t* self, cef_browser_t* browser,
|
||||
const cef_string_t* title)
|
||||
{
|
||||
DCHECK(self);
|
||||
DCHECK(browser);
|
||||
if(!self || !browser)
|
||||
return RV_CONTINUE;
|
||||
|
||||
std::wstring titleStr;
|
||||
if(title)
|
||||
titleStr = title;
|
||||
|
||||
return CefHandlerCppToC::Get(self)->HandleTitleChange(
|
||||
CefBrowserCToCpp::Wrap(browser), titleStr);
|
||||
CefBrowserCToCpp::Wrap(browser), CefString(title));
|
||||
}
|
||||
|
||||
enum cef_retval_t CEF_CALLBACK handler_handle_before_browse(
|
||||
@@ -180,7 +167,7 @@ enum cef_retval_t CEF_CALLBACK handler_handle_load_end(
|
||||
|
||||
enum cef_retval_t CEF_CALLBACK handler_handle_load_error(
|
||||
struct _cef_handler_t* self, cef_browser_t* browser, cef_frame_t* frame,
|
||||
enum cef_handler_errorcode_t errorCode, const wchar_t* failedUrl,
|
||||
enum cef_handler_errorcode_t errorCode, const cef_string_t* failedUrl,
|
||||
cef_string_t* errorText)
|
||||
{
|
||||
DCHECK(self);
|
||||
@@ -190,20 +177,9 @@ enum cef_retval_t CEF_CALLBACK handler_handle_load_error(
|
||||
if(!self || !browser || !errorText || !frame)
|
||||
return RV_CONTINUE;
|
||||
|
||||
std::wstring failedUrlStr, errorTextStr;
|
||||
|
||||
if(failedUrl)
|
||||
failedUrlStr = failedUrl;
|
||||
if(*errorText)
|
||||
errorTextStr = *errorText;
|
||||
|
||||
enum cef_retval_t rv = CefHandlerCppToC::Get(self)->HandleLoadError(
|
||||
return CefHandlerCppToC::Get(self)->HandleLoadError(
|
||||
CefBrowserCToCpp::Wrap(browser), CefFrameCToCpp::Wrap(frame), errorCode,
|
||||
failedUrlStr, errorTextStr);
|
||||
|
||||
transfer_string_contents(errorTextStr, errorText);
|
||||
|
||||
return rv;
|
||||
CefString(failedUrl), CefString(errorText));
|
||||
}
|
||||
|
||||
enum cef_retval_t CEF_CALLBACK handler_handle_before_resource_load(
|
||||
@@ -220,21 +196,12 @@ enum cef_retval_t CEF_CALLBACK handler_handle_before_resource_load(
|
||||
if(!self || !browser || !redirectUrl || !resourceStream || !mimeType)
|
||||
return RV_CONTINUE;
|
||||
|
||||
std::wstring redirectUrlStr, mimeTypeStr;
|
||||
CefRefPtr<CefStreamReader> streamPtr;
|
||||
|
||||
if(*redirectUrl)
|
||||
redirectUrlStr = *redirectUrl;
|
||||
if(*mimeType)
|
||||
mimeTypeStr = *mimeType;
|
||||
|
||||
enum cef_retval_t rv = CefHandlerCppToC::Get(self)->
|
||||
HandleBeforeResourceLoad(CefBrowserCToCpp::Wrap(browser),
|
||||
CefRequestCToCpp::Wrap(request), redirectUrlStr, streamPtr, mimeTypeStr,
|
||||
loadFlags);
|
||||
|
||||
transfer_string_contents(redirectUrlStr, redirectUrl);
|
||||
transfer_string_contents(mimeTypeStr, mimeType);
|
||||
CefRequestCToCpp::Wrap(request), CefString(redirectUrl), streamPtr,
|
||||
CefString(mimeType), loadFlags);
|
||||
|
||||
if(streamPtr.get())
|
||||
*resourceStream = CefStreamReaderCToCpp::Unwrap(streamPtr);
|
||||
@@ -244,8 +211,8 @@ enum cef_retval_t CEF_CALLBACK handler_handle_before_resource_load(
|
||||
|
||||
enum cef_retval_t CEF_CALLBACK handler_handle_download_response(
|
||||
struct _cef_handler_t* self, cef_browser_t* browser,
|
||||
const wchar_t* mimeType, const wchar_t* fileName, int64 contentLength,
|
||||
struct _cef_download_handler_t** handler)
|
||||
const cef_string_t* mimeType, const cef_string_t* fileName,
|
||||
int64 contentLength, struct _cef_download_handler_t** handler)
|
||||
{
|
||||
DCHECK(self);
|
||||
DCHECK(browser);
|
||||
@@ -254,17 +221,11 @@ enum cef_retval_t CEF_CALLBACK handler_handle_download_response(
|
||||
if(!self || !browser || !mimeType || !fileName)
|
||||
return RV_CONTINUE;
|
||||
|
||||
std::wstring mimeTypeStr, fileNameStr;
|
||||
CefRefPtr<CefDownloadHandler> downloadPtr;
|
||||
|
||||
if(mimeType)
|
||||
mimeTypeStr = mimeType;
|
||||
if(fileName)
|
||||
fileNameStr = fileName;
|
||||
|
||||
enum cef_retval_t rv = CefHandlerCppToC::Get(self)->
|
||||
HandleDownloadResponse(CefBrowserCToCpp::Wrap(browser), mimeTypeStr,
|
||||
fileNameStr, contentLength, downloadPtr);
|
||||
HandleDownloadResponse(CefBrowserCToCpp::Wrap(browser),
|
||||
CefString(mimeType), CefString(fileName), contentLength, downloadPtr);
|
||||
|
||||
if(downloadPtr.get())
|
||||
*handler = CefDownloadHandlerCppToC::Wrap(downloadPtr);
|
||||
@@ -296,16 +257,8 @@ enum cef_retval_t CEF_CALLBACK handler_handle_get_menu_label(
|
||||
if(!self || !browser || !label)
|
||||
return RV_CONTINUE;
|
||||
|
||||
std::wstring labelStr;
|
||||
if(*label)
|
||||
labelStr = *label;
|
||||
|
||||
enum cef_retval_t rv = CefHandlerCppToC::Get(self)->HandleGetMenuLabel(
|
||||
CefBrowserCToCpp::Wrap(browser), menuId, labelStr);
|
||||
|
||||
transfer_string_contents(labelStr, label);
|
||||
|
||||
return rv;
|
||||
return CefHandlerCppToC::Get(self)->HandleGetMenuLabel(
|
||||
CefBrowserCToCpp::Wrap(browser), menuId, CefString(label));
|
||||
}
|
||||
|
||||
enum cef_retval_t CEF_CALLBACK handler_handle_menu_action(
|
||||
@@ -336,10 +289,11 @@ enum cef_retval_t CEF_CALLBACK handler_handle_print_options(
|
||||
|
||||
enum cef_retval_t CEF_CALLBACK handler_handle_print_header_footer(
|
||||
struct _cef_handler_t* self, cef_browser_t* browser, cef_frame_t* frame,
|
||||
cef_print_info_t* printInfo, const wchar_t* url, const wchar_t* title,
|
||||
int currentPage, int maxPages, cef_string_t* topLeft,
|
||||
cef_string_t* topCenter, cef_string_t* topRight, cef_string_t* bottomLeft,
|
||||
cef_string_t* bottomCenter, cef_string_t* bottomRight)
|
||||
cef_print_info_t* printInfo, const cef_string_t* url,
|
||||
const cef_string_t* title, int currentPage, int maxPages,
|
||||
cef_string_t* topLeft, cef_string_t* topCenter, cef_string_t* topRight,
|
||||
cef_string_t* bottomLeft, cef_string_t* bottomCenter,
|
||||
cef_string_t* bottomRight)
|
||||
{
|
||||
DCHECK(self);
|
||||
DCHECK(browser);
|
||||
@@ -351,47 +305,19 @@ enum cef_retval_t CEF_CALLBACK handler_handle_print_header_footer(
|
||||
|| !topRight || !bottomLeft || !bottomCenter || !bottomRight)
|
||||
return RV_CONTINUE;
|
||||
|
||||
std::wstring urlStr, titleStr;
|
||||
std::wstring topLeftStr, topCenterStr, topRightStr;
|
||||
std::wstring bottomLeftStr, bottomCenterStr, bottomRightStr;
|
||||
CefPrintInfo info = *printInfo;
|
||||
|
||||
if(url)
|
||||
urlStr = url;
|
||||
if(title)
|
||||
titleStr = title;
|
||||
if(*topLeft)
|
||||
topLeftStr = *topLeft;
|
||||
if(*topCenter)
|
||||
topCenterStr = *topCenter;
|
||||
if(*topRight)
|
||||
topRightStr = *topRight;
|
||||
if(*bottomLeft)
|
||||
bottomLeftStr = *bottomLeft;
|
||||
if(*bottomCenter)
|
||||
bottomCenterStr = *bottomCenter;
|
||||
if(*bottomRight)
|
||||
bottomRightStr = *bottomRight;
|
||||
|
||||
enum cef_retval_t rv = CefHandlerCppToC::Get(self)->
|
||||
return CefHandlerCppToC::Get(self)->
|
||||
HandlePrintHeaderFooter(CefBrowserCToCpp::Wrap(browser),
|
||||
CefFrameCToCpp::Wrap(frame), info, urlStr, titleStr, currentPage,
|
||||
maxPages, topLeftStr, topCenterStr, topRightStr, bottomLeftStr,
|
||||
bottomCenterStr, bottomRightStr);
|
||||
|
||||
transfer_string_contents(topLeftStr, topLeft);
|
||||
transfer_string_contents(topCenterStr, topCenter);
|
||||
transfer_string_contents(topRightStr, topRight);
|
||||
transfer_string_contents(bottomLeftStr, bottomLeft);
|
||||
transfer_string_contents(bottomCenterStr, bottomCenter);
|
||||
transfer_string_contents(bottomRightStr, bottomRight);
|
||||
|
||||
return rv;
|
||||
CefFrameCToCpp::Wrap(frame), info, CefString(url), CefString(title),
|
||||
currentPage, maxPages, CefString(topLeft), CefString(topCenter),
|
||||
CefString(topRight), CefString(bottomLeft), CefString(bottomCenter),
|
||||
CefString(bottomRight));
|
||||
}
|
||||
|
||||
enum cef_retval_t CEF_CALLBACK handler_handle_jsalert(
|
||||
struct _cef_handler_t* self, cef_browser_t* browser, cef_frame_t* frame,
|
||||
const wchar_t* message)
|
||||
const cef_string_t* message)
|
||||
{
|
||||
DCHECK(self);
|
||||
DCHECK(browser);
|
||||
@@ -399,17 +325,14 @@ enum cef_retval_t CEF_CALLBACK handler_handle_jsalert(
|
||||
if(!self || !browser || !frame)
|
||||
return RV_CONTINUE;
|
||||
|
||||
std::wstring messageStr;
|
||||
if(message)
|
||||
messageStr = message;
|
||||
|
||||
return CefHandlerCppToC::Get(self)->HandleJSAlert(
|
||||
CefBrowserCToCpp::Wrap(browser), CefFrameCToCpp::Wrap(frame), messageStr);
|
||||
CefBrowserCToCpp::Wrap(browser), CefFrameCToCpp::Wrap(frame),
|
||||
CefString(message));
|
||||
}
|
||||
|
||||
enum cef_retval_t CEF_CALLBACK handler_handle_jsconfirm(
|
||||
struct _cef_handler_t* self, cef_browser_t* browser, cef_frame_t* frame,
|
||||
const wchar_t* message, int* retval)
|
||||
const cef_string_t* message, int* retval)
|
||||
{
|
||||
DCHECK(self);
|
||||
DCHECK(browser);
|
||||
@@ -418,14 +341,10 @@ enum cef_retval_t CEF_CALLBACK handler_handle_jsconfirm(
|
||||
if(!self || !browser || !retval || !frame)
|
||||
return RV_CONTINUE;
|
||||
|
||||
std::wstring messageStr;
|
||||
if(message)
|
||||
messageStr = message;
|
||||
|
||||
bool ret = false;
|
||||
enum cef_retval_t rv = CefHandlerCppToC::Get(self)->HandleJSConfirm(
|
||||
CefBrowserCToCpp::Wrap(browser), CefFrameCToCpp::Wrap(frame), messageStr,
|
||||
ret);
|
||||
CefBrowserCToCpp::Wrap(browser), CefFrameCToCpp::Wrap(frame),
|
||||
CefString(message), ret);
|
||||
*retval = (ret ? 1 : 0);
|
||||
|
||||
return rv;
|
||||
@@ -433,7 +352,7 @@ enum cef_retval_t CEF_CALLBACK handler_handle_jsconfirm(
|
||||
|
||||
enum cef_retval_t CEF_CALLBACK handler_handle_jsprompt(
|
||||
struct _cef_handler_t* self, cef_browser_t* browser, cef_frame_t* frame,
|
||||
const wchar_t* message, const wchar_t* defaultValue, int* retval,
|
||||
const cef_string_t* message, const cef_string_t* defaultValue, int* retval,
|
||||
cef_string_t* result)
|
||||
{
|
||||
DCHECK(self);
|
||||
@@ -444,23 +363,12 @@ enum cef_retval_t CEF_CALLBACK handler_handle_jsprompt(
|
||||
if(!self || !browser || !frame || !retval || !result)
|
||||
return RV_CONTINUE;
|
||||
|
||||
std::wstring messageStr, defaultValueStr, resultStr;
|
||||
|
||||
if(message)
|
||||
messageStr = message;
|
||||
if(defaultValue)
|
||||
defaultValueStr = defaultValue;
|
||||
if(*result)
|
||||
resultStr = *result;
|
||||
|
||||
bool ret = false;
|
||||
enum cef_retval_t rv = CefHandlerCppToC::Get(self)->HandleJSPrompt(
|
||||
CefBrowserCToCpp::Wrap(browser), CefFrameCToCpp::Wrap(frame), messageStr,
|
||||
defaultValueStr, ret, resultStr);
|
||||
CefBrowserCToCpp::Wrap(browser), CefFrameCToCpp::Wrap(frame),
|
||||
CefString(message), CefString(defaultValue), ret, CefString(result));
|
||||
*retval = (ret ? 1 : 0);
|
||||
|
||||
transfer_string_contents(resultStr, result);
|
||||
|
||||
return rv;
|
||||
}
|
||||
|
||||
@@ -540,35 +448,22 @@ enum cef_retval_t CEF_CALLBACK handler_handle_tooltip(
|
||||
if(!self || !browser || !text)
|
||||
return RV_CONTINUE;
|
||||
|
||||
std::wstring textStr;
|
||||
if(*text)
|
||||
textStr = *text;
|
||||
|
||||
enum cef_retval_t rv = CefHandlerCppToC::Get(self)->HandleTooltip(
|
||||
CefBrowserCToCpp::Wrap(browser), textStr);
|
||||
|
||||
transfer_string_contents(textStr, text);
|
||||
|
||||
return rv;
|
||||
return CefHandlerCppToC::Get(self)->HandleTooltip(
|
||||
CefBrowserCToCpp::Wrap(browser), CefString(text));
|
||||
}
|
||||
|
||||
enum cef_retval_t CEF_CALLBACK handler_handle_console_message(
|
||||
struct _cef_handler_t* self, cef_browser_t* browser, const wchar_t* message,
|
||||
const wchar_t* source, int line)
|
||||
struct _cef_handler_t* self, cef_browser_t* browser,
|
||||
const cef_string_t* message, const cef_string_t* source, int line)
|
||||
{
|
||||
DCHECK(self);
|
||||
DCHECK(browser);
|
||||
if(!self || !browser)
|
||||
return RV_CONTINUE;
|
||||
|
||||
std::wstring messageStr, sourceStr;
|
||||
if(message)
|
||||
messageStr = message;
|
||||
if(source)
|
||||
sourceStr = source;
|
||||
|
||||
return CefHandlerCppToC::Get(self)->HandleConsoleMessage(
|
||||
CefBrowserCToCpp::Wrap(browser), messageStr, sourceStr, line);
|
||||
CefBrowserCToCpp::Wrap(browser), CefString(message), CefString(source),
|
||||
line);
|
||||
}
|
||||
|
||||
enum cef_retval_t CEF_CALLBACK handler_handle_find_result(
|
||||
|
@@ -38,17 +38,13 @@ void CEF_CALLBACK post_data_element_set_to_empty(
|
||||
}
|
||||
|
||||
void CEF_CALLBACK post_data_element_set_to_file(
|
||||
struct _cef_post_data_element_t* self, const wchar_t* fileName)
|
||||
struct _cef_post_data_element_t* self, const cef_string_t* fileName)
|
||||
{
|
||||
DCHECK(self);
|
||||
if(!self)
|
||||
return;
|
||||
|
||||
std::wstring fileNameStr;
|
||||
if(fileName)
|
||||
fileNameStr = fileName;
|
||||
|
||||
CefPostDataElementCppToC::Get(self)->SetToFile(fileNameStr);
|
||||
CefPostDataElementCppToC::Get(self)->SetToFile(CefString(fileName));
|
||||
}
|
||||
|
||||
void CEF_CALLBACK post_data_element_set_to_bytes(
|
||||
@@ -71,18 +67,15 @@ enum cef_postdataelement_type_t CEF_CALLBACK post_data_element_get_type(
|
||||
return CefPostDataElementCppToC::Get(self)->GetType();
|
||||
}
|
||||
|
||||
cef_string_t CEF_CALLBACK post_data_element_get_file(
|
||||
cef_string_userfree_t CEF_CALLBACK post_data_element_get_file(
|
||||
struct _cef_post_data_element_t* self)
|
||||
{
|
||||
DCHECK(self);
|
||||
if(!self)
|
||||
return NULL;
|
||||
|
||||
std::wstring fileNameStr =
|
||||
CefPostDataElementCppToC::Get(self)->GetFile();
|
||||
if(!fileNameStr.empty())
|
||||
return cef_string_alloc(fileNameStr.c_str());
|
||||
return NULL;
|
||||
CefString fileNameStr = CefPostDataElementCppToC::Get(self)->GetFile();
|
||||
return fileNameStr.DetachToUserFree();
|
||||
}
|
||||
|
||||
size_t CEF_CALLBACK post_data_element_get_bytes_count(
|
||||
|
@@ -28,54 +28,45 @@ CEF_EXPORT cef_request_t* cef_request_create()
|
||||
|
||||
// MEMBER FUNCTIONS - Body may be edited by hand.
|
||||
|
||||
cef_string_t CEF_CALLBACK request_get_url(struct _cef_request_t* self)
|
||||
cef_string_userfree_t CEF_CALLBACK request_get_url(struct _cef_request_t* self)
|
||||
{
|
||||
DCHECK(self);
|
||||
if(!self)
|
||||
return NULL;
|
||||
|
||||
std::wstring urlStr = CefRequestCppToC::Get(self)->GetURL();
|
||||
if(!urlStr.empty())
|
||||
return cef_string_alloc(urlStr.c_str());
|
||||
return NULL;
|
||||
CefString urlStr = CefRequestCppToC::Get(self)->GetURL();
|
||||
return urlStr.DetachToUserFree();
|
||||
}
|
||||
|
||||
void CEF_CALLBACK request_set_url(struct _cef_request_t* self,
|
||||
const wchar_t* url)
|
||||
const cef_string_t* url)
|
||||
{
|
||||
DCHECK(self);
|
||||
if(!self)
|
||||
return;
|
||||
|
||||
std::wstring urlStr;
|
||||
if(url)
|
||||
urlStr = url;
|
||||
CefRequestCppToC::Get(self)->SetURL(urlStr);
|
||||
CefRequestCppToC::Get(self)->SetURL(CefString(url));
|
||||
}
|
||||
|
||||
cef_string_t CEF_CALLBACK request_get_method(struct _cef_request_t* self)
|
||||
cef_string_userfree_t CEF_CALLBACK request_get_method(
|
||||
struct _cef_request_t* self)
|
||||
{
|
||||
DCHECK(self);
|
||||
if(!self)
|
||||
return NULL;
|
||||
|
||||
std::wstring methodStr = CefRequestCppToC::Get(self)->GetMethod();
|
||||
if(!methodStr.empty())
|
||||
return cef_string_alloc(methodStr.c_str());
|
||||
return NULL;
|
||||
CefString methodStr = CefRequestCppToC::Get(self)->GetMethod();
|
||||
return methodStr.DetachToUserFree();
|
||||
}
|
||||
|
||||
void CEF_CALLBACK request_set_method(struct _cef_request_t* self,
|
||||
const wchar_t* method)
|
||||
const cef_string_t* method)
|
||||
{
|
||||
DCHECK(self);
|
||||
if(!self)
|
||||
return;
|
||||
|
||||
std::wstring methodStr;
|
||||
if(method)
|
||||
methodStr = method;
|
||||
CefRequestCppToC::Get(self)->SetMethod(methodStr);
|
||||
CefRequestCppToC::Get(self)->SetMethod(CefString(method));
|
||||
}
|
||||
|
||||
struct _cef_post_data_t* CEF_CALLBACK request_get_post_data(
|
||||
@@ -133,28 +124,24 @@ void CEF_CALLBACK request_set_header_map(struct _cef_request_t* self,
|
||||
CefRequestCppToC::Get(self)->SetHeaderMap(map);
|
||||
}
|
||||
|
||||
void CEF_CALLBACK request_set(struct _cef_request_t* self, const wchar_t* url,
|
||||
const wchar_t* method, struct _cef_post_data_t* postData,
|
||||
cef_string_map_t headerMap)
|
||||
void CEF_CALLBACK request_set(struct _cef_request_t* self,
|
||||
const cef_string_t* url, const cef_string_t* method,
|
||||
struct _cef_post_data_t* postData, cef_string_map_t headerMap)
|
||||
{
|
||||
DCHECK(self);
|
||||
if(!self)
|
||||
return;
|
||||
|
||||
std::wstring urlStr, methodStr;
|
||||
CefRefPtr<CefPostData> postDataPtr;
|
||||
CefRequest::HeaderMap map;
|
||||
|
||||
if(url)
|
||||
urlStr = url;
|
||||
if(method)
|
||||
methodStr = method;
|
||||
if(postData)
|
||||
postDataPtr = CefPostDataCppToC::Unwrap(postData);
|
||||
if(headerMap)
|
||||
transfer_string_map_contents(headerMap, map);
|
||||
|
||||
CefRequestCppToC::Get(self)->Set(urlStr, methodStr, postDataPtr, map);
|
||||
CefRequestCppToC::Get(self)->Set(CefString(url), CefString(method),
|
||||
postDataPtr, map);
|
||||
}
|
||||
|
||||
|
||||
|
@@ -12,7 +12,6 @@
|
||||
|
||||
#include "libcef_dll/cpptoc/scheme_handler_cpptoc.h"
|
||||
#include "libcef_dll/ctocpp/request_ctocpp.h"
|
||||
#include "libcef_dll/transfer_util.h"
|
||||
|
||||
|
||||
// MEMBER FUNCTIONS - Body may be edited by hand.
|
||||
@@ -28,16 +27,8 @@ int CEF_CALLBACK scheme_handler_process_request(
|
||||
if(!self || !request || !mime_type || !response_length)
|
||||
return 0;
|
||||
|
||||
std::wstring mimeTypeStr;
|
||||
if(*mime_type)
|
||||
mimeTypeStr = *mime_type;
|
||||
|
||||
bool rv = CefSchemeHandlerCppToC::Get(self)->ProcessRequest(
|
||||
CefRequestCToCpp::Wrap(request), mimeTypeStr, response_length);
|
||||
|
||||
transfer_string_contents(mimeTypeStr, mime_type);
|
||||
|
||||
return rv?1:0;
|
||||
return CefSchemeHandlerCppToC::Get(self)->ProcessRequest(
|
||||
CefRequestCToCpp::Wrap(request), CefString(mime_type), response_length);
|
||||
}
|
||||
|
||||
void CEF_CALLBACK scheme_handler_cancel(struct _cef_scheme_handler_t* self)
|
||||
|
@@ -17,12 +17,10 @@
|
||||
// GLOBAL FUNCTIONS - Body may be edited by hand.
|
||||
|
||||
CEF_EXPORT cef_stream_reader_t* cef_stream_reader_create_for_file(
|
||||
const wchar_t* fileName)
|
||||
const cef_string_t* fileName)
|
||||
{
|
||||
std::wstring filenamestr;
|
||||
if(fileName)
|
||||
filenamestr = fileName;
|
||||
CefRefPtr<CefStreamReader> impl = CefStreamReader::CreateForFile(filenamestr);
|
||||
CefRefPtr<CefStreamReader> impl =
|
||||
CefStreamReader::CreateForFile(CefString(fileName));
|
||||
if(impl.get())
|
||||
return CefStreamReaderCppToC::Wrap(impl);
|
||||
return NULL;
|
||||
|
@@ -17,14 +17,14 @@
|
||||
// GLOBAL FUNCTIONS - Body may be edited by hand.
|
||||
|
||||
CEF_EXPORT cef_stream_writer_t* cef_stream_writer_create_for_file(
|
||||
const wchar_t* fileName)
|
||||
const cef_string_t* fileName)
|
||||
{
|
||||
DCHECK(fileName);
|
||||
if(!fileName)
|
||||
return NULL;
|
||||
|
||||
std::wstring fileNameStr = fileName;
|
||||
CefRefPtr<CefStreamWriter> impl = CefStreamWriter::CreateForFile(fileName);
|
||||
CefRefPtr<CefStreamWriter> impl =
|
||||
CefStreamWriter::CreateForFile(CefString(fileName));
|
||||
if(impl.get())
|
||||
return CefStreamWriterCppToC::Wrap(impl);
|
||||
return NULL;
|
||||
|
@@ -17,9 +17,9 @@
|
||||
// MEMBER FUNCTIONS - Body may be edited by hand.
|
||||
|
||||
int CEF_CALLBACK v8handler_execute(struct _cef_v8handler_t* self,
|
||||
const wchar_t* name, struct _cef_v8value_t* object, size_t argumentCount,
|
||||
struct _cef_v8value_t* const* arguments, struct _cef_v8value_t** retval,
|
||||
cef_string_t* exception)
|
||||
const cef_string_t* name, struct _cef_v8value_t* object,
|
||||
size_t argumentCount, struct _cef_v8value_t* const* arguments,
|
||||
struct _cef_v8value_t** retval, cef_string_t* exception)
|
||||
{
|
||||
DCHECK(self);
|
||||
if(!self)
|
||||
@@ -29,22 +29,15 @@ int CEF_CALLBACK v8handler_execute(struct _cef_v8handler_t* self,
|
||||
if(object)
|
||||
objectPtr = CefV8ValueCToCpp::Wrap(object);
|
||||
|
||||
std::wstring nameStr;
|
||||
if(name)
|
||||
nameStr = name;
|
||||
|
||||
CefV8ValueList list;
|
||||
for(size_t i = 0; i < argumentCount; ++i) {
|
||||
list.push_back(CefV8ValueCToCpp::Wrap(arguments[i]));
|
||||
}
|
||||
|
||||
CefRefPtr<CefV8Value> retValPtr;
|
||||
std::wstring exceptionStr;
|
||||
bool rv = CefV8HandlerCppToC::Get(self)->Execute(nameStr, objectPtr,
|
||||
list, retValPtr, exceptionStr);
|
||||
bool rv = CefV8HandlerCppToC::Get(self)->Execute(CefString(name), objectPtr,
|
||||
list, retValPtr, CefString(exception));
|
||||
if(rv) {
|
||||
if(!exceptionStr.empty() && exception)
|
||||
*exception = cef_string_alloc(exceptionStr.c_str());
|
||||
if(retValPtr.get() && retval)
|
||||
*retval = CefV8ValueCToCpp::Unwrap(retValPtr);
|
||||
}
|
||||
|
@@ -57,13 +57,9 @@ CEF_EXPORT cef_v8value_t* cef_v8value_create_double(double value)
|
||||
return NULL;
|
||||
}
|
||||
|
||||
CEF_EXPORT cef_v8value_t* cef_v8value_create_string(const wchar_t* value)
|
||||
CEF_EXPORT cef_v8value_t* cef_v8value_create_string(const cef_string_t* value)
|
||||
{
|
||||
std::wstring valueStr;
|
||||
if(value)
|
||||
valueStr = value;
|
||||
|
||||
CefRefPtr<CefV8Value> impl = CefV8Value::CreateString(valueStr);
|
||||
CefRefPtr<CefV8Value> impl = CefV8Value::CreateString(CefString(value));
|
||||
if(impl.get())
|
||||
return CefV8ValueCppToC::Wrap(impl);
|
||||
return NULL;
|
||||
@@ -89,17 +85,15 @@ CEF_EXPORT cef_v8value_t* cef_v8value_create_array()
|
||||
return NULL;
|
||||
}
|
||||
|
||||
CEF_EXPORT cef_v8value_t* cef_v8value_create_function(const wchar_t* name,
|
||||
CEF_EXPORT cef_v8value_t* cef_v8value_create_function(const cef_string_t* name,
|
||||
cef_v8handler_t* handler)
|
||||
{
|
||||
std::wstring nameStr;
|
||||
if(name)
|
||||
nameStr = name;
|
||||
CefRefPtr<CefV8Handler> handlerPtr;
|
||||
if(handler)
|
||||
handlerPtr = CefV8HandlerCToCpp::Wrap(handler);
|
||||
|
||||
CefRefPtr<CefV8Value> impl = CefV8Value::CreateFunction(nameStr, handlerPtr);
|
||||
CefRefPtr<CefV8Value> impl =
|
||||
CefV8Value::CreateFunction(CefString(name), handlerPtr);
|
||||
if(impl.get())
|
||||
return CefV8ValueCppToC::Wrap(impl);
|
||||
return NULL;
|
||||
@@ -216,30 +210,25 @@ double CEF_CALLBACK v8value_get_double_value(struct _cef_v8value_t* self)
|
||||
return CefV8ValueCppToC::Get(self)->GetDoubleValue();
|
||||
}
|
||||
|
||||
cef_string_t CEF_CALLBACK v8value_get_string_value(struct _cef_v8value_t* self)
|
||||
cef_string_userfree_t CEF_CALLBACK v8value_get_string_value(
|
||||
struct _cef_v8value_t* self)
|
||||
{
|
||||
DCHECK(self);
|
||||
if(!self)
|
||||
return 0;
|
||||
|
||||
std::wstring valueStr = CefV8ValueCppToC::Get(self)->GetStringValue();
|
||||
if(!valueStr.empty())
|
||||
return cef_string_alloc(valueStr.c_str());
|
||||
return NULL;
|
||||
CefString valueStr = CefV8ValueCppToC::Get(self)->GetStringValue();
|
||||
return valueStr.DetachToUserFree();
|
||||
}
|
||||
|
||||
int CEF_CALLBACK v8value_has_value_bykey(struct _cef_v8value_t* self,
|
||||
const wchar_t* key)
|
||||
const cef_string_t* key)
|
||||
{
|
||||
DCHECK(self);
|
||||
if(!self)
|
||||
return 0;
|
||||
|
||||
std::wstring keyStr;
|
||||
if(key)
|
||||
keyStr = key;
|
||||
|
||||
return CefV8ValueCppToC::Get(self)->HasValue(keyStr);
|
||||
return CefV8ValueCppToC::Get(self)->HasValue(CefString(key));
|
||||
}
|
||||
|
||||
int CEF_CALLBACK v8value_has_value_byindex(struct _cef_v8value_t* self,
|
||||
@@ -253,17 +242,13 @@ int CEF_CALLBACK v8value_has_value_byindex(struct _cef_v8value_t* self,
|
||||
}
|
||||
|
||||
int CEF_CALLBACK v8value_delete_value_bykey(struct _cef_v8value_t* self,
|
||||
const wchar_t* key)
|
||||
const cef_string_t* key)
|
||||
{
|
||||
DCHECK(self);
|
||||
if(!self)
|
||||
return 0;
|
||||
|
||||
std::wstring keyStr;
|
||||
if(key)
|
||||
keyStr = key;
|
||||
|
||||
return CefV8ValueCppToC::Get(self)->DeleteValue(keyStr);
|
||||
return CefV8ValueCppToC::Get(self)->DeleteValue(CefString(key));
|
||||
}
|
||||
|
||||
int CEF_CALLBACK v8value_delete_value_byindex(struct _cef_v8value_t* self,
|
||||
@@ -277,18 +262,14 @@ int CEF_CALLBACK v8value_delete_value_byindex(struct _cef_v8value_t* self,
|
||||
}
|
||||
|
||||
struct _cef_v8value_t* CEF_CALLBACK v8value_get_value_bykey(
|
||||
struct _cef_v8value_t* self, const wchar_t* key)
|
||||
struct _cef_v8value_t* self, const cef_string_t* key)
|
||||
{
|
||||
DCHECK(self);
|
||||
if(!self)
|
||||
return 0;
|
||||
|
||||
std::wstring keyStr;
|
||||
if(key)
|
||||
keyStr = key;
|
||||
|
||||
CefRefPtr<CefV8Value> valuePtr =
|
||||
CefV8ValueCppToC::Get(self)->GetValue(keyStr);
|
||||
CefV8ValueCppToC::Get(self)->GetValue(CefString(key));
|
||||
return CefV8ValueCppToC::Wrap(valuePtr);
|
||||
}
|
||||
|
||||
@@ -305,18 +286,14 @@ struct _cef_v8value_t* CEF_CALLBACK v8value_get_value_byindex(
|
||||
}
|
||||
|
||||
int CEF_CALLBACK v8value_set_value_bykey(struct _cef_v8value_t* self,
|
||||
const wchar_t* key, struct _cef_v8value_t* value)
|
||||
const cef_string_t* key, struct _cef_v8value_t* value)
|
||||
{
|
||||
DCHECK(self);
|
||||
if(!self)
|
||||
return 0;
|
||||
|
||||
std::wstring keyStr;
|
||||
if(key)
|
||||
keyStr = key;
|
||||
|
||||
CefRefPtr<CefV8Value> valuePtr = CefV8ValueCppToC::Unwrap(value);
|
||||
return CefV8ValueCppToC::Get(self)->SetValue(keyStr, valuePtr);
|
||||
return CefV8ValueCppToC::Get(self)->SetValue(CefString(key), valuePtr);
|
||||
}
|
||||
|
||||
int CEF_CALLBACK v8value_set_value_byindex(struct _cef_v8value_t* self,
|
||||
@@ -337,11 +314,11 @@ int CEF_CALLBACK v8value_get_keys(struct _cef_v8value_t* self,
|
||||
if(!self)
|
||||
return 0;
|
||||
|
||||
std::vector<std::wstring> keysList;
|
||||
std::vector<CefString> keysList;
|
||||
CefV8ValueCppToC::Get(self)->GetKeys(keysList);
|
||||
size_t size = keysList.size();
|
||||
for(size_t i = 0; i < size; ++i)
|
||||
cef_string_list_append(keys, keysList[i].c_str());
|
||||
cef_string_list_append(keys, keysList[i].GetStruct());
|
||||
return size;
|
||||
}
|
||||
|
||||
@@ -366,17 +343,15 @@ int CEF_CALLBACK v8value_get_array_length(struct _cef_v8value_t* self)
|
||||
return CefV8ValueCppToC::Get(self)->GetArrayLength();
|
||||
}
|
||||
|
||||
cef_string_t CEF_CALLBACK v8value_get_function_name(struct _cef_v8value_t* self)
|
||||
cef_string_userfree_t CEF_CALLBACK v8value_get_function_name(
|
||||
struct _cef_v8value_t* self)
|
||||
{
|
||||
DCHECK(self);
|
||||
if(!self)
|
||||
return 0;
|
||||
|
||||
std::wstring functionNameStr =
|
||||
CefV8ValueCppToC::Get(self)->GetFunctionName();
|
||||
if(!functionNameStr.empty())
|
||||
return cef_string_alloc(functionNameStr.c_str());
|
||||
return NULL;
|
||||
CefString functionNameStr = CefV8ValueCppToC::Get(self)->GetFunctionName();
|
||||
return functionNameStr.DetachToUserFree();
|
||||
}
|
||||
|
||||
cef_v8handler_t* CEF_CALLBACK v8value_get_function_handler(
|
||||
@@ -409,14 +384,11 @@ int CEF_CALLBACK v8value_execute_function(struct _cef_v8value_t* self,
|
||||
argsList.push_back(CefV8ValueCppToC::Unwrap(arguments[i]));
|
||||
}
|
||||
CefRefPtr<CefV8Value> retvalPtr;
|
||||
std::wstring exceptionStr;
|
||||
|
||||
bool rv = CefV8ValueCppToC::Get(self)->ExecuteFunction(objectPtr,
|
||||
argsList, retvalPtr, exceptionStr);
|
||||
argsList, retvalPtr, CefString(exception));
|
||||
if(retvalPtr.get() && retval)
|
||||
*retval = CefV8ValueCppToC::Wrap(retvalPtr);
|
||||
if(!exceptionStr.empty() && exception)
|
||||
*exception = cef_string_alloc(exceptionStr.c_str());
|
||||
|
||||
return rv;
|
||||
}
|
||||
|
@@ -17,13 +17,10 @@
|
||||
// GLOBAL FUNCTIONS - Body may be edited by hand.
|
||||
|
||||
CEF_EXPORT cef_xml_reader_t* cef_xml_reader_create(cef_stream_reader_t* stream,
|
||||
enum cef_xml_encoding_type_t encodingType, const wchar_t* URI)
|
||||
enum cef_xml_encoding_type_t encodingType, const cef_string_t* URI)
|
||||
{
|
||||
std::wstring encodingTypeStr;
|
||||
if(encodingType)
|
||||
encodingTypeStr = encodingType;
|
||||
CefRefPtr<CefXmlReader> impl = CefXmlReader::Create(
|
||||
CefStreamReaderCppToC::Unwrap(stream), encodingType, encodingTypeStr);
|
||||
CefStreamReaderCppToC::Unwrap(stream), encodingType, CefString(URI));
|
||||
if(impl.get())
|
||||
return CefXmlReaderCppToC::Wrap(impl);
|
||||
return NULL;
|
||||
@@ -59,16 +56,15 @@ int CEF_CALLBACK xml_reader_has_error(struct _cef_xml_reader_t* self)
|
||||
return CefXmlReaderCppToC::Get(self)->HasError();
|
||||
}
|
||||
|
||||
cef_string_t CEF_CALLBACK xml_reader_get_error(struct _cef_xml_reader_t* self)
|
||||
cef_string_userfree_t CEF_CALLBACK xml_reader_get_error(
|
||||
struct _cef_xml_reader_t* self)
|
||||
{
|
||||
DCHECK(self);
|
||||
if(!self)
|
||||
return NULL;
|
||||
|
||||
std::wstring retStr = CefXmlReaderCppToC::Get(self)->GetError();
|
||||
if(!retStr.empty())
|
||||
return cef_string_alloc(retStr.c_str());
|
||||
return NULL;
|
||||
CefString retStr = CefXmlReaderCppToC::Get(self)->GetError();
|
||||
return retStr.DetachToUserFree();
|
||||
}
|
||||
|
||||
enum cef_xml_node_type_t CEF_CALLBACK xml_reader_get_type(
|
||||
@@ -90,81 +86,70 @@ int CEF_CALLBACK xml_reader_get_depth(struct _cef_xml_reader_t* self)
|
||||
return CefXmlReaderCppToC::Get(self)->GetDepth();
|
||||
}
|
||||
|
||||
cef_string_t CEF_CALLBACK xml_reader_get_local_name(
|
||||
cef_string_userfree_t CEF_CALLBACK xml_reader_get_local_name(
|
||||
struct _cef_xml_reader_t* self)
|
||||
{
|
||||
DCHECK(self);
|
||||
if(!self)
|
||||
return NULL;
|
||||
|
||||
std::wstring retStr = CefXmlReaderCppToC::Get(self)->GetLocalName();
|
||||
if(!retStr.empty())
|
||||
return cef_string_alloc(retStr.c_str());
|
||||
return NULL;
|
||||
CefString retStr = CefXmlReaderCppToC::Get(self)->GetLocalName();
|
||||
return retStr.DetachToUserFree();
|
||||
}
|
||||
|
||||
cef_string_t CEF_CALLBACK xml_reader_get_prefix(struct _cef_xml_reader_t* self)
|
||||
{
|
||||
DCHECK(self);
|
||||
if(!self)
|
||||
return NULL;
|
||||
|
||||
std::wstring retStr = CefXmlReaderCppToC::Get(self)->GetPrefix();
|
||||
if(!retStr.empty())
|
||||
return cef_string_alloc(retStr.c_str());
|
||||
return NULL;
|
||||
}
|
||||
|
||||
cef_string_t CEF_CALLBACK xml_reader_get_qualified_name(
|
||||
cef_string_userfree_t CEF_CALLBACK xml_reader_get_prefix(
|
||||
struct _cef_xml_reader_t* self)
|
||||
{
|
||||
DCHECK(self);
|
||||
if(!self)
|
||||
return NULL;
|
||||
|
||||
std::wstring retStr = CefXmlReaderCppToC::Get(self)->GetQualifiedName();
|
||||
if(!retStr.empty())
|
||||
return cef_string_alloc(retStr.c_str());
|
||||
return NULL;
|
||||
CefString retStr = CefXmlReaderCppToC::Get(self)->GetPrefix();
|
||||
return retStr.DetachToUserFree();
|
||||
}
|
||||
|
||||
cef_string_t CEF_CALLBACK xml_reader_get_namespace_uri(
|
||||
cef_string_userfree_t CEF_CALLBACK xml_reader_get_qualified_name(
|
||||
struct _cef_xml_reader_t* self)
|
||||
{
|
||||
DCHECK(self);
|
||||
if(!self)
|
||||
return NULL;
|
||||
|
||||
std::wstring retStr = CefXmlReaderCppToC::Get(self)->GetNamespaceURI();
|
||||
if(!retStr.empty())
|
||||
return cef_string_alloc(retStr.c_str());
|
||||
return NULL;
|
||||
CefString retStr = CefXmlReaderCppToC::Get(self)->GetQualifiedName();
|
||||
return retStr.DetachToUserFree();
|
||||
}
|
||||
|
||||
cef_string_t CEF_CALLBACK xml_reader_get_base_uri(
|
||||
cef_string_userfree_t CEF_CALLBACK xml_reader_get_namespace_uri(
|
||||
struct _cef_xml_reader_t* self)
|
||||
{
|
||||
DCHECK(self);
|
||||
if(!self)
|
||||
return NULL;
|
||||
|
||||
std::wstring retStr = CefXmlReaderCppToC::Get(self)->GetBaseURI();
|
||||
if(!retStr.empty())
|
||||
return cef_string_alloc(retStr.c_str());
|
||||
return NULL;
|
||||
CefString retStr = CefXmlReaderCppToC::Get(self)->GetNamespaceURI();
|
||||
return retStr.DetachToUserFree();
|
||||
}
|
||||
|
||||
cef_string_t CEF_CALLBACK xml_reader_get_xml_lang(
|
||||
cef_string_userfree_t CEF_CALLBACK xml_reader_get_base_uri(
|
||||
struct _cef_xml_reader_t* self)
|
||||
{
|
||||
DCHECK(self);
|
||||
if(!self)
|
||||
return NULL;
|
||||
|
||||
std::wstring retStr = CefXmlReaderCppToC::Get(self)->GetXmlLang();
|
||||
if(!retStr.empty())
|
||||
return cef_string_alloc(retStr.c_str());
|
||||
return NULL;
|
||||
CefString retStr = CefXmlReaderCppToC::Get(self)->GetBaseURI();
|
||||
return retStr.DetachToUserFree();
|
||||
}
|
||||
|
||||
cef_string_userfree_t CEF_CALLBACK xml_reader_get_xml_lang(
|
||||
struct _cef_xml_reader_t* self)
|
||||
{
|
||||
DCHECK(self);
|
||||
if(!self)
|
||||
return NULL;
|
||||
|
||||
CefString retStr = CefXmlReaderCppToC::Get(self)->GetXmlLang();
|
||||
return retStr.DetachToUserFree();
|
||||
}
|
||||
|
||||
int CEF_CALLBACK xml_reader_is_empty_element(struct _cef_xml_reader_t* self)
|
||||
@@ -185,16 +170,15 @@ int CEF_CALLBACK xml_reader_has_value(struct _cef_xml_reader_t* self)
|
||||
return CefXmlReaderCppToC::Get(self)->HasValue();
|
||||
}
|
||||
|
||||
cef_string_t CEF_CALLBACK xml_reader_get_value(struct _cef_xml_reader_t* self)
|
||||
cef_string_userfree_t CEF_CALLBACK xml_reader_get_value(
|
||||
struct _cef_xml_reader_t* self)
|
||||
{
|
||||
DCHECK(self);
|
||||
if(!self)
|
||||
return NULL;
|
||||
|
||||
std::wstring retStr = CefXmlReaderCppToC::Get(self)->GetValue();
|
||||
if(!retStr.empty())
|
||||
return cef_string_alloc(retStr.c_str());
|
||||
return NULL;
|
||||
CefString retStr = CefXmlReaderCppToC::Get(self)->GetValue();
|
||||
return retStr.DetachToUserFree();
|
||||
}
|
||||
|
||||
int CEF_CALLBACK xml_reader_has_attributes(struct _cef_xml_reader_t* self)
|
||||
@@ -216,37 +200,33 @@ size_t CEF_CALLBACK xml_reader_get_attribute_count(
|
||||
return CefXmlReaderCppToC::Get(self)->GetAttributeCount();
|
||||
}
|
||||
|
||||
cef_string_t CEF_CALLBACK xml_reader_get_attribute_byindex(
|
||||
cef_string_userfree_t CEF_CALLBACK xml_reader_get_attribute_byindex(
|
||||
struct _cef_xml_reader_t* self, int index)
|
||||
{
|
||||
DCHECK(self);
|
||||
if(!self)
|
||||
return NULL;
|
||||
|
||||
std::wstring retStr = CefXmlReaderCppToC::Get(self)->GetAttribute(index);
|
||||
if(!retStr.empty())
|
||||
return cef_string_alloc(retStr.c_str());
|
||||
return NULL;
|
||||
CefString retStr = CefXmlReaderCppToC::Get(self)->GetAttribute(index);
|
||||
return retStr.DetachToUserFree();
|
||||
}
|
||||
|
||||
cef_string_t CEF_CALLBACK xml_reader_get_attribute_byqname(
|
||||
struct _cef_xml_reader_t* self, const wchar_t* qualifiedName)
|
||||
cef_string_userfree_t CEF_CALLBACK xml_reader_get_attribute_byqname(
|
||||
struct _cef_xml_reader_t* self, const cef_string_t* qualifiedName)
|
||||
{
|
||||
DCHECK(self);
|
||||
DCHECK(qualifiedName);
|
||||
if(!self || !qualifiedName)
|
||||
return NULL;
|
||||
|
||||
std::wstring retStr = CefXmlReaderCppToC::Get(self)->GetAttribute(
|
||||
qualifiedName);
|
||||
if(!retStr.empty())
|
||||
return cef_string_alloc(retStr.c_str());
|
||||
return NULL;
|
||||
CefString retStr = CefXmlReaderCppToC::Get(self)->GetAttribute(
|
||||
CefString(qualifiedName));
|
||||
return retStr.DetachToUserFree();
|
||||
}
|
||||
|
||||
cef_string_t CEF_CALLBACK xml_reader_get_attribute_bylname(
|
||||
struct _cef_xml_reader_t* self, const wchar_t* localName,
|
||||
const wchar_t* namespaceURI)
|
||||
cef_string_userfree_t CEF_CALLBACK xml_reader_get_attribute_bylname(
|
||||
struct _cef_xml_reader_t* self, const cef_string_t* localName,
|
||||
const cef_string_t* namespaceURI)
|
||||
{
|
||||
DCHECK(self);
|
||||
DCHECK(localName);
|
||||
@@ -254,37 +234,31 @@ cef_string_t CEF_CALLBACK xml_reader_get_attribute_bylname(
|
||||
if(!self || !localName || !namespaceURI)
|
||||
return NULL;
|
||||
|
||||
std::wstring retStr = CefXmlReaderCppToC::Get(self)->GetAttribute(
|
||||
localName, namespaceURI);
|
||||
if(!retStr.empty())
|
||||
return cef_string_alloc(retStr.c_str());
|
||||
return NULL;
|
||||
CefString retStr = CefXmlReaderCppToC::Get(self)->GetAttribute(
|
||||
CefString(localName), CefString(namespaceURI));
|
||||
return retStr.DetachToUserFree();
|
||||
}
|
||||
|
||||
cef_string_t CEF_CALLBACK xml_reader_get_inner_xml(
|
||||
cef_string_userfree_t CEF_CALLBACK xml_reader_get_inner_xml(
|
||||
struct _cef_xml_reader_t* self)
|
||||
{
|
||||
DCHECK(self);
|
||||
if(!self)
|
||||
return NULL;
|
||||
|
||||
std::wstring retStr = CefXmlReaderCppToC::Get(self)->GetInnerXml();
|
||||
if(!retStr.empty())
|
||||
return cef_string_alloc(retStr.c_str());
|
||||
return NULL;
|
||||
CefString retStr = CefXmlReaderCppToC::Get(self)->GetInnerXml();
|
||||
return retStr.DetachToUserFree();
|
||||
}
|
||||
|
||||
cef_string_t CEF_CALLBACK xml_reader_get_outer_xml(
|
||||
cef_string_userfree_t CEF_CALLBACK xml_reader_get_outer_xml(
|
||||
struct _cef_xml_reader_t* self)
|
||||
{
|
||||
DCHECK(self);
|
||||
if(!self)
|
||||
return NULL;
|
||||
|
||||
std::wstring retStr = CefXmlReaderCppToC::Get(self)->GetOuterXml();
|
||||
if(!retStr.empty())
|
||||
return cef_string_alloc(retStr.c_str());
|
||||
return NULL;
|
||||
CefString retStr = CefXmlReaderCppToC::Get(self)->GetOuterXml();
|
||||
return retStr.DetachToUserFree();
|
||||
}
|
||||
|
||||
int CEF_CALLBACK xml_reader_get_line_number(struct _cef_xml_reader_t* self)
|
||||
@@ -307,19 +281,20 @@ int CEF_CALLBACK xml_reader_move_to_attribute_byindex(
|
||||
}
|
||||
|
||||
int CEF_CALLBACK xml_reader_move_to_attribute_byqname(
|
||||
struct _cef_xml_reader_t* self, const wchar_t* qualifiedName)
|
||||
struct _cef_xml_reader_t* self, const cef_string_t* qualifiedName)
|
||||
{
|
||||
DCHECK(self);
|
||||
DCHECK(qualifiedName);
|
||||
if(!self || !qualifiedName)
|
||||
return 0;
|
||||
|
||||
return CefXmlReaderCppToC::Get(self)->MoveToAttribute(qualifiedName);
|
||||
return CefXmlReaderCppToC::Get(self)->MoveToAttribute(
|
||||
CefString(qualifiedName));
|
||||
}
|
||||
|
||||
int CEF_CALLBACK xml_reader_move_to_attribute_bylname(
|
||||
struct _cef_xml_reader_t* self, const wchar_t* localName,
|
||||
const wchar_t* namespaceURI)
|
||||
struct _cef_xml_reader_t* self, const cef_string_t* localName,
|
||||
const cef_string_t* namespaceURI)
|
||||
{
|
||||
DCHECK(self);
|
||||
DCHECK(localName);
|
||||
@@ -327,8 +302,8 @@ int CEF_CALLBACK xml_reader_move_to_attribute_bylname(
|
||||
if(!self || !localName || !namespaceURI)
|
||||
return 0;
|
||||
|
||||
return CefXmlReaderCppToC::Get(self)->MoveToAttribute(localName,
|
||||
namespaceURI);
|
||||
return CefXmlReaderCppToC::Get(self)->MoveToAttribute(CefString(localName),
|
||||
CefString(namespaceURI));
|
||||
}
|
||||
|
||||
int CEF_CALLBACK xml_reader_move_to_first_attribute(
|
||||
|
@@ -47,17 +47,13 @@ int CEF_CALLBACK zip_reader_move_to_next_file(struct _cef_zip_reader_t* self)
|
||||
}
|
||||
|
||||
int CEF_CALLBACK zip_reader_move_to_file(struct _cef_zip_reader_t* self,
|
||||
const wchar_t* fileName, int caseSensitive)
|
||||
const cef_string_t* fileName, int caseSensitive)
|
||||
{
|
||||
DCHECK(self);
|
||||
if(!self)
|
||||
return 0;
|
||||
|
||||
std::wstring fileNameStr;
|
||||
if (fileName)
|
||||
fileNameStr = fileName;
|
||||
|
||||
return CefZipReaderCppToC::Get(self)->MoveToFile(fileNameStr,
|
||||
return CefZipReaderCppToC::Get(self)->MoveToFile(CefString(fileName),
|
||||
caseSensitive ? true : false);
|
||||
}
|
||||
|
||||
@@ -70,16 +66,16 @@ int CEF_CALLBACK zip_reader_close(struct _cef_zip_reader_t* self)
|
||||
return CefZipReaderCppToC::Get(self)->Close();
|
||||
}
|
||||
|
||||
cef_string_t CEF_CALLBACK zip_reader_get_file_name(
|
||||
cef_string_userfree_t CEF_CALLBACK zip_reader_get_file_name(
|
||||
struct _cef_zip_reader_t* self)
|
||||
{
|
||||
DCHECK(self);
|
||||
if(!self)
|
||||
return NULL;
|
||||
|
||||
std::wstring retStr = CefZipReaderCppToC::Get(self)->GetFileName();
|
||||
CefString retStr = CefZipReaderCppToC::Get(self)->GetFileName();
|
||||
if(!retStr.empty())
|
||||
return cef_string_alloc(retStr.c_str());
|
||||
return retStr.DetachToUserFree();
|
||||
return NULL;
|
||||
}
|
||||
|
||||
@@ -103,17 +99,13 @@ time_t CEF_CALLBACK zip_reader_get_file_last_modified(
|
||||
}
|
||||
|
||||
int CEF_CALLBACK zip_reader_open_file(struct _cef_zip_reader_t* self,
|
||||
const wchar_t* password)
|
||||
const cef_string_t* password)
|
||||
{
|
||||
DCHECK(self);
|
||||
if(!self)
|
||||
return 0;
|
||||
|
||||
std::wstring passwordStr;
|
||||
if (password)
|
||||
passwordStr = password;
|
||||
|
||||
return CefZipReaderCppToC::Get(self)->OpenFile(passwordStr);
|
||||
return CefZipReaderCppToC::Get(self)->OpenFile(CefString(password));
|
||||
}
|
||||
|
||||
int CEF_CALLBACK zip_reader_close_file(struct _cef_zip_reader_t* self)
|
||||
|
@@ -13,22 +13,23 @@
|
||||
#include "libcef_dll/cpptoc/handler_cpptoc.h"
|
||||
#include "libcef_dll/ctocpp/browser_ctocpp.h"
|
||||
#include "libcef_dll/ctocpp/frame_ctocpp.h"
|
||||
#include "libcef_dll/transfer_util.h"
|
||||
|
||||
|
||||
// STATIC METHODS - Body may be edited by hand.
|
||||
|
||||
bool CefBrowser::CreateBrowser(CefWindowInfo& windowInfo, bool popup,
|
||||
CefRefPtr<CefHandler> handler, const std::wstring& url)
|
||||
CefRefPtr<CefHandler> handler, const CefString& url)
|
||||
{
|
||||
return cef_browser_create(&windowInfo, popup, CefHandlerCppToC::Wrap(handler),
|
||||
url.c_str())?true:false;
|
||||
url.GetStruct())?true:false;
|
||||
}
|
||||
|
||||
CefRefPtr<CefBrowser> CefBrowser::CreateBrowserSync(CefWindowInfo& windowInfo,
|
||||
bool popup, CefRefPtr<CefHandler> handler, const std::wstring& url)
|
||||
bool popup, CefRefPtr<CefHandler> handler, const CefString& url)
|
||||
{
|
||||
cef_browser_t* impl = cef_browser_create_sync(&windowInfo, popup,
|
||||
CefHandlerCppToC::Wrap(handler), url.c_str());
|
||||
CefHandlerCppToC::Wrap(handler), url.GetStruct());
|
||||
if(impl)
|
||||
return CefBrowserCToCpp::Wrap(impl);
|
||||
return NULL;
|
||||
@@ -153,19 +154,19 @@ CefRefPtr<CefFrame> CefBrowserCToCpp::GetFocusedFrame()
|
||||
return NULL;
|
||||
}
|
||||
|
||||
CefRefPtr<CefFrame> CefBrowserCToCpp::GetFrame(const std::wstring& name)
|
||||
CefRefPtr<CefFrame> CefBrowserCToCpp::GetFrame(const CefString& name)
|
||||
{
|
||||
if(CEF_MEMBER_MISSING(struct_, get_main_frame))
|
||||
return NULL;
|
||||
|
||||
cef_frame_t* frameStruct = struct_->get_frame(struct_, name.c_str());
|
||||
cef_frame_t* frameStruct = struct_->get_frame(struct_, name.GetStruct());
|
||||
if(frameStruct)
|
||||
return CefFrameCToCpp::Wrap(frameStruct);
|
||||
|
||||
return NULL;
|
||||
}
|
||||
|
||||
void CefBrowserCToCpp::GetFrameNames(std::vector<std::wstring>& names)
|
||||
void CefBrowserCToCpp::GetFrameNames(std::vector<CefString>& names)
|
||||
{
|
||||
if(CEF_MEMBER_MISSING(struct_, get_frame_names))
|
||||
return;
|
||||
@@ -173,24 +174,17 @@ void CefBrowserCToCpp::GetFrameNames(std::vector<std::wstring>& names)
|
||||
cef_string_list_t list = cef_string_list_alloc();
|
||||
struct_->get_frame_names(struct_, list);
|
||||
|
||||
cef_string_t str;
|
||||
int size = cef_string_list_size(list);
|
||||
for(int i = 0; i < size; ++i) {
|
||||
str = cef_string_list_value(list, i);
|
||||
names.push_back(str);
|
||||
cef_string_free(str);
|
||||
}
|
||||
|
||||
transfer_string_list_contents(list, names);
|
||||
cef_string_list_free(list);
|
||||
}
|
||||
|
||||
void CefBrowserCToCpp::Find(int identifier, const std::wstring& searchText,
|
||||
void CefBrowserCToCpp::Find(int identifier, const CefString& searchText,
|
||||
bool forward, bool matchCase, bool findNext)
|
||||
{
|
||||
if(CEF_MEMBER_MISSING(struct_, find))
|
||||
return;
|
||||
|
||||
struct_->find(struct_, identifier, searchText.c_str(), forward,
|
||||
struct_->find(struct_, identifier, searchText.GetStruct(), forward,
|
||||
matchCase, findNext);
|
||||
}
|
||||
|
||||
|
@@ -44,10 +44,10 @@ public:
|
||||
virtual CefRefPtr<CefHandler> GetHandler();
|
||||
virtual CefRefPtr<CefFrame> GetMainFrame();
|
||||
virtual CefRefPtr<CefFrame> GetFocusedFrame();
|
||||
virtual CefRefPtr<CefFrame> GetFrame(const std::wstring& name);
|
||||
virtual void GetFrameNames(std::vector<std::wstring>& names);
|
||||
virtual void Find(int identifier, const std::wstring& searchText,
|
||||
bool forward, bool matchCase, bool findNext);
|
||||
virtual CefRefPtr<CefFrame> GetFrame(const CefString& name);
|
||||
virtual void GetFrameNames(std::vector<CefString>& names);
|
||||
virtual void Find(int identifier, const CefString& searchText, bool forward,
|
||||
bool matchCase, bool findNext);
|
||||
virtual void StopFinding(bool clearSelection);
|
||||
};
|
||||
|
||||
|
@@ -89,31 +89,25 @@ void CefFrameCToCpp::ViewSource()
|
||||
struct_->view_source(struct_);
|
||||
}
|
||||
|
||||
std::wstring CefFrameCToCpp::GetSource()
|
||||
CefString CefFrameCToCpp::GetSource()
|
||||
{
|
||||
std::wstring str;
|
||||
CefString str;
|
||||
if(CEF_MEMBER_MISSING(struct_, get_source))
|
||||
return str;
|
||||
|
||||
cef_string_t cef_str = struct_->get_source(struct_);
|
||||
if(cef_str) {
|
||||
str = cef_str;
|
||||
cef_string_free(cef_str);
|
||||
}
|
||||
cef_string_userfree_t strPtr = struct_->get_source(struct_);
|
||||
str.AttachToUserFree(strPtr);
|
||||
return str;
|
||||
}
|
||||
|
||||
std::wstring CefFrameCToCpp::GetText()
|
||||
CefString CefFrameCToCpp::GetText()
|
||||
{
|
||||
std::wstring str;
|
||||
CefString str;
|
||||
if(CEF_MEMBER_MISSING(struct_, get_text))
|
||||
return str;
|
||||
|
||||
cef_string_t cef_str = struct_->get_text(struct_);
|
||||
if(cef_str) {
|
||||
str = cef_str;
|
||||
cef_string_free(cef_str);
|
||||
}
|
||||
cef_string_userfree_t strPtr = struct_->get_text(struct_);
|
||||
str.AttachToUserFree(strPtr);
|
||||
return str;
|
||||
}
|
||||
|
||||
@@ -125,41 +119,40 @@ void CefFrameCToCpp::LoadRequest(CefRefPtr<CefRequest> request)
|
||||
struct_->load_request(struct_, CefRequestCToCpp::Unwrap(request));
|
||||
}
|
||||
|
||||
void CefFrameCToCpp::LoadURL(const std::wstring& url)
|
||||
void CefFrameCToCpp::LoadURL(const CefString& url)
|
||||
{
|
||||
if(CEF_MEMBER_MISSING(struct_, load_url))
|
||||
return;
|
||||
|
||||
struct_->load_url(struct_, url.c_str());
|
||||
struct_->load_url(struct_, url.GetStruct());
|
||||
}
|
||||
|
||||
void CefFrameCToCpp::LoadString(const std::wstring& string,
|
||||
const std::wstring& url)
|
||||
void CefFrameCToCpp::LoadString(const CefString& string, const CefString& url)
|
||||
{
|
||||
if(CEF_MEMBER_MISSING(struct_, load_string))
|
||||
return;
|
||||
|
||||
struct_->load_string(struct_, string.c_str(), url.c_str());
|
||||
struct_->load_string(struct_, string.GetStruct(), url.GetStruct());
|
||||
}
|
||||
|
||||
void CefFrameCToCpp::LoadStream(CefRefPtr<CefStreamReader> stream,
|
||||
const std::wstring& url)
|
||||
const CefString& url)
|
||||
{
|
||||
if(CEF_MEMBER_MISSING(struct_, load_stream))
|
||||
return;
|
||||
|
||||
struct_->load_stream(struct_, CefStreamReaderCToCpp::Unwrap(stream),
|
||||
url.c_str());
|
||||
url.GetStruct());
|
||||
}
|
||||
|
||||
void CefFrameCToCpp::ExecuteJavaScript(const std::wstring& jsCode,
|
||||
const std::wstring& scriptUrl, int startLine)
|
||||
void CefFrameCToCpp::ExecuteJavaScript(const CefString& jsCode,
|
||||
const CefString& scriptUrl, int startLine)
|
||||
{
|
||||
if(CEF_MEMBER_MISSING(struct_, execute_java_script))
|
||||
return;
|
||||
|
||||
struct_->execute_java_script(struct_, jsCode.c_str(), scriptUrl.c_str(),
|
||||
startLine);
|
||||
struct_->execute_java_script(struct_, jsCode.GetStruct(),
|
||||
scriptUrl.GetStruct(), startLine);
|
||||
}
|
||||
|
||||
bool CefFrameCToCpp::IsMain()
|
||||
@@ -178,31 +171,25 @@ bool CefFrameCToCpp::IsFocused()
|
||||
return struct_->is_focused(struct_)?true:false;
|
||||
}
|
||||
|
||||
std::wstring CefFrameCToCpp::GetName()
|
||||
CefString CefFrameCToCpp::GetName()
|
||||
{
|
||||
std::wstring str;
|
||||
CefString str;
|
||||
if(CEF_MEMBER_MISSING(struct_, get_name))
|
||||
return str;
|
||||
|
||||
cef_string_t cef_str = struct_->get_name(struct_);
|
||||
if(cef_str) {
|
||||
str = cef_str;
|
||||
cef_string_free(cef_str);
|
||||
}
|
||||
cef_string_userfree_t strPtr = struct_->get_name(struct_);
|
||||
str.AttachToUserFree(strPtr);
|
||||
return str;
|
||||
}
|
||||
|
||||
std::wstring CefFrameCToCpp::GetURL()
|
||||
CefString CefFrameCToCpp::GetURL()
|
||||
{
|
||||
std::wstring str;
|
||||
CefString str;
|
||||
if(CEF_MEMBER_MISSING(struct_, get_url))
|
||||
return str;
|
||||
|
||||
cef_string_t cef_str = struct_->get_url(struct_);
|
||||
if(cef_str) {
|
||||
str = cef_str;
|
||||
cef_string_free(cef_str);
|
||||
}
|
||||
cef_string_userfree_t strPtr = struct_->get_url(struct_);
|
||||
str.AttachToUserFree(strPtr);
|
||||
return str;
|
||||
}
|
||||
|
||||
|
@@ -40,19 +40,19 @@ public:
|
||||
virtual void SelectAll();
|
||||
virtual void Print();
|
||||
virtual void ViewSource();
|
||||
virtual std::wstring GetSource();
|
||||
virtual std::wstring GetText();
|
||||
virtual CefString GetSource();
|
||||
virtual CefString GetText();
|
||||
virtual void LoadRequest(CefRefPtr<CefRequest> request);
|
||||
virtual void LoadURL(const std::wstring& url);
|
||||
virtual void LoadString(const std::wstring& string, const std::wstring& url);
|
||||
virtual void LoadURL(const CefString& url);
|
||||
virtual void LoadString(const CefString& string, const CefString& url);
|
||||
virtual void LoadStream(CefRefPtr<CefStreamReader> stream,
|
||||
const std::wstring& url);
|
||||
virtual void ExecuteJavaScript(const std::wstring& jsCode,
|
||||
const std::wstring& scriptUrl, int startLine);
|
||||
const CefString& url);
|
||||
virtual void ExecuteJavaScript(const CefString& jsCode,
|
||||
const CefString& scriptUrl, int startLine);
|
||||
virtual bool IsMain();
|
||||
virtual bool IsFocused();
|
||||
virtual std::wstring GetName();
|
||||
virtual std::wstring GetURL();
|
||||
virtual CefString GetName();
|
||||
virtual CefString GetURL();
|
||||
};
|
||||
|
||||
#endif // USING_CEF_SHARED
|
||||
|
@@ -17,7 +17,6 @@
|
||||
#include "libcef_dll/cpptoc/v8value_cpptoc.h"
|
||||
#include "libcef_dll/ctocpp/download_handler_ctocpp.h"
|
||||
#include "libcef_dll/ctocpp/handler_ctocpp.h"
|
||||
#include "libcef_dll/transfer_util.h"
|
||||
|
||||
|
||||
// VIRTUAL METHODS - Body may be edited by hand.
|
||||
@@ -25,7 +24,7 @@
|
||||
CefHandler::RetVal CefHandlerCToCpp::HandleBeforeCreated(
|
||||
CefRefPtr<CefBrowser> parentBrowser, CefWindowInfo& windowInfo, bool popup,
|
||||
const CefPopupFeatures& popupFeatures, CefRefPtr<CefHandler>& handler,
|
||||
std::wstring& url, CefBrowserSettings& settings)
|
||||
CefString& url, CefBrowserSettings& settings)
|
||||
{
|
||||
if(CEF_MEMBER_MISSING(struct_, handle_before_created))
|
||||
return RV_CONTINUE;
|
||||
@@ -39,13 +38,9 @@ CefHandler::RetVal CefHandlerCToCpp::HandleBeforeCreated(
|
||||
handlerStruct = CefHandlerCToCpp::Unwrap(handler);
|
||||
cef_handler_t *origHandlerStruct = handlerStruct;
|
||||
|
||||
cef_string_t urlRet = NULL;
|
||||
if(!url.empty())
|
||||
urlRet = cef_string_alloc(url.c_str());
|
||||
|
||||
cef_retval_t rv = struct_->handle_before_created(struct_,
|
||||
browserStruct, &windowInfo, popup, &popupFeatures, &handlerStruct,
|
||||
&urlRet, &settings);
|
||||
url.GetWritableStruct(), &settings);
|
||||
|
||||
if(handlerStruct && handlerStruct != origHandlerStruct) {
|
||||
// The handler was changed.
|
||||
@@ -55,8 +50,6 @@ CefHandler::RetVal CefHandlerCToCpp::HandleBeforeCreated(
|
||||
handler = NULL;
|
||||
}
|
||||
|
||||
transfer_string_contents(urlRet, url, true);
|
||||
|
||||
return rv;
|
||||
}
|
||||
|
||||
@@ -72,24 +65,24 @@ CefHandler::RetVal CefHandlerCToCpp::HandleAfterCreated(
|
||||
|
||||
CefHandler::RetVal CefHandlerCToCpp::HandleAddressChange(
|
||||
CefRefPtr<CefBrowser> browser, CefRefPtr<CefFrame> frame,
|
||||
const std::wstring& url)
|
||||
const CefString& url)
|
||||
{
|
||||
if(CEF_MEMBER_MISSING(struct_, handle_address_change))
|
||||
return RV_CONTINUE;
|
||||
|
||||
return struct_->handle_address_change(struct_,
|
||||
CefBrowserCppToC::Wrap(browser), CefFrameCppToC::Wrap(frame),
|
||||
url.c_str());
|
||||
url.GetStruct());
|
||||
}
|
||||
|
||||
CefHandler::RetVal CefHandlerCToCpp::HandleTitleChange(
|
||||
CefRefPtr<CefBrowser> browser, const std::wstring& title)
|
||||
CefRefPtr<CefBrowser> browser, const CefString& title)
|
||||
{
|
||||
if(CEF_MEMBER_MISSING(struct_, handle_title_change))
|
||||
return RV_CONTINUE;
|
||||
|
||||
return struct_->handle_title_change(struct_, CefBrowserCppToC::Wrap(browser),
|
||||
title.c_str());
|
||||
title.GetStruct());
|
||||
}
|
||||
|
||||
CefHandler::RetVal CefHandlerCToCpp::HandleBeforeBrowse(
|
||||
@@ -134,46 +127,30 @@ CefHandler::RetVal CefHandlerCToCpp::HandleLoadEnd(
|
||||
|
||||
CefHandler::RetVal CefHandlerCToCpp::HandleLoadError(
|
||||
CefRefPtr<CefBrowser> browser, CefRefPtr<CefFrame> frame,
|
||||
ErrorCode errorCode, const std::wstring& failedUrl,
|
||||
std::wstring& errorText)
|
||||
ErrorCode errorCode, const CefString& failedUrl, CefString& errorText)
|
||||
{
|
||||
if(CEF_MEMBER_MISSING(struct_, handle_load_error))
|
||||
return RV_CONTINUE;
|
||||
|
||||
cef_string_t errorTextRet = NULL;
|
||||
if(!errorText.empty())
|
||||
errorTextRet = cef_string_alloc(errorText.c_str());
|
||||
|
||||
cef_retval_t rv = struct_->handle_load_error(struct_,
|
||||
return struct_->handle_load_error(struct_,
|
||||
CefBrowserCppToC::Wrap(browser), CefFrameCppToC::Wrap(frame), errorCode,
|
||||
failedUrl.c_str(), &errorTextRet);
|
||||
|
||||
transfer_string_contents(errorTextRet, errorText, true);
|
||||
|
||||
return rv;
|
||||
failedUrl.GetStruct(), errorText.GetWritableStruct());
|
||||
}
|
||||
|
||||
CefHandler::RetVal CefHandlerCToCpp::HandleBeforeResourceLoad(
|
||||
CefRefPtr<CefBrowser> browser, CefRefPtr<CefRequest> request,
|
||||
std::wstring& redirectUrl, CefRefPtr<CefStreamReader>& resourceStream,
|
||||
std::wstring& mimeType, int loadFlags)
|
||||
CefString& redirectUrl, CefRefPtr<CefStreamReader>& resourceStream,
|
||||
CefString& mimeType, int loadFlags)
|
||||
{
|
||||
if(CEF_MEMBER_MISSING(struct_, handle_before_resource_load))
|
||||
return RV_CONTINUE;
|
||||
|
||||
cef_string_t redirectUrlRet = NULL;
|
||||
cef_string_t mimeTypeRet = NULL;
|
||||
cef_stream_reader_t* streamRet = NULL;
|
||||
|
||||
if(!redirectUrl.empty())
|
||||
redirectUrlRet = cef_string_alloc(redirectUrl.c_str());
|
||||
|
||||
cef_retval_t rv = struct_->handle_before_resource_load(struct_,
|
||||
CefBrowserCppToC::Wrap(browser), CefRequestCppToC::Wrap(request),
|
||||
&redirectUrlRet, &streamRet, &mimeTypeRet, loadFlags);
|
||||
|
||||
transfer_string_contents(redirectUrlRet, redirectUrl, true);
|
||||
transfer_string_contents(mimeTypeRet, mimeType, true);
|
||||
redirectUrl.GetWritableStruct(), &streamRet, mimeType.GetWritableStruct(),
|
||||
loadFlags);
|
||||
|
||||
if(streamRet)
|
||||
resourceStream = CefStreamReaderCppToC::Unwrap(streamRet);
|
||||
@@ -182,8 +159,8 @@ CefHandler::RetVal CefHandlerCToCpp::HandleBeforeResourceLoad(
|
||||
}
|
||||
|
||||
CefHandler::RetVal CefHandlerCToCpp::HandleDownloadResponse(
|
||||
CefRefPtr<CefBrowser> browser, const std::wstring& mimeType,
|
||||
const std::wstring& fileName, int64 contentLength,
|
||||
CefRefPtr<CefBrowser> browser, const CefString& mimeType,
|
||||
const CefString& fileName, int64 contentLength,
|
||||
CefRefPtr<CefDownloadHandler>& handler)
|
||||
{
|
||||
if(CEF_MEMBER_MISSING(struct_, handle_download_response))
|
||||
@@ -192,7 +169,7 @@ CefHandler::RetVal CefHandlerCToCpp::HandleDownloadResponse(
|
||||
cef_download_handler_t* handlerRet = NULL;
|
||||
|
||||
cef_retval_t rv = struct_->handle_download_response(struct_,
|
||||
CefBrowserCppToC::Wrap(browser), mimeType.c_str(), fileName.c_str(),
|
||||
CefBrowserCppToC::Wrap(browser), mimeType.GetStruct(), fileName.GetStruct(),
|
||||
contentLength, &handlerRet);
|
||||
|
||||
if(handlerRet)
|
||||
@@ -212,21 +189,13 @@ CefHandler::RetVal CefHandlerCToCpp::HandleBeforeMenu(
|
||||
}
|
||||
|
||||
CefHandler::RetVal CefHandlerCToCpp::HandleGetMenuLabel(
|
||||
CefRefPtr<CefBrowser> browser, MenuId menuId, std::wstring& label)
|
||||
CefRefPtr<CefBrowser> browser, MenuId menuId, CefString& label)
|
||||
{
|
||||
if(CEF_MEMBER_MISSING(struct_, handle_get_menu_label))
|
||||
return RV_CONTINUE;
|
||||
|
||||
cef_string_t labelRet = NULL;
|
||||
if(!label.empty())
|
||||
labelRet = cef_string_alloc(label.c_str());
|
||||
|
||||
cef_retval_t rv = struct_->handle_get_menu_label(struct_,
|
||||
CefBrowserCppToC::Wrap(browser), menuId, &labelRet);
|
||||
|
||||
transfer_string_contents(labelRet, label, true);
|
||||
|
||||
return rv;
|
||||
return struct_->handle_get_menu_label(struct_,
|
||||
CefBrowserCppToC::Wrap(browser), menuId, label.GetWritableStruct());
|
||||
}
|
||||
|
||||
CefHandler::RetVal CefHandlerCToCpp::HandleMenuAction(
|
||||
@@ -251,61 +220,36 @@ CefHandler::RetVal CefHandlerCToCpp::HandlePrintOptions(
|
||||
|
||||
CefHandler::RetVal CefHandlerCToCpp::HandlePrintHeaderFooter(
|
||||
CefRefPtr<CefBrowser> browser, CefRefPtr<CefFrame> frame,
|
||||
CefPrintInfo& printInfo, const std::wstring& url,
|
||||
const std::wstring& title, int currentPage, int maxPages,
|
||||
std::wstring& topLeft, std::wstring& topCenter, std::wstring& topRight,
|
||||
std::wstring& bottomLeft, std::wstring& bottomCenter,
|
||||
std::wstring& bottomRight)
|
||||
CefPrintInfo& printInfo, const CefString& url, const CefString& title,
|
||||
int currentPage, int maxPages, CefString& topLeft, CefString& topCenter,
|
||||
CefString& topRight, CefString& bottomLeft, CefString& bottomCenter,
|
||||
CefString& bottomRight)
|
||||
{
|
||||
if(CEF_MEMBER_MISSING(struct_, handle_print_header_footer))
|
||||
return RV_CONTINUE;
|
||||
|
||||
cef_string_t topLeftRet = NULL, topCenterRet = NULL, topRightRet = NULL,
|
||||
bottomLeftRet = NULL, bottomCenterRet = NULL, bottomRightRet = NULL;
|
||||
|
||||
if(!topLeft.empty())
|
||||
topLeftRet = cef_string_alloc(topLeft.c_str());
|
||||
if(!topCenter.empty())
|
||||
topCenterRet = cef_string_alloc(topCenter.c_str());
|
||||
if(!topRight.empty())
|
||||
topRightRet = cef_string_alloc(topRight.c_str());
|
||||
if(!bottomLeft.empty())
|
||||
bottomLeftRet = cef_string_alloc(bottomLeft.c_str());
|
||||
if(!bottomCenter.empty())
|
||||
bottomCenterRet = cef_string_alloc(bottomCenter.c_str());
|
||||
if(!bottomRight.empty())
|
||||
bottomRightRet = cef_string_alloc(bottomRight.c_str());
|
||||
|
||||
cef_retval_t rv = struct_->handle_print_header_footer(struct_,
|
||||
return struct_->handle_print_header_footer(struct_,
|
||||
CefBrowserCppToC::Wrap(browser), CefFrameCppToC::Wrap(frame),
|
||||
&printInfo, url.c_str(), title.c_str(), currentPage, maxPages,
|
||||
&topLeftRet, &topCenterRet, &topRightRet, &bottomLeftRet,
|
||||
&bottomCenterRet, &bottomRightRet);
|
||||
|
||||
transfer_string_contents(topLeftRet, topLeft, true);
|
||||
transfer_string_contents(topCenterRet, topCenter, true);
|
||||
transfer_string_contents(topRightRet, topRight, true);
|
||||
transfer_string_contents(bottomLeftRet, bottomLeft, true);
|
||||
transfer_string_contents(bottomCenterRet, bottomCenter, true);
|
||||
transfer_string_contents(bottomRightRet, bottomRight, true);
|
||||
|
||||
return rv;
|
||||
&printInfo, url.GetStruct(), title.GetStruct(), currentPage, maxPages,
|
||||
topLeft.GetWritableStruct(), topCenter.GetWritableStruct(),
|
||||
topRight.GetWritableStruct(), bottomLeft.GetWritableStruct(),
|
||||
bottomCenter.GetWritableStruct(), bottomRight.GetWritableStruct());
|
||||
}
|
||||
|
||||
CefHandler::RetVal CefHandlerCToCpp::HandleJSAlert(
|
||||
CefRefPtr<CefBrowser> browser, CefRefPtr<CefFrame> frame,
|
||||
const std::wstring& message)
|
||||
const CefString& message)
|
||||
{
|
||||
if(CEF_MEMBER_MISSING(struct_, handle_jsalert))
|
||||
return RV_CONTINUE;
|
||||
|
||||
return struct_->handle_jsalert(struct_, CefBrowserCppToC::Wrap(browser),
|
||||
CefFrameCppToC::Wrap(frame), message.c_str());
|
||||
CefFrameCppToC::Wrap(frame), message.GetStruct());
|
||||
}
|
||||
|
||||
CefHandler::RetVal CefHandlerCToCpp::HandleJSConfirm(
|
||||
CefRefPtr<CefBrowser> browser, CefRefPtr<CefFrame> frame,
|
||||
const std::wstring& message, bool& retval)
|
||||
const CefString& message, bool& retval)
|
||||
{
|
||||
if(CEF_MEMBER_MISSING(struct_, handle_jsconfirm))
|
||||
return RV_CONTINUE;
|
||||
@@ -313,31 +257,25 @@ CefHandler::RetVal CefHandlerCToCpp::HandleJSConfirm(
|
||||
int ret = 0;
|
||||
cef_retval_t rv = struct_->handle_jsconfirm(struct_,
|
||||
CefBrowserCppToC::Wrap(browser), CefFrameCppToC::Wrap(frame),
|
||||
message.c_str(), &ret);
|
||||
message.GetStruct(), &ret);
|
||||
retval = (ret ? true : false);
|
||||
return rv;
|
||||
}
|
||||
|
||||
CefHandler::RetVal CefHandlerCToCpp::HandleJSPrompt(
|
||||
CefRefPtr<CefBrowser> browser, CefRefPtr<CefFrame> frame,
|
||||
const std::wstring& message, const std::wstring& defaultValue,
|
||||
bool& retval, std::wstring& result)
|
||||
const CefString& message, const CefString& defaultValue, bool& retval,
|
||||
CefString& result)
|
||||
{
|
||||
if(CEF_MEMBER_MISSING(struct_, handle_jsprompt))
|
||||
return RV_CONTINUE;
|
||||
|
||||
cef_string_t resultRet = NULL;
|
||||
if(!result.empty())
|
||||
resultRet = cef_string_alloc(result.c_str());
|
||||
|
||||
int ret = 0;
|
||||
cef_retval_t rv = struct_->handle_jsprompt(struct_,
|
||||
CefBrowserCppToC::Wrap(browser), CefFrameCppToC::Wrap(frame),
|
||||
message.c_str(), defaultValue.c_str(), &ret, &resultRet);
|
||||
message.GetStruct(), defaultValue.GetStruct(), &ret,
|
||||
result.GetWritableStruct());
|
||||
retval = (ret ? true : false);
|
||||
|
||||
transfer_string_contents(resultRet, result, true);
|
||||
|
||||
return rv;
|
||||
}
|
||||
|
||||
@@ -394,31 +332,25 @@ CefHandler::RetVal CefHandlerCToCpp::HandleKeyEvent(
|
||||
}
|
||||
|
||||
CefHandler::RetVal CefHandlerCToCpp::HandleTooltip(
|
||||
CefRefPtr<CefBrowser> browser, std::wstring& text)
|
||||
CefRefPtr<CefBrowser> browser, CefString& text)
|
||||
{
|
||||
if(CEF_MEMBER_MISSING(struct_, handle_tooltip))
|
||||
return RV_CONTINUE;
|
||||
cef_string_t textRet = NULL;
|
||||
if(!text.empty())
|
||||
textRet = cef_string_alloc(text.c_str());
|
||||
|
||||
cef_retval_t rv = struct_->handle_tooltip(struct_,
|
||||
CefBrowserCppToC::Wrap(browser), &textRet);
|
||||
|
||||
transfer_string_contents(textRet, text, true);
|
||||
|
||||
return rv;
|
||||
|
||||
return struct_->handle_tooltip(struct_,
|
||||
CefBrowserCppToC::Wrap(browser), text.GetWritableStruct());
|
||||
}
|
||||
|
||||
CefHandler::RetVal CefHandlerCToCpp::HandleConsoleMessage(
|
||||
CefRefPtr<CefBrowser> browser, const std::wstring& message,
|
||||
const std::wstring& source, int line)
|
||||
CefRefPtr<CefBrowser> browser, const CefString& message,
|
||||
const CefString& source, int line)
|
||||
{
|
||||
if(CEF_MEMBER_MISSING(struct_, handle_console_message))
|
||||
return RV_CONTINUE;
|
||||
|
||||
return struct_->handle_console_message(struct_,
|
||||
CefBrowserCppToC::Wrap(browser), message.c_str(), source.c_str(), line);
|
||||
CefBrowserCppToC::Wrap(browser), message.GetStruct(), source.GetStruct(),
|
||||
line);
|
||||
}
|
||||
|
||||
CefHandler::RetVal CefHandlerCToCpp::HandleFindResult(
|
||||
|
@@ -34,12 +34,12 @@ public:
|
||||
virtual RetVal HandleBeforeCreated(CefRefPtr<CefBrowser> parentBrowser,
|
||||
CefWindowInfo& windowInfo, bool popup,
|
||||
const CefPopupFeatures& popupFeatures, CefRefPtr<CefHandler>& handler,
|
||||
std::wstring& url, CefBrowserSettings& settings);
|
||||
CefString& url, CefBrowserSettings& settings);
|
||||
virtual RetVal HandleAfterCreated(CefRefPtr<CefBrowser> browser);
|
||||
virtual RetVal HandleAddressChange(CefRefPtr<CefBrowser> browser,
|
||||
CefRefPtr<CefFrame> frame, const std::wstring& url);
|
||||
CefRefPtr<CefFrame> frame, const CefString& url);
|
||||
virtual RetVal HandleTitleChange(CefRefPtr<CefBrowser> browser,
|
||||
const std::wstring& title);
|
||||
const CefString& title);
|
||||
virtual RetVal HandleBeforeBrowse(CefRefPtr<CefBrowser> browser,
|
||||
CefRefPtr<CefFrame> frame, CefRefPtr<CefRequest> request,
|
||||
NavType navType, bool isRedirect);
|
||||
@@ -49,34 +49,33 @@ public:
|
||||
CefRefPtr<CefFrame> frame);
|
||||
virtual RetVal HandleLoadError(CefRefPtr<CefBrowser> browser,
|
||||
CefRefPtr<CefFrame> frame, ErrorCode errorCode,
|
||||
const std::wstring& failedUrl, std::wstring& errorText);
|
||||
const CefString& failedUrl, CefString& errorText);
|
||||
virtual RetVal HandleBeforeResourceLoad(CefRefPtr<CefBrowser> browser,
|
||||
CefRefPtr<CefRequest> request, std::wstring& redirectUrl,
|
||||
CefRefPtr<CefStreamReader>& resourceStream, std::wstring& mimeType,
|
||||
CefRefPtr<CefRequest> request, CefString& redirectUrl,
|
||||
CefRefPtr<CefStreamReader>& resourceStream, CefString& mimeType,
|
||||
int loadFlags);
|
||||
virtual RetVal HandleDownloadResponse(CefRefPtr<CefBrowser> browser,
|
||||
const std::wstring& mimeType, const std::wstring& fileName,
|
||||
const CefString& mimeType, const CefString& fileName,
|
||||
int64 contentLength, CefRefPtr<CefDownloadHandler>& handler);
|
||||
virtual RetVal HandleBeforeMenu(CefRefPtr<CefBrowser> browser,
|
||||
const MenuInfo& menuInfo);
|
||||
virtual RetVal HandleGetMenuLabel(CefRefPtr<CefBrowser> browser,
|
||||
MenuId menuId, std::wstring& label);
|
||||
MenuId menuId, CefString& label);
|
||||
virtual RetVal HandleMenuAction(CefRefPtr<CefBrowser> browser, MenuId menuId);
|
||||
virtual RetVal HandlePrintOptions(CefRefPtr<CefBrowser> browser,
|
||||
CefPrintOptions& printOptions);
|
||||
virtual RetVal HandlePrintHeaderFooter(CefRefPtr<CefBrowser> browser,
|
||||
CefRefPtr<CefFrame> frame, CefPrintInfo& printInfo,
|
||||
const std::wstring& url, const std::wstring& title, int currentPage,
|
||||
int maxPages, std::wstring& topLeft, std::wstring& topCenter,
|
||||
std::wstring& topRight, std::wstring& bottomLeft,
|
||||
std::wstring& bottomCenter, std::wstring& bottomRight);
|
||||
CefRefPtr<CefFrame> frame, CefPrintInfo& printInfo, const CefString& url,
|
||||
const CefString& title, int currentPage, int maxPages,
|
||||
CefString& topLeft, CefString& topCenter, CefString& topRight,
|
||||
CefString& bottomLeft, CefString& bottomCenter, CefString& bottomRight);
|
||||
virtual RetVal HandleJSAlert(CefRefPtr<CefBrowser> browser,
|
||||
CefRefPtr<CefFrame> frame, const std::wstring& message);
|
||||
CefRefPtr<CefFrame> frame, const CefString& message);
|
||||
virtual RetVal HandleJSConfirm(CefRefPtr<CefBrowser> browser,
|
||||
CefRefPtr<CefFrame> frame, const std::wstring& message, bool& retval);
|
||||
CefRefPtr<CefFrame> frame, const CefString& message, bool& retval);
|
||||
virtual RetVal HandleJSPrompt(CefRefPtr<CefBrowser> browser,
|
||||
CefRefPtr<CefFrame> frame, const std::wstring& message,
|
||||
const std::wstring& defaultValue, bool& retval, std::wstring& result);
|
||||
CefRefPtr<CefFrame> frame, const CefString& message,
|
||||
const CefString& defaultValue, bool& retval, CefString& result);
|
||||
virtual RetVal HandleJSBinding(CefRefPtr<CefBrowser> browser,
|
||||
CefRefPtr<CefFrame> frame, CefRefPtr<CefV8Value> object);
|
||||
virtual RetVal HandleBeforeWindowClose(CefRefPtr<CefBrowser> browser);
|
||||
@@ -84,10 +83,9 @@ public:
|
||||
virtual RetVal HandleSetFocus(CefRefPtr<CefBrowser> browser, bool isWidget);
|
||||
virtual RetVal HandleKeyEvent(CefRefPtr<CefBrowser> browser,
|
||||
KeyEventType type, int code, int modifiers, bool isSystemKey);
|
||||
virtual RetVal HandleTooltip(CefRefPtr<CefBrowser> browser,
|
||||
std::wstring& text);
|
||||
virtual RetVal HandleTooltip(CefRefPtr<CefBrowser> browser, CefString& text);
|
||||
virtual RetVal HandleConsoleMessage(CefRefPtr<CefBrowser> browser,
|
||||
const std::wstring& message, const std::wstring& source, int line);
|
||||
const CefString& message, const CefString& source, int line);
|
||||
virtual RetVal HandleFindResult(CefRefPtr<CefBrowser> browser, int identifier,
|
||||
int count, const CefRect& selectionRect, int activeMatchOrdinal,
|
||||
bool finalUpdate);
|
||||
|
@@ -34,12 +34,12 @@ void CefPostDataElementCToCpp::SetToEmpty()
|
||||
return struct_->set_to_empty(struct_);
|
||||
}
|
||||
|
||||
void CefPostDataElementCToCpp::SetToFile(const std::wstring& fileName)
|
||||
void CefPostDataElementCToCpp::SetToFile(const CefString& fileName)
|
||||
{
|
||||
if(CEF_MEMBER_MISSING(struct_, set_to_file))
|
||||
return;
|
||||
|
||||
return struct_->set_to_file(struct_, fileName.c_str());
|
||||
return struct_->set_to_file(struct_, fileName.GetStruct());
|
||||
}
|
||||
|
||||
void CefPostDataElementCToCpp::SetToBytes(size_t size, const void* bytes)
|
||||
@@ -58,18 +58,14 @@ CefPostDataElement::Type CefPostDataElementCToCpp::GetType()
|
||||
return struct_->get_type(struct_);
|
||||
}
|
||||
|
||||
std::wstring CefPostDataElementCToCpp::GetFile()
|
||||
CefString CefPostDataElementCToCpp::GetFile()
|
||||
{
|
||||
std::wstring str;
|
||||
CefString str;
|
||||
if(CEF_MEMBER_MISSING(struct_, get_file))
|
||||
return str;
|
||||
|
||||
cef_string_t cef_str = struct_->get_file(struct_);
|
||||
if(cef_str) {
|
||||
str = cef_str;
|
||||
cef_string_free(cef_str);
|
||||
}
|
||||
|
||||
cef_string_userfree_t strPtr = struct_->get_file(struct_);
|
||||
str.AttachToUserFree(strPtr);
|
||||
return str;
|
||||
}
|
||||
|
||||
|
@@ -34,10 +34,10 @@ public:
|
||||
|
||||
// CefPostDataElement methods
|
||||
virtual void SetToEmpty();
|
||||
virtual void SetToFile(const std::wstring& fileName);
|
||||
virtual void SetToFile(const CefString& fileName);
|
||||
virtual void SetToBytes(size_t size, const void* bytes);
|
||||
virtual Type GetType();
|
||||
virtual std::wstring GetFile();
|
||||
virtual CefString GetFile();
|
||||
virtual size_t GetBytesCount();
|
||||
virtual size_t GetBytes(size_t size, void* bytes);
|
||||
};
|
||||
|
@@ -28,48 +28,42 @@ CefRefPtr<CefRequest> CefRequest::CreateRequest()
|
||||
|
||||
// VIRTUAL METHODS - Body may be edited by hand.
|
||||
|
||||
std::wstring CefRequestCToCpp::GetURL()
|
||||
CefString CefRequestCToCpp::GetURL()
|
||||
{
|
||||
std::wstring str;
|
||||
CefString str;
|
||||
if(CEF_MEMBER_MISSING(struct_, get_url))
|
||||
return str;
|
||||
|
||||
cef_string_t cef_str = struct_->get_url(struct_);
|
||||
if(cef_str) {
|
||||
str = cef_str;
|
||||
cef_string_free(cef_str);
|
||||
}
|
||||
cef_string_userfree_t strPtr = struct_->get_url(struct_);
|
||||
str.AttachToUserFree(strPtr);
|
||||
return str;
|
||||
}
|
||||
|
||||
void CefRequestCToCpp::SetURL(const std::wstring& url)
|
||||
void CefRequestCToCpp::SetURL(const CefString& url)
|
||||
{
|
||||
if(CEF_MEMBER_MISSING(struct_, set_url))
|
||||
return;
|
||||
|
||||
struct_->set_url(struct_, url.c_str());
|
||||
struct_->set_url(struct_, url.GetStruct());
|
||||
}
|
||||
|
||||
std::wstring CefRequestCToCpp::GetMethod()
|
||||
CefString CefRequestCToCpp::GetMethod()
|
||||
{
|
||||
std::wstring str;
|
||||
CefString str;
|
||||
if(CEF_MEMBER_MISSING(struct_, get_method))
|
||||
return str;
|
||||
|
||||
cef_string_t cef_str = struct_->get_method(struct_);
|
||||
if(cef_str) {
|
||||
str = cef_str;
|
||||
cef_string_free(cef_str);
|
||||
}
|
||||
cef_string_userfree_t strPtr = struct_->get_method(struct_);
|
||||
str.AttachToUserFree(strPtr);
|
||||
return str;
|
||||
}
|
||||
|
||||
void CefRequestCToCpp::SetMethod(const std::wstring& method)
|
||||
void CefRequestCToCpp::SetMethod(const CefString& method)
|
||||
{
|
||||
if(CEF_MEMBER_MISSING(struct_, set_method))
|
||||
return;
|
||||
|
||||
struct_->set_method(struct_, method.c_str());
|
||||
struct_->set_method(struct_, method.GetStruct());
|
||||
}
|
||||
|
||||
CefRefPtr<CefPostData> CefRequestCToCpp::GetPostData()
|
||||
@@ -128,7 +122,7 @@ void CefRequestCToCpp::SetHeaderMap(const HeaderMap& headerMap)
|
||||
cef_string_map_free(map);
|
||||
}
|
||||
|
||||
void CefRequestCToCpp::Set(const std::wstring& url, const std::wstring& method,
|
||||
void CefRequestCToCpp::Set(const CefString& url, const CefString& method,
|
||||
CefRefPtr<CefPostData> postData, const HeaderMap& headerMap)
|
||||
{
|
||||
if(CEF_MEMBER_MISSING(struct_, set))
|
||||
@@ -146,7 +140,8 @@ void CefRequestCToCpp::Set(const std::wstring& url, const std::wstring& method,
|
||||
transfer_string_map_contents(headerMap, map);
|
||||
}
|
||||
|
||||
struct_->set(struct_, url.c_str(), method.c_str(), postDataStruct, map);
|
||||
struct_->set(struct_, url.GetStruct(), method.GetStruct(), postDataStruct,
|
||||
map);
|
||||
|
||||
if(map)
|
||||
cef_string_map_free(map);
|
||||
|
@@ -31,15 +31,15 @@ public:
|
||||
virtual ~CefRequestCToCpp() {}
|
||||
|
||||
// CefRequest methods
|
||||
virtual std::wstring GetURL();
|
||||
virtual void SetURL(const std::wstring& url);
|
||||
virtual std::wstring GetMethod();
|
||||
virtual void SetMethod(const std::wstring& method);
|
||||
virtual CefString GetURL();
|
||||
virtual void SetURL(const CefString& url);
|
||||
virtual CefString GetMethod();
|
||||
virtual void SetMethod(const CefString& method);
|
||||
virtual CefRefPtr<CefPostData> GetPostData();
|
||||
virtual void SetPostData(CefRefPtr<CefPostData> postData);
|
||||
virtual void GetHeaderMap(HeaderMap& headerMap);
|
||||
virtual void SetHeaderMap(const HeaderMap& headerMap);
|
||||
virtual void Set(const std::wstring& url, const std::wstring& method,
|
||||
virtual void Set(const CefString& url, const CefString& method,
|
||||
CefRefPtr<CefPostData> postData, const HeaderMap& headerMap);
|
||||
};
|
||||
|
||||
|
@@ -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;
|
||||
}
|
||||
|
||||
|
||||
|
@@ -34,7 +34,7 @@ public:
|
||||
|
||||
// CefSchemeHandler methods
|
||||
virtual bool ProcessRequest(CefRefPtr<CefRequest> request,
|
||||
std::wstring& mime_type, int* response_length);
|
||||
CefString& mime_type, int* response_length);
|
||||
virtual void Cancel();
|
||||
virtual bool ReadResponse(void* data_out, int bytes_to_read, int* bytes_read);
|
||||
};
|
||||
|
@@ -17,10 +17,10 @@
|
||||
// STATIC METHODS - Body may be edited by hand.
|
||||
|
||||
CefRefPtr<CefStreamReader> CefStreamReader::CreateForFile(
|
||||
const std::wstring& fileName)
|
||||
const CefString& fileName)
|
||||
{
|
||||
cef_stream_reader_t* impl =
|
||||
cef_stream_reader_create_for_file(fileName.c_str());
|
||||
cef_stream_reader_create_for_file(fileName.GetStruct());
|
||||
if(impl)
|
||||
return CefStreamReaderCToCpp::Wrap(impl);
|
||||
return NULL;
|
||||
|
@@ -17,14 +17,14 @@
|
||||
// STATIC METHODS - Body may be edited by hand.
|
||||
|
||||
CefRefPtr<CefStreamWriter> CefStreamWriter::CreateForFile(
|
||||
const std::wstring& fileName)
|
||||
const CefString& fileName)
|
||||
{
|
||||
DCHECK(!fileName.empty());
|
||||
if(fileName.empty())
|
||||
return NULL;
|
||||
|
||||
cef_stream_writer_t* impl =
|
||||
cef_stream_writer_create_for_file(fileName.c_str());
|
||||
cef_stream_writer_create_for_file(fileName.GetStruct());
|
||||
if(impl)
|
||||
return CefStreamWriterCToCpp::Wrap(impl);
|
||||
return NULL;
|
||||
|
@@ -16,9 +16,9 @@
|
||||
|
||||
// VIRTUAL METHODS - Body may be edited by hand.
|
||||
|
||||
bool CefV8HandlerCToCpp::Execute(const std::wstring& name,
|
||||
bool CefV8HandlerCToCpp::Execute(const CefString& name,
|
||||
CefRefPtr<CefV8Value> object, const CefV8ValueList& arguments,
|
||||
CefRefPtr<CefV8Value>& retval, std::wstring& exception)
|
||||
CefRefPtr<CefV8Value>& retval, CefString& exception)
|
||||
{
|
||||
if(CEF_MEMBER_MISSING(struct_, execute))
|
||||
return RV_CONTINUE;
|
||||
@@ -32,17 +32,12 @@ bool CefV8HandlerCToCpp::Execute(const std::wstring& name,
|
||||
}
|
||||
|
||||
cef_v8value_t* retvalStruct = NULL;
|
||||
cef_string_t exceptionStr = NULL;
|
||||
|
||||
int rv = struct_->execute(struct_, name.c_str(),
|
||||
int rv = struct_->execute(struct_, name.GetStruct(),
|
||||
CefV8ValueCppToC::Wrap(object), argsSize, argsStructPtr, &retvalStruct,
|
||||
&exceptionStr);
|
||||
exception.GetWritableStruct());
|
||||
if(retvalStruct)
|
||||
retval = CefV8ValueCppToC::Unwrap(retvalStruct);
|
||||
if(exceptionStr) {
|
||||
exception = exceptionStr;
|
||||
cef_string_free(exceptionStr);
|
||||
}
|
||||
|
||||
if(argsStructPtr)
|
||||
delete [] argsStructPtr;
|
||||
|
@@ -31,9 +31,9 @@ public:
|
||||
virtual ~CefV8HandlerCToCpp() {}
|
||||
|
||||
// CefV8Handler methods
|
||||
virtual bool Execute(const std::wstring& name, CefRefPtr<CefV8Value> object,
|
||||
virtual bool Execute(const CefString& name, CefRefPtr<CefV8Value> object,
|
||||
const CefV8ValueList& arguments, CefRefPtr<CefV8Value>& retval,
|
||||
std::wstring& exception);
|
||||
CefString& exception);
|
||||
};
|
||||
|
||||
#endif // BUILDING_CEF_SHARED
|
||||
|
@@ -13,6 +13,7 @@
|
||||
#include "libcef_dll/cpptoc/base_cpptoc.h"
|
||||
#include "libcef_dll/cpptoc/v8handler_cpptoc.h"
|
||||
#include "libcef_dll/ctocpp/v8value_ctocpp.h"
|
||||
#include "libcef_dll/transfer_util.h"
|
||||
|
||||
|
||||
// STATIC METHODS - Body may be edited by hand.
|
||||
@@ -57,9 +58,9 @@ CefRefPtr<CefV8Value> CefV8Value::CreateDouble(double value)
|
||||
return NULL;
|
||||
}
|
||||
|
||||
CefRefPtr<CefV8Value> CefV8Value::CreateString(const std::wstring& value)
|
||||
CefRefPtr<CefV8Value> CefV8Value::CreateString(const CefString& value)
|
||||
{
|
||||
cef_v8value_t* impl = cef_v8value_create_string(value.c_str());
|
||||
cef_v8value_t* impl = cef_v8value_create_string(value.GetStruct());
|
||||
if(impl)
|
||||
return CefV8ValueCToCpp::Wrap(impl);
|
||||
return NULL;
|
||||
@@ -85,14 +86,14 @@ CefRefPtr<CefV8Value> CefV8Value::CreateArray()
|
||||
return NULL;
|
||||
}
|
||||
|
||||
CefRefPtr<CefV8Value> CefV8Value::CreateFunction(const std::wstring& name,
|
||||
CefRefPtr<CefV8Value> CefV8Value::CreateFunction(const CefString& name,
|
||||
CefRefPtr<CefV8Handler> handler)
|
||||
{
|
||||
cef_v8handler_t* handlerStruct = NULL;
|
||||
if(handler.get())
|
||||
handlerStruct = CefV8HandlerCppToC::Wrap(handler);
|
||||
|
||||
cef_v8value_t* impl = cef_v8value_create_function(name.c_str(),
|
||||
cef_v8value_t* impl = cef_v8value_create_function(name.GetStruct(),
|
||||
handlerStruct);
|
||||
if(impl)
|
||||
return CefV8ValueCToCpp::Wrap(impl);
|
||||
@@ -198,26 +199,23 @@ double CefV8ValueCToCpp::GetDoubleValue()
|
||||
return struct_->get_double_value(struct_);
|
||||
}
|
||||
|
||||
std::wstring CefV8ValueCToCpp::GetStringValue()
|
||||
CefString CefV8ValueCToCpp::GetStringValue()
|
||||
{
|
||||
std::wstring str;
|
||||
CefString str;
|
||||
if(CEF_MEMBER_MISSING(struct_, get_string_value))
|
||||
return str;
|
||||
|
||||
cef_string_t cef_str = struct_->get_string_value(struct_);
|
||||
if(cef_str) {
|
||||
str = cef_str;
|
||||
cef_string_free(cef_str);
|
||||
}
|
||||
cef_string_userfree_t strPtr = struct_->get_string_value(struct_);
|
||||
str.AttachToUserFree(strPtr);
|
||||
return str;
|
||||
}
|
||||
|
||||
bool CefV8ValueCToCpp::HasValue(const std::wstring& key)
|
||||
bool CefV8ValueCToCpp::HasValue(const CefString& key)
|
||||
{
|
||||
if(CEF_MEMBER_MISSING(struct_, has_value_bykey))
|
||||
return false;
|
||||
|
||||
return struct_->has_value_bykey(struct_, key.c_str())?true:false;
|
||||
return struct_->has_value_bykey(struct_, key.GetStruct())?true:false;
|
||||
}
|
||||
|
||||
bool CefV8ValueCToCpp::HasValue(int index)
|
||||
@@ -228,12 +226,12 @@ bool CefV8ValueCToCpp::HasValue(int index)
|
||||
return struct_->has_value_byindex(struct_, index)?true:false;
|
||||
}
|
||||
|
||||
bool CefV8ValueCToCpp::DeleteValue(const std::wstring& key)
|
||||
bool CefV8ValueCToCpp::DeleteValue(const CefString& key)
|
||||
{
|
||||
if(CEF_MEMBER_MISSING(struct_, delete_value_bykey))
|
||||
return false;
|
||||
|
||||
return struct_->delete_value_bykey(struct_, key.c_str())?true:false;
|
||||
return struct_->delete_value_bykey(struct_, key.GetStruct())?true:false;
|
||||
}
|
||||
|
||||
bool CefV8ValueCToCpp::DeleteValue(int index)
|
||||
@@ -244,12 +242,13 @@ bool CefV8ValueCToCpp::DeleteValue(int index)
|
||||
return struct_->delete_value_byindex(struct_, index)?true:false;
|
||||
}
|
||||
|
||||
CefRefPtr<CefV8Value> CefV8ValueCToCpp::GetValue(const std::wstring& key)
|
||||
CefRefPtr<CefV8Value> CefV8ValueCToCpp::GetValue(const CefString& key)
|
||||
{
|
||||
if(CEF_MEMBER_MISSING(struct_, get_value_bykey))
|
||||
return false;
|
||||
|
||||
cef_v8value_t* valueStruct = struct_->get_value_bykey(struct_, key.c_str());
|
||||
cef_v8value_t* valueStruct = struct_->get_value_bykey(struct_,
|
||||
key.GetStruct());
|
||||
if(valueStruct)
|
||||
return CefV8ValueCToCpp::Wrap(valueStruct);
|
||||
return NULL;
|
||||
@@ -266,13 +265,13 @@ CefRefPtr<CefV8Value> CefV8ValueCToCpp::GetValue(int index)
|
||||
return NULL;
|
||||
}
|
||||
|
||||
bool CefV8ValueCToCpp::SetValue(const std::wstring& key,
|
||||
bool CefV8ValueCToCpp::SetValue(const CefString& key,
|
||||
CefRefPtr<CefV8Value> value)
|
||||
{
|
||||
if(CEF_MEMBER_MISSING(struct_, set_value_bykey))
|
||||
return false;
|
||||
|
||||
return struct_->set_value_bykey(struct_, key.c_str(),
|
||||
return struct_->set_value_bykey(struct_, key.GetStruct(),
|
||||
CefV8ValueCToCpp::Unwrap(value))?true:false;
|
||||
}
|
||||
|
||||
@@ -285,20 +284,14 @@ bool CefV8ValueCToCpp::SetValue(int index, CefRefPtr<CefV8Value> value)
|
||||
CefV8ValueCToCpp::Unwrap(value))?true:false;
|
||||
}
|
||||
|
||||
bool CefV8ValueCToCpp::GetKeys(std::vector<std::wstring>& keys)
|
||||
bool CefV8ValueCToCpp::GetKeys(std::vector<CefString>& keys)
|
||||
{
|
||||
if(CEF_MEMBER_MISSING(struct_, get_keys))
|
||||
return false;
|
||||
|
||||
cef_string_list_t list = cef_string_list_alloc();
|
||||
if(struct_->get_keys(struct_, list)) {
|
||||
cef_string_t str;
|
||||
int size = cef_string_list_size(list);
|
||||
for(int i = 0; i < size; ++i) {
|
||||
str = cef_string_list_value(list, i);
|
||||
keys.push_back(str);
|
||||
cef_string_free(str);
|
||||
}
|
||||
transfer_string_list_contents(list, keys);
|
||||
cef_string_list_free(list);
|
||||
return true;
|
||||
}
|
||||
@@ -324,17 +317,14 @@ int CefV8ValueCToCpp::GetArrayLength()
|
||||
return struct_->get_array_length(struct_);
|
||||
}
|
||||
|
||||
std::wstring CefV8ValueCToCpp::GetFunctionName()
|
||||
CefString CefV8ValueCToCpp::GetFunctionName()
|
||||
{
|
||||
std::wstring str;
|
||||
CefString str;
|
||||
if(CEF_MEMBER_MISSING(struct_, get_function_name))
|
||||
return str;
|
||||
|
||||
cef_string_t cef_str = struct_->get_function_name(struct_);
|
||||
if(cef_str) {
|
||||
str = cef_str;
|
||||
cef_string_free(cef_str);
|
||||
}
|
||||
cef_string_userfree_t strPtr = struct_->get_function_name(struct_);
|
||||
str.AttachToUserFree(strPtr);
|
||||
return str;
|
||||
}
|
||||
|
||||
@@ -351,7 +341,7 @@ CefRefPtr<CefV8Handler> CefV8ValueCToCpp::GetFunctionHandler()
|
||||
|
||||
bool CefV8ValueCToCpp::ExecuteFunction(CefRefPtr<CefV8Value> object,
|
||||
const CefV8ValueList& arguments, CefRefPtr<CefV8Value>& retval,
|
||||
std::wstring& exception)
|
||||
CefString& exception)
|
||||
{
|
||||
if(CEF_MEMBER_MISSING(struct_, execute_function))
|
||||
return RV_CONTINUE;
|
||||
@@ -365,16 +355,11 @@ bool CefV8ValueCToCpp::ExecuteFunction(CefRefPtr<CefV8Value> object,
|
||||
}
|
||||
|
||||
cef_v8value_t* retvalStruct = NULL;
|
||||
cef_string_t exceptionStr = NULL;
|
||||
|
||||
int rv = struct_->execute_function(struct_, CefV8ValueCToCpp::Unwrap(object),
|
||||
argsSize, argsStructPtr, &retvalStruct, &exceptionStr);
|
||||
argsSize, argsStructPtr, &retvalStruct, exception.GetWritableStruct());
|
||||
if(retvalStruct)
|
||||
retval = CefV8ValueCToCpp::Wrap(retvalStruct);
|
||||
if(exceptionStr) {
|
||||
exception = exceptionStr;
|
||||
cef_string_free(exceptionStr);
|
||||
}
|
||||
|
||||
if(argsStructPtr)
|
||||
delete [] argsStructPtr;
|
||||
|
@@ -43,23 +43,23 @@ public:
|
||||
virtual bool GetBoolValue();
|
||||
virtual int GetIntValue();
|
||||
virtual double GetDoubleValue();
|
||||
virtual std::wstring GetStringValue();
|
||||
virtual bool HasValue(const std::wstring& key);
|
||||
virtual CefString GetStringValue();
|
||||
virtual bool HasValue(const CefString& key);
|
||||
virtual bool HasValue(int index);
|
||||
virtual bool DeleteValue(const std::wstring& key);
|
||||
virtual bool DeleteValue(const CefString& key);
|
||||
virtual bool DeleteValue(int index);
|
||||
virtual CefRefPtr<CefV8Value> GetValue(const std::wstring& key);
|
||||
virtual CefRefPtr<CefV8Value> GetValue(const CefString& key);
|
||||
virtual CefRefPtr<CefV8Value> GetValue(int index);
|
||||
virtual bool SetValue(const std::wstring& key, CefRefPtr<CefV8Value> value);
|
||||
virtual bool SetValue(const CefString& key, CefRefPtr<CefV8Value> value);
|
||||
virtual bool SetValue(int index, CefRefPtr<CefV8Value> value);
|
||||
virtual bool GetKeys(std::vector<std::wstring>& keys);
|
||||
virtual bool GetKeys(std::vector<CefString>& keys);
|
||||
virtual CefRefPtr<CefBase> GetUserData();
|
||||
virtual int GetArrayLength();
|
||||
virtual std::wstring GetFunctionName();
|
||||
virtual CefString GetFunctionName();
|
||||
virtual CefRefPtr<CefV8Handler> GetFunctionHandler();
|
||||
virtual bool ExecuteFunction(CefRefPtr<CefV8Value> object,
|
||||
const CefV8ValueList& arguments, CefRefPtr<CefV8Value>& retval,
|
||||
std::wstring& exception);
|
||||
CefString& exception);
|
||||
};
|
||||
|
||||
#endif // USING_CEF_SHARED
|
||||
|
@@ -17,10 +17,10 @@
|
||||
// STATIC METHODS - Body may be edited by hand.
|
||||
|
||||
CefRefPtr<CefXmlReader> CefXmlReader::Create(CefRefPtr<CefStreamReader> stream,
|
||||
EncodingType encodingType, const std::wstring& URI)
|
||||
EncodingType encodingType, const CefString& URI)
|
||||
{
|
||||
cef_xml_reader_t* impl = cef_xml_reader_create(
|
||||
CefStreamReaderCToCpp::Unwrap(stream), encodingType, URI.c_str());
|
||||
CefStreamReaderCToCpp::Unwrap(stream), encodingType, URI.GetStruct());
|
||||
if(impl)
|
||||
return CefXmlReaderCToCpp::Wrap(impl);
|
||||
return NULL;
|
||||
@@ -53,18 +53,14 @@ bool CefXmlReaderCToCpp::HasError()
|
||||
return struct_->has_error(struct_) ? true : false;
|
||||
}
|
||||
|
||||
std::wstring CefXmlReaderCToCpp::GetError()
|
||||
CefString CefXmlReaderCToCpp::GetError()
|
||||
{
|
||||
std::wstring str;
|
||||
CefString str;
|
||||
if(CEF_MEMBER_MISSING(struct_, get_error))
|
||||
return str;
|
||||
|
||||
cef_string_t cef_str = struct_->get_error(struct_);
|
||||
if(cef_str) {
|
||||
str = cef_str;
|
||||
cef_string_free(cef_str);
|
||||
}
|
||||
|
||||
cef_string_userfree_t strPtr = struct_->get_error(struct_);
|
||||
str.AttachToUserFree(strPtr);
|
||||
return str;
|
||||
}
|
||||
|
||||
@@ -84,93 +80,69 @@ int CefXmlReaderCToCpp::GetDepth()
|
||||
return struct_->get_depth(struct_);
|
||||
}
|
||||
|
||||
std::wstring CefXmlReaderCToCpp::GetLocalName()
|
||||
CefString CefXmlReaderCToCpp::GetLocalName()
|
||||
{
|
||||
std::wstring str;
|
||||
CefString str;
|
||||
if(CEF_MEMBER_MISSING(struct_, get_local_name))
|
||||
return str;
|
||||
|
||||
cef_string_t cef_str = struct_->get_local_name(struct_);
|
||||
if(cef_str) {
|
||||
str = cef_str;
|
||||
cef_string_free(cef_str);
|
||||
}
|
||||
|
||||
cef_string_userfree_t strPtr = struct_->get_local_name(struct_);
|
||||
str.AttachToUserFree(strPtr);
|
||||
return str;
|
||||
}
|
||||
|
||||
std::wstring CefXmlReaderCToCpp::GetPrefix()
|
||||
CefString CefXmlReaderCToCpp::GetPrefix()
|
||||
{
|
||||
std::wstring str;
|
||||
CefString str;
|
||||
if(CEF_MEMBER_MISSING(struct_, get_prefix))
|
||||
return str;
|
||||
|
||||
cef_string_t cef_str = struct_->get_prefix(struct_);
|
||||
if(cef_str) {
|
||||
str = cef_str;
|
||||
cef_string_free(cef_str);
|
||||
}
|
||||
|
||||
cef_string_userfree_t strPtr = struct_->get_prefix(struct_);
|
||||
str.AttachToUserFree(strPtr);
|
||||
return str;
|
||||
}
|
||||
|
||||
std::wstring CefXmlReaderCToCpp::GetQualifiedName()
|
||||
CefString CefXmlReaderCToCpp::GetQualifiedName()
|
||||
{
|
||||
std::wstring str;
|
||||
CefString str;
|
||||
if(CEF_MEMBER_MISSING(struct_, get_qualified_name))
|
||||
return str;
|
||||
|
||||
cef_string_t cef_str = struct_->get_qualified_name(struct_);
|
||||
if(cef_str) {
|
||||
str = cef_str;
|
||||
cef_string_free(cef_str);
|
||||
}
|
||||
|
||||
cef_string_userfree_t strPtr = struct_->get_qualified_name(struct_);
|
||||
str.AttachToUserFree(strPtr);
|
||||
return str;
|
||||
}
|
||||
|
||||
std::wstring CefXmlReaderCToCpp::GetNamespaceURI()
|
||||
CefString CefXmlReaderCToCpp::GetNamespaceURI()
|
||||
{
|
||||
std::wstring str;
|
||||
CefString str;
|
||||
if(CEF_MEMBER_MISSING(struct_, get_namespace_uri))
|
||||
return str;
|
||||
|
||||
cef_string_t cef_str = struct_->get_namespace_uri(struct_);
|
||||
if(cef_str) {
|
||||
str = cef_str;
|
||||
cef_string_free(cef_str);
|
||||
}
|
||||
|
||||
cef_string_userfree_t strPtr = struct_->get_namespace_uri(struct_);
|
||||
str.AttachToUserFree(strPtr);
|
||||
return str;
|
||||
}
|
||||
|
||||
std::wstring CefXmlReaderCToCpp::GetBaseURI()
|
||||
CefString CefXmlReaderCToCpp::GetBaseURI()
|
||||
{
|
||||
std::wstring str;
|
||||
CefString str;
|
||||
if(CEF_MEMBER_MISSING(struct_, get_base_uri))
|
||||
return str;
|
||||
|
||||
cef_string_t cef_str = struct_->get_base_uri(struct_);
|
||||
if(cef_str) {
|
||||
str = cef_str;
|
||||
cef_string_free(cef_str);
|
||||
}
|
||||
|
||||
cef_string_userfree_t strPtr = struct_->get_base_uri(struct_);
|
||||
str.AttachToUserFree(strPtr);
|
||||
return str;
|
||||
}
|
||||
|
||||
std::wstring CefXmlReaderCToCpp::GetXmlLang()
|
||||
CefString CefXmlReaderCToCpp::GetXmlLang()
|
||||
{
|
||||
std::wstring str;
|
||||
CefString str;
|
||||
if(CEF_MEMBER_MISSING(struct_, get_xml_lang))
|
||||
return str;
|
||||
|
||||
cef_string_t cef_str = struct_->get_xml_lang(struct_);
|
||||
if(cef_str) {
|
||||
str = cef_str;
|
||||
cef_string_free(cef_str);
|
||||
}
|
||||
|
||||
cef_string_userfree_t strPtr = struct_->get_xml_lang(struct_);
|
||||
str.AttachToUserFree(strPtr);
|
||||
return str;
|
||||
}
|
||||
|
||||
@@ -190,18 +162,14 @@ bool CefXmlReaderCToCpp::HasValue()
|
||||
return struct_->has_value(struct_) ? true : false;
|
||||
}
|
||||
|
||||
std::wstring CefXmlReaderCToCpp::GetValue()
|
||||
CefString CefXmlReaderCToCpp::GetValue()
|
||||
{
|
||||
std::wstring str;
|
||||
CefString str;
|
||||
if(CEF_MEMBER_MISSING(struct_, get_value))
|
||||
return str;
|
||||
|
||||
cef_string_t cef_str = struct_->get_value(struct_);
|
||||
if(cef_str) {
|
||||
str = cef_str;
|
||||
cef_string_free(cef_str);
|
||||
}
|
||||
|
||||
cef_string_userfree_t strPtr = struct_->get_value(struct_);
|
||||
str.AttachToUserFree(strPtr);
|
||||
return str;
|
||||
}
|
||||
|
||||
@@ -221,81 +189,61 @@ size_t CefXmlReaderCToCpp::GetAttributeCount()
|
||||
return struct_->get_attribute_count(struct_);
|
||||
}
|
||||
|
||||
std::wstring CefXmlReaderCToCpp::GetAttribute(int index)
|
||||
CefString CefXmlReaderCToCpp::GetAttribute(int index)
|
||||
{
|
||||
std::wstring str;
|
||||
CefString str;
|
||||
if(CEF_MEMBER_MISSING(struct_, get_attribute_byindex))
|
||||
return str;
|
||||
|
||||
cef_string_t cef_str = struct_->get_attribute_byindex(struct_, index);
|
||||
if(cef_str) {
|
||||
str = cef_str;
|
||||
cef_string_free(cef_str);
|
||||
}
|
||||
|
||||
cef_string_userfree_t strPtr = struct_->get_attribute_byindex(struct_, index);
|
||||
str.AttachToUserFree(strPtr);
|
||||
return str;
|
||||
}
|
||||
|
||||
std::wstring CefXmlReaderCToCpp::GetAttribute(const std::wstring& qualifiedName)
|
||||
CefString CefXmlReaderCToCpp::GetAttribute(const CefString& qualifiedName)
|
||||
{
|
||||
std::wstring str;
|
||||
CefString str;
|
||||
if(CEF_MEMBER_MISSING(struct_, get_attribute_byqname))
|
||||
return str;
|
||||
|
||||
cef_string_t cef_str = struct_->get_attribute_byqname(struct_,
|
||||
qualifiedName.c_str());
|
||||
if(cef_str) {
|
||||
str = cef_str;
|
||||
cef_string_free(cef_str);
|
||||
}
|
||||
|
||||
cef_string_userfree_t strPtr = struct_->get_attribute_byqname(struct_,
|
||||
qualifiedName.GetStruct());
|
||||
str.AttachToUserFree(strPtr);
|
||||
return str;
|
||||
}
|
||||
|
||||
std::wstring CefXmlReaderCToCpp::GetAttribute(const std::wstring& localName,
|
||||
const std::wstring& namespaceURI)
|
||||
CefString CefXmlReaderCToCpp::GetAttribute(const CefString& localName,
|
||||
const CefString& namespaceURI)
|
||||
{
|
||||
std::wstring str;
|
||||
CefString str;
|
||||
if(CEF_MEMBER_MISSING(struct_, get_attribute_bylname))
|
||||
return str;
|
||||
|
||||
cef_string_t cef_str = struct_->get_attribute_bylname(struct_,
|
||||
localName.c_str(), namespaceURI.c_str());
|
||||
if(cef_str) {
|
||||
str = cef_str;
|
||||
cef_string_free(cef_str);
|
||||
}
|
||||
|
||||
cef_string_userfree_t strPtr = struct_->get_attribute_bylname(struct_,
|
||||
localName.GetStruct(), namespaceURI.GetStruct());
|
||||
str.AttachToUserFree(strPtr);
|
||||
return str;
|
||||
}
|
||||
|
||||
std::wstring CefXmlReaderCToCpp::GetInnerXml()
|
||||
CefString CefXmlReaderCToCpp::GetInnerXml()
|
||||
{
|
||||
std::wstring str;
|
||||
CefString str;
|
||||
if(CEF_MEMBER_MISSING(struct_, get_inner_xml))
|
||||
return str;
|
||||
|
||||
cef_string_t cef_str = struct_->get_inner_xml(struct_);
|
||||
if(cef_str) {
|
||||
str = cef_str;
|
||||
cef_string_free(cef_str);
|
||||
}
|
||||
|
||||
cef_string_userfree_t strPtr = struct_->get_inner_xml(struct_);
|
||||
str.AttachToUserFree(strPtr);
|
||||
return str;
|
||||
}
|
||||
|
||||
std::wstring CefXmlReaderCToCpp::GetOuterXml()
|
||||
CefString CefXmlReaderCToCpp::GetOuterXml()
|
||||
{
|
||||
std::wstring str;
|
||||
CefString str;
|
||||
if(CEF_MEMBER_MISSING(struct_, get_outer_xml))
|
||||
return str;
|
||||
|
||||
cef_string_t cef_str = struct_->get_outer_xml(struct_);
|
||||
if(cef_str) {
|
||||
str = cef_str;
|
||||
cef_string_free(cef_str);
|
||||
}
|
||||
|
||||
cef_string_userfree_t strPtr = struct_->get_outer_xml(struct_);
|
||||
str.AttachToUserFree(strPtr);
|
||||
return str;
|
||||
}
|
||||
|
||||
@@ -315,23 +263,23 @@ bool CefXmlReaderCToCpp::MoveToAttribute(int index)
|
||||
return struct_->move_to_attribute_byindex(struct_, index) ? true : false;
|
||||
}
|
||||
|
||||
bool CefXmlReaderCToCpp::MoveToAttribute(const std::wstring& qualifiedName)
|
||||
bool CefXmlReaderCToCpp::MoveToAttribute(const CefString& qualifiedName)
|
||||
{
|
||||
if(CEF_MEMBER_MISSING(struct_, move_to_attribute_byqname))
|
||||
return false;
|
||||
|
||||
return struct_->move_to_attribute_byqname(struct_, qualifiedName.c_str()) ?
|
||||
return struct_->move_to_attribute_byqname(struct_, qualifiedName.GetStruct())?
|
||||
true : false;
|
||||
}
|
||||
|
||||
bool CefXmlReaderCToCpp::MoveToAttribute(const std::wstring& localName,
|
||||
const std::wstring& namespaceURI)
|
||||
bool CefXmlReaderCToCpp::MoveToAttribute(const CefString& localName,
|
||||
const CefString& namespaceURI)
|
||||
{
|
||||
if(CEF_MEMBER_MISSING(struct_, move_to_attribute_bylname))
|
||||
return false;
|
||||
|
||||
return struct_->move_to_attribute_bylname(struct_, localName.c_str(),
|
||||
namespaceURI.c_str()) ? true : false;
|
||||
return struct_->move_to_attribute_bylname(struct_, localName.GetStruct(),
|
||||
namespaceURI.GetStruct()) ? true : false;
|
||||
}
|
||||
|
||||
bool CefXmlReaderCToCpp::MoveToFirstAttribute()
|
||||
|
@@ -34,31 +34,31 @@ public:
|
||||
virtual bool MoveToNextNode();
|
||||
virtual bool Close();
|
||||
virtual bool HasError();
|
||||
virtual std::wstring GetError();
|
||||
virtual CefString GetError();
|
||||
virtual NodeType GetType();
|
||||
virtual int GetDepth();
|
||||
virtual std::wstring GetLocalName();
|
||||
virtual std::wstring GetPrefix();
|
||||
virtual std::wstring GetQualifiedName();
|
||||
virtual std::wstring GetNamespaceURI();
|
||||
virtual std::wstring GetBaseURI();
|
||||
virtual std::wstring GetXmlLang();
|
||||
virtual CefString GetLocalName();
|
||||
virtual CefString GetPrefix();
|
||||
virtual CefString GetQualifiedName();
|
||||
virtual CefString GetNamespaceURI();
|
||||
virtual CefString GetBaseURI();
|
||||
virtual CefString GetXmlLang();
|
||||
virtual bool IsEmptyElement();
|
||||
virtual bool HasValue();
|
||||
virtual std::wstring GetValue();
|
||||
virtual CefString GetValue();
|
||||
virtual bool HasAttributes();
|
||||
virtual size_t GetAttributeCount();
|
||||
virtual std::wstring GetAttribute(int index);
|
||||
virtual std::wstring GetAttribute(const std::wstring& qualifiedName);
|
||||
virtual std::wstring GetAttribute(const std::wstring& localName,
|
||||
const std::wstring& namespaceURI);
|
||||
virtual std::wstring GetInnerXml();
|
||||
virtual std::wstring GetOuterXml();
|
||||
virtual CefString GetAttribute(int index);
|
||||
virtual CefString GetAttribute(const CefString& qualifiedName);
|
||||
virtual CefString GetAttribute(const CefString& localName,
|
||||
const CefString& namespaceURI);
|
||||
virtual CefString GetInnerXml();
|
||||
virtual CefString GetOuterXml();
|
||||
virtual int GetLineNumber();
|
||||
virtual bool MoveToAttribute(int index);
|
||||
virtual bool MoveToAttribute(const std::wstring& qualifiedName);
|
||||
virtual bool MoveToAttribute(const std::wstring& localName,
|
||||
const std::wstring& namespaceURI);
|
||||
virtual bool MoveToAttribute(const CefString& qualifiedName);
|
||||
virtual bool MoveToAttribute(const CefString& localName,
|
||||
const CefString& namespaceURI);
|
||||
virtual bool MoveToFirstAttribute();
|
||||
virtual bool MoveToNextAttribute();
|
||||
virtual bool MoveToCarryingElement();
|
||||
|
@@ -44,13 +44,13 @@ bool CefZipReaderCToCpp::MoveToNextFile()
|
||||
return struct_->move_to_next_file(struct_) ? true : false;
|
||||
}
|
||||
|
||||
bool CefZipReaderCToCpp::MoveToFile(const std::wstring& fileName,
|
||||
bool CefZipReaderCToCpp::MoveToFile(const CefString& fileName,
|
||||
bool caseSensitive)
|
||||
{
|
||||
if(CEF_MEMBER_MISSING(struct_, move_to_file))
|
||||
return false;
|
||||
|
||||
return struct_->move_to_file(struct_, fileName.c_str(), caseSensitive) ?
|
||||
return struct_->move_to_file(struct_, fileName.GetStruct(), caseSensitive) ?
|
||||
true : false;
|
||||
}
|
||||
|
||||
@@ -62,18 +62,14 @@ bool CefZipReaderCToCpp::Close()
|
||||
return struct_->close(struct_) ? true : false;
|
||||
}
|
||||
|
||||
std::wstring CefZipReaderCToCpp::GetFileName()
|
||||
CefString CefZipReaderCToCpp::GetFileName()
|
||||
{
|
||||
std::wstring str;
|
||||
CefString str;
|
||||
if(CEF_MEMBER_MISSING(struct_, get_file_name))
|
||||
return str;
|
||||
|
||||
cef_string_t cef_str = struct_->get_file_name(struct_);
|
||||
if(cef_str) {
|
||||
str = cef_str;
|
||||
cef_string_free(cef_str);
|
||||
}
|
||||
|
||||
cef_string_userfree_t strPtr = struct_->get_file_name(struct_);
|
||||
str.AttachToUserFree(strPtr);
|
||||
return str;
|
||||
}
|
||||
|
||||
@@ -93,12 +89,12 @@ time_t CefZipReaderCToCpp::GetFileLastModified()
|
||||
return struct_->get_file_last_modified(struct_);
|
||||
}
|
||||
|
||||
bool CefZipReaderCToCpp::OpenFile(const std::wstring& password)
|
||||
bool CefZipReaderCToCpp::OpenFile(const CefString& password)
|
||||
{
|
||||
if(CEF_MEMBER_MISSING(struct_, open_file))
|
||||
return 0;
|
||||
|
||||
return struct_->open_file(struct_, password.c_str()) ? true : false;
|
||||
return struct_->open_file(struct_, password.GetStruct()) ? true : false;
|
||||
}
|
||||
|
||||
bool CefZipReaderCToCpp::CloseFile()
|
||||
|
@@ -33,12 +33,12 @@ public:
|
||||
// CefZipReader methods
|
||||
virtual bool MoveToFirstFile();
|
||||
virtual bool MoveToNextFile();
|
||||
virtual bool MoveToFile(const std::wstring& fileName, bool caseSensitive);
|
||||
virtual bool MoveToFile(const CefString& fileName, bool caseSensitive);
|
||||
virtual bool Close();
|
||||
virtual std::wstring GetFileName();
|
||||
virtual CefString GetFileName();
|
||||
virtual long GetFileSize();
|
||||
virtual time_t GetFileLastModified();
|
||||
virtual bool OpenFile(const std::wstring& password);
|
||||
virtual bool OpenFile(const CefString& password);
|
||||
virtual bool CloseFile();
|
||||
virtual int ReadFile(void* buffer, size_t bufferSize);
|
||||
virtual long Tell();
|
||||
|
@@ -78,8 +78,8 @@ CEF_EXPORT void cef_do_message_loop_work()
|
||||
CefDoMessageLoopWork();
|
||||
}
|
||||
|
||||
CEF_EXPORT int cef_register_extension(const wchar_t* extension_name,
|
||||
const wchar_t* javascript_code,
|
||||
CEF_EXPORT int cef_register_extension(const cef_string_t* extension_name,
|
||||
const cef_string_t* javascript_code,
|
||||
struct _cef_v8handler_t* handler)
|
||||
{
|
||||
DCHECK(extension_name);
|
||||
@@ -90,36 +90,45 @@ CEF_EXPORT int cef_register_extension(const wchar_t* extension_name,
|
||||
|
||||
if(handler)
|
||||
handlerPtr = CefV8HandlerCToCpp::Wrap(handler);
|
||||
if(extension_name)
|
||||
nameStr = extension_name;
|
||||
if(javascript_code)
|
||||
codeStr = javascript_code;
|
||||
|
||||
return CefRegisterExtension(nameStr, codeStr, handlerPtr);
|
||||
return CefRegisterExtension(CefString(extension_name),
|
||||
CefString(javascript_code), handlerPtr);
|
||||
}
|
||||
|
||||
CEF_EXPORT int cef_register_plugin(const cef_plugin_info_t* plugin_info)
|
||||
{
|
||||
CefPluginInfo pluginInfo;
|
||||
|
||||
pluginInfo.unique_name = plugin_info->unique_name;
|
||||
pluginInfo.display_name = plugin_info->display_name;
|
||||
pluginInfo.version = plugin_info->version;
|
||||
pluginInfo.description = plugin_info->description;
|
||||
pluginInfo.unique_name.FromString(plugin_info->unique_name.str,
|
||||
plugin_info->unique_name.length, true);
|
||||
pluginInfo.display_name.FromString(plugin_info->display_name.str,
|
||||
plugin_info->display_name.length, true);
|
||||
pluginInfo.version.FromString(plugin_info->version.str,
|
||||
plugin_info->version.length, true);
|
||||
pluginInfo.description.FromString(plugin_info->description.str,
|
||||
plugin_info->description.length, true);
|
||||
|
||||
std::vector<std::wstring> mime_types, file_extensions;
|
||||
std::vector<std::wstring> descriptions;
|
||||
base::SplitString(plugin_info->mime_types, '|', &mime_types);
|
||||
base::SplitString(plugin_info->file_extensions, '|', &file_extensions);
|
||||
base::SplitString(plugin_info->type_descriptions, '|', &descriptions);
|
||||
typedef std::vector<std::string> VectorType;
|
||||
VectorType mime_types, file_extensions, descriptions, file_extensions_parts;
|
||||
base::SplitString(CefString(&plugin_info->mime_types), '|',
|
||||
&mime_types);
|
||||
base::SplitString(CefString(&plugin_info->file_extensions), '|',
|
||||
&file_extensions);
|
||||
base::SplitString(CefString(&plugin_info->type_descriptions), '|',
|
||||
&descriptions);
|
||||
|
||||
for (size_t i = 0; i < mime_types.size(); ++i) {
|
||||
CefPluginMimeType mimeType;
|
||||
|
||||
mimeType.mime_type = mime_types[i];
|
||||
|
||||
if (file_extensions.size() > i)
|
||||
base::SplitString(file_extensions[i], ',', &mimeType.file_extensions);
|
||||
if (file_extensions.size() > i) {
|
||||
base::SplitString(file_extensions[i], ',', &file_extensions_parts);
|
||||
VectorType::const_iterator it = file_extensions_parts.begin();
|
||||
for(; it != file_extensions_parts.end(); ++it)
|
||||
mimeType.file_extensions.push_back(*(it));
|
||||
file_extensions_parts.clear();
|
||||
}
|
||||
|
||||
if (descriptions.size() > i)
|
||||
mimeType.description = descriptions[i];
|
||||
@@ -134,22 +143,16 @@ CEF_EXPORT int cef_register_plugin(const cef_plugin_info_t* plugin_info)
|
||||
return CefRegisterPlugin(pluginInfo);
|
||||
}
|
||||
|
||||
CEF_EXPORT int cef_register_scheme(const wchar_t* scheme_name,
|
||||
const wchar_t* host_name, struct _cef_scheme_handler_factory_t* factory)
|
||||
CEF_EXPORT int cef_register_scheme(const cef_string_t* scheme_name,
|
||||
const cef_string_t* host_name,
|
||||
struct _cef_scheme_handler_factory_t* factory)
|
||||
{
|
||||
DCHECK(scheme_name);
|
||||
DCHECK(factory);
|
||||
if(!scheme_name || !factory)
|
||||
return 0;
|
||||
|
||||
std::wstring nameStr, codeStr;
|
||||
|
||||
if(scheme_name)
|
||||
nameStr = scheme_name;
|
||||
if(host_name)
|
||||
codeStr = host_name;
|
||||
|
||||
return CefRegisterScheme(nameStr, codeStr,
|
||||
return CefRegisterScheme(CefString(scheme_name), CefString(host_name),
|
||||
CefSchemeHandlerFactoryCToCpp::Wrap(factory));
|
||||
}
|
||||
|
||||
|
@@ -4,65 +4,44 @@
|
||||
|
||||
#include "transfer_util.h"
|
||||
|
||||
void transfer_string_list_contents(cef_string_list_t fromList,
|
||||
StringList& toList)
|
||||
{
|
||||
int size = cef_string_list_size(fromList);
|
||||
CefString value;
|
||||
|
||||
for(int i = 0; i < size; i++) {
|
||||
cef_string_list_value(fromList, i, value.GetWritableStruct());
|
||||
toList.push_back(value);
|
||||
}
|
||||
}
|
||||
|
||||
void transfer_string_list_contents(const StringList& fromList,
|
||||
cef_string_list_t toList)
|
||||
{
|
||||
size_t size = fromList.size();
|
||||
for(size_t i = 0; i < size; ++i)
|
||||
cef_string_list_append(toList, fromList[i].GetStruct());
|
||||
}
|
||||
|
||||
void transfer_string_map_contents(cef_string_map_t fromMap,
|
||||
std::map<std::wstring, std::wstring>& toMap)
|
||||
StringMap& toMap)
|
||||
{
|
||||
int size = cef_string_map_size(fromMap);
|
||||
cef_string_t key, value;
|
||||
std::wstring keystr, valuestr;
|
||||
CefString key, value;
|
||||
|
||||
for(int i = 0; i < size; ++i) {
|
||||
key = cef_string_map_key(fromMap, i);
|
||||
value = cef_string_map_value(fromMap, i);
|
||||
cef_string_map_key(fromMap, i, key.GetWritableStruct());
|
||||
cef_string_map_value(fromMap, i, value.GetWritableStruct());
|
||||
|
||||
if(key) {
|
||||
keystr = key;
|
||||
cef_string_free(key);
|
||||
} else if(!keystr.empty())
|
||||
keystr.clear();
|
||||
|
||||
if(value) {
|
||||
valuestr = value;
|
||||
cef_string_free(value);
|
||||
} else if(!valuestr.empty())
|
||||
valuestr.clear();
|
||||
|
||||
toMap.insert(std::pair<std::wstring, std::wstring>(keystr, valuestr));
|
||||
toMap.insert(std::pair<CefString, CefString>(key, value));
|
||||
}
|
||||
}
|
||||
|
||||
void transfer_string_map_contents(const std::map<std::wstring, std::wstring>& fromMap,
|
||||
void transfer_string_map_contents(const StringMap& fromMap,
|
||||
cef_string_map_t toMap)
|
||||
{
|
||||
std::map<std::wstring, std::wstring>::const_iterator it = fromMap.begin();
|
||||
for(; it != fromMap.end(); ++it) {
|
||||
cef_string_map_append(toMap, it->first.c_str(), it->second.c_str());
|
||||
}
|
||||
}
|
||||
|
||||
void transfer_string_contents(const std::wstring& fromString,
|
||||
cef_string_t* toString)
|
||||
{
|
||||
if(*toString == NULL || *toString != fromString) {
|
||||
if(*toString) {
|
||||
cef_string_free(*toString);
|
||||
*toString = NULL;
|
||||
}
|
||||
if(!fromString.empty())
|
||||
*toString = cef_string_alloc(fromString.c_str());
|
||||
}
|
||||
}
|
||||
|
||||
void transfer_string_contents(cef_string_t fromString, std::wstring& toString,
|
||||
bool freeFromString)
|
||||
{
|
||||
if(fromString == NULL || fromString != toString) {
|
||||
if(fromString) {
|
||||
toString = fromString;
|
||||
if(freeFromString)
|
||||
cef_string_free(fromString);
|
||||
} else if(!toString.empty())
|
||||
toString.clear();
|
||||
}
|
||||
StringMap::const_iterator it = fromMap.begin();
|
||||
for(; it != fromMap.end(); ++it)
|
||||
cef_string_map_append(toMap, it->first.GetStruct(), it->second.GetStruct());
|
||||
}
|
||||
|
@@ -5,21 +5,23 @@
|
||||
#ifndef _TRANSFER_UTIL_H
|
||||
#define _TRANSFER_UTIL_H
|
||||
|
||||
#include "include/cef_string.h"
|
||||
#include "include/cef_string_list.h"
|
||||
#include "include/cef_string_map.h"
|
||||
#include <map>
|
||||
#include <string>
|
||||
#include <vector>
|
||||
|
||||
// Copy contents from one list type to another.
|
||||
typedef std::vector<CefString> StringList;
|
||||
void transfer_string_list_contents(cef_string_list_t fromList,
|
||||
StringList& toList);
|
||||
void transfer_string_list_contents(const StringList& fromList,
|
||||
cef_string_list_t toList);
|
||||
|
||||
// Copy contents from one map type to another.
|
||||
typedef std::map<CefString, CefString> StringMap;
|
||||
void transfer_string_map_contents(cef_string_map_t fromMap,
|
||||
std::map<std::wstring, std::wstring>& toMap);
|
||||
void transfer_string_map_contents(const std::map<std::wstring, std::wstring>& fromMap,
|
||||
StringMap& toMap);
|
||||
void transfer_string_map_contents(const StringMap& fromMap,
|
||||
cef_string_map_t toMap);
|
||||
|
||||
// Copy the contents from one string type to another.
|
||||
void transfer_string_contents(const std::wstring& fromString,
|
||||
cef_string_t* toString);
|
||||
void transfer_string_contents(cef_string_t fromString, std::wstring& toString,
|
||||
bool freeFromString);
|
||||
|
||||
#endif // _TRANSFER_UTIL_H
|
||||
|
@@ -18,7 +18,7 @@ public:
|
||||
|
||||
bool Load(CefRefPtr<CefStreamReader> stream,
|
||||
CefXmlReader::EncodingType encodingType,
|
||||
const std::wstring& URI)
|
||||
const CefString& URI)
|
||||
{
|
||||
CefRefPtr<CefXmlReader> reader(
|
||||
CefXmlReader::Create(stream, encodingType, URI));
|
||||
@@ -31,7 +31,7 @@ public:
|
||||
CefXmlObject::ObjectVector queue;
|
||||
int cur_depth, value_depth = -1;
|
||||
CefXmlReader::NodeType cur_type;
|
||||
std::wstringstream cur_value;
|
||||
std::stringstream cur_value;
|
||||
bool last_has_ns = false;
|
||||
|
||||
queue.push_back(root_object_);
|
||||
@@ -47,17 +47,17 @@ public:
|
||||
if (cur_type == XML_NODE_ELEMENT_START) {
|
||||
if (cur_depth == value_depth) {
|
||||
// Add to the current value.
|
||||
cur_value << reader->GetOuterXml();
|
||||
cur_value << std::string(reader->GetOuterXml());
|
||||
continue;
|
||||
} else if(last_has_ns && reader->GetPrefix().empty()) {
|
||||
if (!cur_object->HasChildren()) {
|
||||
// Start a new value because the last element has a namespace and
|
||||
// this element does not.
|
||||
value_depth = cur_depth;
|
||||
cur_value << reader->GetOuterXml();
|
||||
cur_value << std::string(reader->GetOuterXml());
|
||||
} else {
|
||||
// Value following a child element is not allowed.
|
||||
std::wstringstream ss;
|
||||
std::stringstream ss;
|
||||
ss << L"Value following child element, line " <<
|
||||
reader->GetLineNumber();
|
||||
load_error_ = ss.str();
|
||||
@@ -93,7 +93,7 @@ public:
|
||||
} else if (cur_depth < value_depth) {
|
||||
// Done with parsing the value portion of the current element.
|
||||
cur_object->SetValue(cur_value.str());
|
||||
cur_value.str(L"");
|
||||
cur_value.str("");
|
||||
value_depth = -1;
|
||||
}
|
||||
|
||||
@@ -105,9 +105,10 @@ public:
|
||||
// Open tag without close tag or close tag without open tag should
|
||||
// never occur (the parser catches this error).
|
||||
DCHECK(false);
|
||||
std::wstringstream ss;
|
||||
ss << L"Mismatched end tag for " << cur_object->GetName() <<
|
||||
L", line " << reader->GetLineNumber();
|
||||
std::stringstream ss;
|
||||
ss << "Mismatched end tag for " <<
|
||||
std::string(cur_object->GetName()) <<
|
||||
", line " << reader->GetLineNumber();
|
||||
load_error_ = ss.str();
|
||||
ret = false;
|
||||
break;
|
||||
@@ -119,15 +120,15 @@ public:
|
||||
cur_type == XML_NODE_ENTITY_REFERENCE) {
|
||||
if (cur_depth == value_depth) {
|
||||
// Add to the current value.
|
||||
cur_value << reader->GetValue();
|
||||
cur_value << std::string(reader->GetValue());
|
||||
} else if (!cur_object->HasChildren()) {
|
||||
// Start a new value.
|
||||
value_depth = cur_depth;
|
||||
cur_value << reader->GetValue();
|
||||
cur_value << std::string(reader->GetValue());
|
||||
} else {
|
||||
// Value following a child element is not allowed.
|
||||
std::wstringstream ss;
|
||||
ss << L"Value following child element, line " <<
|
||||
std::stringstream ss;
|
||||
ss << "Value following child element, line " <<
|
||||
reader->GetLineNumber();
|
||||
load_error_ = ss.str();
|
||||
ret = false;
|
||||
@@ -145,16 +146,16 @@ public:
|
||||
return ret;
|
||||
}
|
||||
|
||||
std::wstring GetLoadError() { return load_error_; }
|
||||
CefString GetLoadError() { return load_error_; }
|
||||
|
||||
private:
|
||||
std::wstring load_error_;
|
||||
CefString load_error_;
|
||||
CefRefPtr<CefXmlObject> root_object_;
|
||||
};
|
||||
|
||||
} // namespace
|
||||
|
||||
CefXmlObject::CefXmlObject(const std::wstring& name)
|
||||
CefXmlObject::CefXmlObject(const CefString& name)
|
||||
: name_(name), parent_(NULL)
|
||||
{
|
||||
}
|
||||
@@ -165,7 +166,7 @@ CefXmlObject::~CefXmlObject()
|
||||
|
||||
bool CefXmlObject::Load(CefRefPtr<CefStreamReader> stream,
|
||||
CefXmlReader::EncodingType encodingType,
|
||||
const std::wstring& URI, std::wstring* loadError)
|
||||
const CefString& URI, CefString* loadError)
|
||||
{
|
||||
AutoLock lock_scope(this);
|
||||
Clear();
|
||||
@@ -236,9 +237,9 @@ void CefXmlObject::Clear()
|
||||
ClearAttributes();
|
||||
}
|
||||
|
||||
std::wstring CefXmlObject::GetName()
|
||||
CefString CefXmlObject::GetName()
|
||||
{
|
||||
std::wstring name;
|
||||
CefString name;
|
||||
{
|
||||
AutoLock lock_scope(this);
|
||||
name = name_;
|
||||
@@ -246,7 +247,7 @@ std::wstring CefXmlObject::GetName()
|
||||
return name;
|
||||
}
|
||||
|
||||
bool CefXmlObject::SetName(const std::wstring& name)
|
||||
bool CefXmlObject::SetName(const CefString& name)
|
||||
{
|
||||
DCHECK(!name.empty());
|
||||
if (name.empty())
|
||||
@@ -279,9 +280,9 @@ bool CefXmlObject::HasValue()
|
||||
return !value_.empty();
|
||||
}
|
||||
|
||||
std::wstring CefXmlObject::GetValue()
|
||||
CefString CefXmlObject::GetValue()
|
||||
{
|
||||
std::wstring value;
|
||||
CefString value;
|
||||
{
|
||||
AutoLock lock_scope(this);
|
||||
value = value_;
|
||||
@@ -289,7 +290,7 @@ std::wstring CefXmlObject::GetValue()
|
||||
return value;
|
||||
}
|
||||
|
||||
bool CefXmlObject::SetValue(const std::wstring& value)
|
||||
bool CefXmlObject::SetValue(const CefString& value)
|
||||
{
|
||||
AutoLock lock_scope(this);
|
||||
DCHECK(children_.empty());
|
||||
@@ -311,7 +312,7 @@ size_t CefXmlObject::GetAttributeCount()
|
||||
return attributes_.size();
|
||||
}
|
||||
|
||||
bool CefXmlObject::HasAttribute(const std::wstring& name)
|
||||
bool CefXmlObject::HasAttribute(const CefString& name)
|
||||
{
|
||||
if (name.empty())
|
||||
return false;
|
||||
@@ -321,10 +322,10 @@ bool CefXmlObject::HasAttribute(const std::wstring& name)
|
||||
return (it != attributes_.end());
|
||||
}
|
||||
|
||||
std::wstring CefXmlObject::GetAttributeValue(const std::wstring& name)
|
||||
CefString CefXmlObject::GetAttributeValue(const CefString& name)
|
||||
{
|
||||
DCHECK(!name.empty());
|
||||
std::wstring value;
|
||||
CefString value;
|
||||
if (!name.empty()) {
|
||||
AutoLock lock_scope(this);
|
||||
AttributeMap::const_iterator it = attributes_.find(name);
|
||||
@@ -334,8 +335,8 @@ std::wstring CefXmlObject::GetAttributeValue(const std::wstring& name)
|
||||
return value;
|
||||
}
|
||||
|
||||
bool CefXmlObject::SetAttributeValue(const std::wstring& name,
|
||||
const std::wstring& value)
|
||||
bool CefXmlObject::SetAttributeValue(const CefString& name,
|
||||
const CefString& value)
|
||||
{
|
||||
DCHECK(!name.empty());
|
||||
if (name.empty())
|
||||
@@ -346,8 +347,7 @@ bool CefXmlObject::SetAttributeValue(const std::wstring& name,
|
||||
if (it != attributes_.end()) {
|
||||
it->second = value;
|
||||
} else {
|
||||
attributes_.insert(
|
||||
std::make_pair<std::wstring,std::wstring>(name, value));
|
||||
attributes_.insert(std::make_pair(name, value));
|
||||
}
|
||||
return true;
|
||||
}
|
||||
@@ -441,7 +441,7 @@ void CefXmlObject::ClearChildren()
|
||||
children_.clear();
|
||||
}
|
||||
|
||||
CefRefPtr<CefXmlObject> CefXmlObject::FindChild(const std::wstring& name)
|
||||
CefRefPtr<CefXmlObject> CefXmlObject::FindChild(const CefString& name)
|
||||
{
|
||||
DCHECK(!name.empty());
|
||||
if (name.empty())
|
||||
@@ -456,7 +456,7 @@ CefRefPtr<CefXmlObject> CefXmlObject::FindChild(const std::wstring& name)
|
||||
return NULL;
|
||||
}
|
||||
|
||||
size_t CefXmlObject::FindChildren(const std::wstring& name,
|
||||
size_t CefXmlObject::FindChildren(const CefString& name,
|
||||
ObjectVector& children)
|
||||
{
|
||||
DCHECK(!name.empty());
|
||||
|
@@ -70,7 +70,7 @@ size_t CefZipArchive::Load(CefRefPtr<CefStreamReader> stream,
|
||||
continue;
|
||||
}
|
||||
|
||||
if (!reader->OpenFile(L""))
|
||||
if (!reader->OpenFile(CefString()))
|
||||
break;
|
||||
|
||||
name = reader->GetFileName();
|
||||
@@ -99,8 +99,7 @@ size_t CefZipArchive::Load(CefRefPtr<CefStreamReader> stream,
|
||||
count++;
|
||||
|
||||
// Add the file to the map.
|
||||
contents_.insert(
|
||||
std::make_pair<std::wstring, CefRefPtr<File> >(name, contents.get()));
|
||||
contents_.insert(std::make_pair(name, contents.get()));
|
||||
} while (reader->MoveToNextFile());
|
||||
|
||||
return count;
|
||||
@@ -118,36 +117,36 @@ size_t CefZipArchive::GetFileCount()
|
||||
return contents_.size();
|
||||
}
|
||||
|
||||
bool CefZipArchive::HasFile(const std::wstring& fileName)
|
||||
bool CefZipArchive::HasFile(const CefString& fileName)
|
||||
{
|
||||
std::wstring str = fileName;
|
||||
std::transform(str.begin(), str.end(), str.begin(), towlower);
|
||||
|
||||
AutoLock lock_scope(this);
|
||||
FileMap::const_iterator it = contents_.find(str);
|
||||
FileMap::const_iterator it = contents_.find(CefString(str));
|
||||
return (it != contents_.end());
|
||||
}
|
||||
|
||||
CefRefPtr<CefZipArchive::File> CefZipArchive::GetFile(
|
||||
const std::wstring& fileName)
|
||||
const CefString& fileName)
|
||||
{
|
||||
std::wstring str = fileName;
|
||||
std::transform(str.begin(), str.end(), str.begin(), towlower);
|
||||
|
||||
AutoLock lock_scope(this);
|
||||
FileMap::const_iterator it = contents_.find(str);
|
||||
FileMap::const_iterator it = contents_.find(CefString(str));
|
||||
if (it != contents_.end())
|
||||
return it->second;
|
||||
return NULL;
|
||||
}
|
||||
|
||||
bool CefZipArchive::RemoveFile(const std::wstring& fileName)
|
||||
bool CefZipArchive::RemoveFile(const CefString& fileName)
|
||||
{
|
||||
std::wstring str = fileName;
|
||||
std::transform(str.begin(), str.end(), str.begin(), towlower);
|
||||
|
||||
AutoLock lock_scope(this);
|
||||
FileMap::iterator it = contents_.find(str);
|
||||
FileMap::iterator it = contents_.find(CefString(str));
|
||||
if (it != contents_.end()) {
|
||||
contents_.erase(it);
|
||||
return true;
|
||||
|
@@ -61,30 +61,40 @@ void CefDoMessageLoopWork()
|
||||
cef_do_message_loop_work();
|
||||
}
|
||||
|
||||
bool CefRegisterExtension(const std::wstring& extension_name,
|
||||
const std::wstring& javascript_code,
|
||||
bool CefRegisterExtension(const CefString& extension_name,
|
||||
const CefString& javascript_code,
|
||||
CefRefPtr<CefV8Handler> handler)
|
||||
{
|
||||
return cef_register_extension(extension_name.c_str(), javascript_code.c_str(),
|
||||
CefV8HandlerCppToC::Wrap(handler))?true:false;
|
||||
return cef_register_extension(extension_name.GetStruct(),
|
||||
javascript_code.GetStruct(), CefV8HandlerCppToC::Wrap(handler))?
|
||||
true:false;
|
||||
}
|
||||
|
||||
bool CefRegisterPlugin(const struct CefPluginInfo& plugin_info)
|
||||
{
|
||||
cef_plugin_info_t pluginInfo;
|
||||
memset(&pluginInfo, 0, sizeof(pluginInfo));
|
||||
|
||||
pluginInfo.unique_name = plugin_info.unique_name.c_str();
|
||||
pluginInfo.display_name = plugin_info.display_name.c_str();
|
||||
pluginInfo.version =plugin_info.version.c_str();
|
||||
pluginInfo.description = plugin_info.description.c_str();
|
||||
cef_string_set(plugin_info.unique_name.c_str(),
|
||||
plugin_info.unique_name.length(),
|
||||
&pluginInfo.unique_name, false);
|
||||
cef_string_set(plugin_info.display_name.c_str(),
|
||||
plugin_info.display_name.length(),
|
||||
&pluginInfo.display_name, false);
|
||||
cef_string_set(plugin_info.version.c_str(),
|
||||
plugin_info.version.length(),
|
||||
&pluginInfo.version, false);
|
||||
cef_string_set(plugin_info.description.c_str(),
|
||||
plugin_info.description.length(),
|
||||
&pluginInfo.description, false);
|
||||
|
||||
std::wstring mimeTypes, fileExtensions, typeDescriptions;
|
||||
std::string mimeTypes, fileExtensions, typeDescriptions;
|
||||
|
||||
for(size_t i = 0; i < plugin_info.mime_types.size(); ++i) {
|
||||
if(i > 0) {
|
||||
mimeTypes += L"|";
|
||||
fileExtensions += L"|";
|
||||
typeDescriptions += L"|";
|
||||
mimeTypes += "|";
|
||||
fileExtensions += "|";
|
||||
typeDescriptions += "|";
|
||||
}
|
||||
|
||||
mimeTypes += plugin_info.mime_types[i].mime_type;
|
||||
@@ -93,28 +103,37 @@ bool CefRegisterPlugin(const struct CefPluginInfo& plugin_info)
|
||||
for(size_t j = 0;
|
||||
j < plugin_info.mime_types[i].file_extensions.size(); ++j) {
|
||||
if(j > 0) {
|
||||
fileExtensions += L",";
|
||||
fileExtensions += ",";
|
||||
}
|
||||
fileExtensions += plugin_info.mime_types[i].file_extensions[j];
|
||||
}
|
||||
}
|
||||
|
||||
pluginInfo.mime_types = mimeTypes.c_str();
|
||||
pluginInfo.file_extensions = fileExtensions.c_str();
|
||||
pluginInfo.type_descriptions = typeDescriptions.c_str();
|
||||
cef_string_from_utf8(mimeTypes.c_str(), mimeTypes.length(),
|
||||
&pluginInfo.mime_types);
|
||||
cef_string_from_utf8(fileExtensions.c_str(), fileExtensions.length(),
|
||||
&pluginInfo.file_extensions);
|
||||
cef_string_from_utf8(typeDescriptions.c_str(), typeDescriptions.length(),
|
||||
&pluginInfo.type_descriptions);
|
||||
|
||||
pluginInfo.np_getentrypoints = plugin_info.np_getentrypoints;
|
||||
pluginInfo.np_initialize = plugin_info.np_initialize;
|
||||
pluginInfo.np_shutdown = plugin_info.np_shutdown;
|
||||
|
||||
return (cef_register_plugin(&pluginInfo) ? true : false);
|
||||
bool ret = cef_register_plugin(&pluginInfo) ? true : false;
|
||||
|
||||
cef_string_clear(&pluginInfo.mime_types);
|
||||
cef_string_clear(&pluginInfo.file_extensions);
|
||||
cef_string_clear(&pluginInfo.type_descriptions);
|
||||
|
||||
return ret;
|
||||
}
|
||||
|
||||
bool CefRegisterScheme(const std::wstring& scheme_name,
|
||||
const std::wstring& host_name,
|
||||
bool CefRegisterScheme(const CefString& scheme_name,
|
||||
const CefString& host_name,
|
||||
CefRefPtr<CefSchemeHandlerFactory> factory)
|
||||
{
|
||||
return cef_register_scheme(scheme_name.c_str(), host_name.c_str(),
|
||||
return cef_register_scheme(scheme_name.GetStruct(), host_name.GetStruct(),
|
||||
CefSchemeHandlerFactoryCppToC::Wrap(factory))?true:false;
|
||||
}
|
||||
|
||||
|
Reference in New Issue
Block a user