• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
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=557b305c33b5975b197bf930cc223f76b3032288$
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")
GetInitialShowState(CefRefPtr<CefWindow> window)131 cef_show_state_t CefWindowDelegateCToCpp::GetInitialShowState(
132     CefRefPtr<CefWindow> window) {
133   shutdown_checker::AssertNotShutdown();
134 
135   cef_window_delegate_t* _struct = GetStruct();
136   if (CEF_MEMBER_MISSING(_struct, get_initial_show_state))
137     return CEF_SHOW_STATE_NORMAL;
138 
139   // AUTO-GENERATED CONTENT - DELETE THIS COMMENT BEFORE MODIFYING
140 
141   // Verify param: window; type: refptr_diff
142   DCHECK(window.get());
143   if (!window.get())
144     return CEF_SHOW_STATE_NORMAL;
145 
146   // Execute
147   cef_show_state_t _retval =
148       _struct->get_initial_show_state(_struct, CefWindowCppToC::Wrap(window));
149 
150   // Return type: simple
151   return _retval;
152 }
153 
154 NO_SANITIZE("cfi-icall")
IsFrameless(CefRefPtr<CefWindow> window)155 bool CefWindowDelegateCToCpp::IsFrameless(CefRefPtr<CefWindow> window) {
156   shutdown_checker::AssertNotShutdown();
157 
158   cef_window_delegate_t* _struct = GetStruct();
159   if (CEF_MEMBER_MISSING(_struct, is_frameless))
160     return false;
161 
162   // AUTO-GENERATED CONTENT - DELETE THIS COMMENT BEFORE MODIFYING
163 
164   // Verify param: window; type: refptr_diff
165   DCHECK(window.get());
166   if (!window.get())
167     return false;
168 
169   // Execute
170   int _retval = _struct->is_frameless(_struct, CefWindowCppToC::Wrap(window));
171 
172   // Return type: bool
173   return _retval ? true : false;
174 }
175 
176 NO_SANITIZE("cfi-icall")
CanResize(CefRefPtr<CefWindow> window)177 bool CefWindowDelegateCToCpp::CanResize(CefRefPtr<CefWindow> window) {
178   shutdown_checker::AssertNotShutdown();
179 
180   cef_window_delegate_t* _struct = GetStruct();
181   if (CEF_MEMBER_MISSING(_struct, can_resize))
182     return false;
183 
184   // AUTO-GENERATED CONTENT - DELETE THIS COMMENT BEFORE MODIFYING
185 
186   // Verify param: window; type: refptr_diff
187   DCHECK(window.get());
188   if (!window.get())
189     return false;
190 
191   // Execute
192   int _retval = _struct->can_resize(_struct, CefWindowCppToC::Wrap(window));
193 
194   // Return type: bool
195   return _retval ? true : false;
196 }
197 
198 NO_SANITIZE("cfi-icall")
CanMaximize(CefRefPtr<CefWindow> window)199 bool CefWindowDelegateCToCpp::CanMaximize(CefRefPtr<CefWindow> window) {
200   shutdown_checker::AssertNotShutdown();
201 
202   cef_window_delegate_t* _struct = GetStruct();
203   if (CEF_MEMBER_MISSING(_struct, can_maximize))
204     return false;
205 
206   // AUTO-GENERATED CONTENT - DELETE THIS COMMENT BEFORE MODIFYING
207 
208   // Verify param: window; type: refptr_diff
209   DCHECK(window.get());
210   if (!window.get())
211     return false;
212 
213   // Execute
214   int _retval = _struct->can_maximize(_struct, CefWindowCppToC::Wrap(window));
215 
216   // Return type: bool
217   return _retval ? true : false;
218 }
219 
220 NO_SANITIZE("cfi-icall")
CanMinimize(CefRefPtr<CefWindow> window)221 bool CefWindowDelegateCToCpp::CanMinimize(CefRefPtr<CefWindow> window) {
222   shutdown_checker::AssertNotShutdown();
223 
224   cef_window_delegate_t* _struct = GetStruct();
225   if (CEF_MEMBER_MISSING(_struct, can_minimize))
226     return false;
227 
228   // AUTO-GENERATED CONTENT - DELETE THIS COMMENT BEFORE MODIFYING
229 
230   // Verify param: window; type: refptr_diff
231   DCHECK(window.get());
232   if (!window.get())
233     return false;
234 
235   // Execute
236   int _retval = _struct->can_minimize(_struct, CefWindowCppToC::Wrap(window));
237 
238   // Return type: bool
239   return _retval ? true : false;
240 }
241 
242 NO_SANITIZE("cfi-icall")
CanClose(CefRefPtr<CefWindow> window)243 bool CefWindowDelegateCToCpp::CanClose(CefRefPtr<CefWindow> window) {
244   shutdown_checker::AssertNotShutdown();
245 
246   cef_window_delegate_t* _struct = GetStruct();
247   if (CEF_MEMBER_MISSING(_struct, can_close))
248     return false;
249 
250   // AUTO-GENERATED CONTENT - DELETE THIS COMMENT BEFORE MODIFYING
251 
252   // Verify param: window; type: refptr_diff
253   DCHECK(window.get());
254   if (!window.get())
255     return false;
256 
257   // Execute
258   int _retval = _struct->can_close(_struct, CefWindowCppToC::Wrap(window));
259 
260   // Return type: bool
261   return _retval ? true : false;
262 }
263 
264 NO_SANITIZE("cfi-icall")
OnAccelerator(CefRefPtr<CefWindow> window,int command_id)265 bool CefWindowDelegateCToCpp::OnAccelerator(CefRefPtr<CefWindow> window,
266                                             int command_id) {
267   shutdown_checker::AssertNotShutdown();
268 
269   cef_window_delegate_t* _struct = GetStruct();
270   if (CEF_MEMBER_MISSING(_struct, on_accelerator))
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 = _struct->on_accelerator(_struct, CefWindowCppToC::Wrap(window),
282                                         command_id);
283 
284   // Return type: bool
285   return _retval ? true : false;
286 }
287 
288 NO_SANITIZE("cfi-icall")
OnKeyEvent(CefRefPtr<CefWindow> window,const CefKeyEvent & event)289 bool CefWindowDelegateCToCpp::OnKeyEvent(CefRefPtr<CefWindow> window,
290                                          const CefKeyEvent& event) {
291   shutdown_checker::AssertNotShutdown();
292 
293   cef_window_delegate_t* _struct = GetStruct();
294   if (CEF_MEMBER_MISSING(_struct, on_key_event))
295     return false;
296 
297   // AUTO-GENERATED CONTENT - DELETE THIS COMMENT BEFORE MODIFYING
298 
299   // Verify param: window; type: refptr_diff
300   DCHECK(window.get());
301   if (!window.get())
302     return false;
303 
304   // Execute
305   int _retval =
306       _struct->on_key_event(_struct, CefWindowCppToC::Wrap(window), &event);
307 
308   // Return type: bool
309   return _retval ? true : false;
310 }
311 
312 NO_SANITIZE("cfi-icall")
GetPreferredSize(CefRefPtr<CefView> view)313 CefSize CefWindowDelegateCToCpp::GetPreferredSize(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_preferred_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_preferred_size(_struct, CefViewCppToC::Wrap(view));
331 
332   // Return type: simple
333   return _retval;
334 }
335 
336 NO_SANITIZE("cfi-icall")
GetMinimumSize(CefRefPtr<CefView> view)337 CefSize CefWindowDelegateCToCpp::GetMinimumSize(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_minimum_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_minimum_size(_struct, CefViewCppToC::Wrap(view));
355 
356   // Return type: simple
357   return _retval;
358 }
359 
360 NO_SANITIZE("cfi-icall")
GetMaximumSize(CefRefPtr<CefView> view)361 CefSize CefWindowDelegateCToCpp::GetMaximumSize(CefRefPtr<CefView> view) {
362   shutdown_checker::AssertNotShutdown();
363 
364   cef_view_delegate_t* _struct =
365       reinterpret_cast<cef_view_delegate_t*>(GetStruct());
366   if (CEF_MEMBER_MISSING(_struct, get_maximum_size))
367     return CefSize();
368 
369   // AUTO-GENERATED CONTENT - DELETE THIS COMMENT BEFORE MODIFYING
370 
371   // Verify param: view; type: refptr_diff
372   DCHECK(view.get());
373   if (!view.get())
374     return CefSize();
375 
376   // Execute
377   cef_size_t _retval =
378       _struct->get_maximum_size(_struct, CefViewCppToC::Wrap(view));
379 
380   // Return type: simple
381   return _retval;
382 }
383 
384 NO_SANITIZE("cfi-icall")
GetHeightForWidth(CefRefPtr<CefView> view,int width)385 int CefWindowDelegateCToCpp::GetHeightForWidth(CefRefPtr<CefView> view,
386                                                int width) {
387   shutdown_checker::AssertNotShutdown();
388 
389   cef_view_delegate_t* _struct =
390       reinterpret_cast<cef_view_delegate_t*>(GetStruct());
391   if (CEF_MEMBER_MISSING(_struct, get_height_for_width))
392     return 0;
393 
394   // AUTO-GENERATED CONTENT - DELETE THIS COMMENT BEFORE MODIFYING
395 
396   // Verify param: view; type: refptr_diff
397   DCHECK(view.get());
398   if (!view.get())
399     return 0;
400 
401   // Execute
402   int _retval =
403       _struct->get_height_for_width(_struct, CefViewCppToC::Wrap(view), width);
404 
405   // Return type: simple
406   return _retval;
407 }
408 
409 NO_SANITIZE("cfi-icall")
OnParentViewChanged(CefRefPtr<CefView> view,bool added,CefRefPtr<CefView> parent)410 void CefWindowDelegateCToCpp::OnParentViewChanged(CefRefPtr<CefView> view,
411                                                   bool added,
412                                                   CefRefPtr<CefView> parent) {
413   shutdown_checker::AssertNotShutdown();
414 
415   cef_view_delegate_t* _struct =
416       reinterpret_cast<cef_view_delegate_t*>(GetStruct());
417   if (CEF_MEMBER_MISSING(_struct, on_parent_view_changed))
418     return;
419 
420   // AUTO-GENERATED CONTENT - DELETE THIS COMMENT BEFORE MODIFYING
421 
422   // Verify param: view; type: refptr_diff
423   DCHECK(view.get());
424   if (!view.get())
425     return;
426   // Verify param: parent; type: refptr_diff
427   DCHECK(parent.get());
428   if (!parent.get())
429     return;
430 
431   // Execute
432   _struct->on_parent_view_changed(_struct, CefViewCppToC::Wrap(view), added,
433                                   CefViewCppToC::Wrap(parent));
434 }
435 
436 NO_SANITIZE("cfi-icall")
OnChildViewChanged(CefRefPtr<CefView> view,bool added,CefRefPtr<CefView> child)437 void CefWindowDelegateCToCpp::OnChildViewChanged(CefRefPtr<CefView> view,
438                                                  bool added,
439                                                  CefRefPtr<CefView> child) {
440   shutdown_checker::AssertNotShutdown();
441 
442   cef_view_delegate_t* _struct =
443       reinterpret_cast<cef_view_delegate_t*>(GetStruct());
444   if (CEF_MEMBER_MISSING(_struct, on_child_view_changed))
445     return;
446 
447   // AUTO-GENERATED CONTENT - DELETE THIS COMMENT BEFORE MODIFYING
448 
449   // Verify param: view; type: refptr_diff
450   DCHECK(view.get());
451   if (!view.get())
452     return;
453   // Verify param: child; type: refptr_diff
454   DCHECK(child.get());
455   if (!child.get())
456     return;
457 
458   // Execute
459   _struct->on_child_view_changed(_struct, CefViewCppToC::Wrap(view), added,
460                                  CefViewCppToC::Wrap(child));
461 }
462 
463 NO_SANITIZE("cfi-icall")
OnWindowChanged(CefRefPtr<CefView> view,bool added)464 void CefWindowDelegateCToCpp::OnWindowChanged(CefRefPtr<CefView> view,
465                                               bool added) {
466   shutdown_checker::AssertNotShutdown();
467 
468   cef_view_delegate_t* _struct =
469       reinterpret_cast<cef_view_delegate_t*>(GetStruct());
470   if (CEF_MEMBER_MISSING(_struct, on_window_changed))
471     return;
472 
473   // AUTO-GENERATED CONTENT - DELETE THIS COMMENT BEFORE MODIFYING
474 
475   // Verify param: view; type: refptr_diff
476   DCHECK(view.get());
477   if (!view.get())
478     return;
479 
480   // Execute
481   _struct->on_window_changed(_struct, CefViewCppToC::Wrap(view), added);
482 }
483 
484 NO_SANITIZE("cfi-icall")
OnLayoutChanged(CefRefPtr<CefView> view,const CefRect & new_bounds)485 void CefWindowDelegateCToCpp::OnLayoutChanged(CefRefPtr<CefView> view,
486                                               const CefRect& new_bounds) {
487   shutdown_checker::AssertNotShutdown();
488 
489   cef_view_delegate_t* _struct =
490       reinterpret_cast<cef_view_delegate_t*>(GetStruct());
491   if (CEF_MEMBER_MISSING(_struct, on_layout_changed))
492     return;
493 
494   // AUTO-GENERATED CONTENT - DELETE THIS COMMENT BEFORE MODIFYING
495 
496   // Verify param: view; type: refptr_diff
497   DCHECK(view.get());
498   if (!view.get())
499     return;
500 
501   // Execute
502   _struct->on_layout_changed(_struct, CefViewCppToC::Wrap(view), &new_bounds);
503 }
504 
505 NO_SANITIZE("cfi-icall")
OnFocus(CefRefPtr<CefView> view)506 void CefWindowDelegateCToCpp::OnFocus(CefRefPtr<CefView> view) {
507   shutdown_checker::AssertNotShutdown();
508 
509   cef_view_delegate_t* _struct =
510       reinterpret_cast<cef_view_delegate_t*>(GetStruct());
511   if (CEF_MEMBER_MISSING(_struct, on_focus))
512     return;
513 
514   // AUTO-GENERATED CONTENT - DELETE THIS COMMENT BEFORE MODIFYING
515 
516   // Verify param: view; type: refptr_diff
517   DCHECK(view.get());
518   if (!view.get())
519     return;
520 
521   // Execute
522   _struct->on_focus(_struct, CefViewCppToC::Wrap(view));
523 }
524 
525 NO_SANITIZE("cfi-icall")
OnBlur(CefRefPtr<CefView> view)526 void CefWindowDelegateCToCpp::OnBlur(CefRefPtr<CefView> view) {
527   shutdown_checker::AssertNotShutdown();
528 
529   cef_view_delegate_t* _struct =
530       reinterpret_cast<cef_view_delegate_t*>(GetStruct());
531   if (CEF_MEMBER_MISSING(_struct, on_blur))
532     return;
533 
534   // AUTO-GENERATED CONTENT - DELETE THIS COMMENT BEFORE MODIFYING
535 
536   // Verify param: view; type: refptr_diff
537   DCHECK(view.get());
538   if (!view.get())
539     return;
540 
541   // Execute
542   _struct->on_blur(_struct, CefViewCppToC::Wrap(view));
543 }
544 
545 // CONSTRUCTOR - Do not edit by hand.
546 
CefWindowDelegateCToCpp()547 CefWindowDelegateCToCpp::CefWindowDelegateCToCpp() {}
548 
549 // DESTRUCTOR - Do not edit by hand.
550 
~CefWindowDelegateCToCpp()551 CefWindowDelegateCToCpp::~CefWindowDelegateCToCpp() {
552   shutdown_checker::AssertNotShutdown();
553 }
554 
555 template <>
556 cef_window_delegate_t* CefCToCppRefCounted<
557     CefWindowDelegateCToCpp,
558     CefWindowDelegate,
UnwrapDerived(CefWrapperType type,CefWindowDelegate * c)559     cef_window_delegate_t>::UnwrapDerived(CefWrapperType type,
560                                           CefWindowDelegate* c) {
561   NOTREACHED() << "Unexpected class type: " << type;
562   return nullptr;
563 }
564 
565 template <>
566 CefWrapperType CefCToCppRefCounted<CefWindowDelegateCToCpp,
567                                    CefWindowDelegate,
568                                    cef_window_delegate_t>::kWrapperType =
569     WT_WINDOW_DELEGATE;
570