2012-01-10 00:46:23 +01:00
|
|
|
// Copyright (c) 2012 The Chromium Embedded Framework Authors. All rights
|
2011-05-20 16:42:25 +02:00
|
|
|
// 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
|
|
|
|
// implementations. See the translator.README.txt file in the tools directory
|
|
|
|
// for more information.
|
2011-05-20 16:42:25 +02:00
|
|
|
//
|
|
|
|
|
|
|
|
#include "libcef_dll/cpptoc/browser_cpptoc.h"
|
2012-03-22 23:09:09 +01:00
|
|
|
#include "libcef_dll/cpptoc/cookie_manager_cpptoc.h"
|
2011-05-20 16:42:25 +02:00
|
|
|
#include "libcef_dll/cpptoc/frame_cpptoc.h"
|
|
|
|
#include "libcef_dll/cpptoc/request_cpptoc.h"
|
|
|
|
#include "libcef_dll/cpptoc/response_cpptoc.h"
|
|
|
|
#include "libcef_dll/cpptoc/stream_reader_cpptoc.h"
|
2011-05-24 01:39:07 +02:00
|
|
|
#include "libcef_dll/ctocpp/content_filter_ctocpp.h"
|
2011-05-20 16:42:25 +02:00
|
|
|
#include "libcef_dll/ctocpp/download_handler_ctocpp.h"
|
|
|
|
#include "libcef_dll/ctocpp/request_handler_ctocpp.h"
|
|
|
|
|
|
|
|
|
|
|
|
// VIRTUAL METHODS - Body may be edited by hand.
|
|
|
|
|
|
|
|
bool CefRequestHandlerCToCpp::OnBeforeBrowse(CefRefPtr<CefBrowser> browser,
|
|
|
|
CefRefPtr<CefFrame> frame, CefRefPtr<CefRequest> request, NavType navType,
|
2012-01-10 00:46:23 +01:00
|
|
|
bool isRedirect) {
|
2011-05-20 16:42:25 +02:00
|
|
|
if (CEF_MEMBER_MISSING(struct_, on_before_browse))
|
2011-12-08 02:38:30 +01:00
|
|
|
return false;
|
|
|
|
|
|
|
|
// AUTO-GENERATED CONTENT - DELETE THIS COMMENT BEFORE MODIFYING
|
|
|
|
|
|
|
|
// Verify param: browser; type: refptr_diff
|
|
|
|
DCHECK(browser.get());
|
|
|
|
if (!browser.get())
|
|
|
|
return false;
|
|
|
|
// Verify param: frame; type: refptr_diff
|
|
|
|
DCHECK(frame.get());
|
|
|
|
if (!frame.get())
|
|
|
|
return false;
|
|
|
|
// Verify param: request; type: refptr_diff
|
|
|
|
DCHECK(request.get());
|
|
|
|
if (!request.get())
|
|
|
|
return false;
|
2011-05-20 16:42:25 +02:00
|
|
|
|
2011-12-08 02:38:30 +01:00
|
|
|
// Execute
|
|
|
|
int _retval = struct_->on_before_browse(struct_,
|
|
|
|
CefBrowserCppToC::Wrap(browser),
|
|
|
|
CefFrameCppToC::Wrap(frame),
|
|
|
|
CefRequestCppToC::Wrap(request),
|
|
|
|
navType,
|
|
|
|
isRedirect);
|
|
|
|
|
|
|
|
// Return type: bool
|
|
|
|
return _retval?true:false;
|
2011-05-20 16:42:25 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
bool CefRequestHandlerCToCpp::OnBeforeResourceLoad(
|
|
|
|
CefRefPtr<CefBrowser> browser, CefRefPtr<CefRequest> request,
|
|
|
|
CefString& redirectUrl, CefRefPtr<CefStreamReader>& resourceStream,
|
2012-01-10 00:46:23 +01:00
|
|
|
CefRefPtr<CefResponse> response, int loadFlags) {
|
2011-05-20 16:42:25 +02:00
|
|
|
if (CEF_MEMBER_MISSING(struct_, on_before_resource_load))
|
|
|
|
return false;
|
|
|
|
|
2011-12-08 02:38:30 +01:00
|
|
|
// AUTO-GENERATED CONTENT - DELETE THIS COMMENT BEFORE MODIFYING
|
|
|
|
|
|
|
|
// Verify param: browser; type: refptr_diff
|
|
|
|
DCHECK(browser.get());
|
|
|
|
if (!browser.get())
|
|
|
|
return false;
|
|
|
|
// Verify param: request; type: refptr_diff
|
|
|
|
DCHECK(request.get());
|
|
|
|
if (!request.get())
|
|
|
|
return false;
|
|
|
|
// Verify param: response; type: refptr_diff
|
|
|
|
DCHECK(response.get());
|
|
|
|
if (!response.get())
|
|
|
|
return false;
|
|
|
|
|
|
|
|
// Translate param: resourceStream; type: refptr_diff_byref
|
|
|
|
cef_stream_reader_t* resourceStreamStruct = NULL;
|
2012-01-10 00:46:23 +01:00
|
|
|
if (resourceStream.get())
|
2011-12-08 02:38:30 +01:00
|
|
|
resourceStreamStruct = CefStreamReaderCppToC::Wrap(resourceStream);
|
|
|
|
cef_stream_reader_t* resourceStreamOrig = resourceStreamStruct;
|
2011-05-20 16:42:25 +02:00
|
|
|
|
2011-12-08 02:38:30 +01:00
|
|
|
// Execute
|
|
|
|
int _retval = struct_->on_before_resource_load(struct_,
|
|
|
|
CefBrowserCppToC::Wrap(browser),
|
|
|
|
CefRequestCppToC::Wrap(request),
|
|
|
|
redirectUrl.GetWritableStruct(),
|
|
|
|
&resourceStreamStruct,
|
|
|
|
CefResponseCppToC::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 (resourceStreamStruct) {
|
|
|
|
if (resourceStreamStruct != resourceStreamOrig) {
|
|
|
|
resourceStream = CefStreamReaderCppToC::Unwrap(resourceStreamStruct);
|
|
|
|
}
|
|
|
|
} else {
|
|
|
|
resourceStream = NULL;
|
|
|
|
}
|
2011-05-20 16:42:25 +02:00
|
|
|
|
2011-12-08 02:38:30 +01:00
|
|
|
// Return type: bool
|
|
|
|
return _retval?true:false;
|
2011-05-20 16:42:25 +02:00
|
|
|
}
|
|
|
|
|
2011-12-12 18:34:24 +01:00
|
|
|
void CefRequestHandlerCToCpp::OnResourceRedirect(CefRefPtr<CefBrowser> browser,
|
2012-01-10 00:46:23 +01:00
|
|
|
const CefString& old_url, CefString& new_url) {
|
2011-12-12 18:34:24 +01:00
|
|
|
if (CEF_MEMBER_MISSING(struct_, on_resource_redirect))
|
|
|
|
return;
|
|
|
|
|
|
|
|
// AUTO-GENERATED CONTENT - DELETE THIS COMMENT BEFORE MODIFYING
|
|
|
|
|
|
|
|
// Verify param: browser; type: refptr_diff
|
|
|
|
DCHECK(browser.get());
|
|
|
|
if (!browser.get())
|
|
|
|
return;
|
|
|
|
// Verify param: old_url; type: string_byref_const
|
|
|
|
DCHECK(!old_url.empty());
|
|
|
|
if (old_url.empty())
|
|
|
|
return;
|
|
|
|
|
|
|
|
// Execute
|
|
|
|
struct_->on_resource_redirect(struct_,
|
|
|
|
CefBrowserCppToC::Wrap(browser),
|
|
|
|
old_url.GetStruct(),
|
|
|
|
new_url.GetWritableStruct());
|
|
|
|
}
|
|
|
|
|
2011-07-02 19:57:00 +02:00
|
|
|
void CefRequestHandlerCToCpp::OnResourceResponse(CefRefPtr<CefBrowser> browser,
|
2011-05-24 01:39:07 +02:00
|
|
|
const CefString& url, CefRefPtr<CefResponse> response,
|
2012-01-10 00:46:23 +01:00
|
|
|
CefRefPtr<CefContentFilter>& filter) {
|
2011-07-02 19:57:00 +02:00
|
|
|
if (CEF_MEMBER_MISSING(struct_, on_resource_response))
|
2011-05-24 01:39:07 +02:00
|
|
|
return;
|
|
|
|
|
2011-12-08 02:38:30 +01:00
|
|
|
// AUTO-GENERATED CONTENT - DELETE THIS COMMENT BEFORE MODIFYING
|
2011-05-24 01:39:07 +02:00
|
|
|
|
2011-12-08 02:38:30 +01:00
|
|
|
// Verify param: browser; type: refptr_diff
|
|
|
|
DCHECK(browser.get());
|
|
|
|
if (!browser.get())
|
|
|
|
return;
|
|
|
|
// Verify param: url; type: string_byref_const
|
|
|
|
DCHECK(!url.empty());
|
|
|
|
if (url.empty())
|
|
|
|
return;
|
|
|
|
// Verify param: response; type: refptr_diff
|
|
|
|
DCHECK(response.get());
|
|
|
|
if (!response.get())
|
|
|
|
return;
|
|
|
|
|
|
|
|
// Translate param: filter; type: refptr_same_byref
|
|
|
|
cef_content_filter_t* filterStruct = NULL;
|
2012-01-10 00:46:23 +01:00
|
|
|
if (filter.get())
|
2011-12-08 02:38:30 +01:00
|
|
|
filterStruct = CefContentFilterCToCpp::Unwrap(filter);
|
|
|
|
cef_content_filter_t* filterOrig = filterStruct;
|
|
|
|
|
|
|
|
// Execute
|
2011-07-02 19:57:00 +02:00
|
|
|
struct_->on_resource_response(struct_,
|
2011-12-08 02:38:30 +01:00
|
|
|
CefBrowserCppToC::Wrap(browser),
|
|
|
|
url.GetStruct(),
|
|
|
|
CefResponseCppToC::Wrap(response),
|
|
|
|
&filterStruct);
|
|
|
|
|
|
|
|
// Restore param:filter; type: refptr_same_byref
|
|
|
|
if (filterStruct) {
|
|
|
|
if (filterStruct != filterOrig) {
|
|
|
|
filter = CefContentFilterCToCpp::Wrap(filterStruct);
|
|
|
|
}
|
|
|
|
} else {
|
|
|
|
filter = NULL;
|
|
|
|
}
|
2011-05-24 01:39:07 +02:00
|
|
|
}
|
|
|
|
|
2011-05-20 16:42:25 +02:00
|
|
|
bool CefRequestHandlerCToCpp::OnProtocolExecution(CefRefPtr<CefBrowser> browser,
|
2012-01-10 00:46:23 +01:00
|
|
|
const CefString& url, bool& allowOSExecution) {
|
2011-05-20 16:42:25 +02:00
|
|
|
if (CEF_MEMBER_MISSING(struct_, on_protocol_execution))
|
|
|
|
return false;
|
|
|
|
|
2011-12-08 02:38:30 +01:00
|
|
|
// AUTO-GENERATED CONTENT - DELETE THIS COMMENT BEFORE MODIFYING
|
|
|
|
|
|
|
|
// Verify param: browser; type: refptr_diff
|
|
|
|
DCHECK(browser.get());
|
|
|
|
if (!browser.get())
|
|
|
|
return false;
|
|
|
|
// Verify param: url; type: string_byref_const
|
|
|
|
DCHECK(!url.empty());
|
|
|
|
if (url.empty())
|
|
|
|
return false;
|
|
|
|
|
|
|
|
// Translate param: allowOSExecution; type: bool_byref
|
|
|
|
int allowOSExecutionInt = allowOSExecution;
|
|
|
|
|
|
|
|
// Execute
|
|
|
|
int _retval = struct_->on_protocol_execution(struct_,
|
|
|
|
CefBrowserCppToC::Wrap(browser),
|
|
|
|
url.GetStruct(),
|
|
|
|
&allowOSExecutionInt);
|
|
|
|
|
|
|
|
// Restore param:allowOSExecution; type: bool_byref
|
|
|
|
allowOSExecution = allowOSExecutionInt?true:false;
|
|
|
|
|
|
|
|
// Return type: bool
|
|
|
|
return _retval?true:false;
|
2011-05-20 16:42:25 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
bool CefRequestHandlerCToCpp::GetDownloadHandler(CefRefPtr<CefBrowser> browser,
|
|
|
|
const CefString& mimeType, const CefString& fileName, int64 contentLength,
|
2012-01-10 00:46:23 +01:00
|
|
|
CefRefPtr<CefDownloadHandler>& handler) {
|
2011-05-20 16:42:25 +02:00
|
|
|
if (CEF_MEMBER_MISSING(struct_, get_download_handler))
|
|
|
|
return false;
|
|
|
|
|
2011-12-08 02:38:30 +01:00
|
|
|
// AUTO-GENERATED CONTENT - DELETE THIS COMMENT BEFORE MODIFYING
|
|
|
|
|
|
|
|
// Verify param: browser; type: refptr_diff
|
|
|
|
DCHECK(browser.get());
|
|
|
|
if (!browser.get())
|
|
|
|
return false;
|
|
|
|
// Verify param: mimeType; type: string_byref_const
|
|
|
|
DCHECK(!mimeType.empty());
|
|
|
|
if (mimeType.empty())
|
|
|
|
return false;
|
|
|
|
// Verify param: fileName; type: string_byref_const
|
|
|
|
DCHECK(!fileName.empty());
|
|
|
|
if (fileName.empty())
|
|
|
|
return false;
|
2011-05-20 16:42:25 +02:00
|
|
|
|
2011-12-08 02:38:30 +01:00
|
|
|
// Translate param: handler; type: refptr_same_byref
|
|
|
|
cef_download_handler_t* handlerStruct = NULL;
|
2012-01-10 00:46:23 +01:00
|
|
|
if (handler.get())
|
2011-12-08 02:38:30 +01:00
|
|
|
handlerStruct = CefDownloadHandlerCToCpp::Unwrap(handler);
|
|
|
|
cef_download_handler_t* handlerOrig = handlerStruct;
|
2011-05-20 16:42:25 +02:00
|
|
|
|
2011-12-08 02:38:30 +01:00
|
|
|
// Execute
|
|
|
|
int _retval = struct_->get_download_handler(struct_,
|
|
|
|
CefBrowserCppToC::Wrap(browser),
|
|
|
|
mimeType.GetStruct(),
|
|
|
|
fileName.GetStruct(),
|
|
|
|
contentLength,
|
|
|
|
&handlerStruct);
|
2011-05-20 16:42:25 +02:00
|
|
|
|
2011-12-08 02:38:30 +01:00
|
|
|
// Restore param:handler; type: refptr_same_byref
|
|
|
|
if (handlerStruct) {
|
|
|
|
if (handlerStruct != handlerOrig) {
|
|
|
|
handler = CefDownloadHandlerCToCpp::Wrap(handlerStruct);
|
|
|
|
}
|
|
|
|
} else {
|
|
|
|
handler = NULL;
|
|
|
|
}
|
|
|
|
|
|
|
|
// Return type: bool
|
|
|
|
return _retval?true:false;
|
2011-05-20 16:42:25 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
bool CefRequestHandlerCToCpp::GetAuthCredentials(CefRefPtr<CefBrowser> browser,
|
2011-09-23 02:16:03 +02:00
|
|
|
bool isProxy, const CefString& host, int port, const CefString& realm,
|
2012-01-10 00:46:23 +01:00
|
|
|
const CefString& scheme, CefString& username, CefString& password) {
|
2011-05-20 16:42:25 +02:00
|
|
|
if (CEF_MEMBER_MISSING(struct_, get_auth_credentials))
|
|
|
|
return false;
|
|
|
|
|
2011-12-08 02:38:30 +01:00
|
|
|
// AUTO-GENERATED CONTENT - DELETE THIS COMMENT BEFORE MODIFYING
|
|
|
|
|
|
|
|
// Verify param: browser; type: refptr_diff
|
|
|
|
DCHECK(browser.get());
|
|
|
|
if (!browser.get())
|
|
|
|
return false;
|
|
|
|
// Verify param: host; type: string_byref_const
|
|
|
|
DCHECK(!host.empty());
|
|
|
|
if (host.empty())
|
|
|
|
return false;
|
|
|
|
// Verify param: scheme; type: string_byref_const
|
|
|
|
DCHECK(!scheme.empty());
|
|
|
|
if (scheme.empty())
|
|
|
|
return false;
|
2011-12-16 14:50:15 +01:00
|
|
|
// Unverified params: realm
|
2011-12-08 02:38:30 +01:00
|
|
|
|
|
|
|
// Execute
|
|
|
|
int _retval = struct_->get_auth_credentials(struct_,
|
|
|
|
CefBrowserCppToC::Wrap(browser),
|
|
|
|
isProxy,
|
|
|
|
host.GetStruct(),
|
|
|
|
port,
|
|
|
|
realm.GetStruct(),
|
|
|
|
scheme.GetStruct(),
|
|
|
|
username.GetWritableStruct(),
|
|
|
|
password.GetWritableStruct());
|
|
|
|
|
|
|
|
// Return type: bool
|
|
|
|
return _retval?true:false;
|
2011-05-20 16:42:25 +02:00
|
|
|
}
|
|
|
|
|
2012-03-22 23:09:09 +01:00
|
|
|
CefRefPtr<CefCookieManager> CefRequestHandlerCToCpp::GetCookieManager(
|
|
|
|
CefRefPtr<CefBrowser> browser, const CefString& main_url) {
|
|
|
|
if (CEF_MEMBER_MISSING(struct_, get_cookie_manager))
|
|
|
|
return NULL;
|
|
|
|
|
|
|
|
// AUTO-GENERATED CONTENT - DELETE THIS COMMENT BEFORE MODIFYING
|
|
|
|
|
|
|
|
// Verify param: browser; type: refptr_diff
|
|
|
|
DCHECK(browser.get());
|
|
|
|
if (!browser.get())
|
|
|
|
return NULL;
|
|
|
|
// Verify param: main_url; type: string_byref_const
|
|
|
|
DCHECK(!main_url.empty());
|
|
|
|
if (main_url.empty())
|
|
|
|
return NULL;
|
|
|
|
|
|
|
|
// Execute
|
|
|
|
cef_cookie_manager_t* _retval = struct_->get_cookie_manager(struct_,
|
|
|
|
CefBrowserCppToC::Wrap(browser),
|
|
|
|
main_url.GetStruct());
|
|
|
|
|
|
|
|
// Return type: refptr_diff
|
|
|
|
return CefCookieManagerCppToC::Unwrap(_retval);
|
|
|
|
}
|
|
|
|
|
2011-05-20 16:42:25 +02:00
|
|
|
|
|
|
|
#ifndef NDEBUG
|
|
|
|
template<> long CefCToCpp<CefRequestHandlerCToCpp, CefRequestHandler,
|
|
|
|
cef_request_handler_t>::DebugObjCt = 0;
|
|
|
|
#endif
|
|
|
|
|