1 // Copyright (c) 2022 The Chromium Embedded Framework Authors. All rights
2 // reserved. Use of this source code is governed by a BSD-style license that
3 // can be found in the LICENSE file.
4 //
5 // ---------------------------------------------------------------------------
6 //
7 // This file was generated by the CEF translator tool. If making changes by
8 // hand only do so within the body of existing method and function
9 // implementations. See the translator.README.txt file in the tools directory
10 // for more information.
11 //
12 // $hash=9c26e4bf9952a26541915f64dad82080f09dfd58$
13 //
14
15 #include "libcef_dll/cpptoc/print_handler_cpptoc.h"
16 #include "libcef_dll/ctocpp/browser_ctocpp.h"
17 #include "libcef_dll/ctocpp/print_dialog_callback_ctocpp.h"
18 #include "libcef_dll/ctocpp/print_job_callback_ctocpp.h"
19 #include "libcef_dll/ctocpp/print_settings_ctocpp.h"
20 #include "libcef_dll/shutdown_checker.h"
21
22 namespace {
23
24 // MEMBER FUNCTIONS - Body may be edited by hand.
25
26 void CEF_CALLBACK
print_handler_on_print_start(struct _cef_print_handler_t * self,cef_browser_t * browser)27 print_handler_on_print_start(struct _cef_print_handler_t* self,
28 cef_browser_t* browser) {
29 shutdown_checker::AssertNotShutdown();
30
31 // AUTO-GENERATED CONTENT - DELETE THIS COMMENT BEFORE MODIFYING
32
33 DCHECK(self);
34 if (!self)
35 return;
36 // Verify param: browser; type: refptr_diff
37 DCHECK(browser);
38 if (!browser)
39 return;
40
41 // Execute
42 CefPrintHandlerCppToC::Get(self)->OnPrintStart(
43 CefBrowserCToCpp::Wrap(browser));
44 }
45
46 void CEF_CALLBACK
print_handler_on_print_settings(struct _cef_print_handler_t * self,cef_browser_t * browser,struct _cef_print_settings_t * settings,int get_defaults)47 print_handler_on_print_settings(struct _cef_print_handler_t* self,
48 cef_browser_t* browser,
49 struct _cef_print_settings_t* settings,
50 int get_defaults) {
51 shutdown_checker::AssertNotShutdown();
52
53 // AUTO-GENERATED CONTENT - DELETE THIS COMMENT BEFORE MODIFYING
54
55 DCHECK(self);
56 if (!self)
57 return;
58 // Verify param: browser; type: refptr_diff
59 DCHECK(browser);
60 if (!browser)
61 return;
62 // Verify param: settings; type: refptr_diff
63 DCHECK(settings);
64 if (!settings)
65 return;
66
67 // Execute
68 CefPrintHandlerCppToC::Get(self)->OnPrintSettings(
69 CefBrowserCToCpp::Wrap(browser), CefPrintSettingsCToCpp::Wrap(settings),
70 get_defaults ? true : false);
71 }
72
73 int CEF_CALLBACK
print_handler_on_print_dialog(struct _cef_print_handler_t * self,cef_browser_t * browser,int has_selection,cef_print_dialog_callback_t * callback)74 print_handler_on_print_dialog(struct _cef_print_handler_t* self,
75 cef_browser_t* browser,
76 int has_selection,
77 cef_print_dialog_callback_t* callback) {
78 shutdown_checker::AssertNotShutdown();
79
80 // AUTO-GENERATED CONTENT - DELETE THIS COMMENT BEFORE MODIFYING
81
82 DCHECK(self);
83 if (!self)
84 return 0;
85 // Verify param: browser; type: refptr_diff
86 DCHECK(browser);
87 if (!browser)
88 return 0;
89 // Verify param: callback; type: refptr_diff
90 DCHECK(callback);
91 if (!callback)
92 return 0;
93
94 // Execute
95 bool _retval = CefPrintHandlerCppToC::Get(self)->OnPrintDialog(
96 CefBrowserCToCpp::Wrap(browser), has_selection ? true : false,
97 CefPrintDialogCallbackCToCpp::Wrap(callback));
98
99 // Return type: bool
100 return _retval;
101 }
102
103 int CEF_CALLBACK
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 * pdf_file_path,cef_print_job_callback_t * callback)104 print_handler_on_print_job(struct _cef_print_handler_t* self,
105 cef_browser_t* browser,
106 const cef_string_t* document_name,
107 const cef_string_t* pdf_file_path,
108 cef_print_job_callback_t* callback) {
109 shutdown_checker::AssertNotShutdown();
110
111 // AUTO-GENERATED CONTENT - DELETE THIS COMMENT BEFORE MODIFYING
112
113 DCHECK(self);
114 if (!self)
115 return 0;
116 // Verify param: browser; type: refptr_diff
117 DCHECK(browser);
118 if (!browser)
119 return 0;
120 // Verify param: document_name; type: string_byref_const
121 DCHECK(document_name);
122 if (!document_name)
123 return 0;
124 // Verify param: pdf_file_path; type: string_byref_const
125 DCHECK(pdf_file_path);
126 if (!pdf_file_path)
127 return 0;
128 // Verify param: callback; type: refptr_diff
129 DCHECK(callback);
130 if (!callback)
131 return 0;
132
133 // Execute
134 bool _retval = CefPrintHandlerCppToC::Get(self)->OnPrintJob(
135 CefBrowserCToCpp::Wrap(browser), CefString(document_name),
136 CefString(pdf_file_path), CefPrintJobCallbackCToCpp::Wrap(callback));
137
138 // Return type: bool
139 return _retval;
140 }
141
142 void CEF_CALLBACK
print_handler_on_print_reset(struct _cef_print_handler_t * self,cef_browser_t * browser)143 print_handler_on_print_reset(struct _cef_print_handler_t* self,
144 cef_browser_t* browser) {
145 shutdown_checker::AssertNotShutdown();
146
147 // AUTO-GENERATED CONTENT - DELETE THIS COMMENT BEFORE MODIFYING
148
149 DCHECK(self);
150 if (!self)
151 return;
152 // Verify param: browser; type: refptr_diff
153 DCHECK(browser);
154 if (!browser)
155 return;
156
157 // Execute
158 CefPrintHandlerCppToC::Get(self)->OnPrintReset(
159 CefBrowserCToCpp::Wrap(browser));
160 }
161
162 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)163 print_handler_get_pdf_paper_size(struct _cef_print_handler_t* self,
164 cef_browser_t* browser,
165 int device_units_per_inch) {
166 shutdown_checker::AssertNotShutdown();
167
168 // AUTO-GENERATED CONTENT - DELETE THIS COMMENT BEFORE MODIFYING
169
170 DCHECK(self);
171 if (!self)
172 return CefSize();
173 // Verify param: browser; type: refptr_diff
174 DCHECK(browser);
175 if (!browser)
176 return CefSize();
177
178 // Execute
179 cef_size_t _retval = CefPrintHandlerCppToC::Get(self)->GetPdfPaperSize(
180 CefBrowserCToCpp::Wrap(browser), device_units_per_inch);
181
182 // Return type: simple
183 return _retval;
184 }
185
186 } // namespace
187
188 // CONSTRUCTOR - Do not edit by hand.
189
CefPrintHandlerCppToC()190 CefPrintHandlerCppToC::CefPrintHandlerCppToC() {
191 GetStruct()->on_print_start = print_handler_on_print_start;
192 GetStruct()->on_print_settings = print_handler_on_print_settings;
193 GetStruct()->on_print_dialog = print_handler_on_print_dialog;
194 GetStruct()->on_print_job = print_handler_on_print_job;
195 GetStruct()->on_print_reset = print_handler_on_print_reset;
196 GetStruct()->get_pdf_paper_size = print_handler_get_pdf_paper_size;
197 }
198
199 // DESTRUCTOR - Do not edit by hand.
200
~CefPrintHandlerCppToC()201 CefPrintHandlerCppToC::~CefPrintHandlerCppToC() {
202 shutdown_checker::AssertNotShutdown();
203 }
204
205 template <>
206 CefRefPtr<CefPrintHandler> CefCppToCRefCounted<
207 CefPrintHandlerCppToC,
208 CefPrintHandler,
UnwrapDerived(CefWrapperType type,cef_print_handler_t * s)209 cef_print_handler_t>::UnwrapDerived(CefWrapperType type,
210 cef_print_handler_t* s) {
211 NOTREACHED() << "Unexpected class type: " << type;
212 return nullptr;
213 }
214
215 template <>
216 CefWrapperType CefCppToCRefCounted<CefPrintHandlerCppToC,
217 CefPrintHandler,
218 cef_print_handler_t>::kWrapperType =
219 WT_PRINT_HANDLER;
220