Commit dce5d5c2 authored by Marshall Greenblatt's avatar Marshall Greenblatt

Linux: Pass CefBrowser to CefPrintHandler callbacks (issue #2196)

parent 5918d426
...@@ -33,7 +33,7 @@ ...@@ -33,7 +33,7 @@
// by hand. See the translator.README.txt file in the tools directory for // by hand. See the translator.README.txt file in the tools directory for
// more information. // more information.
// //
// $hash=e8f6bdc822cf4f5c32b22ba8b5cacb25823d8971$ // $hash=ed78ca41d62dfc0cdb52828dcf795617c4e231a7$
// //
#ifndef CEF_INCLUDE_CAPI_CEF_PRINT_HANDLER_CAPI_H_ #ifndef CEF_INCLUDE_CAPI_CEF_PRINT_HANDLER_CAPI_H_
...@@ -85,8 +85,9 @@ typedef struct _cef_print_job_callback_t { ...@@ -85,8 +85,9 @@ typedef struct _cef_print_job_callback_t {
} cef_print_job_callback_t; } cef_print_job_callback_t;
/// ///
// Implement this structure to handle printing on Linux. The functions of this // Implement this structure to handle printing on Linux. Each browser will have
// structure will be called on the browser process UI thread. // only one print job in progress at a time. The functions of this structure
// will be called on the browser process UI thread.
/// ///
typedef struct _cef_print_handler_t { typedef struct _cef_print_handler_t {
/// ///
...@@ -109,6 +110,7 @@ typedef struct _cef_print_handler_t { ...@@ -109,6 +110,7 @@ typedef struct _cef_print_handler_t {
// reference to |settings| outside of this callback. // reference to |settings| outside of this callback.
/// ///
void(CEF_CALLBACK* on_print_settings)(struct _cef_print_handler_t* self, void(CEF_CALLBACK* on_print_settings)(struct _cef_print_handler_t* self,
struct _cef_browser_t* browser,
struct _cef_print_settings_t* settings, struct _cef_print_settings_t* settings,
int get_defaults); int get_defaults);
...@@ -119,6 +121,7 @@ typedef struct _cef_print_handler_t { ...@@ -119,6 +121,7 @@ typedef struct _cef_print_handler_t {
/// ///
int(CEF_CALLBACK* on_print_dialog)( int(CEF_CALLBACK* on_print_dialog)(
struct _cef_print_handler_t* self, struct _cef_print_handler_t* self,
struct _cef_browser_t* browser,
int has_selection, int has_selection,
struct _cef_print_dialog_callback_t* callback); struct _cef_print_dialog_callback_t* callback);
...@@ -128,6 +131,7 @@ typedef struct _cef_print_handler_t { ...@@ -128,6 +131,7 @@ typedef struct _cef_print_handler_t {
// the job immediately. // the job immediately.
/// ///
int(CEF_CALLBACK* on_print_job)(struct _cef_print_handler_t* self, int(CEF_CALLBACK* on_print_job)(struct _cef_print_handler_t* self,
struct _cef_browser_t* browser,
const cef_string_t* document_name, const cef_string_t* document_name,
const cef_string_t* pdf_file_path, const cef_string_t* pdf_file_path,
struct _cef_print_job_callback_t* callback); struct _cef_print_job_callback_t* callback);
...@@ -135,7 +139,8 @@ typedef struct _cef_print_handler_t { ...@@ -135,7 +139,8 @@ typedef struct _cef_print_handler_t {
/// ///
// Reset client state related to printing. // Reset client state related to printing.
/// ///
void(CEF_CALLBACK* on_print_reset)(struct _cef_print_handler_t* self); void(CEF_CALLBACK* on_print_reset)(struct _cef_print_handler_t* self,
struct _cef_browser_t* browser);
/// ///
// Return the PDF paper size in device units. Used in combination with // Return the PDF paper size in device units. Used in combination with
...@@ -143,6 +148,7 @@ typedef struct _cef_print_handler_t { ...@@ -143,6 +148,7 @@ typedef struct _cef_print_handler_t {
/// ///
cef_size_t(CEF_CALLBACK* get_pdf_paper_size)( cef_size_t(CEF_CALLBACK* get_pdf_paper_size)(
struct _cef_print_handler_t* self, struct _cef_print_handler_t* self,
struct _cef_browser_t* browser,
int device_units_per_inch); int device_units_per_inch);
} cef_print_handler_t; } cef_print_handler_t;
......
...@@ -75,8 +75,9 @@ class CefPrintJobCallback : public virtual CefBaseRefCounted { ...@@ -75,8 +75,9 @@ class CefPrintJobCallback : public virtual CefBaseRefCounted {
}; };
/// ///
// Implement this interface to handle printing on Linux. The methods of this // Implement this interface to handle printing on Linux. Each browser will have
// class will be called on the browser process UI thread. // only one print job in progress at a time. The methods of this class will be
// called on the browser process UI thread.
/// ///
/*--cef(source=client)--*/ /*--cef(source=client)--*/
class CefPrintHandler : public virtual CefBaseRefCounted { class CefPrintHandler : public virtual CefBaseRefCounted {
...@@ -96,7 +97,8 @@ class CefPrintHandler : public virtual CefBaseRefCounted { ...@@ -96,7 +97,8 @@ class CefPrintHandler : public virtual CefBaseRefCounted {
// reference to |settings| outside of this callback. // reference to |settings| outside of this callback.
/// ///
/*--cef()--*/ /*--cef()--*/
virtual void OnPrintSettings(CefRefPtr<CefPrintSettings> settings, virtual void OnPrintSettings(CefRefPtr<CefBrowser> browser,
CefRefPtr<CefPrintSettings> settings,
bool get_defaults) = 0; bool get_defaults) = 0;
/// ///
...@@ -105,7 +107,8 @@ class CefPrintHandler : public virtual CefBaseRefCounted { ...@@ -105,7 +107,8 @@ class CefPrintHandler : public virtual CefBaseRefCounted {
// printing immediately. // printing immediately.
/// ///
/*--cef()--*/ /*--cef()--*/
virtual bool OnPrintDialog(bool has_selection, virtual bool OnPrintDialog(CefRefPtr<CefBrowser> browser,
bool has_selection,
CefRefPtr<CefPrintDialogCallback> callback) = 0; CefRefPtr<CefPrintDialogCallback> callback) = 0;
/// ///
...@@ -114,7 +117,8 @@ class CefPrintHandler : public virtual CefBaseRefCounted { ...@@ -114,7 +117,8 @@ class CefPrintHandler : public virtual CefBaseRefCounted {
// immediately. // immediately.
/// ///
/*--cef()--*/ /*--cef()--*/
virtual bool OnPrintJob(const CefString& document_name, virtual bool OnPrintJob(CefRefPtr<CefBrowser> browser,
const CefString& document_name,
const CefString& pdf_file_path, const CefString& pdf_file_path,
CefRefPtr<CefPrintJobCallback> callback) = 0; CefRefPtr<CefPrintJobCallback> callback) = 0;
...@@ -122,14 +126,15 @@ class CefPrintHandler : public virtual CefBaseRefCounted { ...@@ -122,14 +126,15 @@ class CefPrintHandler : public virtual CefBaseRefCounted {
// Reset client state related to printing. // Reset client state related to printing.
/// ///
/*--cef()--*/ /*--cef()--*/
virtual void OnPrintReset() = 0; virtual void OnPrintReset(CefRefPtr<CefBrowser> browser) = 0;
/// ///
// Return the PDF paper size in device units. Used in combination with // Return the PDF paper size in device units. Used in combination with
// CefBrowserHost::PrintToPDF(). // CefBrowserHost::PrintToPDF().
/// ///
/*--cef()--*/ /*--cef()--*/
virtual CefSize GetPdfPaperSize(int device_units_per_inch) { virtual CefSize GetPdfPaperSize(CefRefPtr<CefBrowser> browser,
int device_units_per_inch) {
return CefSize(); return CefSize();
} }
}; };
......
...@@ -113,9 +113,12 @@ gfx::Size CefPrintDialogLinux::GetPdfPaperSize( ...@@ -113,9 +113,12 @@ gfx::Size CefPrintDialogLinux::GetPdfPaperSize(
if (browser_handler.get()) { if (browser_handler.get()) {
CefRefPtr<CefPrintHandler> handler = browser_handler->GetPrintHandler(); CefRefPtr<CefPrintHandler> handler = browser_handler->GetPrintHandler();
if (handler.get()) { if (handler.get()) {
CefRefPtr<CefBrowserHostImpl> browser =
extensions::GetOwnerBrowserForFrame(
context->render_process_id(), context->render_frame_id(), NULL);
const printing::PrintSettings& settings = context->settings(); const printing::PrintSettings& settings = context->settings();
CefSize cef_size = CefSize cef_size = handler->GetPdfPaperSize(
handler->GetPdfPaperSize(settings.device_units_per_inch()); browser.get(), settings.device_units_per_inch());
size.SetSize(cef_size.width, cef_size.height); size.SetSize(cef_size.width, cef_size.height);
} }
} }
...@@ -187,10 +190,14 @@ void CefPrintDialogLinux::ShowDialog( ...@@ -187,10 +190,14 @@ void CefPrintDialogLinux::ShowDialog(
callback_ = callback; callback_ = callback;
CefRefPtr<CefBrowserHostImpl> browser = extensions::GetOwnerBrowserForFrame(
context_->render_process_id(), context_->render_frame_id(), NULL);
CefRefPtr<CefPrintDialogCallbackImpl> callback_impl( CefRefPtr<CefPrintDialogCallbackImpl> callback_impl(
new CefPrintDialogCallbackImpl(this)); new CefPrintDialogCallbackImpl(this));
if (!handler_->OnPrintDialog(has_selection, callback_impl.get())) { if (!handler_->OnPrintDialog(browser.get(), has_selection,
callback_impl.get())) {
callback_impl->Disconnect(); callback_impl->Disconnect();
OnPrintCancel(); OnPrintCancel();
} }
...@@ -253,7 +260,10 @@ void CefPrintDialogLinux::SetHandler() { ...@@ -253,7 +260,10 @@ void CefPrintDialogLinux::SetHandler() {
void CefPrintDialogLinux::ReleaseHandler() { void CefPrintDialogLinux::ReleaseHandler() {
if (handler_.get()) { if (handler_.get()) {
handler_->OnPrintReset(); CefRefPtr<CefBrowserHostImpl> browser = extensions::GetOwnerBrowserForFrame(
context_->render_process_id(), context_->render_frame_id(), NULL);
handler_->OnPrintReset(browser.get());
handler_ = NULL; handler_ = NULL;
} }
} }
...@@ -266,9 +276,12 @@ bool CefPrintDialogLinux::UpdateSettings(printing::PrintSettings* settings, ...@@ -266,9 +276,12 @@ bool CefPrintDialogLinux::UpdateSettings(printing::PrintSettings* settings,
if (!handler_.get()) if (!handler_.get())
return false; return false;
CefRefPtr<CefBrowserHostImpl> browser = extensions::GetOwnerBrowserForFrame(
context_->render_process_id(), context_->render_frame_id(), NULL);
CefRefPtr<CefPrintSettingsImpl> settings_impl( CefRefPtr<CefPrintSettingsImpl> settings_impl(
new CefPrintSettingsImpl(settings, false, false)); new CefPrintSettingsImpl(settings, false, false));
handler_->OnPrintSettings(settings_impl.get(), get_defaults); handler_->OnPrintSettings(browser.get(), settings_impl.get(), get_defaults);
settings_impl->Detach(NULL); settings_impl->Detach(NULL);
context_->InitWithSettings(*settings); context_->InitWithSettings(*settings);
...@@ -284,10 +297,13 @@ void CefPrintDialogLinux::SendDocumentToPrinter( ...@@ -284,10 +297,13 @@ void CefPrintDialogLinux::SendDocumentToPrinter(
return; return;
} }
CefRefPtr<CefBrowserHostImpl> browser = extensions::GetOwnerBrowserForFrame(
context_->render_process_id(), context_->render_frame_id(), NULL);
CefRefPtr<CefPrintJobCallbackImpl> callback_impl( CefRefPtr<CefPrintJobCallbackImpl> callback_impl(
new CefPrintJobCallbackImpl(this)); new CefPrintJobCallbackImpl(this));
if (!handler_->OnPrintJob(document_name, path_to_pdf_.value(), if (!handler_->OnPrintJob(browser.get(), document_name, path_to_pdf_.value(),
callback_impl.get())) { callback_impl.get())) {
callback_impl->Disconnect(); callback_impl->Disconnect();
OnJobCompleted(); OnJobCompleted();
......
...@@ -9,7 +9,7 @@ ...@@ -9,7 +9,7 @@
// implementations. See the translator.README.txt file in the tools directory // implementations. See the translator.README.txt file in the tools directory
// for more information. // for more information.
// //
// $hash=e2a9910119dcf81b74624588d222c7781e3fdc9a$ // $hash=80fc869800987a74f4c6e4eb202f0f5201126a76$
// //
#include "libcef_dll/cpptoc/print_handler_cpptoc.h" #include "libcef_dll/cpptoc/print_handler_cpptoc.h"
...@@ -42,6 +42,7 @@ print_handler_on_print_start(struct _cef_print_handler_t* self, ...@@ -42,6 +42,7 @@ print_handler_on_print_start(struct _cef_print_handler_t* self,
void CEF_CALLBACK void CEF_CALLBACK
print_handler_on_print_settings(struct _cef_print_handler_t* self, print_handler_on_print_settings(struct _cef_print_handler_t* self,
cef_browser_t* browser,
struct _cef_print_settings_t* settings, struct _cef_print_settings_t* settings,
int get_defaults) { int get_defaults) {
// AUTO-GENERATED CONTENT - DELETE THIS COMMENT BEFORE MODIFYING // AUTO-GENERATED CONTENT - DELETE THIS COMMENT BEFORE MODIFYING
...@@ -49,6 +50,10 @@ print_handler_on_print_settings(struct _cef_print_handler_t* self, ...@@ -49,6 +50,10 @@ print_handler_on_print_settings(struct _cef_print_handler_t* self,
DCHECK(self); DCHECK(self);
if (!self) if (!self)
return; return;
// Verify param: browser; type: refptr_diff
DCHECK(browser);
if (!browser)
return;
// Verify param: settings; type: refptr_diff // Verify param: settings; type: refptr_diff
DCHECK(settings); DCHECK(settings);
if (!settings) if (!settings)
...@@ -56,11 +61,13 @@ print_handler_on_print_settings(struct _cef_print_handler_t* self, ...@@ -56,11 +61,13 @@ print_handler_on_print_settings(struct _cef_print_handler_t* self,
// Execute // Execute
CefPrintHandlerCppToC::Get(self)->OnPrintSettings( CefPrintHandlerCppToC::Get(self)->OnPrintSettings(
CefPrintSettingsCToCpp::Wrap(settings), get_defaults ? true : false); CefBrowserCToCpp::Wrap(browser), CefPrintSettingsCToCpp::Wrap(settings),
get_defaults ? true : false);
} }
int CEF_CALLBACK int CEF_CALLBACK
print_handler_on_print_dialog(struct _cef_print_handler_t* self, print_handler_on_print_dialog(struct _cef_print_handler_t* self,
cef_browser_t* browser,
int has_selection, int has_selection,
cef_print_dialog_callback_t* callback) { cef_print_dialog_callback_t* callback) {
// AUTO-GENERATED CONTENT - DELETE THIS COMMENT BEFORE MODIFYING // AUTO-GENERATED CONTENT - DELETE THIS COMMENT BEFORE MODIFYING
...@@ -68,6 +75,10 @@ print_handler_on_print_dialog(struct _cef_print_handler_t* self, ...@@ -68,6 +75,10 @@ print_handler_on_print_dialog(struct _cef_print_handler_t* self,
DCHECK(self); DCHECK(self);
if (!self) if (!self)
return 0; return 0;
// Verify param: browser; type: refptr_diff
DCHECK(browser);
if (!browser)
return 0;
// Verify param: callback; type: refptr_diff // Verify param: callback; type: refptr_diff
DCHECK(callback); DCHECK(callback);
if (!callback) if (!callback)
...@@ -75,7 +86,7 @@ print_handler_on_print_dialog(struct _cef_print_handler_t* self, ...@@ -75,7 +86,7 @@ print_handler_on_print_dialog(struct _cef_print_handler_t* self,
// Execute // Execute
bool _retval = CefPrintHandlerCppToC::Get(self)->OnPrintDialog( bool _retval = CefPrintHandlerCppToC::Get(self)->OnPrintDialog(
has_selection ? true : false, CefBrowserCToCpp::Wrap(browser), has_selection ? true : false,
CefPrintDialogCallbackCToCpp::Wrap(callback)); CefPrintDialogCallbackCToCpp::Wrap(callback));
// Return type: bool // Return type: bool
...@@ -84,6 +95,7 @@ print_handler_on_print_dialog(struct _cef_print_handler_t* self, ...@@ -84,6 +95,7 @@ print_handler_on_print_dialog(struct _cef_print_handler_t* self,
int CEF_CALLBACK int CEF_CALLBACK
print_handler_on_print_job(struct _cef_print_handler_t* self, print_handler_on_print_job(struct _cef_print_handler_t* self,
cef_browser_t* browser,
const cef_string_t* document_name, const cef_string_t* document_name,
const cef_string_t* pdf_file_path, const cef_string_t* pdf_file_path,
cef_print_job_callback_t* callback) { cef_print_job_callback_t* callback) {
...@@ -92,6 +104,10 @@ print_handler_on_print_job(struct _cef_print_handler_t* self, ...@@ -92,6 +104,10 @@ print_handler_on_print_job(struct _cef_print_handler_t* self,
DCHECK(self); DCHECK(self);
if (!self) if (!self)
return 0; return 0;
// Verify param: browser; type: refptr_diff
DCHECK(browser);
if (!browser)
return 0;
// Verify param: document_name; type: string_byref_const // Verify param: document_name; type: string_byref_const
DCHECK(document_name); DCHECK(document_name);
if (!document_name) if (!document_name)
...@@ -107,37 +123,48 @@ print_handler_on_print_job(struct _cef_print_handler_t* self, ...@@ -107,37 +123,48 @@ print_handler_on_print_job(struct _cef_print_handler_t* self,
// Execute // Execute
bool _retval = CefPrintHandlerCppToC::Get(self)->OnPrintJob( bool _retval = CefPrintHandlerCppToC::Get(self)->OnPrintJob(
CefString(document_name), CefString(pdf_file_path), CefBrowserCToCpp::Wrap(browser), CefString(document_name),
CefPrintJobCallbackCToCpp::Wrap(callback)); CefString(pdf_file_path), CefPrintJobCallbackCToCpp::Wrap(callback));
// Return type: bool // Return type: bool
return _retval; return _retval;
} }
void CEF_CALLBACK void CEF_CALLBACK
print_handler_on_print_reset(struct _cef_print_handler_t* self) { print_handler_on_print_reset(struct _cef_print_handler_t* self,
cef_browser_t* browser) {
// AUTO-GENERATED CONTENT - DELETE THIS COMMENT BEFORE MODIFYING // AUTO-GENERATED CONTENT - DELETE THIS COMMENT BEFORE MODIFYING
DCHECK(self); DCHECK(self);
if (!self) if (!self)
return; return;
// Verify param: browser; type: refptr_diff
DCHECK(browser);
if (!browser)
return;
// Execute // Execute
CefPrintHandlerCppToC::Get(self)->OnPrintReset(); CefPrintHandlerCppToC::Get(self)->OnPrintReset(
CefBrowserCToCpp::Wrap(browser));
} }
cef_size_t CEF_CALLBACK cef_size_t CEF_CALLBACK
print_handler_get_pdf_paper_size(struct _cef_print_handler_t* self, print_handler_get_pdf_paper_size(struct _cef_print_handler_t* self,
cef_browser_t* browser,
int device_units_per_inch) { int device_units_per_inch) {
// AUTO-GENERATED CONTENT - DELETE THIS COMMENT BEFORE MODIFYING // AUTO-GENERATED CONTENT - DELETE THIS COMMENT BEFORE MODIFYING
DCHECK(self); DCHECK(self);
if (!self) if (!self)
return CefSize(); return CefSize();
// Verify param: browser; type: refptr_diff
DCHECK(browser);
if (!browser)
return CefSize();
// Execute // Execute
cef_size_t _retval = cef_size_t _retval = CefPrintHandlerCppToC::Get(self)->GetPdfPaperSize(
CefPrintHandlerCppToC::Get(self)->GetPdfPaperSize(device_units_per_inch); CefBrowserCToCpp::Wrap(browser), device_units_per_inch);
// Return type: simple // Return type: simple
return _retval; return _retval;
......
...@@ -9,7 +9,7 @@ ...@@ -9,7 +9,7 @@
// implementations. See the translator.README.txt file in the tools directory // implementations. See the translator.README.txt file in the tools directory
// for more information. // for more information.
// //
// $hash=0749b78aaf8f69cd706962477d4d0241c93cf333$ // $hash=80679bfc067e7564eadb691876081c4176b04c4f$
// //
#include "libcef_dll/ctocpp/print_handler_ctocpp.h" #include "libcef_dll/ctocpp/print_handler_ctocpp.h"
...@@ -37,6 +37,7 @@ void CefPrintHandlerCToCpp::OnPrintStart(CefRefPtr<CefBrowser> browser) { ...@@ -37,6 +37,7 @@ void CefPrintHandlerCToCpp::OnPrintStart(CefRefPtr<CefBrowser> browser) {
} }
void CefPrintHandlerCToCpp::OnPrintSettings( void CefPrintHandlerCToCpp::OnPrintSettings(
CefRefPtr<CefBrowser> browser,
CefRefPtr<CefPrintSettings> settings, CefRefPtr<CefPrintSettings> settings,
bool get_defaults) { bool get_defaults) {
cef_print_handler_t* _struct = GetStruct(); cef_print_handler_t* _struct = GetStruct();
...@@ -45,17 +46,23 @@ void CefPrintHandlerCToCpp::OnPrintSettings( ...@@ -45,17 +46,23 @@ void CefPrintHandlerCToCpp::OnPrintSettings(
// AUTO-GENERATED CONTENT - DELETE THIS COMMENT BEFORE MODIFYING // 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 // Verify param: settings; type: refptr_diff
DCHECK(settings.get()); DCHECK(settings.get());
if (!settings.get()) if (!settings.get())
return; return;
// Execute // Execute
_struct->on_print_settings(_struct, CefPrintSettingsCppToC::Wrap(settings), _struct->on_print_settings(_struct, CefBrowserCppToC::Wrap(browser),
CefPrintSettingsCppToC::Wrap(settings),
get_defaults); get_defaults);
} }
bool CefPrintHandlerCToCpp::OnPrintDialog( bool CefPrintHandlerCToCpp::OnPrintDialog(
CefRefPtr<CefBrowser> browser,
bool has_selection, bool has_selection,
CefRefPtr<CefPrintDialogCallback> callback) { CefRefPtr<CefPrintDialogCallback> callback) {
cef_print_handler_t* _struct = GetStruct(); cef_print_handler_t* _struct = GetStruct();
...@@ -64,6 +71,10 @@ bool CefPrintHandlerCToCpp::OnPrintDialog( ...@@ -64,6 +71,10 @@ bool CefPrintHandlerCToCpp::OnPrintDialog(
// AUTO-GENERATED CONTENT - DELETE THIS COMMENT BEFORE MODIFYING // 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 // Verify param: callback; type: refptr_diff
DCHECK(callback.get()); DCHECK(callback.get());
if (!callback.get()) if (!callback.get())
...@@ -71,13 +82,15 @@ bool CefPrintHandlerCToCpp::OnPrintDialog( ...@@ -71,13 +82,15 @@ bool CefPrintHandlerCToCpp::OnPrintDialog(
// Execute // Execute
int _retval = _struct->on_print_dialog( 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 type: bool
return _retval ? true : false; return _retval ? true : false;
} }
bool CefPrintHandlerCToCpp::OnPrintJob( bool CefPrintHandlerCToCpp::OnPrintJob(
CefRefPtr<CefBrowser> browser,
const CefString& document_name, const CefString& document_name,
const CefString& pdf_file_path, const CefString& pdf_file_path,
CefRefPtr<CefPrintJobCallback> callback) { CefRefPtr<CefPrintJobCallback> callback) {
...@@ -87,6 +100,10 @@ bool CefPrintHandlerCToCpp::OnPrintJob( ...@@ -87,6 +100,10 @@ bool CefPrintHandlerCToCpp::OnPrintJob(
// AUTO-GENERATED CONTENT - DELETE THIS COMMENT BEFORE MODIFYING // 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 // Verify param: document_name; type: string_byref_const
DCHECK(!document_name.empty()); DCHECK(!document_name.empty());
if (document_name.empty()) if (document_name.empty())
...@@ -102,34 +119,45 @@ bool CefPrintHandlerCToCpp::OnPrintJob( ...@@ -102,34 +119,45 @@ bool CefPrintHandlerCToCpp::OnPrintJob(
// Execute // Execute
int _retval = _struct->on_print_job( int _retval = _struct->on_print_job(
_struct, document_name.GetStruct(), pdf_file_path.GetStruct(), _struct, CefBrowserCppToC::Wrap(browser), document_name.GetStruct(),
CefPrintJobCallbackCppToC::Wrap(callback)); pdf_file_path.GetStruct(), CefPrintJobCallbackCppToC::Wrap(callback));
// Return type: bool // Return type: bool
return _retval ? true : false; return _retval ? true : false;
} }
void CefPrintHandlerCToCpp::OnPrintReset() { void CefPrintHandlerCToCpp::OnPrintReset(CefRefPtr<CefBrowser> browser) {
cef_print_handler_t* _struct = GetStruct(); cef_print_handler_t* _struct = GetStruct();
if (CEF_MEMBER_MISSING(_struct, on_print_reset)) if (CEF_MEMBER_MISSING(_struct, on_print_reset))
return; return;
// AUTO-GENERATED CONTENT - DELETE THIS COMMENT BEFORE MODIFYING // AUTO-GENERATED CONTENT - DELETE THIS COMMENT BEFORE MODIFYING
// Verify param: browser; type: refptr_diff
DCHECK(browser.get());
if (!browser.get())
return;
// Execute // 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(