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=7a6d2ca91509c2e6c510d5c9585a74c2fe10499b$
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")
OnFocus(CefRefPtr<CefView> view)193 void CefViewDelegateCToCpp::OnFocus(CefRefPtr<CefView> view) {
194 shutdown_checker::AssertNotShutdown();
195
196 cef_view_delegate_t* _struct = GetStruct();
197 if (CEF_MEMBER_MISSING(_struct, on_focus))
198 return;
199
200 // AUTO-GENERATED CONTENT - DELETE THIS COMMENT BEFORE MODIFYING
201
202 // Verify param: view; type: refptr_diff
203 DCHECK(view.get());
204 if (!view.get())
205 return;
206
207 // Execute
208 _struct->on_focus(_struct, CefViewCppToC::Wrap(view));
209 }
210
211 NO_SANITIZE("cfi-icall")
OnBlur(CefRefPtr<CefView> view)212 void CefViewDelegateCToCpp::OnBlur(CefRefPtr<CefView> view) {
213 shutdown_checker::AssertNotShutdown();
214
215 cef_view_delegate_t* _struct = GetStruct();
216 if (CEF_MEMBER_MISSING(_struct, on_blur))
217 return;
218
219 // AUTO-GENERATED CONTENT - DELETE THIS COMMENT BEFORE MODIFYING
220
221 // Verify param: view; type: refptr_diff
222 DCHECK(view.get());
223 if (!view.get())
224 return;
225
226 // Execute
227 _struct->on_blur(_struct, CefViewCppToC::Wrap(view));
228 }
229
230 // CONSTRUCTOR - Do not edit by hand.
231
CefViewDelegateCToCpp()232 CefViewDelegateCToCpp::CefViewDelegateCToCpp() {}
233
234 // DESTRUCTOR - Do not edit by hand.
235
~CefViewDelegateCToCpp()236 CefViewDelegateCToCpp::~CefViewDelegateCToCpp() {
237 shutdown_checker::AssertNotShutdown();
238 }
239
240 template <>
241 cef_view_delegate_t*
242 CefCToCppRefCounted<CefViewDelegateCToCpp,
243 CefViewDelegate,
UnwrapDerived(CefWrapperType type,CefViewDelegate * c)244 cef_view_delegate_t>::UnwrapDerived(CefWrapperType type,
245 CefViewDelegate* c) {
246 if (type == WT_BROWSER_VIEW_DELEGATE) {
247 return reinterpret_cast<cef_view_delegate_t*>(
248 CefBrowserViewDelegateCToCpp::Unwrap(
249 reinterpret_cast<CefBrowserViewDelegate*>(c)));
250 }
251 if (type == WT_BUTTON_DELEGATE) {
252 return reinterpret_cast<cef_view_delegate_t*>(
253 CefButtonDelegateCToCpp::Unwrap(
254 reinterpret_cast<CefButtonDelegate*>(c)));
255 }
256 if (type == WT_MENU_BUTTON_DELEGATE) {
257 return reinterpret_cast<cef_view_delegate_t*>(
258 CefMenuButtonDelegateCToCpp::Unwrap(
259 reinterpret_cast<CefMenuButtonDelegate*>(c)));
260 }
261 if (type == WT_PANEL_DELEGATE) {
262 return reinterpret_cast<cef_view_delegate_t*>(
263 CefPanelDelegateCToCpp::Unwrap(reinterpret_cast<CefPanelDelegate*>(c)));
264 }
265 if (type == WT_TEXTFIELD_DELEGATE) {
266 return reinterpret_cast<cef_view_delegate_t*>(
267 CefTextfieldDelegateCToCpp::Unwrap(
268 reinterpret_cast<CefTextfieldDelegate*>(c)));
269 }
270 if (type == WT_WINDOW_DELEGATE) {
271 return reinterpret_cast<cef_view_delegate_t*>(
272 CefWindowDelegateCToCpp::Unwrap(
273 reinterpret_cast<CefWindowDelegate*>(c)));
274 }
275 NOTREACHED() << "Unexpected class type: " << type;
276 return nullptr;
277 }
278
279 template <>
280 CefWrapperType CefCToCppRefCounted<CefViewDelegateCToCpp,
281 CefViewDelegate,
282 cef_view_delegate_t>::kWrapperType =
283 WT_VIEW_DELEGATE;
284