mirror of
https://bitbucket.org/chromiumembedded/cef
synced 2025-06-05 21:39:12 +02:00
- Add the CEF translator tool for generating the C API header and cpptoc/ctocpp wrapper files.
- Update to files generated by the CEF translator tool. This introduces minor changes in cef.h and cef_capi.h for naming and translation consistency. - C API global function names that were previously in the cef_create_classname*() format are now in the cef_classname_create*() format. - cef_frame_t::get_frame_names() now returns void instead of size_t. - cef_frame_t::execute_javascript() has been renamed to cef_frame_t::execute_java_script(). - The 'arguments' attribute of CefV8Handler::Execute() and CefV8Value::ExecuteFunction() is now const. git-svn-id: https://chromiumembedded.googlecode.com/svn/trunk@30 5089003a-bbd8-11dd-ad1f-f1f9622dbc98
This commit is contained in:
@ -1,126 +1,147 @@
|
||||
// Copyright (c) 2009 The Chromium Embedded Framework Authors. All rights
|
||||
// reserved. Use of this source code is governed by a BSD-style license that
|
||||
// can be found in the LICENSE file.
|
||||
|
||||
// Copyright (c) 2009 The Chromium Embedded Framework Authors. All rights
|
||||
// reserved. Use of this source code is governed by a BSD-style license that
|
||||
// can be found in the LICENSE file.
|
||||
//
|
||||
// ---------------------------------------------------------------------------
|
||||
//
|
||||
// A portion of this file was generated by the CEF translator tool. When
|
||||
// making changes by hand only do so within the body of existing function
|
||||
// implementations. See the translator.README.txt file in the tools directory
|
||||
// for more information.
|
||||
//
|
||||
|
||||
#include "../precompiled_libcef.h"
|
||||
#include "cpptoc/post_data_cpptoc.h"
|
||||
#include "cpptoc/request_cpptoc.h"
|
||||
#include "transfer_util.h"
|
||||
#include "../transfer_util.h"
|
||||
|
||||
|
||||
cef_string_t CEF_CALLBACK request_get_url(struct _cef_request_t* request)
|
||||
// GLOBAL FUNCTIONS - Body may be edited by hand.
|
||||
|
||||
CEF_EXPORT cef_request_t* cef_request_create()
|
||||
{
|
||||
DCHECK(request);
|
||||
if(!request)
|
||||
return NULL;
|
||||
|
||||
std::wstring urlStr = CefRequestCppToC::Get(request)->GetURL();
|
||||
CefRefPtr<CefRequest> impl = CefRequest::CreateRequest();
|
||||
if(impl.get())
|
||||
return CefRequestCppToC::Wrap(impl);
|
||||
return NULL;
|
||||
}
|
||||
|
||||
|
||||
// MEMBER FUNCTIONS - Body may be edited by hand.
|
||||
|
||||
cef_string_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;
|
||||
}
|
||||
|
||||
void CEF_CALLBACK request_set_url(struct _cef_request_t* request,
|
||||
const wchar_t* url)
|
||||
void CEF_CALLBACK request_set_url(struct _cef_request_t* self,
|
||||
const wchar_t* url)
|
||||
{
|
||||
DCHECK(request);
|
||||
if(!request)
|
||||
return;
|
||||
|
||||
std::wstring urlStr;
|
||||
if(url)
|
||||
urlStr = url;
|
||||
CefRequestCppToC::Get(request)->SetURL(urlStr);
|
||||
DCHECK(self);
|
||||
if(!self)
|
||||
return;
|
||||
|
||||
std::wstring urlStr;
|
||||
if(url)
|
||||
urlStr = url;
|
||||
CefRequestCppToC::Get(self)->SetURL(urlStr);
|
||||
}
|
||||
|
||||
cef_string_t CEF_CALLBACK request_get_method(struct _cef_request_t* request)
|
||||
cef_string_t CEF_CALLBACK request_get_method(struct _cef_request_t* self)
|
||||
{
|
||||
DCHECK(request);
|
||||
if(!request)
|
||||
return NULL;
|
||||
|
||||
std::wstring methodStr = CefRequestCppToC::Get(request)->GetMethod();
|
||||
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;
|
||||
}
|
||||
|
||||
void CEF_CALLBACK request_set_method(struct _cef_request_t* request,
|
||||
const wchar_t* method)
|
||||
void CEF_CALLBACK request_set_method(struct _cef_request_t* self,
|
||||
const wchar_t* method)
|
||||
{
|
||||
DCHECK(request);
|
||||
if(!request)
|
||||
return;
|
||||
|
||||
std::wstring methodStr;
|
||||
if(method)
|
||||
methodStr = method;
|
||||
CefRequestCppToC::Get(request)->SetMethod(methodStr);
|
||||
DCHECK(self);
|
||||
if(!self)
|
||||
return;
|
||||
|
||||
std::wstring methodStr;
|
||||
if(method)
|
||||
methodStr = method;
|
||||
CefRequestCppToC::Get(self)->SetMethod(methodStr);
|
||||
}
|
||||
|
||||
struct _cef_post_data_t* CEF_CALLBACK request_get_post_data(
|
||||
struct _cef_request_t* request)
|
||||
struct _cef_request_t* self)
|
||||
{
|
||||
DCHECK(request);
|
||||
if(!request)
|
||||
return NULL;
|
||||
|
||||
DCHECK(self);
|
||||
if(!self)
|
||||
return NULL;
|
||||
|
||||
CefRefPtr<CefPostData> postDataPtr =
|
||||
CefRequestCppToC::Get(request)->GetPostData();
|
||||
CefRequestCppToC::Get(self)->GetPostData();
|
||||
if(!postDataPtr.get())
|
||||
return NULL;
|
||||
|
||||
return CefPostDataCppToC::Wrap(postDataPtr);
|
||||
}
|
||||
|
||||
void CEF_CALLBACK request_set_post_data(struct _cef_request_t* request,
|
||||
struct _cef_post_data_t* postData)
|
||||
void CEF_CALLBACK request_set_post_data(struct _cef_request_t* self,
|
||||
struct _cef_post_data_t* postData)
|
||||
{
|
||||
DCHECK(request);
|
||||
if(!request)
|
||||
return;
|
||||
|
||||
DCHECK(self);
|
||||
if(!self)
|
||||
return;
|
||||
|
||||
CefRefPtr<CefPostData> postDataPtr;
|
||||
if(postData)
|
||||
postDataPtr = CefPostDataCppToC::Unwrap(postData);
|
||||
|
||||
CefRequestCppToC::Get(request)->SetPostData(postDataPtr);
|
||||
CefRequestCppToC::Get(self)->SetPostData(postDataPtr);
|
||||
}
|
||||
|
||||
void CEF_CALLBACK request_get_header_map(struct _cef_request_t* request,
|
||||
cef_string_map_t headerMap)
|
||||
void CEF_CALLBACK request_get_header_map(struct _cef_request_t* self,
|
||||
cef_string_map_t headerMap)
|
||||
{
|
||||
DCHECK(request);
|
||||
if(!request)
|
||||
return;
|
||||
|
||||
DCHECK(self);
|
||||
if(!self)
|
||||
return;
|
||||
|
||||
CefRequest::HeaderMap map;
|
||||
CefRequestCppToC::Get(request)->GetHeaderMap(map);
|
||||
CefRequestCppToC::Get(self)->GetHeaderMap(map);
|
||||
transfer_string_map_contents(map, headerMap);
|
||||
}
|
||||
|
||||
void CEF_CALLBACK request_set_header_map(struct _cef_request_t* request,
|
||||
cef_string_map_t headerMap)
|
||||
void CEF_CALLBACK request_set_header_map(struct _cef_request_t* self,
|
||||
cef_string_map_t headerMap)
|
||||
{
|
||||
DCHECK(request);
|
||||
if(!request)
|
||||
return;
|
||||
|
||||
DCHECK(self);
|
||||
if(!self)
|
||||
return;
|
||||
|
||||
CefRequest::HeaderMap map;
|
||||
if(headerMap)
|
||||
transfer_string_map_contents(headerMap, map);
|
||||
|
||||
CefRequestCppToC::Get(request)->SetHeaderMap(map);
|
||||
CefRequestCppToC::Get(self)->SetHeaderMap(map);
|
||||
}
|
||||
|
||||
void CEF_CALLBACK request_set(struct _cef_request_t* request,
|
||||
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 wchar_t* url,
|
||||
const wchar_t* method, struct _cef_post_data_t* postData,
|
||||
cef_string_map_t headerMap)
|
||||
{
|
||||
DCHECK(request);
|
||||
if(!request)
|
||||
return;
|
||||
|
||||
DCHECK(self);
|
||||
if(!self)
|
||||
return;
|
||||
|
||||
std::wstring urlStr, methodStr;
|
||||
CefRefPtr<CefPostData> postDataPtr;
|
||||
CefRequest::HeaderMap map;
|
||||
@ -134,13 +155,15 @@ void CEF_CALLBACK request_set(struct _cef_request_t* request,
|
||||
if(headerMap)
|
||||
transfer_string_map_contents(headerMap, map);
|
||||
|
||||
CefRequestCppToC::Get(request)->Set(urlStr, methodStr, postDataPtr, map);
|
||||
CefRequestCppToC::Get(self)->Set(urlStr, methodStr, postDataPtr, map);
|
||||
}
|
||||
|
||||
|
||||
CefRequestCppToC::CefRequestCppToC(CefRequest* cls)
|
||||
: CefCppToC<CefRequestCppToC, CefRequest, cef_request_t>(cls)
|
||||
{
|
||||
// CONSTRUCTOR - Do not edit by hand.
|
||||
|
||||
CefRequestCppToC::CefRequestCppToC(CefRequest* cls)
|
||||
: CefCppToC<CefRequestCppToC, CefRequest, cef_request_t>(cls)
|
||||
{
|
||||
struct_.struct_.get_url = request_get_url;
|
||||
struct_.struct_.set_url = request_set_url;
|
||||
struct_.struct_.get_method = request_get_method;
|
||||
@ -149,188 +172,10 @@ CefRequestCppToC::CefRequestCppToC(CefRequest* cls)
|
||||
struct_.struct_.set_post_data = request_set_post_data;
|
||||
struct_.struct_.get_header_map = request_get_header_map;
|
||||
struct_.struct_.set_header_map = request_set_header_map;
|
||||
struct_.struct_.set = request_set;
|
||||
}
|
||||
|
||||
struct_.struct_.set = request_set;
|
||||
}
|
||||
|
||||
#ifdef _DEBUG
|
||||
long CefCppToC<CefRequestCppToC, CefRequest, cef_request_t>::DebugObjCt = 0;
|
||||
#endif
|
||||
|
||||
|
||||
size_t CEF_CALLBACK post_data_get_element_count(
|
||||
struct _cef_post_data_t* postData)
|
||||
{
|
||||
DCHECK(postData);
|
||||
if(!postData)
|
||||
return 0;
|
||||
|
||||
return CefPostDataCppToC::Get(postData)->GetElementCount();
|
||||
}
|
||||
|
||||
struct _cef_post_data_element_t* CEF_CALLBACK post_data_get_element(
|
||||
struct _cef_post_data_t* postData, int index)
|
||||
{
|
||||
DCHECK(postData);
|
||||
if(!postData)
|
||||
return NULL;
|
||||
|
||||
CefPostData::ElementVector elements;
|
||||
CefPostDataCppToC::Get(postData)->GetElements(elements);
|
||||
|
||||
if(index < 0 || index >= (int)elements.size())
|
||||
return NULL;
|
||||
|
||||
return CefPostDataElementCppToC::Wrap(elements[index]);
|
||||
}
|
||||
|
||||
int CEF_CALLBACK post_data_remove_element(struct _cef_post_data_t* postData,
|
||||
struct _cef_post_data_element_t* element)
|
||||
{
|
||||
DCHECK(postData);
|
||||
DCHECK(element);
|
||||
if(!postData || !element)
|
||||
return 0;
|
||||
|
||||
CefRefPtr<CefPostDataElement> postDataElementPtr =
|
||||
CefPostDataElementCppToC::Unwrap(element);
|
||||
return CefPostDataCppToC::Get(postData)->RemoveElement(postDataElementPtr);
|
||||
}
|
||||
|
||||
int CEF_CALLBACK post_data_add_element(struct _cef_post_data_t* postData,
|
||||
struct _cef_post_data_element_t* element)
|
||||
{
|
||||
DCHECK(postData);
|
||||
DCHECK(element);
|
||||
if(!postData || !element)
|
||||
return 0;
|
||||
|
||||
CefRefPtr<CefPostDataElement> postDataElementPtr =
|
||||
CefPostDataElementCppToC::Unwrap(element);
|
||||
return CefPostDataCppToC::Get(postData)->AddElement(postDataElementPtr);
|
||||
}
|
||||
|
||||
void CEF_CALLBACK post_data_remove_elements(struct _cef_post_data_t* postData)
|
||||
{
|
||||
DCHECK(postData);
|
||||
if(!postData)
|
||||
return;
|
||||
|
||||
CefPostDataCppToC::Get(postData)->RemoveElements();
|
||||
}
|
||||
|
||||
|
||||
CefPostDataCppToC::CefPostDataCppToC(CefPostData* cls)
|
||||
: CefCppToC<CefPostDataCppToC, CefPostData, cef_post_data_t>(cls)
|
||||
{
|
||||
struct_.struct_.get_element_count = post_data_get_element_count;
|
||||
struct_.struct_.get_element = post_data_get_element;
|
||||
struct_.struct_.remove_element = post_data_remove_element;
|
||||
struct_.struct_.add_element = post_data_add_element;
|
||||
struct_.struct_.remove_elements = post_data_remove_elements;
|
||||
}
|
||||
|
||||
#ifdef _DEBUG
|
||||
long CefCppToC<CefPostDataCppToC, CefPostData, cef_post_data_t>::DebugObjCt
|
||||
= 0;
|
||||
#endif
|
||||
|
||||
|
||||
void CEF_CALLBACK post_data_element_set_to_empty(
|
||||
struct _cef_post_data_element_t* postDataElement)
|
||||
{
|
||||
DCHECK(postDataElement);
|
||||
if(!postDataElement)
|
||||
return;
|
||||
|
||||
CefPostDataElementCppToC::Get(postDataElement)->SetToEmpty();
|
||||
}
|
||||
|
||||
void CEF_CALLBACK post_data_element_set_to_file(
|
||||
struct _cef_post_data_element_t* postDataElement,
|
||||
const wchar_t* fileName)
|
||||
{
|
||||
DCHECK(postDataElement);
|
||||
if(!postDataElement)
|
||||
return;
|
||||
|
||||
std::wstring fileNameStr;
|
||||
if(fileName)
|
||||
fileNameStr = fileName;
|
||||
|
||||
CefPostDataElementCppToC::Get(postDataElement)->SetToFile(fileNameStr);
|
||||
}
|
||||
|
||||
void CEF_CALLBACK post_data_element_set_to_bytes(
|
||||
struct _cef_post_data_element_t* postDataElement, size_t size,
|
||||
const void* bytes)
|
||||
{
|
||||
DCHECK(postDataElement);
|
||||
if(!postDataElement)
|
||||
return;
|
||||
|
||||
CefPostDataElementCppToC::Get(postDataElement)->SetToBytes(size, bytes);
|
||||
}
|
||||
|
||||
cef_postdataelement_type_t CEF_CALLBACK post_data_element_get_type(
|
||||
struct _cef_post_data_element_t* postDataElement)
|
||||
{
|
||||
DCHECK(postDataElement);
|
||||
if(!postDataElement)
|
||||
return PDE_TYPE_EMPTY;
|
||||
|
||||
return CefPostDataElementCppToC::Get(postDataElement)->GetType();
|
||||
}
|
||||
|
||||
cef_string_t CEF_CALLBACK post_data_element_get_file(
|
||||
struct _cef_post_data_element_t* postDataElement)
|
||||
{
|
||||
DCHECK(postDataElement);
|
||||
if(!postDataElement)
|
||||
return NULL;
|
||||
|
||||
std::wstring fileNameStr =
|
||||
CefPostDataElementCppToC::Get(postDataElement)->GetFile();
|
||||
if(!fileNameStr.empty())
|
||||
return cef_string_alloc(fileNameStr.c_str());
|
||||
return NULL;
|
||||
}
|
||||
|
||||
size_t CEF_CALLBACK post_data_element_get_bytes_count(
|
||||
struct _cef_post_data_element_t* postDataElement)
|
||||
{
|
||||
DCHECK(postDataElement);
|
||||
if(!postDataElement)
|
||||
return 0;
|
||||
|
||||
return CefPostDataElementCppToC::Get(postDataElement)->GetBytesCount();
|
||||
}
|
||||
|
||||
size_t CEF_CALLBACK post_data_element_get_bytes(
|
||||
struct _cef_post_data_element_t* postDataElement, size_t size,
|
||||
void *bytes)
|
||||
{
|
||||
DCHECK(postDataElement);
|
||||
if(!postDataElement)
|
||||
return 0;
|
||||
|
||||
return CefPostDataElementCppToC::Get(postDataElement)->GetBytes(size, bytes);
|
||||
}
|
||||
|
||||
|
||||
CefPostDataElementCppToC::CefPostDataElementCppToC(CefPostDataElement* cls)
|
||||
: CefCppToC<CefPostDataElementCppToC, CefPostDataElement,
|
||||
cef_post_data_element_t>(cls)
|
||||
{
|
||||
struct_.struct_.set_to_empty = post_data_element_set_to_empty;
|
||||
struct_.struct_.set_to_file = post_data_element_set_to_file;
|
||||
struct_.struct_.set_to_bytes = post_data_element_set_to_bytes;
|
||||
struct_.struct_.get_type = post_data_element_get_type;
|
||||
struct_.struct_.get_file = post_data_element_get_file;
|
||||
struct_.struct_.get_bytes_count = post_data_element_get_bytes_count;
|
||||
struct_.struct_.get_bytes = post_data_element_get_bytes;
|
||||
}
|
||||
|
||||
#ifdef _DEBUG
|
||||
long CefCppToC<CefPostDataElementCppToC, CefPostDataElement,
|
||||
cef_post_data_element_t>::DebugObjCt = 0;
|
||||
#endif
|
||||
|
Reference in New Issue
Block a user