mirror of
https://bitbucket.org/chromiumembedded/cef
synced 2025-06-05 21:39:12 +02:00
- Auto-generate all C/C++ translation code (issue #33).
- Change index parameter types from int to size_t to make 0-based range implicit. - Make CefPrintOptions and CefMenuInfo proper wrapper classes. - Normalize the naming of menu-related types. - Remove unused command_line variable from test_suite.cc. git-svn-id: https://chromiumembedded.googlecode.com/svn/trunk@408 5089003a-bbd8-11dd-ad1f-f1f9622dbc98
This commit is contained in:
@@ -4,10 +4,10 @@
|
||||
//
|
||||
// ---------------------------------------------------------------------------
|
||||
//
|
||||
// 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.
|
||||
// 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/browser_cpptoc.h"
|
||||
@@ -27,13 +27,36 @@ bool CefRequestHandlerCToCpp::OnBeforeBrowse(CefRefPtr<CefBrowser> browser,
|
||||
bool isRedirect)
|
||||
{
|
||||
if (CEF_MEMBER_MISSING(struct_, on_before_browse))
|
||||
return true;
|
||||
return false;
|
||||
|
||||
return struct_->on_before_browse(struct_, CefBrowserCppToC::Wrap(browser),
|
||||
CefFrameCppToC::Wrap(frame), CefRequestCppToC::Wrap(request),
|
||||
navType, isRedirect) ? true : 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;
|
||||
|
||||
// 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;
|
||||
}
|
||||
|
||||
|
||||
bool CefRequestHandlerCToCpp::OnBeforeResourceLoad(
|
||||
CefRefPtr<CefBrowser> browser, CefRefPtr<CefRequest> request,
|
||||
CefString& redirectUrl, CefRefPtr<CefStreamReader>& resourceStream,
|
||||
@@ -42,19 +65,50 @@ bool CefRequestHandlerCToCpp::OnBeforeResourceLoad(
|
||||
if (CEF_MEMBER_MISSING(struct_, on_before_resource_load))
|
||||
return false;
|
||||
|
||||
cef_stream_reader_t* streamRet = NULL;
|
||||
// AUTO-GENERATED CONTENT - DELETE THIS COMMENT BEFORE MODIFYING
|
||||
|
||||
int rv = struct_->on_before_resource_load(struct_,
|
||||
CefBrowserCppToC::Wrap(browser), CefRequestCppToC::Wrap(request),
|
||||
redirectUrl.GetWritableStruct(), &streamRet,
|
||||
CefResponseCppToC::Wrap(response), loadFlags);
|
||||
// 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;
|
||||
|
||||
if(streamRet)
|
||||
resourceStream = CefStreamReaderCppToC::Unwrap(streamRet);
|
||||
// Translate param: resourceStream; type: refptr_diff_byref
|
||||
cef_stream_reader_t* resourceStreamStruct = NULL;
|
||||
if(resourceStream.get())
|
||||
resourceStreamStruct = CefStreamReaderCppToC::Wrap(resourceStream);
|
||||
cef_stream_reader_t* resourceStreamOrig = resourceStreamStruct;
|
||||
|
||||
return (rv ? true : false);
|
||||
// Execute
|
||||
int _retval = struct_->on_before_resource_load(struct_,
|
||||
CefBrowserCppToC::Wrap(browser),
|
||||
CefRequestCppToC::Wrap(request),
|
||||
redirectUrl.GetWritableStruct(),
|
||||
&resourceStreamStruct,
|
||||
CefResponseCppToC::Wrap(response),
|
||||
loadFlags);
|
||||
|
||||
// Restore param:resourceStream; type: refptr_diff_byref
|
||||
if (resourceStreamStruct) {
|
||||
if (resourceStreamStruct != resourceStreamOrig) {
|
||||
resourceStream = CefStreamReaderCppToC::Unwrap(resourceStreamStruct);
|
||||
}
|
||||
} else {
|
||||
resourceStream = NULL;
|
||||
}
|
||||
|
||||
// Return type: bool
|
||||
return _retval?true:false;
|
||||
}
|
||||
|
||||
|
||||
void CefRequestHandlerCToCpp::OnResourceResponse(CefRefPtr<CefBrowser> browser,
|
||||
const CefString& url, CefRefPtr<CefResponse> response,
|
||||
CefRefPtr<CefContentFilter>& filter)
|
||||
@@ -62,29 +116,79 @@ void CefRequestHandlerCToCpp::OnResourceResponse(CefRefPtr<CefBrowser> browser,
|
||||
if (CEF_MEMBER_MISSING(struct_, on_resource_response))
|
||||
return;
|
||||
|
||||
cef_content_filter_t* filterRet = NULL;
|
||||
// AUTO-GENERATED CONTENT - DELETE THIS COMMENT BEFORE MODIFYING
|
||||
|
||||
// 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;
|
||||
if(filter.get())
|
||||
filterStruct = CefContentFilterCToCpp::Unwrap(filter);
|
||||
cef_content_filter_t* filterOrig = filterStruct;
|
||||
|
||||
// Execute
|
||||
struct_->on_resource_response(struct_,
|
||||
CefBrowserCppToC::Wrap(browser), url.GetStruct(),
|
||||
CefResponseCppToC::Wrap(response), &filterRet);
|
||||
|
||||
if(filterRet)
|
||||
filter = CefContentFilterCToCpp::Wrap(filterRet);
|
||||
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;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
bool CefRequestHandlerCToCpp::OnProtocolExecution(CefRefPtr<CefBrowser> browser,
|
||||
const CefString& url, bool& allowOSExecution)
|
||||
{
|
||||
if (CEF_MEMBER_MISSING(struct_, on_protocol_execution))
|
||||
return false;
|
||||
|
||||
int allowExec = allowOSExecution;
|
||||
int rv = struct_->on_protocol_execution(struct_,
|
||||
CefBrowserCppToC::Wrap(browser), url.GetStruct(), &allowExec);
|
||||
allowOSExecution = allowExec?true:false;
|
||||
return (rv ? true : 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: 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;
|
||||
}
|
||||
|
||||
|
||||
bool CefRequestHandlerCToCpp::GetDownloadHandler(CefRefPtr<CefBrowser> browser,
|
||||
const CefString& mimeType, const CefString& fileName, int64 contentLength,
|
||||
CefRefPtr<CefDownloadHandler>& handler)
|
||||
@@ -92,18 +196,49 @@ bool CefRequestHandlerCToCpp::GetDownloadHandler(CefRefPtr<CefBrowser> browser,
|
||||
if (CEF_MEMBER_MISSING(struct_, get_download_handler))
|
||||
return false;
|
||||
|
||||
cef_download_handler_t* handlerRet = NULL;
|
||||
// AUTO-GENERATED CONTENT - DELETE THIS COMMENT BEFORE MODIFYING
|
||||
|
||||
int rv = struct_->get_download_handler(struct_,
|
||||
CefBrowserCppToC::Wrap(browser), mimeType.GetStruct(),
|
||||
fileName.GetStruct(), contentLength, &handlerRet);
|
||||
// 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;
|
||||
|
||||
if(handlerRet)
|
||||
handler = CefDownloadHandlerCToCpp::Wrap(handlerRet);
|
||||
// Translate param: handler; type: refptr_same_byref
|
||||
cef_download_handler_t* handlerStruct = NULL;
|
||||
if(handler.get())
|
||||
handlerStruct = CefDownloadHandlerCToCpp::Unwrap(handler);
|
||||
cef_download_handler_t* handlerOrig = handlerStruct;
|
||||
|
||||
return (rv ? true : false);
|
||||
// Execute
|
||||
int _retval = struct_->get_download_handler(struct_,
|
||||
CefBrowserCppToC::Wrap(browser),
|
||||
mimeType.GetStruct(),
|
||||
fileName.GetStruct(),
|
||||
contentLength,
|
||||
&handlerStruct);
|
||||
|
||||
// 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;
|
||||
}
|
||||
|
||||
|
||||
bool CefRequestHandlerCToCpp::GetAuthCredentials(CefRefPtr<CefBrowser> browser,
|
||||
bool isProxy, const CefString& host, int port, const CefString& realm,
|
||||
const CefString& scheme, CefString& username, CefString& password)
|
||||
@@ -111,13 +246,42 @@ bool CefRequestHandlerCToCpp::GetAuthCredentials(CefRefPtr<CefBrowser> browser,
|
||||
if (CEF_MEMBER_MISSING(struct_, get_auth_credentials))
|
||||
return false;
|
||||
|
||||
return struct_->get_auth_credentials(struct_, CefBrowserCppToC::Wrap(browser),
|
||||
isProxy, host.GetStruct(), port, realm.GetStruct(), scheme.GetStruct(),
|
||||
username.GetWritableStruct(), password.GetWritableStruct()) ?
|
||||
true : 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: host; type: string_byref_const
|
||||
DCHECK(!host.empty());
|
||||
if (host.empty())
|
||||
return false;
|
||||
// Verify param: realm; type: string_byref_const
|
||||
DCHECK(!realm.empty());
|
||||
if (realm.empty())
|
||||
return false;
|
||||
// Verify param: scheme; type: string_byref_const
|
||||
DCHECK(!scheme.empty());
|
||||
if (scheme.empty())
|
||||
return false;
|
||||
|
||||
// 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;
|
||||
}
|
||||
|
||||
|
||||
|
||||
#ifndef NDEBUG
|
||||
template<> long CefCToCpp<CefRequestHandlerCToCpp, CefRequestHandler,
|
||||
cef_request_handler_t>::DebugObjCt = 0;
|
||||
|
Reference in New Issue
Block a user