2023-01-02 23:47:15 +01:00
|
|
|
// Copyright (c) 2023 The Chromium Embedded Framework Authors. All rights
|
2012-04-03 03:34:16 +02:00
|
|
|
// 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.
|
|
|
|
//
|
2023-05-08 17:15:02 +02:00
|
|
|
// $hash=e96fe0660b55afa20c3bb5fdebc85635ccc53d09$
|
2017-05-17 11:29:28 +02:00
|
|
|
//
|
2012-04-03 03:34:16 +02:00
|
|
|
|
|
|
|
#include "libcef_dll/cpptoc/life_span_handler_cpptoc.h"
|
2017-05-19 11:06:00 +02:00
|
|
|
#include "libcef_dll/cpptoc/client_cpptoc.h"
|
2012-04-03 03:34:16 +02:00
|
|
|
#include "libcef_dll/ctocpp/browser_ctocpp.h"
|
2019-03-19 10:42:54 +01:00
|
|
|
#include "libcef_dll/ctocpp/dictionary_value_ctocpp.h"
|
2013-02-08 01:07:41 +01:00
|
|
|
#include "libcef_dll/ctocpp/frame_ctocpp.h"
|
2019-01-23 16:42:12 +01:00
|
|
|
#include "libcef_dll/shutdown_checker.h"
|
2022-01-27 18:10:29 +01:00
|
|
|
#include "libcef_dll/template_util.h"
|
2012-04-03 03:34:16 +02:00
|
|
|
|
2015-04-26 20:40:01 +02:00
|
|
|
namespace {
|
|
|
|
|
2012-04-03 03:34:16 +02:00
|
|
|
// MEMBER FUNCTIONS - Body may be edited by hand.
|
|
|
|
|
2013-02-09 23:38:24 +01:00
|
|
|
int CEF_CALLBACK life_span_handler_on_before_popup(
|
2017-05-17 11:29:28 +02:00
|
|
|
struct _cef_life_span_handler_t* self,
|
|
|
|
cef_browser_t* browser,
|
|
|
|
cef_frame_t* frame,
|
|
|
|
const cef_string_t* target_url,
|
2013-02-09 23:38:24 +01:00
|
|
|
const cef_string_t* target_frame_name,
|
2017-05-17 11:29:28 +02:00
|
|
|
cef_window_open_disposition_t target_disposition,
|
|
|
|
int user_gesture,
|
2022-07-14 10:13:29 +02:00
|
|
|
const cef_popup_features_t* popupFeatures,
|
2017-05-17 11:29:28 +02:00
|
|
|
cef_window_info_t* windowInfo,
|
|
|
|
cef_client_t** client,
|
|
|
|
struct _cef_browser_settings_t* settings,
|
2019-03-19 10:42:54 +01:00
|
|
|
struct _cef_dictionary_value_t** extra_info,
|
2017-05-17 11:29:28 +02:00
|
|
|
int* no_javascript_access) {
|
2019-01-23 16:42:12 +01:00
|
|
|
shutdown_checker::AssertNotShutdown();
|
|
|
|
|
2012-04-03 03:34:16 +02:00
|
|
|
// AUTO-GENERATED CONTENT - DELETE THIS COMMENT BEFORE MODIFYING
|
|
|
|
|
|
|
|
DCHECK(self);
|
2023-01-02 23:47:15 +01:00
|
|
|
if (!self) {
|
2012-04-03 03:34:16 +02:00
|
|
|
return 0;
|
2023-01-02 23:47:15 +01:00
|
|
|
}
|
2013-02-08 01:07:41 +01:00
|
|
|
// Verify param: browser; type: refptr_diff
|
|
|
|
DCHECK(browser);
|
2023-01-02 23:47:15 +01:00
|
|
|
if (!browser) {
|
2013-02-08 01:07:41 +01:00
|
|
|
return 0;
|
2023-01-02 23:47:15 +01:00
|
|
|
}
|
2013-02-08 01:07:41 +01:00
|
|
|
// Verify param: frame; type: refptr_diff
|
|
|
|
DCHECK(frame);
|
2023-01-02 23:47:15 +01:00
|
|
|
if (!frame) {
|
2012-04-03 03:34:16 +02:00
|
|
|
return 0;
|
2023-01-02 23:47:15 +01:00
|
|
|
}
|
2022-07-14 10:13:29 +02:00
|
|
|
// Verify param: popupFeatures; type: simple_byref_const
|
2012-04-03 03:34:16 +02:00
|
|
|
DCHECK(popupFeatures);
|
2023-01-02 23:47:15 +01:00
|
|
|
if (!popupFeatures) {
|
2013-02-09 23:38:24 +01:00
|
|
|
return 0;
|
2023-01-02 23:47:15 +01:00
|
|
|
}
|
2012-04-03 03:34:16 +02:00
|
|
|
// Verify param: windowInfo; type: struct_byref
|
|
|
|
DCHECK(windowInfo);
|
2023-01-02 23:47:15 +01:00
|
|
|
if (!windowInfo) {
|
2013-02-09 23:38:24 +01:00
|
|
|
return 0;
|
2023-01-02 23:47:15 +01:00
|
|
|
}
|
2022-01-27 18:10:29 +01:00
|
|
|
if (!template_util::has_valid_size(windowInfo)) {
|
2023-05-08 17:15:02 +02:00
|
|
|
DCHECK(false) << "invalid windowInfo->[base.]size";
|
2022-01-27 18:10:29 +01:00
|
|
|
return 0;
|
|
|
|
}
|
2012-04-03 03:34:16 +02:00
|
|
|
// Verify param: client; type: refptr_same_byref
|
|
|
|
DCHECK(client);
|
2023-01-02 23:47:15 +01:00
|
|
|
if (!client) {
|
2013-02-09 23:38:24 +01:00
|
|
|
return 0;
|
2023-01-02 23:47:15 +01:00
|
|
|
}
|
2012-04-03 03:34:16 +02:00
|
|
|
// Verify param: settings; type: struct_byref
|
|
|
|
DCHECK(settings);
|
2023-01-02 23:47:15 +01:00
|
|
|
if (!settings) {
|
2013-02-09 23:38:24 +01:00
|
|
|
return 0;
|
2023-01-02 23:47:15 +01:00
|
|
|
}
|
2022-01-27 18:10:29 +01:00
|
|
|
if (!template_util::has_valid_size(settings)) {
|
2023-05-08 17:15:02 +02:00
|
|
|
DCHECK(false) << "invalid settings->[base.]size";
|
2022-01-27 18:10:29 +01:00
|
|
|
return 0;
|
|
|
|
}
|
2019-03-19 10:42:54 +01:00
|
|
|
// Verify param: extra_info; type: refptr_diff_byref
|
|
|
|
DCHECK(extra_info);
|
2023-01-02 23:47:15 +01:00
|
|
|
if (!extra_info) {
|
2019-03-19 10:42:54 +01:00
|
|
|
return 0;
|
2023-01-02 23:47:15 +01:00
|
|
|
}
|
2013-02-09 23:38:24 +01:00
|
|
|
// Verify param: no_javascript_access; type: bool_byaddr
|
|
|
|
DCHECK(no_javascript_access);
|
2023-01-02 23:47:15 +01:00
|
|
|
if (!no_javascript_access) {
|
2013-02-09 23:38:24 +01:00
|
|
|
return 0;
|
2023-01-02 23:47:15 +01:00
|
|
|
}
|
2013-02-08 01:07:41 +01:00
|
|
|
// Unverified params: target_url, target_frame_name
|
2012-04-03 03:34:16 +02:00
|
|
|
|
2022-07-14 10:13:29 +02:00
|
|
|
// Translate param: popupFeatures; type: simple_byref_const
|
|
|
|
CefPopupFeatures popupFeaturesVal =
|
|
|
|
popupFeatures ? *popupFeatures : CefPopupFeatures();
|
2012-04-03 03:34:16 +02:00
|
|
|
// Translate param: windowInfo; type: struct_byref
|
|
|
|
CefWindowInfo windowInfoObj;
|
2023-01-02 23:47:15 +01:00
|
|
|
if (windowInfo) {
|
2012-04-03 03:34:16 +02:00
|
|
|
windowInfoObj.AttachTo(*windowInfo);
|
2023-01-02 23:47:15 +01:00
|
|
|
}
|
2012-04-03 03:34:16 +02:00
|
|
|
// Translate param: client; type: refptr_same_byref
|
|
|
|
CefRefPtr<CefClient> clientPtr;
|
2023-01-02 23:47:15 +01:00
|
|
|
if (client && *client) {
|
2012-04-03 03:34:16 +02:00
|
|
|
clientPtr = CefClientCppToC::Unwrap(*client);
|
2023-01-02 23:47:15 +01:00
|
|
|
}
|
2012-04-03 03:34:16 +02:00
|
|
|
CefClient* clientOrig = clientPtr.get();
|
|
|
|
// Translate param: settings; type: struct_byref
|
|
|
|
CefBrowserSettings settingsObj;
|
2023-01-02 23:47:15 +01:00
|
|
|
if (settings) {
|
2012-04-03 03:34:16 +02:00
|
|
|
settingsObj.AttachTo(*settings);
|
2023-01-02 23:47:15 +01:00
|
|
|
}
|
2019-03-19 10:42:54 +01:00
|
|
|
// Translate param: extra_info; type: refptr_diff_byref
|
|
|
|
CefRefPtr<CefDictionaryValue> extra_infoPtr;
|
2023-01-02 23:47:15 +01:00
|
|
|
if (extra_info && *extra_info) {
|
2019-03-19 10:42:54 +01:00
|
|
|
extra_infoPtr = CefDictionaryValueCToCpp::Wrap(*extra_info);
|
2023-01-02 23:47:15 +01:00
|
|
|
}
|
2019-03-19 10:42:54 +01:00
|
|
|
CefDictionaryValue* extra_infoOrig = extra_infoPtr.get();
|
2013-02-09 23:38:24 +01:00
|
|
|
// Translate param: no_javascript_access; type: bool_byaddr
|
2017-05-17 11:29:28 +02:00
|
|
|
bool no_javascript_accessBool =
|
|
|
|
(no_javascript_access && *no_javascript_access) ? true : false;
|
2012-04-03 03:34:16 +02:00
|
|
|
|
|
|
|
// Execute
|
2013-02-09 23:38:24 +01:00
|
|
|
bool _retval = CefLifeSpanHandlerCppToC::Get(self)->OnBeforePopup(
|
2017-05-17 11:29:28 +02:00
|
|
|
CefBrowserCToCpp::Wrap(browser), CefFrameCToCpp::Wrap(frame),
|
|
|
|
CefString(target_url), CefString(target_frame_name), target_disposition,
|
2022-07-14 10:13:29 +02:00
|
|
|
user_gesture ? true : false, popupFeaturesVal, windowInfoObj, clientPtr,
|
2019-03-19 10:42:54 +01:00
|
|
|
settingsObj, extra_infoPtr, &no_javascript_accessBool);
|
2012-04-03 03:34:16 +02:00
|
|
|
|
|
|
|
// Restore param: windowInfo; type: struct_byref
|
2023-01-02 23:47:15 +01:00
|
|
|
if (windowInfo) {
|
2012-04-03 03:34:16 +02:00
|
|
|
windowInfoObj.DetachTo(*windowInfo);
|
2023-01-02 23:47:15 +01:00
|
|
|
}
|
2012-04-03 03:34:16 +02:00
|
|
|
// Restore param: client; type: refptr_same_byref
|
|
|
|
if (client) {
|
|
|
|
if (clientPtr.get()) {
|
|
|
|
if (clientPtr.get() != clientOrig) {
|
|
|
|
*client = CefClientCppToC::Wrap(clientPtr);
|
|
|
|
}
|
|
|
|
} else {
|
2020-01-15 14:53:19 +01:00
|
|
|
*client = nullptr;
|
2012-04-03 03:34:16 +02:00
|
|
|
}
|
|
|
|
}
|
|
|
|
// Restore param: settings; type: struct_byref
|
2023-01-02 23:47:15 +01:00
|
|
|
if (settings) {
|
2012-04-03 03:34:16 +02:00
|
|
|
settingsObj.DetachTo(*settings);
|
2023-01-02 23:47:15 +01:00
|
|
|
}
|
2019-03-19 10:42:54 +01:00
|
|
|
// Restore param: extra_info; type: refptr_diff_byref
|
|
|
|
if (extra_info) {
|
|
|
|
if (extra_infoPtr.get()) {
|
|
|
|
if (extra_infoPtr.get() != extra_infoOrig) {
|
|
|
|
*extra_info = CefDictionaryValueCToCpp::Unwrap(extra_infoPtr);
|
|
|
|
}
|
|
|
|
} else {
|
2020-01-15 14:53:19 +01:00
|
|
|
*extra_info = nullptr;
|
2019-03-19 10:42:54 +01:00
|
|
|
}
|
|
|
|
}
|
2013-02-09 23:38:24 +01:00
|
|
|
// Restore param: no_javascript_access; type: bool_byaddr
|
2023-01-02 23:47:15 +01:00
|
|
|
if (no_javascript_access) {
|
2017-05-17 11:29:28 +02:00
|
|
|
*no_javascript_access = no_javascript_accessBool ? true : false;
|
2023-01-02 23:47:15 +01:00
|
|
|
}
|
2013-02-09 23:38:24 +01:00
|
|
|
|
|
|
|
// Return type: bool
|
|
|
|
return _retval;
|
2012-04-03 03:34:16 +02:00
|
|
|
}
|
|
|
|
|
2017-05-17 11:29:28 +02:00
|
|
|
void CEF_CALLBACK
|
|
|
|
life_span_handler_on_after_created(struct _cef_life_span_handler_t* self,
|
|
|
|
cef_browser_t* browser) {
|
2019-01-23 16:42:12 +01:00
|
|
|
shutdown_checker::AssertNotShutdown();
|
|
|
|
|
2012-04-03 03:34:16 +02:00
|
|
|
// AUTO-GENERATED CONTENT - DELETE THIS COMMENT BEFORE MODIFYING
|
|
|
|
|
|
|
|
DCHECK(self);
|
2023-01-02 23:47:15 +01:00
|
|
|
if (!self) {
|
2012-04-03 03:34:16 +02:00
|
|
|
return;
|
2023-01-02 23:47:15 +01:00
|
|
|
}
|
2012-04-03 03:34:16 +02:00
|
|
|
// Verify param: browser; type: refptr_diff
|
|
|
|
DCHECK(browser);
|
2023-01-02 23:47:15 +01:00
|
|
|
if (!browser) {
|
2012-04-03 03:34:16 +02:00
|
|
|
return;
|
2023-01-02 23:47:15 +01:00
|
|
|
}
|
2012-04-03 03:34:16 +02:00
|
|
|
|
|
|
|
// Execute
|
|
|
|
CefLifeSpanHandlerCppToC::Get(self)->OnAfterCreated(
|
|
|
|
CefBrowserCToCpp::Wrap(browser));
|
|
|
|
}
|
|
|
|
|
2017-05-17 11:29:28 +02:00
|
|
|
int CEF_CALLBACK
|
|
|
|
life_span_handler_do_close(struct _cef_life_span_handler_t* self,
|
|
|
|
cef_browser_t* browser) {
|
2019-01-23 16:42:12 +01:00
|
|
|
shutdown_checker::AssertNotShutdown();
|
|
|
|
|
2012-04-03 03:34:16 +02:00
|
|
|
// AUTO-GENERATED CONTENT - DELETE THIS COMMENT BEFORE MODIFYING
|
|
|
|
|
|
|
|
DCHECK(self);
|
2023-01-02 23:47:15 +01:00
|
|
|
if (!self) {
|
2012-04-03 03:34:16 +02:00
|
|
|
return 0;
|
2023-01-02 23:47:15 +01:00
|
|
|
}
|
2012-04-03 03:34:16 +02:00
|
|
|
// Verify param: browser; type: refptr_diff
|
|
|
|
DCHECK(browser);
|
2023-01-02 23:47:15 +01:00
|
|
|
if (!browser) {
|
2012-04-03 03:34:16 +02:00
|
|
|
return 0;
|
2023-01-02 23:47:15 +01:00
|
|
|
}
|
2012-04-03 03:34:16 +02:00
|
|
|
|
|
|
|
// Execute
|
|
|
|
bool _retval = CefLifeSpanHandlerCppToC::Get(self)->DoClose(
|
|
|
|
CefBrowserCToCpp::Wrap(browser));
|
|
|
|
|
|
|
|
// Return type: bool
|
|
|
|
return _retval;
|
|
|
|
}
|
|
|
|
|
2017-05-17 11:29:28 +02:00
|
|
|
void CEF_CALLBACK
|
|
|
|
life_span_handler_on_before_close(struct _cef_life_span_handler_t* self,
|
|
|
|
cef_browser_t* browser) {
|
2019-01-23 16:42:12 +01:00
|
|
|
shutdown_checker::AssertNotShutdown();
|
|
|
|
|
2012-04-03 03:34:16 +02:00
|
|
|
// AUTO-GENERATED CONTENT - DELETE THIS COMMENT BEFORE MODIFYING
|
|
|
|
|
|
|
|
DCHECK(self);
|
2023-01-02 23:47:15 +01:00
|
|
|
if (!self) {
|
2012-04-03 03:34:16 +02:00
|
|
|
return;
|
2023-01-02 23:47:15 +01:00
|
|
|
}
|
2012-04-03 03:34:16 +02:00
|
|
|
// Verify param: browser; type: refptr_diff
|
|
|
|
DCHECK(browser);
|
2023-01-02 23:47:15 +01:00
|
|
|
if (!browser) {
|
2012-04-03 03:34:16 +02:00
|
|
|
return;
|
2023-01-02 23:47:15 +01:00
|
|
|
}
|
2012-04-03 03:34:16 +02:00
|
|
|
|
|
|
|
// Execute
|
|
|
|
CefLifeSpanHandlerCppToC::Get(self)->OnBeforeClose(
|
|
|
|
CefBrowserCToCpp::Wrap(browser));
|
|
|
|
}
|
|
|
|
|
2015-04-26 20:40:01 +02:00
|
|
|
} // namespace
|
|
|
|
|
2012-04-03 03:34:16 +02:00
|
|
|
// CONSTRUCTOR - Do not edit by hand.
|
|
|
|
|
2015-04-26 20:40:01 +02:00
|
|
|
CefLifeSpanHandlerCppToC::CefLifeSpanHandlerCppToC() {
|
|
|
|
GetStruct()->on_before_popup = life_span_handler_on_before_popup;
|
|
|
|
GetStruct()->on_after_created = life_span_handler_on_after_created;
|
|
|
|
GetStruct()->do_close = life_span_handler_do_close;
|
|
|
|
GetStruct()->on_before_close = life_span_handler_on_before_close;
|
|
|
|
}
|
|
|
|
|
2019-01-23 16:42:12 +01:00
|
|
|
// DESTRUCTOR - Do not edit by hand.
|
|
|
|
|
|
|
|
CefLifeSpanHandlerCppToC::~CefLifeSpanHandlerCppToC() {
|
|
|
|
shutdown_checker::AssertNotShutdown();
|
|
|
|
}
|
|
|
|
|
2017-05-17 11:29:28 +02:00
|
|
|
template <>
|
|
|
|
CefRefPtr<CefLifeSpanHandler> CefCppToCRefCounted<
|
|
|
|
CefLifeSpanHandlerCppToC,
|
|
|
|
CefLifeSpanHandler,
|
|
|
|
cef_life_span_handler_t>::UnwrapDerived(CefWrapperType type,
|
|
|
|
cef_life_span_handler_t* s) {
|
2023-05-08 17:15:02 +02:00
|
|
|
DCHECK(false) << "Unexpected class type: " << type;
|
2020-01-15 14:53:19 +01:00
|
|
|
return nullptr;
|
2012-04-03 03:34:16 +02:00
|
|
|
}
|
|
|
|
|
2017-05-17 11:29:28 +02:00
|
|
|
template <>
|
|
|
|
CefWrapperType CefCppToCRefCounted<CefLifeSpanHandlerCppToC,
|
|
|
|
CefLifeSpanHandler,
|
|
|
|
cef_life_span_handler_t>::kWrapperType =
|
2015-04-26 20:40:01 +02:00
|
|
|
WT_LIFE_SPAN_HANDLER;
|