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=fc962d2832eeb3dee99e9a201f234d4a4b4d6f0f$
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")
OnFocus(CefRefPtr<CefView> view)235 void CefButtonDelegateCToCpp::OnFocus(CefRefPtr<CefView> view) {
236 shutdown_checker::AssertNotShutdown();
237
238 cef_view_delegate_t* _struct =
239 reinterpret_cast<cef_view_delegate_t*>(GetStruct());
240 if (CEF_MEMBER_MISSING(_struct, on_focus))
241 return;
242
243 // AUTO-GENERATED CONTENT - DELETE THIS COMMENT BEFORE MODIFYING
244
245 // Verify param: view; type: refptr_diff
246 DCHECK(view.get());
247 if (!view.get())
248 return;
249
250 // Execute
251 _struct->on_focus(_struct, CefViewCppToC::Wrap(view));
252 }
253
254 NO_SANITIZE("cfi-icall")
OnBlur(CefRefPtr<CefView> view)255 void CefButtonDelegateCToCpp::OnBlur(CefRefPtr<CefView> view) {
256 shutdown_checker::AssertNotShutdown();
257
258 cef_view_delegate_t* _struct =
259 reinterpret_cast<cef_view_delegate_t*>(GetStruct());
260 if (CEF_MEMBER_MISSING(_struct, on_blur))
261 return;
262
263 // AUTO-GENERATED CONTENT - DELETE THIS COMMENT BEFORE MODIFYING
264
265 // Verify param: view; type: refptr_diff
266 DCHECK(view.get());
267 if (!view.get())
268 return;
269
270 // Execute
271 _struct->on_blur(_struct, CefViewCppToC::Wrap(view));
272 }
273
274 // CONSTRUCTOR - Do not edit by hand.
275
CefButtonDelegateCToCpp()276 CefButtonDelegateCToCpp::CefButtonDelegateCToCpp() {}
277
278 // DESTRUCTOR - Do not edit by hand.
279
~CefButtonDelegateCToCpp()280 CefButtonDelegateCToCpp::~CefButtonDelegateCToCpp() {
281 shutdown_checker::AssertNotShutdown();
282 }
283
284 template <>
285 cef_button_delegate_t* CefCToCppRefCounted<
286 CefButtonDelegateCToCpp,
287 CefButtonDelegate,
UnwrapDerived(CefWrapperType type,CefButtonDelegate * c)288 cef_button_delegate_t>::UnwrapDerived(CefWrapperType type,
289 CefButtonDelegate* c) {
290 if (type == WT_MENU_BUTTON_DELEGATE) {
291 return reinterpret_cast<cef_button_delegate_t*>(
292 CefMenuButtonDelegateCToCpp::Unwrap(
293 reinterpret_cast<CefMenuButtonDelegate*>(c)));
294 }
295 NOTREACHED() << "Unexpected class type: " << type;
296 return nullptr;
297 }
298
299 template <>
300 CefWrapperType CefCToCppRefCounted<CefButtonDelegateCToCpp,
301 CefButtonDelegate,
302 cef_button_delegate_t>::kWrapperType =
303 WT_BUTTON_DELEGATE;
304