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 static and
|
|
|
|
// virtual method implementations. See the translator.README.txt file in the
|
|
|
|
// tools directory for more information.
|
|
|
|
//
|
|
|
|
|
2009-03-05 02:10:06 +01:00
|
|
|
#include "../precompiled_libcef.h"
|
2009-06-21 00:09:28 +02:00
|
|
|
#include "ctocpp/post_data_ctocpp.h"
|
2009-03-05 02:10:06 +01:00
|
|
|
#include "ctocpp/request_ctocpp.h"
|
2009-06-21 00:09:28 +02:00
|
|
|
#include "../transfer_util.h"
|
|
|
|
|
|
|
|
|
|
|
|
// STATIC METHODS - Body may be edited by hand.
|
|
|
|
|
|
|
|
CefRefPtr<CefRequest> CefRequest::CreateRequest()
|
|
|
|
{
|
|
|
|
cef_request_t* impl = cef_request_create();
|
|
|
|
if(impl)
|
|
|
|
return CefRequestCToCpp::Wrap(impl);
|
|
|
|
return NULL;
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
// VIRTUAL METHODS - Body may be edited by hand.
|
2009-03-05 02:10:06 +01:00
|
|
|
|
|
|
|
std::wstring CefRequestCToCpp::GetURL()
|
|
|
|
{
|
|
|
|
std::wstring 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);
|
|
|
|
}
|
|
|
|
return str;
|
|
|
|
}
|
|
|
|
|
|
|
|
void CefRequestCToCpp::SetURL(const std::wstring& url)
|
|
|
|
{
|
|
|
|
if(CEF_MEMBER_MISSING(struct_, set_url))
|
|
|
|
return;
|
|
|
|
|
|
|
|
struct_->set_url(struct_, url.c_str());
|
|
|
|
}
|
|
|
|
|
|
|
|
std::wstring CefRequestCToCpp::GetMethod()
|
|
|
|
{
|
|
|
|
std::wstring 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);
|
|
|
|
}
|
|
|
|
return str;
|
|
|
|
}
|
|
|
|
|
|
|
|
void CefRequestCToCpp::SetMethod(const std::wstring& method)
|
|
|
|
{
|
|
|
|
if(CEF_MEMBER_MISSING(struct_, set_method))
|
|
|
|
return;
|
|
|
|
|
|
|
|
struct_->set_method(struct_, method.c_str());
|
|
|
|
}
|
|
|
|
|
|
|
|
CefRefPtr<CefPostData> CefRequestCToCpp::GetPostData()
|
|
|
|
{
|
|
|
|
if(CEF_MEMBER_MISSING(struct_, get_post_data))
|
|
|
|
return NULL;
|
|
|
|
|
|
|
|
cef_post_data_t* postDataStruct = struct_->get_post_data(struct_);
|
2009-05-28 02:31:21 +02:00
|
|
|
if(postDataStruct)
|
|
|
|
return CefPostDataCToCpp::Wrap(postDataStruct);
|
|
|
|
return NULL;
|
2009-03-05 02:10:06 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
void CefRequestCToCpp::SetPostData(CefRefPtr<CefPostData> postData)
|
|
|
|
{
|
|
|
|
if(CEF_MEMBER_MISSING(struct_, set_post_data))
|
|
|
|
return;
|
|
|
|
|
|
|
|
cef_post_data_t* postDataStruct = NULL;
|
2009-05-28 02:31:21 +02:00
|
|
|
if(postData.get())
|
|
|
|
postDataStruct = CefPostDataCToCpp::Unwrap(postData);
|
|
|
|
|
2009-03-05 02:10:06 +01:00
|
|
|
struct_->set_post_data(struct_, postDataStruct);
|
|
|
|
}
|
|
|
|
|
|
|
|
void CefRequestCToCpp::GetHeaderMap(HeaderMap& headerMap)
|
|
|
|
{
|
|
|
|
if(CEF_MEMBER_MISSING(struct_, get_header_map))
|
|
|
|
return;
|
|
|
|
|
|
|
|
cef_string_map_t map = cef_string_map_alloc();
|
|
|
|
if(!map)
|
|
|
|
return;
|
|
|
|
|
|
|
|
struct_->get_header_map(struct_, map);
|
|
|
|
transfer_string_map_contents(map, headerMap);
|
|
|
|
cef_string_map_free(map);
|
|
|
|
}
|
|
|
|
|
|
|
|
void CefRequestCToCpp::SetHeaderMap(const HeaderMap& headerMap)
|
|
|
|
{
|
|
|
|
if(CEF_MEMBER_MISSING(struct_, set_header_map))
|
|
|
|
return;
|
|
|
|
|
|
|
|
cef_string_map_t map = NULL;
|
|
|
|
if(!headerMap.empty()) {
|
|
|
|
map = cef_string_map_alloc();
|
|
|
|
if(!map)
|
|
|
|
return;
|
|
|
|
transfer_string_map_contents(headerMap, map);
|
|
|
|
}
|
|
|
|
|
|
|
|
struct_->set_header_map(struct_, map);
|
|
|
|
|
|
|
|
if(map)
|
|
|
|
cef_string_map_free(map);
|
|
|
|
}
|
|
|
|
|
2009-06-21 00:09:28 +02:00
|
|
|
void CefRequestCToCpp::Set(const std::wstring& url, const std::wstring& method,
|
|
|
|
CefRefPtr<CefPostData> postData, const HeaderMap& headerMap)
|
2009-03-05 02:10:06 +01:00
|
|
|
{
|
|
|
|
if(CEF_MEMBER_MISSING(struct_, set))
|
|
|
|
return;
|
|
|
|
|
|
|
|
cef_post_data_t* postDataStruct = NULL;
|
2009-05-28 02:31:21 +02:00
|
|
|
if(postData.get())
|
|
|
|
postDataStruct = CefPostDataCToCpp::Unwrap(postData);
|
2009-03-05 02:10:06 +01:00
|
|
|
|
|
|
|
cef_string_map_t map = NULL;
|
|
|
|
if(!headerMap.empty()) {
|
|
|
|
map = cef_string_map_alloc();
|
|
|
|
if(!map)
|
|
|
|
return;
|
|
|
|
transfer_string_map_contents(headerMap, map);
|
|
|
|
}
|
|
|
|
|
2009-05-28 02:31:21 +02:00
|
|
|
struct_->set(struct_, url.c_str(), method.c_str(), postDataStruct, map);
|
2009-03-05 02:10:06 +01:00
|
|
|
|
|
|
|
if(map)
|
|
|
|
cef_string_map_free(map);
|
|
|
|
}
|
|
|
|
|
|
|
|
|
2009-03-08 03:26:16 +01:00
|
|
|
#ifdef _DEBUG
|
2009-06-21 00:09:28 +02:00
|
|
|
long CefCToCpp<CefRequestCToCpp, CefRequest, cef_request_t>::DebugObjCt = 0;
|
2009-03-08 03:26:16 +01:00
|
|
|
#endif
|
2009-03-05 02:10:06 +01:00
|
|
|
|