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