mirror of
https://bitbucket.org/chromiumembedded/cef
synced 2025-06-05 21:39:12 +02:00
Linux: Pass CefBrowser to CefPrintHandler callbacks (issue #2196)
This commit is contained in:
@@ -9,7 +9,7 @@
|
||||
// implementations. See the translator.README.txt file in the tools directory
|
||||
// for more information.
|
||||
//
|
||||
// $hash=0749b78aaf8f69cd706962477d4d0241c93cf333$
|
||||
// $hash=80679bfc067e7564eadb691876081c4176b04c4f$
|
||||
//
|
||||
|
||||
#include "libcef_dll/ctocpp/print_handler_ctocpp.h"
|
||||
@@ -37,6 +37,7 @@ void CefPrintHandlerCToCpp::OnPrintStart(CefRefPtr<CefBrowser> browser) {
|
||||
}
|
||||
|
||||
void CefPrintHandlerCToCpp::OnPrintSettings(
|
||||
CefRefPtr<CefBrowser> browser,
|
||||
CefRefPtr<CefPrintSettings> settings,
|
||||
bool get_defaults) {
|
||||
cef_print_handler_t* _struct = GetStruct();
|
||||
@@ -45,17 +46,23 @@ void CefPrintHandlerCToCpp::OnPrintSettings(
|
||||
|
||||
// AUTO-GENERATED CONTENT - DELETE THIS COMMENT BEFORE MODIFYING
|
||||
|
||||
// Verify param: browser; type: refptr_diff
|
||||
DCHECK(browser.get());
|
||||
if (!browser.get())
|
||||
return;
|
||||
// Verify param: settings; type: refptr_diff
|
||||
DCHECK(settings.get());
|
||||
if (!settings.get())
|
||||
return;
|
||||
|
||||
// Execute
|
||||
_struct->on_print_settings(_struct, CefPrintSettingsCppToC::Wrap(settings),
|
||||
_struct->on_print_settings(_struct, CefBrowserCppToC::Wrap(browser),
|
||||
CefPrintSettingsCppToC::Wrap(settings),
|
||||
get_defaults);
|
||||
}
|
||||
|
||||
bool CefPrintHandlerCToCpp::OnPrintDialog(
|
||||
CefRefPtr<CefBrowser> browser,
|
||||
bool has_selection,
|
||||
CefRefPtr<CefPrintDialogCallback> callback) {
|
||||
cef_print_handler_t* _struct = GetStruct();
|
||||
@@ -64,6 +71,10 @@ bool CefPrintHandlerCToCpp::OnPrintDialog(
|
||||
|
||||
// AUTO-GENERATED CONTENT - DELETE THIS COMMENT BEFORE MODIFYING
|
||||
|
||||
// Verify param: browser; type: refptr_diff
|
||||
DCHECK(browser.get());
|
||||
if (!browser.get())
|
||||
return false;
|
||||
// Verify param: callback; type: refptr_diff
|
||||
DCHECK(callback.get());
|
||||
if (!callback.get())
|
||||
@@ -71,13 +82,15 @@ bool CefPrintHandlerCToCpp::OnPrintDialog(
|
||||
|
||||
// Execute
|
||||
int _retval = _struct->on_print_dialog(
|
||||
_struct, has_selection, CefPrintDialogCallbackCppToC::Wrap(callback));
|
||||
_struct, CefBrowserCppToC::Wrap(browser), has_selection,
|
||||
CefPrintDialogCallbackCppToC::Wrap(callback));
|
||||
|
||||
// Return type: bool
|
||||
return _retval ? true : false;
|
||||
}
|
||||
|
||||
bool CefPrintHandlerCToCpp::OnPrintJob(
|
||||
CefRefPtr<CefBrowser> browser,
|
||||
const CefString& document_name,
|
||||
const CefString& pdf_file_path,
|
||||
CefRefPtr<CefPrintJobCallback> callback) {
|
||||
@@ -87,6 +100,10 @@ bool CefPrintHandlerCToCpp::OnPrintJob(
|
||||
|
||||
// AUTO-GENERATED CONTENT - DELETE THIS COMMENT BEFORE MODIFYING
|
||||
|
||||
// Verify param: browser; type: refptr_diff
|
||||
DCHECK(browser.get());
|
||||
if (!browser.get())
|
||||
return false;
|
||||
// Verify param: document_name; type: string_byref_const
|
||||
DCHECK(!document_name.empty());
|
||||
if (document_name.empty())
|
||||
@@ -102,34 +119,45 @@ bool CefPrintHandlerCToCpp::OnPrintJob(
|
||||
|
||||
// Execute
|
||||
int _retval = _struct->on_print_job(
|
||||
_struct, document_name.GetStruct(), pdf_file_path.GetStruct(),
|
||||
CefPrintJobCallbackCppToC::Wrap(callback));
|
||||
_struct, CefBrowserCppToC::Wrap(browser), document_name.GetStruct(),
|
||||
pdf_file_path.GetStruct(), CefPrintJobCallbackCppToC::Wrap(callback));
|
||||
|
||||
// Return type: bool
|
||||
return _retval ? true : false;
|
||||
}
|
||||
|
||||
void CefPrintHandlerCToCpp::OnPrintReset() {
|
||||
void CefPrintHandlerCToCpp::OnPrintReset(CefRefPtr<CefBrowser> browser) {
|
||||
cef_print_handler_t* _struct = GetStruct();
|
||||
if (CEF_MEMBER_MISSING(_struct, on_print_reset))
|
||||
return;
|
||||
|
||||
// AUTO-GENERATED CONTENT - DELETE THIS COMMENT BEFORE MODIFYING
|
||||
|
||||
// Verify param: browser; type: refptr_diff
|
||||
DCHECK(browser.get());
|
||||
if (!browser.get())
|
||||
return;
|
||||
|
||||
// Execute
|
||||
_struct->on_print_reset(_struct);
|
||||
_struct->on_print_reset(_struct, CefBrowserCppToC::Wrap(browser));
|
||||
}
|
||||
|
||||
CefSize CefPrintHandlerCToCpp::GetPdfPaperSize(int device_units_per_inch) {
|
||||
CefSize CefPrintHandlerCToCpp::GetPdfPaperSize(CefRefPtr<CefBrowser> browser,
|
||||
int device_units_per_inch) {
|
||||
cef_print_handler_t* _struct = GetStruct();
|
||||
if (CEF_MEMBER_MISSING(_struct, get_pdf_paper_size))
|
||||
return CefSize();
|
||||
|
||||
// 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;
|
||||
|
@@ -9,7 +9,7 @@
|
||||
// implementations. See the translator.README.txt file in the tools directory
|
||||
// for more information.
|
||||
//
|
||||
// $hash=104e754c5019270e7bd700c6b979891f1275f9a7$
|
||||
// $hash=1a2adb6e9cbbe96253cc997312e60ca330dc4de6$
|
||||
//
|
||||
|
||||
#ifndef CEF_LIBCEF_DLL_CTOCPP_PRINT_HANDLER_CTOCPP_H_
|
||||
@@ -34,15 +34,19 @@ class CefPrintHandlerCToCpp : public CefCToCppRefCounted<CefPrintHandlerCToCpp,
|
||||
|
||||
// CefPrintHandler methods.
|
||||
void OnPrintStart(CefRefPtr<CefBrowser> browser) override;
|
||||
void OnPrintSettings(CefRefPtr<CefPrintSettings> settings,
|
||||
void OnPrintSettings(CefRefPtr<CefBrowser> browser,
|
||||
CefRefPtr<CefPrintSettings> settings,
|
||||
bool get_defaults) override;
|
||||
bool OnPrintDialog(bool has_selection,
|
||||
bool OnPrintDialog(CefRefPtr<CefBrowser> browser,
|
||||
bool has_selection,
|
||||
CefRefPtr<CefPrintDialogCallback> callback) override;
|
||||
bool OnPrintJob(const CefString& document_name,
|
||||
bool OnPrintJob(CefRefPtr<CefBrowser> browser,
|
||||
const CefString& document_name,
|
||||
const CefString& pdf_file_path,
|
||||
CefRefPtr<CefPrintJobCallback> callback) override;
|
||||
void OnPrintReset() override;
|
||||
CefSize GetPdfPaperSize(int device_units_per_inch) override;
|
||||
void OnPrintReset(CefRefPtr<CefBrowser> browser) override;
|
||||
CefSize GetPdfPaperSize(CefRefPtr<CefBrowser> browser,
|
||||
int device_units_per_inch) override;
|
||||
};
|
||||
|
||||
#endif // CEF_LIBCEF_DLL_CTOCPP_PRINT_HANDLER_CTOCPP_H_
|
||||
|
Reference in New Issue
Block a user