2009-06-21 00:09:28 +02:00
|
|
|
// 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.
|
|
|
|
//
|
|
|
|
|
2009-10-02 19:59:38 +02:00
|
|
|
#include "libcef_dll/cpptoc/post_data_cpptoc.h"
|
|
|
|
#include "libcef_dll/cpptoc/request_cpptoc.h"
|
|
|
|
#include "libcef_dll/transfer_util.h"
|
2009-06-21 00:09:28 +02:00
|
|
|
|
|
|
|
|
|
|
|
// GLOBAL FUNCTIONS - Body may be edited by hand.
|
|
|
|
|
|
|
|
CEF_EXPORT cef_request_t* cef_request_create()
|
|
|
|
{
|
|
|
|
CefRefPtr<CefRequest> impl = CefRequest::CreateRequest();
|
|
|
|
if(impl.get())
|
|
|
|
return CefRequestCppToC::Wrap(impl);
|
|
|
|
return NULL;
|
|
|
|
}
|
|
|
|
|
2009-03-05 02:10:06 +01:00
|
|
|
|
2009-06-21 00:09:28 +02:00
|
|
|
// MEMBER FUNCTIONS - Body may be edited by hand.
|
2009-03-05 02:10:06 +01:00
|
|
|
|
2009-06-21 00:09:28 +02:00
|
|
|
cef_string_t CEF_CALLBACK request_get_url(struct _cef_request_t* self)
|
2009-03-05 02:10:06 +01:00
|
|
|
{
|
2009-06-21 00:09:28 +02:00
|
|
|
DCHECK(self);
|
|
|
|
if(!self)
|
|
|
|
return NULL;
|
|
|
|
|
|
|
|
std::wstring urlStr = CefRequestCppToC::Get(self)->GetURL();
|
2009-05-28 02:31:21 +02:00
|
|
|
if(!urlStr.empty())
|
|
|
|
return cef_string_alloc(urlStr.c_str());
|
|
|
|
return NULL;
|
2009-03-05 02:10:06 +01:00
|
|
|
}
|
|
|
|
|
2009-06-21 00:09:28 +02:00
|
|
|
void CEF_CALLBACK request_set_url(struct _cef_request_t* self,
|
|
|
|
const wchar_t* url)
|
2009-03-05 02:10:06 +01:00
|
|
|
{
|
2009-06-21 00:09:28 +02:00
|
|
|
DCHECK(self);
|
|
|
|
if(!self)
|
|
|
|
return;
|
|
|
|
|
|
|
|
std::wstring urlStr;
|
|
|
|
if(url)
|
|
|
|
urlStr = url;
|
|
|
|
CefRequestCppToC::Get(self)->SetURL(urlStr);
|
2009-03-05 02:10:06 +01:00
|
|
|
}
|
|
|
|
|
2009-06-21 00:09:28 +02:00
|
|
|
cef_string_t CEF_CALLBACK request_get_method(struct _cef_request_t* self)
|
2009-03-05 02:10:06 +01:00
|
|
|
{
|
2009-06-21 00:09:28 +02:00
|
|
|
DCHECK(self);
|
|
|
|
if(!self)
|
|
|
|
return NULL;
|
|
|
|
|
|
|
|
std::wstring methodStr = CefRequestCppToC::Get(self)->GetMethod();
|
2009-05-28 02:31:21 +02:00
|
|
|
if(!methodStr.empty())
|
|
|
|
return cef_string_alloc(methodStr.c_str());
|
|
|
|
return NULL;
|
2009-03-05 02:10:06 +01:00
|
|
|
}
|
|
|
|
|
2009-06-21 00:09:28 +02:00
|
|
|
void CEF_CALLBACK request_set_method(struct _cef_request_t* self,
|
|
|
|
const wchar_t* method)
|
2009-03-05 02:10:06 +01:00
|
|
|
{
|
2009-06-21 00:09:28 +02:00
|
|
|
DCHECK(self);
|
|
|
|
if(!self)
|
|
|
|
return;
|
|
|
|
|
|
|
|
std::wstring methodStr;
|
|
|
|
if(method)
|
|
|
|
methodStr = method;
|
|
|
|
CefRequestCppToC::Get(self)->SetMethod(methodStr);
|
2009-03-05 02:10:06 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
struct _cef_post_data_t* CEF_CALLBACK request_get_post_data(
|
2009-06-21 00:09:28 +02:00
|
|
|
struct _cef_request_t* self)
|
2009-03-05 02:10:06 +01:00
|
|
|
{
|
2009-06-21 00:09:28 +02:00
|
|
|
DCHECK(self);
|
|
|
|
if(!self)
|
|
|
|
return NULL;
|
|
|
|
|
2009-05-28 02:31:21 +02:00
|
|
|
CefRefPtr<CefPostData> postDataPtr =
|
2009-06-21 00:09:28 +02:00
|
|
|
CefRequestCppToC::Get(self)->GetPostData();
|
2009-05-28 02:31:21 +02:00
|
|
|
if(!postDataPtr.get())
|
2009-03-05 02:10:06 +01:00
|
|
|
return NULL;
|
|
|
|
|
2009-05-28 02:31:21 +02:00
|
|
|
return CefPostDataCppToC::Wrap(postDataPtr);
|
2009-03-05 02:10:06 +01:00
|
|
|
}
|
|
|
|
|
2009-06-21 00:09:28 +02:00
|
|
|
void CEF_CALLBACK request_set_post_data(struct _cef_request_t* self,
|
|
|
|
struct _cef_post_data_t* postData)
|
2009-03-05 02:10:06 +01:00
|
|
|
{
|
2009-06-21 00:09:28 +02:00
|
|
|
DCHECK(self);
|
|
|
|
if(!self)
|
|
|
|
return;
|
|
|
|
|
2009-03-05 02:10:06 +01:00
|
|
|
CefRefPtr<CefPostData> postDataPtr;
|
2009-05-28 02:31:21 +02:00
|
|
|
if(postData)
|
|
|
|
postDataPtr = CefPostDataCppToC::Unwrap(postData);
|
2009-03-05 02:10:06 +01:00
|
|
|
|
2009-06-21 00:09:28 +02:00
|
|
|
CefRequestCppToC::Get(self)->SetPostData(postDataPtr);
|
2009-03-05 02:10:06 +01:00
|
|
|
}
|
|
|
|
|
2009-06-21 00:09:28 +02:00
|
|
|
void CEF_CALLBACK request_get_header_map(struct _cef_request_t* self,
|
|
|
|
cef_string_map_t headerMap)
|
2009-03-05 02:10:06 +01:00
|
|
|
{
|
2009-06-21 00:09:28 +02:00
|
|
|
DCHECK(self);
|
|
|
|
if(!self)
|
|
|
|
return;
|
|
|
|
|
2009-03-05 02:10:06 +01:00
|
|
|
CefRequest::HeaderMap map;
|
2009-06-21 00:09:28 +02:00
|
|
|
CefRequestCppToC::Get(self)->GetHeaderMap(map);
|
2009-03-05 02:10:06 +01:00
|
|
|
transfer_string_map_contents(map, headerMap);
|
|
|
|
}
|
|
|
|
|
2009-06-21 00:09:28 +02:00
|
|
|
void CEF_CALLBACK request_set_header_map(struct _cef_request_t* self,
|
|
|
|
cef_string_map_t headerMap)
|
2009-03-05 02:10:06 +01:00
|
|
|
{
|
2009-06-21 00:09:28 +02:00
|
|
|
DCHECK(self);
|
|
|
|
if(!self)
|
|
|
|
return;
|
|
|
|
|
2009-03-05 02:10:06 +01:00
|
|
|
CefRequest::HeaderMap map;
|
|
|
|
if(headerMap)
|
|
|
|
transfer_string_map_contents(headerMap, map);
|
|
|
|
|
2009-06-21 00:09:28 +02:00
|
|
|
CefRequestCppToC::Get(self)->SetHeaderMap(map);
|
2009-03-05 02:10:06 +01:00
|
|
|
}
|
|
|
|
|
2009-06-21 00:09:28 +02:00
|
|
|
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)
|
2009-03-05 02:10:06 +01:00
|
|
|
{
|
2009-06-21 00:09:28 +02:00
|
|
|
DCHECK(self);
|
|
|
|
if(!self)
|
|
|
|
return;
|
|
|
|
|
2009-05-28 02:31:21 +02:00
|
|
|
std::wstring urlStr, methodStr;
|
|
|
|
CefRefPtr<CefPostData> postDataPtr;
|
2009-03-05 02:10:06 +01:00
|
|
|
CefRequest::HeaderMap map;
|
|
|
|
|
|
|
|
if(url)
|
|
|
|
urlStr = url;
|
|
|
|
if(method)
|
|
|
|
methodStr = method;
|
2009-05-28 02:31:21 +02:00
|
|
|
if(postData)
|
|
|
|
postDataPtr = CefPostDataCppToC::Unwrap(postData);
|
2009-03-05 02:10:06 +01:00
|
|
|
if(headerMap)
|
|
|
|
transfer_string_map_contents(headerMap, map);
|
|
|
|
|
2009-06-21 00:09:28 +02:00
|
|
|
CefRequestCppToC::Get(self)->Set(urlStr, methodStr, postDataPtr, map);
|
2009-03-05 02:10:06 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
|
2009-06-21 00:09:28 +02:00
|
|
|
// CONSTRUCTOR - Do not edit by hand.
|
|
|
|
|
|
|
|
CefRequestCppToC::CefRequestCppToC(CefRequest* cls)
|
|
|
|
: CefCppToC<CefRequestCppToC, CefRequest, cef_request_t>(cls)
|
|
|
|
{
|
2009-03-05 02:10:06 +01:00
|
|
|
struct_.struct_.get_url = request_get_url;
|
|
|
|
struct_.struct_.set_url = request_set_url;
|
|
|
|
struct_.struct_.get_method = request_get_method;
|
|
|
|
struct_.struct_.set_method = request_set_method;
|
|
|
|
struct_.struct_.get_post_data = request_get_post_data;
|
|
|
|
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;
|
2009-06-21 00:09:28 +02:00
|
|
|
struct_.struct_.set = request_set;
|
2009-03-05 02:10:06 +01:00
|
|
|
}
|
|
|
|
|
2009-03-08 03:26:16 +01:00
|
|
|
#ifdef _DEBUG
|
2009-06-21 00:09:28 +02:00
|
|
|
long CefCppToC<CefRequestCppToC, CefRequest, cef_request_t>::DebugObjCt = 0;
|
2009-03-08 03:26:16 +01:00
|
|
|
#endif
|
2009-03-05 02:10:06 +01:00
|
|
|
|