• 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=394bf2a5f6f5898787c498b91bcf8375099eae47$
13 //
14 
15 #include "libcef_dll/ctocpp/views/view_delegate_ctocpp.h"
16 #include "libcef_dll/cpptoc/views/view_cpptoc.h"
17 #include "libcef_dll/ctocpp/views/browser_view_delegate_ctocpp.h"
18 #include "libcef_dll/ctocpp/views/button_delegate_ctocpp.h"
19 #include "libcef_dll/ctocpp/views/menu_button_delegate_ctocpp.h"
20 #include "libcef_dll/ctocpp/views/panel_delegate_ctocpp.h"
21 #include "libcef_dll/ctocpp/views/textfield_delegate_ctocpp.h"
22 #include "libcef_dll/ctocpp/views/window_delegate_ctocpp.h"
23 #include "libcef_dll/shutdown_checker.h"
24 
25 // VIRTUAL METHODS - Body may be edited by hand.
26 
27 NO_SANITIZE("cfi-icall")
GetPreferredSize(CefRefPtr<CefView> view)28 CefSize CefViewDelegateCToCpp::GetPreferredSize(CefRefPtr<CefView> view) {
29   shutdown_checker::AssertNotShutdown();
30 
31   cef_view_delegate_t* _struct = GetStruct();
32   if (CEF_MEMBER_MISSING(_struct, get_preferred_size))
33     return CefSize();
34 
35   // AUTO-GENERATED CONTENT - DELETE THIS COMMENT BEFORE MODIFYING
36 
37   // Verify param: view; type: refptr_diff
38   DCHECK(view.get());
39   if (!view.get())
40     return CefSize();
41 
42   // Execute
43   cef_size_t _retval =
44       _struct->get_preferred_size(_struct, CefViewCppToC::Wrap(view));
45 
46   // Return type: simple
47   return _retval;
48 }
49 
50 NO_SANITIZE("cfi-icall")
GetMinimumSize(CefRefPtr<CefView> view)51 CefSize CefViewDelegateCToCpp::GetMinimumSize(CefRefPtr<CefView> view) {
52   shutdown_checker::AssertNotShutdown();
53 
54   cef_view_delegate_t* _struct = GetStruct();
55   if (CEF_MEMBER_MISSING(_struct, get_minimum_size))
56     return CefSize();
57 
58   // AUTO-GENERATED CONTENT - DELETE THIS COMMENT BEFORE MODIFYING
59 
60   // Verify param: view; type: refptr_diff
61   DCHECK(view.get());
62   if (!view.get())
63     return CefSize();
64 
65   // Execute
66   cef_size_t _retval =
67       _struct->get_minimum_size(_struct, CefViewCppToC::Wrap(view));
68 
69   // Return type: simple
70   return _retval;
71 }
72 
73 NO_SANITIZE("cfi-icall")
GetMaximumSize(CefRefPtr<CefView> view)74 CefSize CefViewDelegateCToCpp::GetMaximumSize(CefRefPtr<CefView> view) {
75   shutdown_checker::AssertNotShutdown();
76 
77   cef_view_delegate_t* _struct = GetStruct();
78   if (CEF_MEMBER_MISSING(_struct, get_maximum_size))
79     return CefSize();
80 
81   // AUTO-GENERATED CONTENT - DELETE THIS COMMENT BEFORE MODIFYING
82 
83   // Verify param: view; type: refptr_diff
84   DCHECK(view.get());
85   if (!view.get())
86     return CefSize();
87 
88   // Execute
89   cef_size_t _retval =
90       _struct->get_maximum_size(_struct, CefViewCppToC::Wrap(view));
91 
92   // Return type: simple
93   return _retval;
94 }
95 
96 NO_SANITIZE("cfi-icall")
GetHeightForWidth(CefRefPtr<CefView> view,int width)97 int CefViewDelegateCToCpp::GetHeightForWidth(CefRefPtr<CefView> view,
98                                              int width) {
99   shutdown_checker::AssertNotShutdown();
100 
101   cef_view_delegate_t* _struct = GetStruct();
102   if (CEF_MEMBER_MISSING(_struct, get_height_for_width))
103     return 0;
104 
105   // AUTO-GENERATED CONTENT - DELETE THIS COMMENT BEFORE MODIFYING
106 
107   // Verify param: view; type: refptr_diff
108   DCHECK(view.get());
109   if (!view.get())
110     return 0;
111 
112   // Execute
113   int _retval =
114       _struct->get_height_for_width(_struct, CefViewCppToC::Wrap(view), width);
115 
116   // Return type: simple
117   return _retval;
118 }
119 
120 NO_SANITIZE("cfi-icall")
OnParentViewChanged(CefRefPtr<CefView> view,bool added,CefRefPtr<CefView> parent)121 void CefViewDelegateCToCpp::OnParentViewChanged(CefRefPtr<CefView> view,
122                                                 bool added,
123                                                 CefRefPtr<CefView> parent) {
124   shutdown_checker::AssertNotShutdown();
125 
126   cef_view_delegate_t* _struct = GetStruct();
127   if (CEF_MEMBER_MISSING(_struct, on_parent_view_changed))
128     return;
129 
130   // AUTO-GENERATED CONTENT - DELETE THIS COMMENT BEFORE MODIFYING
131 
132   // Verify param: view; type: refptr_diff
133   DCHECK(view.get());
134   if (!view.get())
135     return;
136   // Verify param: parent; type: refptr_diff
137   DCHECK(parent.get());
138   if (!parent.get())
139     return;
140 
141   // Execute
142   _struct->on_parent_view_changed(_struct, CefViewCppToC::Wrap(view), added,
143                                   CefViewCppToC::Wrap(parent));
144 }
145 
146 NO_SANITIZE("cfi-icall")
OnChildViewChanged(CefRefPtr<CefView> view,bool added,CefRefPtr<CefView> child)147 void CefViewDelegateCToCpp::OnChildViewChanged(CefRefPtr<CefView> view,
148                                                bool added,
149                                                CefRefPtr<CefView> child) {
150   shutdown_checker::AssertNotShutdown();
151 
152   cef_view_delegate_t* _struct = GetStruct();
153   if (CEF_MEMBER_MISSING(_struct, on_child_view_changed))
154     return;
155 
156   // AUTO-GENERATED CONTENT - DELETE THIS COMMENT BEFORE MODIFYING
157 
158   // Verify param: view; type: refptr_diff
159   DCHECK(view.get());
160   if (!view.get())
161     return;
162   // Verify param: child; type: refptr_diff
163   DCHECK(child.get());
164   if (!child.get())
165     return;
166 
167   // Execute
168   _struct->on_child_view_changed(_struct, CefViewCppToC::Wrap(view), added,
169                                  CefViewCppToC::Wrap(child));
170 }
171 
172 NO_SANITIZE("cfi-icall")
OnWindowChanged(CefRefPtr<CefView> view,bool added)173 void CefViewDelegateCToCpp::OnWindowChanged(CefRefPtr<CefView> view,
174                                             bool added) {
175   shutdown_checker::AssertNotShutdown();
176 
177   cef_view_delegate_t* _struct = GetStruct();
178   if (CEF_MEMBER_MISSING(_struct, on_window_changed))
179     return;
180 
181   // AUTO-GENERATED CONTENT - DELETE THIS COMMENT BEFORE MODIFYING
182 
183   // Verify param: view; type: refptr_diff
184   DCHECK(view.get());
185   if (!view.get())
186     return;
187 
188   // Execute
189   _struct->on_window_changed(_struct, CefViewCppToC::Wrap(view), added);
190 }
191 
192 NO_SANITIZE("cfi-icall")
OnLayoutChanged(CefRefPtr<CefView> view,const CefRect & new_bounds)193 void CefViewDelegateCToCpp::OnLayoutChanged(CefRefPtr<CefView> view,
194                                             const CefRect& new_bounds) {
195   shutdown_checker::AssertNotShutdown();
196 
197   cef_view_delegate_t* _struct = GetStruct();
198   if (CEF_MEMBER_MISSING(_struct, on_layout_changed))
199     return;
200 
201   // AUTO-GENERATED CONTENT - DELETE THIS COMMENT BEFORE MODIFYING
202 
203   // Verify param: view; type: refptr_diff
204   DCHECK(view.get());
205   if (!view.get())
206     return;
207 
208   // Execute
209   _struct->on_layout_changed(_struct, CefViewCppToC::Wrap(view), &new_bounds);
210 }
211 
212 NO_SANITIZE("cfi-icall")
OnFocus(CefRefPtr<CefView> view)213 void CefViewDelegateCToCpp::OnFocus(CefRefPtr<CefView> view) {
214   shutdown_checker::AssertNotShutdown();
215 
216   cef_view_delegate_t* _struct = GetStruct();
217   if (CEF_MEMBER_MISSING(_struct, on_focus))
218     return;
219 
220   // AUTO-GENERATED CONTENT - DELETE THIS COMMENT BEFORE MODIFYING
221 
222   // Verify param: view; type: refptr_diff
223   DCHECK(view.get());
224   if (!view.get())
225     return;
226 
227   // Execute
228   _struct->on_focus(_struct, CefViewCppToC::Wrap(view));
229 }
230 
231 NO_SANITIZE("cfi-icall")
OnBlur(CefRefPtr<CefView> view)232 void CefViewDelegateCToCpp::OnBlur(CefRefPtr<CefView> view) {
233   shutdown_checker::AssertNotShutdown();
234 
235   cef_view_delegate_t* _struct = GetStruct();
236   if (CEF_MEMBER_MISSING(_struct, on_blur))
237     return;
238 
239   // AUTO-GENERATED CONTENT - DELETE THIS COMMENT BEFORE MODIFYING
240 
241   // Verify param: view; type: refptr_diff
242   DCHECK(view.get());
243   if (!view.get())
244     return;
245 
246   // Execute
247   _struct->on_blur(_struct, CefViewCppToC::Wrap(view));
248 }
249 
250 // CONSTRUCTOR - Do not edit by hand.
251 
CefViewDelegateCToCpp()252 CefViewDelegateCToCpp::CefViewDelegateCToCpp() {}
253 
254 // DESTRUCTOR - Do not edit by hand.
255 
~CefViewDelegateCToCpp()256 CefViewDelegateCToCpp::~CefViewDelegateCToCpp() {
257   shutdown_checker::AssertNotShutdown();
258 }
259 
260 template <>
261 cef_view_delegate_t*
262 CefCToCppRefCounted<CefViewDelegateCToCpp,
263                     CefViewDelegate,
UnwrapDerived(CefWrapperType type,CefViewDelegate * c)264                     cef_view_delegate_t>::UnwrapDerived(CefWrapperType type,
265                                                         CefViewDelegate* c) {
266   if (type == WT_BROWSER_VIEW_DELEGATE) {
267     return reinterpret_cast<cef_view_delegate_t*>(
268         CefBrowserViewDelegateCToCpp::Unwrap(
269             reinterpret_cast<CefBrowserViewDelegate*>(c)));
270   }
271   if (type == WT_BUTTON_DELEGATE) {
272     return reinterpret_cast<cef_view_delegate_t*>(
273         CefButtonDelegateCToCpp::Unwrap(
274             reinterpret_cast<CefButtonDelegate*>(c)));
275   }
276   if (type == WT_MENU_BUTTON_DELEGATE) {
277     return reinterpret_cast<cef_view_delegate_t*>(
278         CefMenuButtonDelegateCToCpp::Unwrap(
279             reinterpret_cast<CefMenuButtonDelegate*>(c)));
280   }
281   if (type == WT_PANEL_DELEGATE) {
282     return reinterpret_cast<cef_view_delegate_t*>(
283         CefPanelDelegateCToCpp::Unwrap(reinterpret_cast<CefPanelDelegate*>(c)));
284   }
285   if (type == WT_TEXTFIELD_DELEGATE) {
286     return reinterpret_cast<cef_view_delegate_t*>(
287         CefTextfieldDelegateCToCpp::Unwrap(
288             reinterpret_cast<CefTextfieldDelegate*>(c)));
289   }
290   if (type == WT_WINDOW_DELEGATE) {
291     return reinterpret_cast<cef_view_delegate_t*>(
292         CefWindowDelegateCToCpp::Unwrap(
293             reinterpret_cast<CefWindowDelegate*>(c)));
294   }
295   NOTREACHED() << "Unexpected class type: " << type;
296   return nullptr;
297 }
298 
299 template <>
300 CefWrapperType CefCToCppRefCounted<CefViewDelegateCToCpp,
301                                    CefViewDelegate,
302                                    cef_view_delegate_t>::kWrapperType =
303     WT_VIEW_DELEGATE;
304