- Add CefWebURLRequest implementation (issue #51).

- Default new CefRequest objects to the "GET" method.
- Send URL and title change notifications for CefFrame::LoadString().
- Disable the RequestTest.HistoryNav test which requires WebKit patches.

git-svn-id: https://chromiumembedded.googlecode.com/svn/trunk@184 5089003a-bbd8-11dd-ad1f-f1f9622dbc98
This commit is contained in:
Marshall Greenblatt
2011-02-09 22:04:35 +00:00
parent af12107c33
commit a125c0d964
35 changed files with 2235 additions and 156 deletions

View File

@ -144,6 +144,47 @@ void CEF_CALLBACK request_set(struct _cef_request_t* self,
postDataPtr, map);
}
enum cef_weburlrequest_flags_t CEF_CALLBACK request_get_flags(
struct _cef_request_t* self)
{
DCHECK(self);
if(!self)
return WUR_FLAG_NONE;
return CefRequestCppToC::Get(self)->GetFlags();
}
void CEF_CALLBACK request_set_flags(struct _cef_request_t* self,
enum cef_weburlrequest_flags_t flags)
{
DCHECK(self);
if(!self)
return;
CefRequestCppToC::Get(self)->SetFlags(flags);
}
cef_string_userfree_t CEF_CALLBACK request_get_first_party_for_cookies(
struct _cef_request_t* self)
{
DCHECK(self);
if(!self)
return NULL;
CefString urlStr = CefRequestCppToC::Get(self)->GetFirstPartyForCookies();
return urlStr.DetachToUserFree();
}
void CEF_CALLBACK request_set_first_party_for_cookies(
struct _cef_request_t* self, const cef_string_t* url)
{
DCHECK(self);
if(!self)
return;
CefRequestCppToC::Get(self)->SetFirstPartyForCookies(CefString(url));
}
// CONSTRUCTOR - Do not edit by hand.
@ -159,6 +200,12 @@ CefRequestCppToC::CefRequestCppToC(CefRequest* cls)
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_.get_flags = request_get_flags;
struct_.struct_.set_flags = request_set_flags;
struct_.struct_.get_first_party_for_cookies =
request_get_first_party_for_cookies;
struct_.struct_.set_first_party_for_cookies =
request_set_first_party_for_cookies;
}
#ifdef _DEBUG

View File

@ -0,0 +1,125 @@
// Copyright (c) 2010 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 "libcef_dll/cpptoc/web_urlrequest_client_cpptoc.h"
#include "libcef_dll/ctocpp/request_ctocpp.h"
#include "libcef_dll/ctocpp/response_ctocpp.h"
#include "libcef_dll/ctocpp/web_urlrequest_ctocpp.h"
// MEMBER FUNCTIONS - Body may be edited by hand.
void CEF_CALLBACK web_urlrequest_client_on_state_change(
struct _cef_web_urlrequest_client_t* self, cef_web_urlrequest_t* requester,
enum cef_weburlrequest_state_t state)
{
DCHECK(self);
DCHECK(requester);
if(!self || !requester)
return;
CefWebURLRequestClientCppToC::Get(self)->OnStateChange(
CefWebURLRequestCToCpp::Wrap(requester), state );
}
void CEF_CALLBACK web_urlrequest_client_on_redirect(
struct _cef_web_urlrequest_client_t* self, cef_web_urlrequest_t* requester,
cef_request_t* request, cef_response_t* response)
{
DCHECK(self);
DCHECK(requester);
DCHECK(request);
DCHECK(response);
if(!self || !requester || !request || !response)
return;
CefWebURLRequestClientCppToC::Get(self)->OnRedirect(
CefWebURLRequestCToCpp::Wrap(requester), CefRequestCToCpp::Wrap(request),
CefResponseCToCpp::Wrap(response));
}
void CEF_CALLBACK web_urlrequest_client_on_headers_received(
struct _cef_web_urlrequest_client_t* self, cef_web_urlrequest_t* requester,
cef_response_t* response)
{
DCHECK(self);
DCHECK(requester);
DCHECK(response);
if(!self || !requester || !response)
return;
CefWebURLRequestClientCppToC::Get(self)->OnHeadersReceived(
CefWebURLRequestCToCpp::Wrap(requester),
CefResponseCToCpp::Wrap(response));
}
void CEF_CALLBACK web_urlrequest_client_on_progress(
struct _cef_web_urlrequest_client_t* self, cef_web_urlrequest_t* requester,
uint64 bytesSent, uint64 totalBytesToBeSent)
{
DCHECK(self);
DCHECK(requester);
if(!self || !requester)
return;
CefWebURLRequestClientCppToC::Get(self)->OnProgress(
CefWebURLRequestCToCpp::Wrap(requester), bytesSent, totalBytesToBeSent);
}
void CEF_CALLBACK web_urlrequest_client_on_data(
struct _cef_web_urlrequest_client_t* self, cef_web_urlrequest_t* requester,
const void* data, int dataLength)
{
DCHECK(self);
DCHECK(requester);
if(!self || !requester)
return;
CefWebURLRequestClientCppToC::Get(self)->OnData(
CefWebURLRequestCToCpp::Wrap(requester), data, dataLength);
}
void CEF_CALLBACK web_urlrequest_client_on_error(
struct _cef_web_urlrequest_client_t* self, cef_web_urlrequest_t* requester,
enum cef_handler_errorcode_t errorCode)
{
DCHECK(self);
DCHECK(requester);
if(!self || !requester)
return;
CefWebURLRequestClientCppToC::Get(self)->OnError(
CefWebURLRequestCToCpp::Wrap(requester), errorCode);
}
// CONSTRUCTOR - Do not edit by hand.
CefWebURLRequestClientCppToC::CefWebURLRequestClientCppToC(
CefWebURLRequestClient* cls)
: CefCppToC<CefWebURLRequestClientCppToC, CefWebURLRequestClient,
cef_web_urlrequest_client_t>(cls)
{
struct_.struct_.on_state_change = web_urlrequest_client_on_state_change;
struct_.struct_.on_redirect = web_urlrequest_client_on_redirect;
struct_.struct_.on_headers_received =
web_urlrequest_client_on_headers_received;
struct_.struct_.on_progress = web_urlrequest_client_on_progress;
struct_.struct_.on_data = web_urlrequest_client_on_data;
struct_.struct_.on_error = web_urlrequest_client_on_error;
}
#ifdef _DEBUG
template<> long CefCppToC<CefWebURLRequestClientCppToC, CefWebURLRequestClient,
cef_web_urlrequest_client_t>::DebugObjCt = 0;
#endif

View File

@ -0,0 +1,35 @@
// Copyright (c) 2010 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.
//
// ---------------------------------------------------------------------------
//
// This file was generated by the CEF translator tool and should not edited
// by hand. See the translator.README.txt file in the tools directory for
// more information.
//
#ifndef _WEBURLREQUESTCLIENT_CPPTOC_H
#define _WEBURLREQUESTCLIENT_CPPTOC_H
#ifndef USING_CEF_SHARED
#pragma message("Warning: "__FILE__" may be accessed wrapper-side only")
#else // USING_CEF_SHARED
#include "include/cef.h"
#include "include/cef_capi.h"
#include "libcef_dll/cpptoc/cpptoc.h"
// Wrap a C++ class with a C structure.
// This class may be instantiated and accessed wrapper-side only.
class CefWebURLRequestClientCppToC
: public CefCppToC<CefWebURLRequestClientCppToC, CefWebURLRequestClient,
cef_web_urlrequest_client_t>
{
public:
CefWebURLRequestClientCppToC(CefWebURLRequestClient* cls);
virtual ~CefWebURLRequestClientCppToC() {}
};
#endif // USING_CEF_SHARED
#endif // _WEBURLREQUESTCLIENT_CPPTOC_H

View File

@ -0,0 +1,73 @@
// Copyright (c) 2010 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 "libcef_dll/cpptoc/request_cpptoc.h"
#include "libcef_dll/cpptoc/web_urlrequest_cpptoc.h"
#include "libcef_dll/ctocpp/web_urlrequest_client_ctocpp.h"
// GLOBAL FUNCTIONS - Body may be edited by hand.
CEF_EXPORT cef_web_urlrequest_t* cef_web_urlrequest_create(
cef_request_t* request, struct _cef_web_urlrequest_client_t* client)
{
CefRefPtr<CefRequest> requestPtr = CefRequestCppToC::Unwrap(request);
CefRefPtr<CefWebURLRequestClient> clientPtr;
if(client)
clientPtr = CefWebURLRequestClientCToCpp::Wrap(client);
CefRefPtr<CefWebURLRequest> impl =
CefWebURLRequest::CreateWebURLRequest(requestPtr, clientPtr);
if(impl.get())
return CefWebURLRequestCppToC::Wrap(impl);
return NULL;
}
// MEMBER FUNCTIONS - Body may be edited by hand.
void CEF_CALLBACK web_urlrequest_cancel(struct _cef_web_urlrequest_t* self)
{
DCHECK(self);
if(!self)
return;
CefWebURLRequestCppToC::Get(self)->Cancel();
}
enum cef_weburlrequest_state_t CEF_CALLBACK web_urlrequest_get_state(
struct _cef_web_urlrequest_t* self)
{
DCHECK(self);
if(!self)
return WUR_STATE_UNSENT;
return CefWebURLRequestCppToC::Get(self)->GetState();
}
// CONSTRUCTOR - Do not edit by hand.
CefWebURLRequestCppToC::CefWebURLRequestCppToC(CefWebURLRequest* cls)
: CefCppToC<CefWebURLRequestCppToC, CefWebURLRequest, cef_web_urlrequest_t>(
cls)
{
struct_.struct_.cancel = web_urlrequest_cancel;
struct_.struct_.get_state = web_urlrequest_get_state;
}
#ifdef _DEBUG
template<> long CefCppToC<CefWebURLRequestCppToC, CefWebURLRequest,
cef_web_urlrequest_t>::DebugObjCt = 0;
#endif

View File

@ -0,0 +1,35 @@
// Copyright (c) 2010 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.
//
// ---------------------------------------------------------------------------
//
// This file was generated by the CEF translator tool and should not edited
// by hand. See the translator.README.txt file in the tools directory for
// more information.
//
#ifndef _WEBURLREQUEST_CPPTOC_H
#define _WEBURLREQUEST_CPPTOC_H
#ifndef BUILDING_CEF_SHARED
#pragma message("Warning: "__FILE__" may be accessed DLL-side only")
#else // BUILDING_CEF_SHARED
#include "include/cef.h"
#include "include/cef_capi.h"
#include "libcef_dll/cpptoc/cpptoc.h"
// Wrap a C++ class with a C structure.
// This class may be instantiated and accessed DLL-side only.
class CefWebURLRequestCppToC
: public CefCppToC<CefWebURLRequestCppToC, CefWebURLRequest,
cef_web_urlrequest_t>
{
public:
CefWebURLRequestCppToC(CefWebURLRequest* cls);
virtual ~CefWebURLRequestCppToC() {}
};
#endif // BUILDING_CEF_SHARED
#endif // _WEBURLREQUEST_CPPTOC_H