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,13 +9,12 @@
// implementations. See the translator.README.txt file in the tools directory
// for more information.
//
// $hash=a2e25ad75313e9b264bce1b1525c7766e625ea17$
// $hash=f70d18a15f7c01ce5171d781577312fa7d2fb93b$
//
#include "libcef_dll/ctocpp/browser_process_handler_ctocpp.h"
#include "libcef_dll/cpptoc/command_line_cpptoc.h"
#include "libcef_dll/ctocpp/client_ctocpp.h"
#include "libcef_dll/ctocpp/print_handler_ctocpp.h"
#include "libcef_dll/transfer_util.h"
// VIRTUAL METHODS - Body may be edited by hand.
@ -82,21 +81,6 @@ void CefBrowserProcessHandlerCToCpp::OnBeforeChildProcessLaunch(
_struct, CefCommandLineCppToC::Wrap(command_line));
}
NO_SANITIZE("cfi-icall")
CefRefPtr<CefPrintHandler> CefBrowserProcessHandlerCToCpp::GetPrintHandler() {
cef_browser_process_handler_t* _struct = GetStruct();
if (CEF_MEMBER_MISSING(_struct, get_print_handler))
return nullptr;
// AUTO-GENERATED CONTENT - DELETE THIS COMMENT BEFORE MODIFYING
// Execute
cef_print_handler_t* _retval = _struct->get_print_handler(_struct);
// Return type: refptr_same
return CefPrintHandlerCToCpp::Wrap(_retval);
}
NO_SANITIZE("cfi-icall")
void CefBrowserProcessHandlerCToCpp::OnScheduleMessagePumpWork(int64 delay_ms) {
cef_browser_process_handler_t* _struct = GetStruct();

View File

@ -9,7 +9,7 @@
// implementations. See the translator.README.txt file in the tools directory
// for more information.
//
// $hash=0c4282bac5261394776306ab376b8839a1690a57$
// $hash=e6881fab8b5f8b46c08f0b472abdc8508edaed52$
//
#ifndef CEF_LIBCEF_DLL_CTOCPP_BROWSER_PROCESS_HANDLER_CTOCPP_H_
@ -41,7 +41,6 @@ class CefBrowserProcessHandlerCToCpp
void OnContextInitialized() override;
void OnBeforeChildProcessLaunch(
CefRefPtr<CefCommandLine> command_line) override;
CefRefPtr<CefPrintHandler> GetPrintHandler() override;
void OnScheduleMessagePumpWork(int64 delay_ms) override;
CefRefPtr<CefClient> GetDefaultClient() override;
};

View File

@ -9,7 +9,7 @@
// implementations. See the translator.README.txt file in the tools directory
// for more information.
//
// $hash=e82aefc18c6f1869a4ff61b21e040dc2df69bfc9$
// $hash=19d21957d8b7f66de8c88b9085abb2a08718582d$
//
#include "libcef_dll/ctocpp/client_ctocpp.h"
@ -28,6 +28,7 @@
#include "libcef_dll/ctocpp/keyboard_handler_ctocpp.h"
#include "libcef_dll/ctocpp/life_span_handler_ctocpp.h"
#include "libcef_dll/ctocpp/load_handler_ctocpp.h"
#include "libcef_dll/ctocpp/print_handler_ctocpp.h"
#include "libcef_dll/ctocpp/render_handler_ctocpp.h"
#include "libcef_dll/ctocpp/request_handler_ctocpp.h"
@ -214,6 +215,21 @@ CefRefPtr<CefLoadHandler> CefClientCToCpp::GetLoadHandler() {
return CefLoadHandlerCToCpp::Wrap(_retval);
}
NO_SANITIZE("cfi-icall")
CefRefPtr<CefPrintHandler> CefClientCToCpp::GetPrintHandler() {
cef_client_t* _struct = GetStruct();
if (CEF_MEMBER_MISSING(_struct, get_print_handler))
return nullptr;
// AUTO-GENERATED CONTENT - DELETE THIS COMMENT BEFORE MODIFYING
// Execute
cef_print_handler_t* _retval = _struct->get_print_handler(_struct);
// Return type: refptr_same
return CefPrintHandlerCToCpp::Wrap(_retval);
}
NO_SANITIZE("cfi-icall")
CefRefPtr<CefRenderHandler> CefClientCToCpp::GetRenderHandler() {
cef_client_t* _struct = GetStruct();

View File

@ -9,7 +9,7 @@
// implementations. See the translator.README.txt file in the tools directory
// for more information.
//
// $hash=8395e101ac220a443a9d26dc302258185e6e33ea$
// $hash=a640d4535140448a46340432470dbd1ef4f90b69$
//
#ifndef CEF_LIBCEF_DLL_CTOCPP_CLIENT_CTOCPP_H_
@ -45,6 +45,7 @@ class CefClientCToCpp
CefRefPtr<CefKeyboardHandler> GetKeyboardHandler() override;
CefRefPtr<CefLifeSpanHandler> GetLifeSpanHandler() override;
CefRefPtr<CefLoadHandler> GetLoadHandler() override;
CefRefPtr<CefPrintHandler> GetPrintHandler() override;
CefRefPtr<CefRenderHandler> GetRenderHandler() override;
CefRefPtr<CefRequestHandler> GetRequestHandler() override;
bool OnProcessMessageReceived(CefRefPtr<CefBrowser> browser,

View File

@ -9,7 +9,7 @@
// implementations. See the translator.README.txt file in the tools directory
// for more information.
//
// $hash=af80c710cd11dc6a92ca2ed5923ff4787ee97e86$
// $hash=5c1f65c2b1b111d248d5b7b27ddcb59b06594923$
//
#include "libcef_dll/ctocpp/print_handler_ctocpp.h"
@ -159,7 +159,8 @@ void CefPrintHandlerCToCpp::OnPrintReset(CefRefPtr<CefBrowser> browser) {
}
NO_SANITIZE("cfi-icall")
CefSize CefPrintHandlerCToCpp::GetPdfPaperSize(int device_units_per_inch) {
CefSize CefPrintHandlerCToCpp::GetPdfPaperSize(CefRefPtr<CefBrowser> browser,
int device_units_per_inch) {
shutdown_checker::AssertNotShutdown();
cef_print_handler_t* _struct = GetStruct();
@ -168,9 +169,14 @@ CefSize CefPrintHandlerCToCpp::GetPdfPaperSize(int device_units_per_inch) {
// AUTO-GENERATED CONTENT - DELETE THIS COMMENT BEFORE MODIFYING
// Verify param: browser; type: refptr_diff
DCHECK(browser.get());
if (!browser.get())
return CefSize();
// Execute
cef_size_t _retval =
_struct->get_pdf_paper_size(_struct, device_units_per_inch);
cef_size_t _retval = _struct->get_pdf_paper_size(
_struct, CefBrowserCppToC::Wrap(browser), device_units_per_inch);
// Return type: simple
return _retval;

View File

@ -9,7 +9,7 @@
// implementations. See the translator.README.txt file in the tools directory
// for more information.
//
// $hash=0ef71e42f869e9eaa0b87f8fd90e2f80c3553e2f$
// $hash=5592945a1621a79ccff78a053a98e68bf08d9a8b$
//
#ifndef CEF_LIBCEF_DLL_CTOCPP_PRINT_HANDLER_CTOCPP_H_
@ -46,7 +46,8 @@ class CefPrintHandlerCToCpp : public CefCToCppRefCounted<CefPrintHandlerCToCpp,
const CefString& pdf_file_path,
CefRefPtr<CefPrintJobCallback> callback) override;
void OnPrintReset(CefRefPtr<CefBrowser> browser) override;
CefSize GetPdfPaperSize(int device_units_per_inch) override;
CefSize GetPdfPaperSize(CefRefPtr<CefBrowser> browser,
int device_units_per_inch) override;
};
#endif // CEF_LIBCEF_DLL_CTOCPP_PRINT_HANDLER_CTOCPP_H_