Move GetPrintHandler to CefClient (see issue #2196)

This new location is preferred because we now know the associated CefBrowser
for all CefPrintHandler callbacks.
This commit is contained in:
Marshall Greenblatt
2021-03-30 09:16:51 -07:00
parent f7a4c777e8
commit 7876a2f321
25 changed files with 112 additions and 129 deletions

View File

@ -9,12 +9,11 @@
// implementations. See the translator.README.txt file in the tools directory
// for more information.
//
// $hash=380946147815033eba2f98d612b723ef676ee711$
// $hash=deb93b82f75f2e3f59cccf3a82ce8e47b400f5c1$
//
#include "libcef_dll/cpptoc/browser_process_handler_cpptoc.h"
#include "libcef_dll/cpptoc/client_cpptoc.h"
#include "libcef_dll/cpptoc/print_handler_cpptoc.h"
#include "libcef_dll/ctocpp/command_line_ctocpp.h"
#include "libcef_dll/transfer_util.h"
@ -89,23 +88,6 @@ void CEF_CALLBACK browser_process_handler_on_before_child_process_launch(
CefCommandLineCToCpp::Wrap(command_line));
}
struct _cef_print_handler_t* CEF_CALLBACK
browser_process_handler_get_print_handler(
struct _cef_browser_process_handler_t* self) {
// AUTO-GENERATED CONTENT - DELETE THIS COMMENT BEFORE MODIFYING
DCHECK(self);
if (!self)
return NULL;
// Execute
CefRefPtr<CefPrintHandler> _retval =
CefBrowserProcessHandlerCppToC::Get(self)->GetPrintHandler();
// Return type: refptr_same
return CefPrintHandlerCppToC::Wrap(_retval);
}
void CEF_CALLBACK browser_process_handler_on_schedule_message_pump_work(
struct _cef_browser_process_handler_t* self,
int64 delay_ms) {
@ -147,7 +129,6 @@ CefBrowserProcessHandlerCppToC::CefBrowserProcessHandlerCppToC() {
browser_process_handler_on_context_initialized;
GetStruct()->on_before_child_process_launch =
browser_process_handler_on_before_child_process_launch;
GetStruct()->get_print_handler = browser_process_handler_get_print_handler;
GetStruct()->on_schedule_message_pump_work =
browser_process_handler_on_schedule_message_pump_work;
GetStruct()->get_default_client = browser_process_handler_get_default_client;

View File

@ -9,7 +9,7 @@
// implementations. See the translator.README.txt file in the tools directory
// for more information.
//
// $hash=59d3b3767f39bd3078bdeeeca09f0f29486b53f6$
// $hash=bdbe1ed03a5ab0ca22668417c329555a3b0d9cea$
//
#include "libcef_dll/cpptoc/client_cpptoc.h"
@ -25,6 +25,7 @@
#include "libcef_dll/cpptoc/keyboard_handler_cpptoc.h"
#include "libcef_dll/cpptoc/life_span_handler_cpptoc.h"
#include "libcef_dll/cpptoc/load_handler_cpptoc.h"
#include "libcef_dll/cpptoc/print_handler_cpptoc.h"
#include "libcef_dll/cpptoc/render_handler_cpptoc.h"
#include "libcef_dll/cpptoc/request_handler_cpptoc.h"
#include "libcef_dll/ctocpp/browser_ctocpp.h"
@ -227,6 +228,22 @@ client_get_load_handler(struct _cef_client_t* self) {
return CefLoadHandlerCppToC::Wrap(_retval);
}
struct _cef_print_handler_t* CEF_CALLBACK
client_get_print_handler(struct _cef_client_t* self) {
// AUTO-GENERATED CONTENT - DELETE THIS COMMENT BEFORE MODIFYING
DCHECK(self);
if (!self)
return NULL;
// Execute
CefRefPtr<CefPrintHandler> _retval =
CefClientCppToC::Get(self)->GetPrintHandler();
// Return type: refptr_same
return CefPrintHandlerCppToC::Wrap(_retval);
}
struct _cef_render_handler_t* CEF_CALLBACK
client_get_render_handler(struct _cef_client_t* self) {
// AUTO-GENERATED CONTENT - DELETE THIS COMMENT BEFORE MODIFYING
@ -309,6 +326,7 @@ CefClientCppToC::CefClientCppToC() {
GetStruct()->get_keyboard_handler = client_get_keyboard_handler;
GetStruct()->get_life_span_handler = client_get_life_span_handler;
GetStruct()->get_load_handler = client_get_load_handler;
GetStruct()->get_print_handler = client_get_print_handler;
GetStruct()->get_render_handler = client_get_render_handler;
GetStruct()->get_request_handler = client_get_request_handler;
GetStruct()->on_process_message_received = client_on_process_message_received;

View File

@ -9,7 +9,7 @@
// implementations. See the translator.README.txt file in the tools directory
// for more information.
//
// $hash=d07c33f1e14a7d42feac46fa1bf27dbfab50c97f$
// $hash=15d1e044a5bc40ca25c72f070a9b996907c4c0cb$
//
#include "libcef_dll/cpptoc/print_handler_cpptoc.h"
@ -161,6 +161,7 @@ print_handler_on_print_reset(struct _cef_print_handler_t* self,
cef_size_t CEF_CALLBACK
print_handler_get_pdf_paper_size(struct _cef_print_handler_t* self,
cef_browser_t* browser,
int device_units_per_inch) {
shutdown_checker::AssertNotShutdown();
@ -169,10 +170,14 @@ print_handler_get_pdf_paper_size(struct _cef_print_handler_t* self,
DCHECK(self);
if (!self)
return CefSize();
// Verify param: browser; type: refptr_diff
DCHECK(browser);
if (!browser)
return CefSize();
// Execute
cef_size_t _retval =
CefPrintHandlerCppToC::Get(self)->GetPdfPaperSize(device_units_per_inch);
cef_size_t _retval = CefPrintHandlerCppToC::Get(self)->GetPdfPaperSize(
CefBrowserCToCpp::Wrap(browser), device_units_per_inch);
// Return type: simple
return _retval;