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=f81708853d5cb6ee2fb397f401787068b722b060$
13 //
14
15 #include "libcef_dll/ctocpp/print_handler_ctocpp.h"
16 #include "libcef_dll/cpptoc/browser_cpptoc.h"
17 #include "libcef_dll/cpptoc/print_dialog_callback_cpptoc.h"
18 #include "libcef_dll/cpptoc/print_job_callback_cpptoc.h"
19 #include "libcef_dll/cpptoc/print_settings_cpptoc.h"
20 #include "libcef_dll/shutdown_checker.h"
21
22 // VIRTUAL METHODS - Body may be edited by hand.
23
24 NO_SANITIZE("cfi-icall")
OnPrintStart(CefRefPtr<CefBrowser> browser)25 void CefPrintHandlerCToCpp::OnPrintStart(CefRefPtr<CefBrowser> browser) {
26 shutdown_checker::AssertNotShutdown();
27
28 cef_print_handler_t* _struct = GetStruct();
29 if (CEF_MEMBER_MISSING(_struct, on_print_start))
30 return;
31
32 // AUTO-GENERATED CONTENT - DELETE THIS COMMENT BEFORE MODIFYING
33
34 // Verify param: browser; type: refptr_diff
35 DCHECK(browser.get());
36 if (!browser.get())
37 return;
38
39 // Execute
40 _struct->on_print_start(_struct, CefBrowserCppToC::Wrap(browser));
41 }
42
43 NO_SANITIZE("cfi-icall")
OnPrintSettings(CefRefPtr<CefBrowser> browser,CefRefPtr<CefPrintSettings> settings,bool get_defaults)44 void CefPrintHandlerCToCpp::OnPrintSettings(
45 CefRefPtr<CefBrowser> browser,
46 CefRefPtr<CefPrintSettings> settings,
47 bool get_defaults) {
48 shutdown_checker::AssertNotShutdown();
49
50 cef_print_handler_t* _struct = GetStruct();
51 if (CEF_MEMBER_MISSING(_struct, on_print_settings))
52 return;
53
54 // AUTO-GENERATED CONTENT - DELETE THIS COMMENT BEFORE MODIFYING
55
56 // Verify param: browser; type: refptr_diff
57 DCHECK(browser.get());
58 if (!browser.get())
59 return;
60 // Verify param: settings; type: refptr_diff
61 DCHECK(settings.get());
62 if (!settings.get())
63 return;
64
65 // Execute
66 _struct->on_print_settings(_struct, CefBrowserCppToC::Wrap(browser),
67 CefPrintSettingsCppToC::Wrap(settings),
68 get_defaults);
69 }
70
71 NO_SANITIZE("cfi-icall")
OnPrintDialog(CefRefPtr<CefBrowser> browser,bool has_selection,CefRefPtr<CefPrintDialogCallback> callback)72 bool CefPrintHandlerCToCpp::OnPrintDialog(
73 CefRefPtr<CefBrowser> browser,
74 bool has_selection,
75 CefRefPtr<CefPrintDialogCallback> callback) {
76 shutdown_checker::AssertNotShutdown();
77
78 cef_print_handler_t* _struct = GetStruct();
79 if (CEF_MEMBER_MISSING(_struct, on_print_dialog))
80 return false;
81
82 // AUTO-GENERATED CONTENT - DELETE THIS COMMENT BEFORE MODIFYING
83
84 // Verify param: browser; type: refptr_diff
85 DCHECK(browser.get());
86 if (!browser.get())
87 return false;
88 // Verify param: callback; type: refptr_diff
89 DCHECK(callback.get());
90 if (!callback.get())
91 return false;
92
93 // Execute
94 int _retval = _struct->on_print_dialog(
95 _struct, CefBrowserCppToC::Wrap(browser), has_selection,
96 CefPrintDialogCallbackCppToC::Wrap(callback));
97
98 // Return type: bool
99 return _retval ? true : false;
100 }
101
102 NO_SANITIZE("cfi-icall")
OnPrintJob(CefRefPtr<CefBrowser> browser,const CefString & document_name,const CefString & pdf_file_path,CefRefPtr<CefPrintJobCallback> callback)103 bool CefPrintHandlerCToCpp::OnPrintJob(
104 CefRefPtr<CefBrowser> browser,
105 const CefString& document_name,
106 const CefString& pdf_file_path,
107 CefRefPtr<CefPrintJobCallback> callback) {
108 shutdown_checker::AssertNotShutdown();
109
110 cef_print_handler_t* _struct = GetStruct();
111 if (CEF_MEMBER_MISSING(_struct, on_print_job))
112 return false;
113
114 // AUTO-GENERATED CONTENT - DELETE THIS COMMENT BEFORE MODIFYING
115
116 // Verify param: browser; type: refptr_diff
117 DCHECK(browser.get());
118 if (!browser.get())
119 return false;
120 // Verify param: document_name; type: string_byref_const
121 DCHECK(!document_name.empty());
122 if (document_name.empty())
123 return false;
124 // Verify param: pdf_file_path; type: string_byref_const
125 DCHECK(!pdf_file_path.empty());
126 if (pdf_file_path.empty())
127 return false;
128 // Verify param: callback; type: refptr_diff
129 DCHECK(callback.get());
130 if (!callback.get())
131 return false;
132
133 // Execute
134 int _retval = _struct->on_print_job(
135 _struct, CefBrowserCppToC::Wrap(browser), document_name.GetStruct(),
136 pdf_file_path.GetStruct(), CefPrintJobCallbackCppToC::Wrap(callback));
137
138 // Return type: bool
139 return _retval ? true : false;
140 }
141
142 NO_SANITIZE("cfi-icall")
OnPrintReset(CefRefPtr<CefBrowser> browser)143 void CefPrintHandlerCToCpp::OnPrintReset(CefRefPtr<CefBrowser> browser) {
144 shutdown_checker::AssertNotShutdown();
145
146 cef_print_handler_t* _struct = GetStruct();
147 if (CEF_MEMBER_MISSING(_struct, on_print_reset))
148 return;
149
150 // AUTO-GENERATED CONTENT - DELETE THIS COMMENT BEFORE MODIFYING
151
152 // Verify param: browser; type: refptr_diff
153 DCHECK(browser.get());
154 if (!browser.get())
155 return;
156
157 // Execute
158 _struct->on_print_reset(_struct, CefBrowserCppToC::Wrap(browser));
159 }
160
161 NO_SANITIZE("cfi-icall")
GetPdfPaperSize(CefRefPtr<CefBrowser> browser,int device_units_per_inch)162 CefSize CefPrintHandlerCToCpp::GetPdfPaperSize(CefRefPtr<CefBrowser> browser,
163 int device_units_per_inch) {
164 shutdown_checker::AssertNotShutdown();
165
166 cef_print_handler_t* _struct = GetStruct();
167 if (CEF_MEMBER_MISSING(_struct, get_pdf_paper_size))
168 return CefSize();
169
170 // AUTO-GENERATED CONTENT - DELETE THIS COMMENT BEFORE MODIFYING
171
172 // Verify param: browser; type: refptr_diff
173 DCHECK(browser.get());
174 if (!browser.get())
175 return CefSize();
176
177 // Execute
178 cef_size_t _retval = _struct->get_pdf_paper_size(
179 _struct, CefBrowserCppToC::Wrap(browser), device_units_per_inch);
180
181 // Return type: simple
182 return _retval;
183 }
184
185 // CONSTRUCTOR - Do not edit by hand.
186
CefPrintHandlerCToCpp()187 CefPrintHandlerCToCpp::CefPrintHandlerCToCpp() {}
188
189 // DESTRUCTOR - Do not edit by hand.
190
~CefPrintHandlerCToCpp()191 CefPrintHandlerCToCpp::~CefPrintHandlerCToCpp() {
192 shutdown_checker::AssertNotShutdown();
193 }
194
195 template <>
196 cef_print_handler_t*
197 CefCToCppRefCounted<CefPrintHandlerCToCpp,
198 CefPrintHandler,
UnwrapDerived(CefWrapperType type,CefPrintHandler * c)199 cef_print_handler_t>::UnwrapDerived(CefWrapperType type,
200 CefPrintHandler* c) {
201 NOTREACHED() << "Unexpected class type: " << type;
202 return nullptr;
203 }
204
205 template <>
206 CefWrapperType CefCToCppRefCounted<CefPrintHandlerCToCpp,
207 CefPrintHandler,
208 cef_print_handler_t>::kWrapperType =
209 WT_PRINT_HANDLER;
210