1 // Copyright (c) 2021 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=bdbe1ed03a5ab0ca22668417c329555a3b0d9cea$
13 //
14
15 #include "libcef_dll/cpptoc/client_cpptoc.h"
16 #include "libcef_dll/cpptoc/audio_handler_cpptoc.h"
17 #include "libcef_dll/cpptoc/context_menu_handler_cpptoc.h"
18 #include "libcef_dll/cpptoc/dialog_handler_cpptoc.h"
19 #include "libcef_dll/cpptoc/display_handler_cpptoc.h"
20 #include "libcef_dll/cpptoc/download_handler_cpptoc.h"
21 #include "libcef_dll/cpptoc/drag_handler_cpptoc.h"
22 #include "libcef_dll/cpptoc/find_handler_cpptoc.h"
23 #include "libcef_dll/cpptoc/focus_handler_cpptoc.h"
24 #include "libcef_dll/cpptoc/jsdialog_handler_cpptoc.h"
25 #include "libcef_dll/cpptoc/keyboard_handler_cpptoc.h"
26 #include "libcef_dll/cpptoc/life_span_handler_cpptoc.h"
27 #include "libcef_dll/cpptoc/load_handler_cpptoc.h"
28 #include "libcef_dll/cpptoc/print_handler_cpptoc.h"
29 #include "libcef_dll/cpptoc/render_handler_cpptoc.h"
30 #include "libcef_dll/cpptoc/request_handler_cpptoc.h"
31 #include "libcef_dll/ctocpp/browser_ctocpp.h"
32 #include "libcef_dll/ctocpp/frame_ctocpp.h"
33 #include "libcef_dll/ctocpp/process_message_ctocpp.h"
34
35 namespace {
36
37 // MEMBER FUNCTIONS - Body may be edited by hand.
38
39 cef_audio_handler_t* CEF_CALLBACK
client_get_audio_handler(struct _cef_client_t * self)40 client_get_audio_handler(struct _cef_client_t* self) {
41 // AUTO-GENERATED CONTENT - DELETE THIS COMMENT BEFORE MODIFYING
42
43 DCHECK(self);
44 if (!self)
45 return NULL;
46
47 // Execute
48 CefRefPtr<CefAudioHandler> _retval =
49 CefClientCppToC::Get(self)->GetAudioHandler();
50
51 // Return type: refptr_same
52 return CefAudioHandlerCppToC::Wrap(_retval);
53 }
54
55 struct _cef_context_menu_handler_t* CEF_CALLBACK
client_get_context_menu_handler(struct _cef_client_t * self)56 client_get_context_menu_handler(struct _cef_client_t* self) {
57 // AUTO-GENERATED CONTENT - DELETE THIS COMMENT BEFORE MODIFYING
58
59 DCHECK(self);
60 if (!self)
61 return NULL;
62
63 // Execute
64 CefRefPtr<CefContextMenuHandler> _retval =
65 CefClientCppToC::Get(self)->GetContextMenuHandler();
66
67 // Return type: refptr_same
68 return CefContextMenuHandlerCppToC::Wrap(_retval);
69 }
70
71 struct _cef_dialog_handler_t* CEF_CALLBACK
client_get_dialog_handler(struct _cef_client_t * self)72 client_get_dialog_handler(struct _cef_client_t* self) {
73 // AUTO-GENERATED CONTENT - DELETE THIS COMMENT BEFORE MODIFYING
74
75 DCHECK(self);
76 if (!self)
77 return NULL;
78
79 // Execute
80 CefRefPtr<CefDialogHandler> _retval =
81 CefClientCppToC::Get(self)->GetDialogHandler();
82
83 // Return type: refptr_same
84 return CefDialogHandlerCppToC::Wrap(_retval);
85 }
86
87 struct _cef_display_handler_t* CEF_CALLBACK
client_get_display_handler(struct _cef_client_t * self)88 client_get_display_handler(struct _cef_client_t* self) {
89 // AUTO-GENERATED CONTENT - DELETE THIS COMMENT BEFORE MODIFYING
90
91 DCHECK(self);
92 if (!self)
93 return NULL;
94
95 // Execute
96 CefRefPtr<CefDisplayHandler> _retval =
97 CefClientCppToC::Get(self)->GetDisplayHandler();
98
99 // Return type: refptr_same
100 return CefDisplayHandlerCppToC::Wrap(_retval);
101 }
102
103 struct _cef_download_handler_t* CEF_CALLBACK
client_get_download_handler(struct _cef_client_t * self)104 client_get_download_handler(struct _cef_client_t* self) {
105 // AUTO-GENERATED CONTENT - DELETE THIS COMMENT BEFORE MODIFYING
106
107 DCHECK(self);
108 if (!self)
109 return NULL;
110
111 // Execute
112 CefRefPtr<CefDownloadHandler> _retval =
113 CefClientCppToC::Get(self)->GetDownloadHandler();
114
115 // Return type: refptr_same
116 return CefDownloadHandlerCppToC::Wrap(_retval);
117 }
118
119 struct _cef_drag_handler_t* CEF_CALLBACK
client_get_drag_handler(struct _cef_client_t * self)120 client_get_drag_handler(struct _cef_client_t* self) {
121 // AUTO-GENERATED CONTENT - DELETE THIS COMMENT BEFORE MODIFYING
122
123 DCHECK(self);
124 if (!self)
125 return NULL;
126
127 // Execute
128 CefRefPtr<CefDragHandler> _retval =
129 CefClientCppToC::Get(self)->GetDragHandler();
130
131 // Return type: refptr_same
132 return CefDragHandlerCppToC::Wrap(_retval);
133 }
134
135 struct _cef_find_handler_t* CEF_CALLBACK
client_get_find_handler(struct _cef_client_t * self)136 client_get_find_handler(struct _cef_client_t* self) {
137 // AUTO-GENERATED CONTENT - DELETE THIS COMMENT BEFORE MODIFYING
138
139 DCHECK(self);
140 if (!self)
141 return NULL;
142
143 // Execute
144 CefRefPtr<CefFindHandler> _retval =
145 CefClientCppToC::Get(self)->GetFindHandler();
146
147 // Return type: refptr_same
148 return CefFindHandlerCppToC::Wrap(_retval);
149 }
150
151 struct _cef_focus_handler_t* CEF_CALLBACK
client_get_focus_handler(struct _cef_client_t * self)152 client_get_focus_handler(struct _cef_client_t* self) {
153 // AUTO-GENERATED CONTENT - DELETE THIS COMMENT BEFORE MODIFYING
154
155 DCHECK(self);
156 if (!self)
157 return NULL;
158
159 // Execute
160 CefRefPtr<CefFocusHandler> _retval =
161 CefClientCppToC::Get(self)->GetFocusHandler();
162
163 // Return type: refptr_same
164 return CefFocusHandlerCppToC::Wrap(_retval);
165 }
166
167 struct _cef_jsdialog_handler_t* CEF_CALLBACK
client_get_jsdialog_handler(struct _cef_client_t * self)168 client_get_jsdialog_handler(struct _cef_client_t* self) {
169 // AUTO-GENERATED CONTENT - DELETE THIS COMMENT BEFORE MODIFYING
170
171 DCHECK(self);
172 if (!self)
173 return NULL;
174
175 // Execute
176 CefRefPtr<CefJSDialogHandler> _retval =
177 CefClientCppToC::Get(self)->GetJSDialogHandler();
178
179 // Return type: refptr_same
180 return CefJSDialogHandlerCppToC::Wrap(_retval);
181 }
182
183 struct _cef_keyboard_handler_t* CEF_CALLBACK
client_get_keyboard_handler(struct _cef_client_t * self)184 client_get_keyboard_handler(struct _cef_client_t* self) {
185 // AUTO-GENERATED CONTENT - DELETE THIS COMMENT BEFORE MODIFYING
186
187 DCHECK(self);
188 if (!self)
189 return NULL;
190
191 // Execute
192 CefRefPtr<CefKeyboardHandler> _retval =
193 CefClientCppToC::Get(self)->GetKeyboardHandler();
194
195 // Return type: refptr_same
196 return CefKeyboardHandlerCppToC::Wrap(_retval);
197 }
198
199 struct _cef_life_span_handler_t* CEF_CALLBACK
client_get_life_span_handler(struct _cef_client_t * self)200 client_get_life_span_handler(struct _cef_client_t* self) {
201 // AUTO-GENERATED CONTENT - DELETE THIS COMMENT BEFORE MODIFYING
202
203 DCHECK(self);
204 if (!self)
205 return NULL;
206
207 // Execute
208 CefRefPtr<CefLifeSpanHandler> _retval =
209 CefClientCppToC::Get(self)->GetLifeSpanHandler();
210
211 // Return type: refptr_same
212 return CefLifeSpanHandlerCppToC::Wrap(_retval);
213 }
214
215 struct _cef_load_handler_t* CEF_CALLBACK
client_get_load_handler(struct _cef_client_t * self)216 client_get_load_handler(struct _cef_client_t* self) {
217 // AUTO-GENERATED CONTENT - DELETE THIS COMMENT BEFORE MODIFYING
218
219 DCHECK(self);
220 if (!self)
221 return NULL;
222
223 // Execute
224 CefRefPtr<CefLoadHandler> _retval =
225 CefClientCppToC::Get(self)->GetLoadHandler();
226
227 // Return type: refptr_same
228 return CefLoadHandlerCppToC::Wrap(_retval);
229 }
230
231 struct _cef_print_handler_t* CEF_CALLBACK
client_get_print_handler(struct _cef_client_t * self)232 client_get_print_handler(struct _cef_client_t* self) {
233 // AUTO-GENERATED CONTENT - DELETE THIS COMMENT BEFORE MODIFYING
234
235 DCHECK(self);
236 if (!self)
237 return NULL;
238
239 // Execute
240 CefRefPtr<CefPrintHandler> _retval =
241 CefClientCppToC::Get(self)->GetPrintHandler();
242
243 // Return type: refptr_same
244 return CefPrintHandlerCppToC::Wrap(_retval);
245 }
246
247 struct _cef_render_handler_t* CEF_CALLBACK
client_get_render_handler(struct _cef_client_t * self)248 client_get_render_handler(struct _cef_client_t* self) {
249 // AUTO-GENERATED CONTENT - DELETE THIS COMMENT BEFORE MODIFYING
250
251 DCHECK(self);
252 if (!self)
253 return NULL;
254
255 // Execute
256 CefRefPtr<CefRenderHandler> _retval =
257 CefClientCppToC::Get(self)->GetRenderHandler();
258
259 // Return type: refptr_same
260 return CefRenderHandlerCppToC::Wrap(_retval);
261 }
262
263 struct _cef_request_handler_t* CEF_CALLBACK
client_get_request_handler(struct _cef_client_t * self)264 client_get_request_handler(struct _cef_client_t* self) {
265 // AUTO-GENERATED CONTENT - DELETE THIS COMMENT BEFORE MODIFYING
266
267 DCHECK(self);
268 if (!self)
269 return NULL;
270
271 // Execute
272 CefRefPtr<CefRequestHandler> _retval =
273 CefClientCppToC::Get(self)->GetRequestHandler();
274
275 // Return type: refptr_same
276 return CefRequestHandlerCppToC::Wrap(_retval);
277 }
278
279 int CEF_CALLBACK
client_on_process_message_received(struct _cef_client_t * self,cef_browser_t * browser,struct _cef_frame_t * frame,cef_process_id_t source_process,struct _cef_process_message_t * message)280 client_on_process_message_received(struct _cef_client_t* self,
281 cef_browser_t* browser,
282 struct _cef_frame_t* frame,
283 cef_process_id_t source_process,
284 struct _cef_process_message_t* message) {
285 // AUTO-GENERATED CONTENT - DELETE THIS COMMENT BEFORE MODIFYING
286
287 DCHECK(self);
288 if (!self)
289 return 0;
290 // Verify param: browser; type: refptr_diff
291 DCHECK(browser);
292 if (!browser)
293 return 0;
294 // Verify param: frame; type: refptr_diff
295 DCHECK(frame);
296 if (!frame)
297 return 0;
298 // Verify param: message; type: refptr_diff
299 DCHECK(message);
300 if (!message)
301 return 0;
302
303 // Execute
304 bool _retval = CefClientCppToC::Get(self)->OnProcessMessageReceived(
305 CefBrowserCToCpp::Wrap(browser), CefFrameCToCpp::Wrap(frame),
306 source_process, CefProcessMessageCToCpp::Wrap(message));
307
308 // Return type: bool
309 return _retval;
310 }
311
312 } // namespace
313
314 // CONSTRUCTOR - Do not edit by hand.
315
CefClientCppToC()316 CefClientCppToC::CefClientCppToC() {
317 GetStruct()->get_audio_handler = client_get_audio_handler;
318 GetStruct()->get_context_menu_handler = client_get_context_menu_handler;
319 GetStruct()->get_dialog_handler = client_get_dialog_handler;
320 GetStruct()->get_display_handler = client_get_display_handler;
321 GetStruct()->get_download_handler = client_get_download_handler;
322 GetStruct()->get_drag_handler = client_get_drag_handler;
323 GetStruct()->get_find_handler = client_get_find_handler;
324 GetStruct()->get_focus_handler = client_get_focus_handler;
325 GetStruct()->get_jsdialog_handler = client_get_jsdialog_handler;
326 GetStruct()->get_keyboard_handler = client_get_keyboard_handler;
327 GetStruct()->get_life_span_handler = client_get_life_span_handler;
328 GetStruct()->get_load_handler = client_get_load_handler;
329 GetStruct()->get_print_handler = client_get_print_handler;
330 GetStruct()->get_render_handler = client_get_render_handler;
331 GetStruct()->get_request_handler = client_get_request_handler;
332 GetStruct()->on_process_message_received = client_on_process_message_received;
333 }
334
335 // DESTRUCTOR - Do not edit by hand.
336
~CefClientCppToC()337 CefClientCppToC::~CefClientCppToC() {}
338
339 template <>
340 CefRefPtr<CefClient>
UnwrapDerived(CefWrapperType type,cef_client_t * s)341 CefCppToCRefCounted<CefClientCppToC, CefClient, cef_client_t>::UnwrapDerived(
342 CefWrapperType type,
343 cef_client_t* s) {
344 NOTREACHED() << "Unexpected class type: " << type;
345 return nullptr;
346 }
347
348 template <>
349 CefWrapperType CefCppToCRefCounted<CefClientCppToC, CefClient, cef_client_t>::
350 kWrapperType = WT_CLIENT;
351