2011-05-20 16:42:25 +02:00
|
|
|
// Copyright (c) 2011 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.
|
|
|
|
//
|
|
|
|
// ---------------------------------------------------------------------------
|
|
|
|
//
|
2011-12-08 02:38:30 +01:00
|
|
|
// This file was generated by the CEF translator tool. If making changes by
|
|
|
|
// hand only do so within the body of existing method and function
|
2011-05-20 16:42:25 +02:00
|
|
|
// implementations. See the translator.README.txt file in the tools directory
|
|
|
|
// for more information.
|
|
|
|
//
|
|
|
|
|
2011-05-24 01:39:07 +02:00
|
|
|
#include "libcef_dll/cpptoc/content_filter_cpptoc.h"
|
2011-05-20 16:42:25 +02:00
|
|
|
#include "libcef_dll/cpptoc/download_handler_cpptoc.h"
|
|
|
|
#include "libcef_dll/cpptoc/request_handler_cpptoc.h"
|
|
|
|
#include "libcef_dll/ctocpp/browser_ctocpp.h"
|
|
|
|
#include "libcef_dll/ctocpp/frame_ctocpp.h"
|
|
|
|
#include "libcef_dll/ctocpp/request_ctocpp.h"
|
|
|
|
#include "libcef_dll/ctocpp/response_ctocpp.h"
|
|
|
|
#include "libcef_dll/ctocpp/stream_reader_ctocpp.h"
|
|
|
|
|
|
|
|
|
|
|
|
// MEMBER FUNCTIONS - Body may be edited by hand.
|
|
|
|
|
|
|
|
int CEF_CALLBACK request_handler_on_before_browse(
|
|
|
|
struct _cef_request_handler_t* self, cef_browser_t* browser,
|
2011-12-23 18:36:30 +01:00
|
|
|
cef_frame_t* frame, cef_request_t* request,
|
2011-05-20 16:42:25 +02:00
|
|
|
enum cef_handler_navtype_t navType, int isRedirect)
|
|
|
|
{
|
2011-12-08 02:38:30 +01:00
|
|
|
// AUTO-GENERATED CONTENT - DELETE THIS COMMENT BEFORE MODIFYING
|
|
|
|
|
2011-05-20 16:42:25 +02:00
|
|
|
DCHECK(self);
|
2011-12-08 02:38:30 +01:00
|
|
|
if (!self)
|
|
|
|
return 0;
|
|
|
|
// Verify param: browser; type: refptr_diff
|
2011-05-20 16:42:25 +02:00
|
|
|
DCHECK(browser);
|
2011-12-08 02:38:30 +01:00
|
|
|
if (!browser)
|
|
|
|
return 0;
|
|
|
|
// Verify param: frame; type: refptr_diff
|
2011-05-20 16:42:25 +02:00
|
|
|
DCHECK(frame);
|
2011-12-08 02:38:30 +01:00
|
|
|
if (!frame)
|
|
|
|
return 0;
|
|
|
|
// Verify param: request; type: refptr_diff
|
2011-05-20 16:42:25 +02:00
|
|
|
DCHECK(request);
|
2011-12-08 02:38:30 +01:00
|
|
|
if (!request)
|
2011-05-20 16:42:25 +02:00
|
|
|
return 0;
|
|
|
|
|
2011-12-08 02:38:30 +01:00
|
|
|
// Execute
|
|
|
|
bool _retval = CefRequestHandlerCppToC::Get(self)->OnBeforeBrowse(
|
|
|
|
CefBrowserCToCpp::Wrap(browser),
|
|
|
|
CefFrameCToCpp::Wrap(frame),
|
|
|
|
CefRequestCToCpp::Wrap(request),
|
|
|
|
navType,
|
|
|
|
isRedirect?true:false);
|
|
|
|
|
|
|
|
// Return type: bool
|
|
|
|
return _retval;
|
2011-05-20 16:42:25 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
int CEF_CALLBACK request_handler_on_before_resource_load(
|
|
|
|
struct _cef_request_handler_t* self, cef_browser_t* browser,
|
2011-12-23 18:36:30 +01:00
|
|
|
cef_request_t* request, cef_string_t* redirectUrl,
|
2011-05-20 16:42:25 +02:00
|
|
|
struct _cef_stream_reader_t** resourceStream,
|
|
|
|
struct _cef_response_t* response, int loadFlags)
|
|
|
|
{
|
2011-12-08 02:38:30 +01:00
|
|
|
// AUTO-GENERATED CONTENT - DELETE THIS COMMENT BEFORE MODIFYING
|
|
|
|
|
2011-05-20 16:42:25 +02:00
|
|
|
DCHECK(self);
|
2011-12-08 02:38:30 +01:00
|
|
|
if (!self)
|
|
|
|
return 0;
|
|
|
|
// Verify param: browser; type: refptr_diff
|
2011-05-20 16:42:25 +02:00
|
|
|
DCHECK(browser);
|
2011-12-08 02:38:30 +01:00
|
|
|
if (!browser)
|
|
|
|
return 0;
|
|
|
|
// Verify param: request; type: refptr_diff
|
2011-05-20 16:42:25 +02:00
|
|
|
DCHECK(request);
|
2011-12-08 02:38:30 +01:00
|
|
|
if (!request)
|
|
|
|
return 0;
|
|
|
|
// Verify param: redirectUrl; type: string_byref
|
2011-05-20 16:42:25 +02:00
|
|
|
DCHECK(redirectUrl);
|
2011-12-08 02:38:30 +01:00
|
|
|
if (!redirectUrl)
|
|
|
|
return 0;
|
|
|
|
// Verify param: resourceStream; type: refptr_diff_byref
|
2011-05-20 16:42:25 +02:00
|
|
|
DCHECK(resourceStream);
|
2011-12-08 02:38:30 +01:00
|
|
|
if (!resourceStream)
|
|
|
|
return 0;
|
|
|
|
// Verify param: response; type: refptr_diff
|
2011-05-20 16:42:25 +02:00
|
|
|
DCHECK(response);
|
2011-12-08 02:38:30 +01:00
|
|
|
if (!response)
|
2011-05-20 16:42:25 +02:00
|
|
|
return 0;
|
|
|
|
|
2011-12-08 02:38:30 +01:00
|
|
|
// Translate param: redirectUrl; type: string_byref
|
2011-05-20 16:42:25 +02:00
|
|
|
CefString redirectUrlStr(redirectUrl);
|
2011-12-08 02:38:30 +01:00
|
|
|
// Translate param: resourceStream; type: refptr_diff_byref
|
|
|
|
CefRefPtr<CefStreamReader> resourceStreamPtr;
|
|
|
|
if (resourceStream && *resourceStream)
|
|
|
|
resourceStreamPtr = CefStreamReaderCToCpp::Wrap(*resourceStream);
|
|
|
|
CefStreamReader* resourceStreamOrig = resourceStreamPtr.get();
|
|
|
|
|
|
|
|
// Execute
|
|
|
|
bool _retval = CefRequestHandlerCppToC::Get(self)->OnBeforeResourceLoad(
|
|
|
|
CefBrowserCToCpp::Wrap(browser),
|
|
|
|
CefRequestCToCpp::Wrap(request),
|
|
|
|
redirectUrlStr,
|
|
|
|
resourceStreamPtr,
|
|
|
|
CefResponseCToCpp::Wrap(response),
|
|
|
|
loadFlags);
|
2011-05-20 16:42:25 +02:00
|
|
|
|
2011-12-08 02:38:30 +01:00
|
|
|
// Restore param: resourceStream; type: refptr_diff_byref
|
|
|
|
if (resourceStream) {
|
|
|
|
if (resourceStreamPtr.get()) {
|
|
|
|
if (resourceStreamPtr.get() != resourceStreamOrig) {
|
|
|
|
*resourceStream = CefStreamReaderCToCpp::Unwrap(resourceStreamPtr);
|
|
|
|
}
|
|
|
|
} else {
|
|
|
|
*resourceStream = NULL;
|
|
|
|
}
|
|
|
|
}
|
2011-05-20 16:42:25 +02:00
|
|
|
|
2011-12-08 02:38:30 +01:00
|
|
|
// Return type: bool
|
|
|
|
return _retval;
|
2011-05-20 16:42:25 +02:00
|
|
|
}
|
|
|
|
|
2011-12-12 18:34:24 +01:00
|
|
|
void CEF_CALLBACK request_handler_on_resource_redirect(
|
|
|
|
struct _cef_request_handler_t* self, cef_browser_t* browser,
|
|
|
|
const cef_string_t* old_url, cef_string_t* new_url)
|
|
|
|
{
|
|
|
|
// AUTO-GENERATED CONTENT - DELETE THIS COMMENT BEFORE MODIFYING
|
|
|
|
|
|
|
|
DCHECK(self);
|
|
|
|
if (!self)
|
|
|
|
return;
|
|
|
|
// Verify param: browser; type: refptr_diff
|
|
|
|
DCHECK(browser);
|
|
|
|
if (!browser)
|
|
|
|
return;
|
|
|
|
// Verify param: old_url; type: string_byref_const
|
|
|
|
DCHECK(old_url);
|
|
|
|
if (!old_url)
|
|
|
|
return;
|
|
|
|
// Verify param: new_url; type: string_byref
|
|
|
|
DCHECK(new_url);
|
|
|
|
if (!new_url)
|
|
|
|
return;
|
|
|
|
|
|
|
|
// Translate param: new_url; type: string_byref
|
|
|
|
CefString new_urlStr(new_url);
|
|
|
|
|
|
|
|
// Execute
|
|
|
|
CefRequestHandlerCppToC::Get(self)->OnResourceRedirect(
|
|
|
|
CefBrowserCToCpp::Wrap(browser),
|
|
|
|
CefString(old_url),
|
|
|
|
new_urlStr);
|
|
|
|
}
|
|
|
|
|
2011-07-02 19:57:00 +02:00
|
|
|
void CEF_CALLBACK request_handler_on_resource_response(
|
2011-05-24 01:39:07 +02:00
|
|
|
struct _cef_request_handler_t* self, cef_browser_t* browser,
|
|
|
|
const cef_string_t* url, struct _cef_response_t* response,
|
2011-12-23 18:36:30 +01:00
|
|
|
cef_content_filter_t** filter)
|
2011-05-24 01:39:07 +02:00
|
|
|
{
|
2011-12-08 02:38:30 +01:00
|
|
|
// AUTO-GENERATED CONTENT - DELETE THIS COMMENT BEFORE MODIFYING
|
|
|
|
|
2011-05-24 01:39:07 +02:00
|
|
|
DCHECK(self);
|
2011-12-08 02:38:30 +01:00
|
|
|
if (!self)
|
|
|
|
return;
|
|
|
|
// Verify param: browser; type: refptr_diff
|
2011-05-24 01:39:07 +02:00
|
|
|
DCHECK(browser);
|
2011-12-08 02:38:30 +01:00
|
|
|
if (!browser)
|
|
|
|
return;
|
|
|
|
// Verify param: url; type: string_byref_const
|
2011-05-24 01:39:07 +02:00
|
|
|
DCHECK(url);
|
2011-12-08 02:38:30 +01:00
|
|
|
if (!url)
|
|
|
|
return;
|
|
|
|
// Verify param: response; type: refptr_diff
|
2011-05-24 01:39:07 +02:00
|
|
|
DCHECK(response);
|
2011-12-08 02:38:30 +01:00
|
|
|
if (!response)
|
|
|
|
return;
|
|
|
|
// Verify param: filter; type: refptr_same_byref
|
2011-05-24 01:39:07 +02:00
|
|
|
DCHECK(filter);
|
2011-12-08 02:38:30 +01:00
|
|
|
if (!filter)
|
2011-05-24 01:39:07 +02:00
|
|
|
return;
|
|
|
|
|
2011-12-08 02:38:30 +01:00
|
|
|
// Translate param: filter; type: refptr_same_byref
|
2011-05-24 01:39:07 +02:00
|
|
|
CefRefPtr<CefContentFilter> filterPtr;
|
2011-12-08 02:38:30 +01:00
|
|
|
if (filter && *filter)
|
|
|
|
filterPtr = CefContentFilterCppToC::Unwrap(*filter);
|
|
|
|
CefContentFilter* filterOrig = filterPtr.get();
|
2011-05-24 01:39:07 +02:00
|
|
|
|
2011-12-08 02:38:30 +01:00
|
|
|
// Execute
|
2011-07-02 19:57:00 +02:00
|
|
|
CefRequestHandlerCppToC::Get(self)->OnResourceResponse(
|
2011-12-08 02:38:30 +01:00
|
|
|
CefBrowserCToCpp::Wrap(browser),
|
|
|
|
CefString(url),
|
|
|
|
CefResponseCToCpp::Wrap(response),
|
2011-05-24 01:39:07 +02:00
|
|
|
filterPtr);
|
|
|
|
|
2011-12-08 02:38:30 +01:00
|
|
|
// Restore param: filter; type: refptr_same_byref
|
|
|
|
if (filter) {
|
|
|
|
if (filterPtr.get()) {
|
|
|
|
if (filterPtr.get() != filterOrig) {
|
|
|
|
*filter = CefContentFilterCppToC::Wrap(filterPtr);
|
|
|
|
}
|
|
|
|
} else {
|
|
|
|
*filter = NULL;
|
|
|
|
}
|
|
|
|
}
|
2011-05-24 01:39:07 +02:00
|
|
|
}
|
|
|
|
|
2011-05-20 16:42:25 +02:00
|
|
|
int CEF_CALLBACK request_handler_on_protocol_execution(
|
|
|
|
struct _cef_request_handler_t* self, cef_browser_t* browser,
|
|
|
|
const cef_string_t* url, int* allowOSExecution)
|
|
|
|
{
|
2011-12-08 02:38:30 +01:00
|
|
|
// AUTO-GENERATED CONTENT - DELETE THIS COMMENT BEFORE MODIFYING
|
|
|
|
|
2011-05-20 16:42:25 +02:00
|
|
|
DCHECK(self);
|
2011-12-08 02:38:30 +01:00
|
|
|
if (!self)
|
|
|
|
return 0;
|
|
|
|
// Verify param: browser; type: refptr_diff
|
2011-05-20 16:42:25 +02:00
|
|
|
DCHECK(browser);
|
2011-12-08 02:38:30 +01:00
|
|
|
if (!browser)
|
|
|
|
return 0;
|
|
|
|
// Verify param: url; type: string_byref_const
|
2011-05-20 16:42:25 +02:00
|
|
|
DCHECK(url);
|
2011-12-08 02:38:30 +01:00
|
|
|
if (!url)
|
|
|
|
return 0;
|
|
|
|
// Verify param: allowOSExecution; type: bool_byref
|
2011-05-20 16:42:25 +02:00
|
|
|
DCHECK(allowOSExecution);
|
2011-12-08 02:38:30 +01:00
|
|
|
if (!allowOSExecution)
|
2011-05-20 16:42:25 +02:00
|
|
|
return 0;
|
|
|
|
|
2011-12-08 02:38:30 +01:00
|
|
|
// Translate param: allowOSExecution; type: bool_byref
|
|
|
|
bool allowOSExecutionBool = (
|
|
|
|
allowOSExecution && *allowOSExecution)?true:false;
|
2011-05-20 16:42:25 +02:00
|
|
|
|
2011-12-08 02:38:30 +01:00
|
|
|
// Execute
|
|
|
|
bool _retval = CefRequestHandlerCppToC::Get(self)->OnProtocolExecution(
|
|
|
|
CefBrowserCToCpp::Wrap(browser),
|
|
|
|
CefString(url),
|
|
|
|
allowOSExecutionBool);
|
|
|
|
|
|
|
|
// Restore param: allowOSExecution; type: bool_byref
|
|
|
|
if (allowOSExecution)
|
|
|
|
*allowOSExecution = allowOSExecutionBool?true:false;
|
|
|
|
|
|
|
|
// Return type: bool
|
|
|
|
return _retval;
|
2011-05-20 16:42:25 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
int CEF_CALLBACK request_handler_get_download_handler(
|
|
|
|
struct _cef_request_handler_t* self, cef_browser_t* browser,
|
|
|
|
const cef_string_t* mimeType, const cef_string_t* fileName,
|
2011-12-23 18:36:30 +01:00
|
|
|
int64 contentLength, cef_download_handler_t** handler)
|
2011-05-20 16:42:25 +02:00
|
|
|
{
|
2011-12-08 02:38:30 +01:00
|
|
|
// AUTO-GENERATED CONTENT - DELETE THIS COMMENT BEFORE MODIFYING
|
|
|
|
|
2011-05-20 16:42:25 +02:00
|
|
|
DCHECK(self);
|
2011-12-08 02:38:30 +01:00
|
|
|
if (!self)
|
|
|
|
return 0;
|
|
|
|
// Verify param: browser; type: refptr_diff
|
2011-05-20 16:42:25 +02:00
|
|
|
DCHECK(browser);
|
2011-12-08 02:38:30 +01:00
|
|
|
if (!browser)
|
|
|
|
return 0;
|
|
|
|
// Verify param: mimeType; type: string_byref_const
|
2011-05-20 16:42:25 +02:00
|
|
|
DCHECK(mimeType);
|
2011-12-08 02:38:30 +01:00
|
|
|
if (!mimeType)
|
|
|
|
return 0;
|
|
|
|
// Verify param: fileName; type: string_byref_const
|
2011-05-20 16:42:25 +02:00
|
|
|
DCHECK(fileName);
|
2011-12-08 02:38:30 +01:00
|
|
|
if (!fileName)
|
|
|
|
return 0;
|
|
|
|
// Verify param: handler; type: refptr_same_byref
|
2011-05-20 16:42:25 +02:00
|
|
|
DCHECK(handler);
|
2011-12-08 02:38:30 +01:00
|
|
|
if (!handler)
|
2011-05-20 16:42:25 +02:00
|
|
|
return 0;
|
|
|
|
|
2011-12-08 02:38:30 +01:00
|
|
|
// Translate param: handler; type: refptr_same_byref
|
|
|
|
CefRefPtr<CefDownloadHandler> handlerPtr;
|
|
|
|
if (handler && *handler)
|
|
|
|
handlerPtr = CefDownloadHandlerCppToC::Unwrap(*handler);
|
|
|
|
CefDownloadHandler* handlerOrig = handlerPtr.get();
|
2011-05-20 16:42:25 +02:00
|
|
|
|
2011-12-08 02:38:30 +01:00
|
|
|
// Execute
|
|
|
|
bool _retval = CefRequestHandlerCppToC::Get(self)->GetDownloadHandler(
|
|
|
|
CefBrowserCToCpp::Wrap(browser),
|
|
|
|
CefString(mimeType),
|
|
|
|
CefString(fileName),
|
|
|
|
contentLength,
|
|
|
|
handlerPtr);
|
2011-05-20 16:42:25 +02:00
|
|
|
|
2011-12-08 02:38:30 +01:00
|
|
|
// Restore param: handler; type: refptr_same_byref
|
|
|
|
if (handler) {
|
|
|
|
if (handlerPtr.get()) {
|
|
|
|
if (handlerPtr.get() != handlerOrig) {
|
|
|
|
*handler = CefDownloadHandlerCppToC::Wrap(handlerPtr);
|
|
|
|
}
|
|
|
|
} else {
|
|
|
|
*handler = NULL;
|
|
|
|
}
|
|
|
|
}
|
2011-05-20 16:42:25 +02:00
|
|
|
|
2011-12-08 02:38:30 +01:00
|
|
|
// Return type: bool
|
|
|
|
return _retval;
|
2011-05-20 16:42:25 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
int CEF_CALLBACK request_handler_get_auth_credentials(
|
|
|
|
struct _cef_request_handler_t* self, cef_browser_t* browser, int isProxy,
|
2011-09-23 02:16:03 +02:00
|
|
|
const cef_string_t* host, int port, const cef_string_t* realm,
|
2011-05-20 16:42:25 +02:00
|
|
|
const cef_string_t* scheme, cef_string_t* username,
|
|
|
|
cef_string_t* password)
|
|
|
|
{
|
2011-12-08 02:38:30 +01:00
|
|
|
// AUTO-GENERATED CONTENT - DELETE THIS COMMENT BEFORE MODIFYING
|
|
|
|
|
2011-05-20 16:42:25 +02:00
|
|
|
DCHECK(self);
|
2011-12-08 02:38:30 +01:00
|
|
|
if (!self)
|
|
|
|
return 0;
|
|
|
|
// Verify param: browser; type: refptr_diff
|
2011-05-20 16:42:25 +02:00
|
|
|
DCHECK(browser);
|
2011-12-08 02:38:30 +01:00
|
|
|
if (!browser)
|
|
|
|
return 0;
|
|
|
|
// Verify param: host; type: string_byref_const
|
2011-05-20 16:42:25 +02:00
|
|
|
DCHECK(host);
|
2011-12-08 02:38:30 +01:00
|
|
|
if (!host)
|
|
|
|
return 0;
|
|
|
|
// Verify param: scheme; type: string_byref_const
|
2011-05-20 16:42:25 +02:00
|
|
|
DCHECK(scheme);
|
2011-12-08 02:38:30 +01:00
|
|
|
if (!scheme)
|
|
|
|
return 0;
|
|
|
|
// Verify param: username; type: string_byref
|
2011-05-20 16:42:25 +02:00
|
|
|
DCHECK(username);
|
2011-12-08 02:38:30 +01:00
|
|
|
if (!username)
|
|
|
|
return 0;
|
|
|
|
// Verify param: password; type: string_byref
|
2011-05-20 16:42:25 +02:00
|
|
|
DCHECK(password);
|
2011-12-08 02:38:30 +01:00
|
|
|
if (!password)
|
2011-05-20 16:42:25 +02:00
|
|
|
return 0;
|
2011-12-16 14:50:15 +01:00
|
|
|
// Unverified params: realm
|
2011-05-20 16:42:25 +02:00
|
|
|
|
2011-12-08 02:38:30 +01:00
|
|
|
// Translate param: username; type: string_byref
|
2011-05-20 16:42:25 +02:00
|
|
|
CefString usernameStr(username);
|
2011-12-08 02:38:30 +01:00
|
|
|
// Translate param: password; type: string_byref
|
2011-05-20 16:42:25 +02:00
|
|
|
CefString passwordStr(password);
|
2011-12-08 02:38:30 +01:00
|
|
|
|
|
|
|
// Execute
|
|
|
|
bool _retval = CefRequestHandlerCppToC::Get(self)->GetAuthCredentials(
|
|
|
|
CefBrowserCToCpp::Wrap(browser),
|
|
|
|
isProxy?true:false,
|
|
|
|
CefString(host),
|
|
|
|
port,
|
|
|
|
CefString(realm),
|
|
|
|
CefString(scheme),
|
|
|
|
usernameStr,
|
2011-05-20 16:42:25 +02:00
|
|
|
passwordStr);
|
2011-12-08 02:38:30 +01:00
|
|
|
|
|
|
|
// Return type: bool
|
|
|
|
return _retval;
|
2011-05-20 16:42:25 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
// CONSTRUCTOR - Do not edit by hand.
|
|
|
|
|
|
|
|
CefRequestHandlerCppToC::CefRequestHandlerCppToC(CefRequestHandler* cls)
|
|
|
|
: CefCppToC<CefRequestHandlerCppToC, CefRequestHandler,
|
|
|
|
cef_request_handler_t>(cls)
|
|
|
|
{
|
|
|
|
struct_.struct_.on_before_browse = request_handler_on_before_browse;
|
|
|
|
struct_.struct_.on_before_resource_load =
|
|
|
|
request_handler_on_before_resource_load;
|
2011-12-12 18:34:24 +01:00
|
|
|
struct_.struct_.on_resource_redirect = request_handler_on_resource_redirect;
|
2011-07-02 19:57:00 +02:00
|
|
|
struct_.struct_.on_resource_response = request_handler_on_resource_response;
|
2011-05-20 16:42:25 +02:00
|
|
|
struct_.struct_.on_protocol_execution = request_handler_on_protocol_execution;
|
|
|
|
struct_.struct_.get_download_handler = request_handler_get_download_handler;
|
|
|
|
struct_.struct_.get_auth_credentials = request_handler_get_auth_credentials;
|
|
|
|
}
|
|
|
|
|
|
|
|
#ifndef NDEBUG
|
|
|
|
template<> long CefCppToC<CefRequestHandlerCppToC, CefRequestHandler,
|
|
|
|
cef_request_handler_t>::DebugObjCt = 0;
|
|
|
|
#endif
|
|
|
|
|