cef/libcef_dll/cpptoc/request_handler_cpptoc.cc
Marshall Greenblatt ff976bc07f Break cef.h into multiple headers (issue #142).
- Move wrapper classes from cef_wrapper.h to wrapper/ directory.
- Move C API functions/classes from cef_capi.h to capi/ directory.
- Move global function implementations from cef_context.cc to *_impl.cc files.
- Output auto-generated file paths in cef_paths.gypi.

git-svn-id: https://chromiumembedded.googlecode.com/svn/trunk@442 5089003a-bbd8-11dd-ad1f-f1f9622dbc98
2011-12-23 17:36:30 +00:00

379 lines
11 KiB
C++

// 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.
//
// ---------------------------------------------------------------------------
//
// 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
// implementations. See the translator.README.txt file in the tools directory
// for more information.
//
#include "libcef_dll/cpptoc/content_filter_cpptoc.h"
#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,
cef_frame_t* frame, cef_request_t* request,
enum cef_handler_navtype_t navType, int isRedirect)
{
// AUTO-GENERATED CONTENT - DELETE THIS COMMENT BEFORE MODIFYING
DCHECK(self);
if (!self)
return 0;
// Verify param: browser; type: refptr_diff
DCHECK(browser);
if (!browser)
return 0;
// Verify param: frame; type: refptr_diff
DCHECK(frame);
if (!frame)
return 0;
// Verify param: request; type: refptr_diff
DCHECK(request);
if (!request)
return 0;
// 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;
}
int CEF_CALLBACK request_handler_on_before_resource_load(
struct _cef_request_handler_t* self, cef_browser_t* browser,
cef_request_t* request, cef_string_t* redirectUrl,
struct _cef_stream_reader_t** resourceStream,
struct _cef_response_t* response, int loadFlags)
{
// AUTO-GENERATED CONTENT - DELETE THIS COMMENT BEFORE MODIFYING
DCHECK(self);
if (!self)
return 0;
// Verify param: browser; type: refptr_diff
DCHECK(browser);
if (!browser)
return 0;
// Verify param: request; type: refptr_diff
DCHECK(request);
if (!request)
return 0;
// Verify param: redirectUrl; type: string_byref
DCHECK(redirectUrl);
if (!redirectUrl)
return 0;
// Verify param: resourceStream; type: refptr_diff_byref
DCHECK(resourceStream);
if (!resourceStream)
return 0;
// Verify param: response; type: refptr_diff
DCHECK(response);
if (!response)
return 0;
// Translate param: redirectUrl; type: string_byref
CefString redirectUrlStr(redirectUrl);
// 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);
// Restore param: resourceStream; type: refptr_diff_byref
if (resourceStream) {
if (resourceStreamPtr.get()) {
if (resourceStreamPtr.get() != resourceStreamOrig) {
*resourceStream = CefStreamReaderCToCpp::Unwrap(resourceStreamPtr);
}
} else {
*resourceStream = NULL;
}
}
// Return type: bool
return _retval;
}
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);
}
void CEF_CALLBACK request_handler_on_resource_response(
struct _cef_request_handler_t* self, cef_browser_t* browser,
const cef_string_t* url, struct _cef_response_t* response,
cef_content_filter_t** filter)
{
// 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: url; type: string_byref_const
DCHECK(url);
if (!url)
return;
// Verify param: response; type: refptr_diff
DCHECK(response);
if (!response)
return;
// Verify param: filter; type: refptr_same_byref
DCHECK(filter);
if (!filter)
return;
// Translate param: filter; type: refptr_same_byref
CefRefPtr<CefContentFilter> filterPtr;
if (filter && *filter)
filterPtr = CefContentFilterCppToC::Unwrap(*filter);
CefContentFilter* filterOrig = filterPtr.get();
// Execute
CefRequestHandlerCppToC::Get(self)->OnResourceResponse(
CefBrowserCToCpp::Wrap(browser),
CefString(url),
CefResponseCToCpp::Wrap(response),
filterPtr);
// Restore param: filter; type: refptr_same_byref
if (filter) {
if (filterPtr.get()) {
if (filterPtr.get() != filterOrig) {
*filter = CefContentFilterCppToC::Wrap(filterPtr);
}
} else {
*filter = NULL;
}
}
}
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)
{
// AUTO-GENERATED CONTENT - DELETE THIS COMMENT BEFORE MODIFYING
DCHECK(self);
if (!self)
return 0;
// Verify param: browser; type: refptr_diff
DCHECK(browser);
if (!browser)
return 0;
// Verify param: url; type: string_byref_const
DCHECK(url);
if (!url)
return 0;
// Verify param: allowOSExecution; type: bool_byref
DCHECK(allowOSExecution);
if (!allowOSExecution)
return 0;
// Translate param: allowOSExecution; type: bool_byref
bool allowOSExecutionBool = (
allowOSExecution && *allowOSExecution)?true:false;
// 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;
}
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,
int64 contentLength, cef_download_handler_t** handler)
{
// AUTO-GENERATED CONTENT - DELETE THIS COMMENT BEFORE MODIFYING
DCHECK(self);
if (!self)
return 0;
// Verify param: browser; type: refptr_diff
DCHECK(browser);
if (!browser)
return 0;
// Verify param: mimeType; type: string_byref_const
DCHECK(mimeType);
if (!mimeType)
return 0;
// Verify param: fileName; type: string_byref_const
DCHECK(fileName);
if (!fileName)
return 0;
// Verify param: handler; type: refptr_same_byref
DCHECK(handler);
if (!handler)
return 0;
// Translate param: handler; type: refptr_same_byref
CefRefPtr<CefDownloadHandler> handlerPtr;
if (handler && *handler)
handlerPtr = CefDownloadHandlerCppToC::Unwrap(*handler);
CefDownloadHandler* handlerOrig = handlerPtr.get();
// Execute
bool _retval = CefRequestHandlerCppToC::Get(self)->GetDownloadHandler(
CefBrowserCToCpp::Wrap(browser),
CefString(mimeType),
CefString(fileName),
contentLength,
handlerPtr);
// Restore param: handler; type: refptr_same_byref
if (handler) {
if (handlerPtr.get()) {
if (handlerPtr.get() != handlerOrig) {
*handler = CefDownloadHandlerCppToC::Wrap(handlerPtr);
}
} else {
*handler = NULL;
}
}
// Return type: bool
return _retval;
}
int CEF_CALLBACK request_handler_get_auth_credentials(
struct _cef_request_handler_t* self, cef_browser_t* browser, int isProxy,
const cef_string_t* host, int port, const cef_string_t* realm,
const cef_string_t* scheme, cef_string_t* username,
cef_string_t* password)
{
// AUTO-GENERATED CONTENT - DELETE THIS COMMENT BEFORE MODIFYING
DCHECK(self);
if (!self)
return 0;
// Verify param: browser; type: refptr_diff
DCHECK(browser);
if (!browser)
return 0;
// Verify param: host; type: string_byref_const
DCHECK(host);
if (!host)
return 0;
// Verify param: scheme; type: string_byref_const
DCHECK(scheme);
if (!scheme)
return 0;
// Verify param: username; type: string_byref
DCHECK(username);
if (!username)
return 0;
// Verify param: password; type: string_byref
DCHECK(password);
if (!password)
return 0;
// Unverified params: realm
// Translate param: username; type: string_byref
CefString usernameStr(username);
// Translate param: password; type: string_byref
CefString passwordStr(password);
// Execute
bool _retval = CefRequestHandlerCppToC::Get(self)->GetAuthCredentials(
CefBrowserCToCpp::Wrap(browser),
isProxy?true:false,
CefString(host),
port,
CefString(realm),
CefString(scheme),
usernameStr,
passwordStr);
// Return type: bool
return _retval;
}
// 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;
struct_.struct_.on_resource_redirect = request_handler_on_resource_redirect;
struct_.struct_.on_resource_response = request_handler_on_resource_response;
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