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=dda345b957ac58c71770da1cf4813ce16ea568b8$
13 //
14
15 #include "libcef_dll/ctocpp/views/window_delegate_ctocpp.h"
16 #include "libcef_dll/cpptoc/views/view_cpptoc.h"
17 #include "libcef_dll/cpptoc/views/window_cpptoc.h"
18 #include "libcef_dll/shutdown_checker.h"
19
20 // VIRTUAL METHODS - Body may be edited by hand.
21
22 NO_SANITIZE("cfi-icall")
OnWindowCreated(CefRefPtr<CefWindow> window)23 void CefWindowDelegateCToCpp::OnWindowCreated(CefRefPtr<CefWindow> window) {
24 shutdown_checker::AssertNotShutdown();
25
26 cef_window_delegate_t* _struct = GetStruct();
27 if (CEF_MEMBER_MISSING(_struct, on_window_created))
28 return;
29
30 // AUTO-GENERATED CONTENT - DELETE THIS COMMENT BEFORE MODIFYING
31
32 // Verify param: window; type: refptr_diff
33 DCHECK(window.get());
34 if (!window.get())
35 return;
36
37 // Execute
38 _struct->on_window_created(_struct, CefWindowCppToC::Wrap(window));
39 }
40
41 NO_SANITIZE("cfi-icall")
OnWindowDestroyed(CefRefPtr<CefWindow> window)42 void CefWindowDelegateCToCpp::OnWindowDestroyed(CefRefPtr<CefWindow> window) {
43 shutdown_checker::AssertNotShutdown();
44
45 cef_window_delegate_t* _struct = GetStruct();
46 if (CEF_MEMBER_MISSING(_struct, on_window_destroyed))
47 return;
48
49 // AUTO-GENERATED CONTENT - DELETE THIS COMMENT BEFORE MODIFYING
50
51 // Verify param: window; type: refptr_diff
52 DCHECK(window.get());
53 if (!window.get())
54 return;
55
56 // Execute
57 _struct->on_window_destroyed(_struct, CefWindowCppToC::Wrap(window));
58 }
59
60 NO_SANITIZE("cfi-icall")
GetParentWindow(CefRefPtr<CefWindow> window,bool * is_menu,bool * can_activate_menu)61 CefRefPtr<CefWindow> CefWindowDelegateCToCpp::GetParentWindow(
62 CefRefPtr<CefWindow> window,
63 bool* is_menu,
64 bool* can_activate_menu) {
65 shutdown_checker::AssertNotShutdown();
66
67 cef_window_delegate_t* _struct = GetStruct();
68 if (CEF_MEMBER_MISSING(_struct, get_parent_window))
69 return nullptr;
70
71 // AUTO-GENERATED CONTENT - DELETE THIS COMMENT BEFORE MODIFYING
72
73 // Verify param: window; type: refptr_diff
74 DCHECK(window.get());
75 if (!window.get())
76 return nullptr;
77 // Verify param: is_menu; type: bool_byaddr
78 DCHECK(is_menu);
79 if (!is_menu)
80 return nullptr;
81 // Verify param: can_activate_menu; type: bool_byaddr
82 DCHECK(can_activate_menu);
83 if (!can_activate_menu)
84 return nullptr;
85
86 // Translate param: is_menu; type: bool_byaddr
87 int is_menuInt = is_menu ? *is_menu : 0;
88 // Translate param: can_activate_menu; type: bool_byaddr
89 int can_activate_menuInt = can_activate_menu ? *can_activate_menu : 0;
90
91 // Execute
92 cef_window_t* _retval =
93 _struct->get_parent_window(_struct, CefWindowCppToC::Wrap(window),
94 &is_menuInt, &can_activate_menuInt);
95
96 // Restore param:is_menu; type: bool_byaddr
97 if (is_menu)
98 *is_menu = is_menuInt ? true : false;
99 // Restore param:can_activate_menu; type: bool_byaddr
100 if (can_activate_menu)
101 *can_activate_menu = can_activate_menuInt ? true : false;
102
103 // Return type: refptr_diff
104 return CefWindowCppToC::Unwrap(_retval);
105 }
106
107 NO_SANITIZE("cfi-icall")
GetInitialBounds(CefRefPtr<CefWindow> window)108 CefRect CefWindowDelegateCToCpp::GetInitialBounds(CefRefPtr<CefWindow> window) {
109 shutdown_checker::AssertNotShutdown();
110
111 cef_window_delegate_t* _struct = GetStruct();
112 if (CEF_MEMBER_MISSING(_struct, get_initial_bounds))
113 return CefRect();
114
115 // AUTO-GENERATED CONTENT - DELETE THIS COMMENT BEFORE MODIFYING
116
117 // Verify param: window; type: refptr_diff
118 DCHECK(window.get());
119 if (!window.get())
120 return CefRect();
121
122 // Execute
123 cef_rect_t _retval =
124 _struct->get_initial_bounds(_struct, CefWindowCppToC::Wrap(window));
125
126 // Return type: simple
127 return _retval;
128 }
129
130 NO_SANITIZE("cfi-icall")
IsFrameless(CefRefPtr<CefWindow> window)131 bool CefWindowDelegateCToCpp::IsFrameless(CefRefPtr<CefWindow> window) {
132 shutdown_checker::AssertNotShutdown();
133
134 cef_window_delegate_t* _struct = GetStruct();
135 if (CEF_MEMBER_MISSING(_struct, is_frameless))
136 return false;
137
138 // AUTO-GENERATED CONTENT - DELETE THIS COMMENT BEFORE MODIFYING
139
140 // Verify param: window; type: refptr_diff
141 DCHECK(window.get());
142 if (!window.get())
143 return false;
144
145 // Execute
146 int _retval = _struct->is_frameless(_struct, CefWindowCppToC::Wrap(window));
147
148 // Return type: bool
149 return _retval ? true : false;
150 }
151
152 NO_SANITIZE("cfi-icall")
CanResize(CefRefPtr<CefWindow> window)153 bool CefWindowDelegateCToCpp::CanResize(CefRefPtr<CefWindow> window) {
154 shutdown_checker::AssertNotShutdown();
155
156 cef_window_delegate_t* _struct = GetStruct();
157 if (CEF_MEMBER_MISSING(_struct, can_resize))
158 return false;
159
160 // AUTO-GENERATED CONTENT - DELETE THIS COMMENT BEFORE MODIFYING
161
162 // Verify param: window; type: refptr_diff
163 DCHECK(window.get());
164 if (!window.get())
165 return false;
166
167 // Execute
168 int _retval = _struct->can_resize(_struct, CefWindowCppToC::Wrap(window));
169
170 // Return type: bool
171 return _retval ? true : false;
172 }
173
174 NO_SANITIZE("cfi-icall")
CanMaximize(CefRefPtr<CefWindow> window)175 bool CefWindowDelegateCToCpp::CanMaximize(CefRefPtr<CefWindow> window) {
176 shutdown_checker::AssertNotShutdown();
177
178 cef_window_delegate_t* _struct = GetStruct();
179 if (CEF_MEMBER_MISSING(_struct, can_maximize))
180 return false;
181
182 // AUTO-GENERATED CONTENT - DELETE THIS COMMENT BEFORE MODIFYING
183
184 // Verify param: window; type: refptr_diff
185 DCHECK(window.get());
186 if (!window.get())
187 return false;
188
189 // Execute
190 int _retval = _struct->can_maximize(_struct, CefWindowCppToC::Wrap(window));
191
192 // Return type: bool
193 return _retval ? true : false;
194 }
195
196 NO_SANITIZE("cfi-icall")
CanMinimize(CefRefPtr<CefWindow> window)197 bool CefWindowDelegateCToCpp::CanMinimize(CefRefPtr<CefWindow> window) {
198 shutdown_checker::AssertNotShutdown();
199
200 cef_window_delegate_t* _struct = GetStruct();
201 if (CEF_MEMBER_MISSING(_struct, can_minimize))
202 return false;
203
204 // AUTO-GENERATED CONTENT - DELETE THIS COMMENT BEFORE MODIFYING
205
206 // Verify param: window; type: refptr_diff
207 DCHECK(window.get());
208 if (!window.get())
209 return false;
210
211 // Execute
212 int _retval = _struct->can_minimize(_struct, CefWindowCppToC::Wrap(window));
213
214 // Return type: bool
215 return _retval ? true : false;
216 }
217
218 NO_SANITIZE("cfi-icall")
CanClose(CefRefPtr<CefWindow> window)219 bool CefWindowDelegateCToCpp::CanClose(CefRefPtr<CefWindow> window) {
220 shutdown_checker::AssertNotShutdown();
221
222 cef_window_delegate_t* _struct = GetStruct();
223 if (CEF_MEMBER_MISSING(_struct, can_close))
224 return false;
225
226 // AUTO-GENERATED CONTENT - DELETE THIS COMMENT BEFORE MODIFYING
227
228 // Verify param: window; type: refptr_diff
229 DCHECK(window.get());
230 if (!window.get())
231 return false;
232
233 // Execute
234 int _retval = _struct->can_close(_struct, CefWindowCppToC::Wrap(window));
235
236 // Return type: bool
237 return _retval ? true : false;
238 }
239
240 NO_SANITIZE("cfi-icall")
OnAccelerator(CefRefPtr<CefWindow> window,int command_id)241 bool CefWindowDelegateCToCpp::OnAccelerator(CefRefPtr<CefWindow> window,
242 int command_id) {
243 shutdown_checker::AssertNotShutdown();
244
245 cef_window_delegate_t* _struct = GetStruct();
246 if (CEF_MEMBER_MISSING(_struct, on_accelerator))
247 return false;
248
249 // AUTO-GENERATED CONTENT - DELETE THIS COMMENT BEFORE MODIFYING
250
251 // Verify param: window; type: refptr_diff
252 DCHECK(window.get());
253 if (!window.get())
254 return false;
255
256 // Execute
257 int _retval = _struct->on_accelerator(_struct, CefWindowCppToC::Wrap(window),
258 command_id);
259
260 // Return type: bool
261 return _retval ? true : false;
262 }
263
264 NO_SANITIZE("cfi-icall")
OnKeyEvent(CefRefPtr<CefWindow> window,const CefKeyEvent & event)265 bool CefWindowDelegateCToCpp::OnKeyEvent(CefRefPtr<CefWindow> window,
266 const CefKeyEvent& event) {
267 shutdown_checker::AssertNotShutdown();
268
269 cef_window_delegate_t* _struct = GetStruct();
270 if (CEF_MEMBER_MISSING(_struct, on_key_event))
271 return false;
272
273 // AUTO-GENERATED CONTENT - DELETE THIS COMMENT BEFORE MODIFYING
274
275 // Verify param: window; type: refptr_diff
276 DCHECK(window.get());
277 if (!window.get())
278 return false;
279
280 // Execute
281 int _retval =
282 _struct->on_key_event(_struct, CefWindowCppToC::Wrap(window), &event);
283
284 // Return type: bool
285 return _retval ? true : false;
286 }
287
288 NO_SANITIZE("cfi-icall")
GetPreferredSize(CefRefPtr<CefView> view)289 CefSize CefWindowDelegateCToCpp::GetPreferredSize(CefRefPtr<CefView> view) {
290 shutdown_checker::AssertNotShutdown();
291
292 cef_view_delegate_t* _struct =
293 reinterpret_cast<cef_view_delegate_t*>(GetStruct());
294 if (CEF_MEMBER_MISSING(_struct, get_preferred_size))
295 return CefSize();
296
297 // AUTO-GENERATED CONTENT - DELETE THIS COMMENT BEFORE MODIFYING
298
299 // Verify param: view; type: refptr_diff
300 DCHECK(view.get());
301 if (!view.get())
302 return CefSize();
303
304 // Execute
305 cef_size_t _retval =
306 _struct->get_preferred_size(_struct, CefViewCppToC::Wrap(view));
307
308 // Return type: simple
309 return _retval;
310 }
311
312 NO_SANITIZE("cfi-icall")
GetMinimumSize(CefRefPtr<CefView> view)313 CefSize CefWindowDelegateCToCpp::GetMinimumSize(CefRefPtr<CefView> view) {
314 shutdown_checker::AssertNotShutdown();
315
316 cef_view_delegate_t* _struct =
317 reinterpret_cast<cef_view_delegate_t*>(GetStruct());
318 if (CEF_MEMBER_MISSING(_struct, get_minimum_size))
319 return CefSize();
320
321 // AUTO-GENERATED CONTENT - DELETE THIS COMMENT BEFORE MODIFYING
322
323 // Verify param: view; type: refptr_diff
324 DCHECK(view.get());
325 if (!view.get())
326 return CefSize();
327
328 // Execute
329 cef_size_t _retval =
330 _struct->get_minimum_size(_struct, CefViewCppToC::Wrap(view));
331
332 // Return type: simple
333 return _retval;
334 }
335
336 NO_SANITIZE("cfi-icall")
GetMaximumSize(CefRefPtr<CefView> view)337 CefSize CefWindowDelegateCToCpp::GetMaximumSize(CefRefPtr<CefView> view) {
338 shutdown_checker::AssertNotShutdown();
339
340 cef_view_delegate_t* _struct =
341 reinterpret_cast<cef_view_delegate_t*>(GetStruct());
342 if (CEF_MEMBER_MISSING(_struct, get_maximum_size))
343 return CefSize();
344
345 // AUTO-GENERATED CONTENT - DELETE THIS COMMENT BEFORE MODIFYING
346
347 // Verify param: view; type: refptr_diff
348 DCHECK(view.get());
349 if (!view.get())
350 return CefSize();
351
352 // Execute
353 cef_size_t _retval =
354 _struct->get_maximum_size(_struct, CefViewCppToC::Wrap(view));
355
356 // Return type: simple
357 return _retval;
358 }
359
360 NO_SANITIZE("cfi-icall")
GetHeightForWidth(CefRefPtr<CefView> view,int width)361 int CefWindowDelegateCToCpp::GetHeightForWidth(CefRefPtr<CefView> view,
362 int width) {
363 shutdown_checker::AssertNotShutdown();
364
365 cef_view_delegate_t* _struct =
366 reinterpret_cast<cef_view_delegate_t*>(GetStruct());
367 if (CEF_MEMBER_MISSING(_struct, get_height_for_width))
368 return 0;
369
370 // AUTO-GENERATED CONTENT - DELETE THIS COMMENT BEFORE MODIFYING
371
372 // Verify param: view; type: refptr_diff
373 DCHECK(view.get());
374 if (!view.get())
375 return 0;
376
377 // Execute
378 int _retval =
379 _struct->get_height_for_width(_struct, CefViewCppToC::Wrap(view), width);
380
381 // Return type: simple
382 return _retval;
383 }
384
385 NO_SANITIZE("cfi-icall")
OnParentViewChanged(CefRefPtr<CefView> view,bool added,CefRefPtr<CefView> parent)386 void CefWindowDelegateCToCpp::OnParentViewChanged(CefRefPtr<CefView> view,
387 bool added,
388 CefRefPtr<CefView> parent) {
389 shutdown_checker::AssertNotShutdown();
390
391 cef_view_delegate_t* _struct =
392 reinterpret_cast<cef_view_delegate_t*>(GetStruct());
393 if (CEF_MEMBER_MISSING(_struct, on_parent_view_changed))
394 return;
395
396 // AUTO-GENERATED CONTENT - DELETE THIS COMMENT BEFORE MODIFYING
397
398 // Verify param: view; type: refptr_diff
399 DCHECK(view.get());
400 if (!view.get())
401 return;
402 // Verify param: parent; type: refptr_diff
403 DCHECK(parent.get());
404 if (!parent.get())
405 return;
406
407 // Execute
408 _struct->on_parent_view_changed(_struct, CefViewCppToC::Wrap(view), added,
409 CefViewCppToC::Wrap(parent));
410 }
411
412 NO_SANITIZE("cfi-icall")
OnChildViewChanged(CefRefPtr<CefView> view,bool added,CefRefPtr<CefView> child)413 void CefWindowDelegateCToCpp::OnChildViewChanged(CefRefPtr<CefView> view,
414 bool added,
415 CefRefPtr<CefView> child) {
416 shutdown_checker::AssertNotShutdown();
417
418 cef_view_delegate_t* _struct =
419 reinterpret_cast<cef_view_delegate_t*>(GetStruct());
420 if (CEF_MEMBER_MISSING(_struct, on_child_view_changed))
421 return;
422
423 // AUTO-GENERATED CONTENT - DELETE THIS COMMENT BEFORE MODIFYING
424
425 // Verify param: view; type: refptr_diff
426 DCHECK(view.get());
427 if (!view.get())
428 return;
429 // Verify param: child; type: refptr_diff
430 DCHECK(child.get());
431 if (!child.get())
432 return;
433
434 // Execute
435 _struct->on_child_view_changed(_struct, CefViewCppToC::Wrap(view), added,
436 CefViewCppToC::Wrap(child));
437 }
438
439 NO_SANITIZE("cfi-icall")
OnWindowChanged(CefRefPtr<CefView> view,bool added)440 void CefWindowDelegateCToCpp::OnWindowChanged(CefRefPtr<CefView> view,
441 bool added) {
442 shutdown_checker::AssertNotShutdown();
443
444 cef_view_delegate_t* _struct =
445 reinterpret_cast<cef_view_delegate_t*>(GetStruct());
446 if (CEF_MEMBER_MISSING(_struct, on_window_changed))
447 return;
448
449 // AUTO-GENERATED CONTENT - DELETE THIS COMMENT BEFORE MODIFYING
450
451 // Verify param: view; type: refptr_diff
452 DCHECK(view.get());
453 if (!view.get())
454 return;
455
456 // Execute
457 _struct->on_window_changed(_struct, CefViewCppToC::Wrap(view), added);
458 }
459
460 NO_SANITIZE("cfi-icall")
OnFocus(CefRefPtr<CefView> view)461 void CefWindowDelegateCToCpp::OnFocus(CefRefPtr<CefView> view) {
462 shutdown_checker::AssertNotShutdown();
463
464 cef_view_delegate_t* _struct =
465 reinterpret_cast<cef_view_delegate_t*>(GetStruct());
466 if (CEF_MEMBER_MISSING(_struct, on_focus))
467 return;
468
469 // AUTO-GENERATED CONTENT - DELETE THIS COMMENT BEFORE MODIFYING
470
471 // Verify param: view; type: refptr_diff
472 DCHECK(view.get());
473 if (!view.get())
474 return;
475
476 // Execute
477 _struct->on_focus(_struct, CefViewCppToC::Wrap(view));
478 }
479
480 NO_SANITIZE("cfi-icall")
OnBlur(CefRefPtr<CefView> view)481 void CefWindowDelegateCToCpp::OnBlur(CefRefPtr<CefView> view) {
482 shutdown_checker::AssertNotShutdown();
483
484 cef_view_delegate_t* _struct =
485 reinterpret_cast<cef_view_delegate_t*>(GetStruct());
486 if (CEF_MEMBER_MISSING(_struct, on_blur))
487 return;
488
489 // AUTO-GENERATED CONTENT - DELETE THIS COMMENT BEFORE MODIFYING
490
491 // Verify param: view; type: refptr_diff
492 DCHECK(view.get());
493 if (!view.get())
494 return;
495
496 // Execute
497 _struct->on_blur(_struct, CefViewCppToC::Wrap(view));
498 }
499
500 // CONSTRUCTOR - Do not edit by hand.
501
CefWindowDelegateCToCpp()502 CefWindowDelegateCToCpp::CefWindowDelegateCToCpp() {}
503
504 // DESTRUCTOR - Do not edit by hand.
505
~CefWindowDelegateCToCpp()506 CefWindowDelegateCToCpp::~CefWindowDelegateCToCpp() {
507 shutdown_checker::AssertNotShutdown();
508 }
509
510 template <>
511 cef_window_delegate_t* CefCToCppRefCounted<
512 CefWindowDelegateCToCpp,
513 CefWindowDelegate,
UnwrapDerived(CefWrapperType type,CefWindowDelegate * c)514 cef_window_delegate_t>::UnwrapDerived(CefWrapperType type,
515 CefWindowDelegate* c) {
516 NOTREACHED() << "Unexpected class type: " << type;
517 return nullptr;
518 }
519
520 template <>
521 CefWrapperType CefCToCppRefCounted<CefWindowDelegateCToCpp,
522 CefWindowDelegate,
523 cef_window_delegate_t>::kWrapperType =
524 WT_WINDOW_DELEGATE;
525