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=8f3129779912a325240795e05610d6190997e028$
13 //
14
15 #include "libcef_dll/cpptoc/views/browser_view_delegate_cpptoc.h"
16 #include "libcef_dll/cpptoc/client_cpptoc.h"
17 #include "libcef_dll/ctocpp/browser_ctocpp.h"
18 #include "libcef_dll/ctocpp/views/browser_view_ctocpp.h"
19 #include "libcef_dll/ctocpp/views/view_ctocpp.h"
20 #include "libcef_dll/shutdown_checker.h"
21
22 namespace {
23
24 // MEMBER FUNCTIONS - Body may be edited by hand.
25
browser_view_delegate_on_browser_created(struct _cef_browser_view_delegate_t * self,cef_browser_view_t * browser_view,cef_browser_t * browser)26 void CEF_CALLBACK browser_view_delegate_on_browser_created(
27 struct _cef_browser_view_delegate_t* self,
28 cef_browser_view_t* browser_view,
29 cef_browser_t* browser) {
30 shutdown_checker::AssertNotShutdown();
31
32 // AUTO-GENERATED CONTENT - DELETE THIS COMMENT BEFORE MODIFYING
33
34 DCHECK(self);
35 if (!self)
36 return;
37 // Verify param: browser_view; type: refptr_diff
38 DCHECK(browser_view);
39 if (!browser_view)
40 return;
41 // Verify param: browser; type: refptr_diff
42 DCHECK(browser);
43 if (!browser)
44 return;
45
46 // Execute
47 CefBrowserViewDelegateCppToC::Get(self)->OnBrowserCreated(
48 CefBrowserViewCToCpp::Wrap(browser_view),
49 CefBrowserCToCpp::Wrap(browser));
50 }
51
browser_view_delegate_on_browser_destroyed(struct _cef_browser_view_delegate_t * self,cef_browser_view_t * browser_view,cef_browser_t * browser)52 void CEF_CALLBACK browser_view_delegate_on_browser_destroyed(
53 struct _cef_browser_view_delegate_t* self,
54 cef_browser_view_t* browser_view,
55 cef_browser_t* browser) {
56 shutdown_checker::AssertNotShutdown();
57
58 // AUTO-GENERATED CONTENT - DELETE THIS COMMENT BEFORE MODIFYING
59
60 DCHECK(self);
61 if (!self)
62 return;
63 // Verify param: browser_view; type: refptr_diff
64 DCHECK(browser_view);
65 if (!browser_view)
66 return;
67 // Verify param: browser; type: refptr_diff
68 DCHECK(browser);
69 if (!browser)
70 return;
71
72 // Execute
73 CefBrowserViewDelegateCppToC::Get(self)->OnBrowserDestroyed(
74 CefBrowserViewCToCpp::Wrap(browser_view),
75 CefBrowserCToCpp::Wrap(browser));
76 }
77
78 cef_browser_view_delegate_t* CEF_CALLBACK
browser_view_delegate_get_delegate_for_popup_browser_view(struct _cef_browser_view_delegate_t * self,cef_browser_view_t * browser_view,const struct _cef_browser_settings_t * settings,cef_client_t * client,int is_devtools)79 browser_view_delegate_get_delegate_for_popup_browser_view(
80 struct _cef_browser_view_delegate_t* self,
81 cef_browser_view_t* browser_view,
82 const struct _cef_browser_settings_t* settings,
83 cef_client_t* client,
84 int is_devtools) {
85 shutdown_checker::AssertNotShutdown();
86
87 // AUTO-GENERATED CONTENT - DELETE THIS COMMENT BEFORE MODIFYING
88
89 DCHECK(self);
90 if (!self)
91 return NULL;
92 // Verify param: browser_view; type: refptr_diff
93 DCHECK(browser_view);
94 if (!browser_view)
95 return NULL;
96 // Verify param: settings; type: struct_byref_const
97 DCHECK(settings);
98 if (!settings)
99 return NULL;
100 // Verify param: client; type: refptr_same
101 DCHECK(client);
102 if (!client)
103 return NULL;
104
105 // Translate param: settings; type: struct_byref_const
106 CefBrowserSettings settingsObj;
107 if (settings)
108 settingsObj.Set(*settings, false);
109
110 // Execute
111 CefRefPtr<CefBrowserViewDelegate> _retval =
112 CefBrowserViewDelegateCppToC::Get(self)->GetDelegateForPopupBrowserView(
113 CefBrowserViewCToCpp::Wrap(browser_view), settingsObj,
114 CefClientCppToC::Unwrap(client), is_devtools ? true : false);
115
116 // Return type: refptr_same
117 return CefBrowserViewDelegateCppToC::Wrap(_retval);
118 }
119
browser_view_delegate_on_popup_browser_view_created(struct _cef_browser_view_delegate_t * self,cef_browser_view_t * browser_view,cef_browser_view_t * popup_browser_view,int is_devtools)120 int CEF_CALLBACK browser_view_delegate_on_popup_browser_view_created(
121 struct _cef_browser_view_delegate_t* self,
122 cef_browser_view_t* browser_view,
123 cef_browser_view_t* popup_browser_view,
124 int is_devtools) {
125 shutdown_checker::AssertNotShutdown();
126
127 // AUTO-GENERATED CONTENT - DELETE THIS COMMENT BEFORE MODIFYING
128
129 DCHECK(self);
130 if (!self)
131 return 0;
132 // Verify param: browser_view; type: refptr_diff
133 DCHECK(browser_view);
134 if (!browser_view)
135 return 0;
136 // Verify param: popup_browser_view; type: refptr_diff
137 DCHECK(popup_browser_view);
138 if (!popup_browser_view)
139 return 0;
140
141 // Execute
142 bool _retval =
143 CefBrowserViewDelegateCppToC::Get(self)->OnPopupBrowserViewCreated(
144 CefBrowserViewCToCpp::Wrap(browser_view),
145 CefBrowserViewCToCpp::Wrap(popup_browser_view),
146 is_devtools ? true : false);
147
148 // Return type: bool
149 return _retval;
150 }
151
152 cef_chrome_toolbar_type_t CEF_CALLBACK
browser_view_delegate_get_chrome_toolbar_type(struct _cef_browser_view_delegate_t * self)153 browser_view_delegate_get_chrome_toolbar_type(
154 struct _cef_browser_view_delegate_t* self) {
155 shutdown_checker::AssertNotShutdown();
156
157 // AUTO-GENERATED CONTENT - DELETE THIS COMMENT BEFORE MODIFYING
158
159 DCHECK(self);
160 if (!self)
161 return CEF_CTT_NONE;
162
163 // Execute
164 cef_chrome_toolbar_type_t _retval =
165 CefBrowserViewDelegateCppToC::Get(self)->GetChromeToolbarType();
166
167 // Return type: simple
168 return _retval;
169 }
170
171 cef_size_t CEF_CALLBACK
browser_view_delegate_get_preferred_size(struct _cef_view_delegate_t * self,cef_view_t * view)172 browser_view_delegate_get_preferred_size(struct _cef_view_delegate_t* self,
173 cef_view_t* view) {
174 shutdown_checker::AssertNotShutdown();
175
176 // AUTO-GENERATED CONTENT - DELETE THIS COMMENT BEFORE MODIFYING
177
178 DCHECK(self);
179 if (!self)
180 return CefSize();
181 // Verify param: view; type: refptr_diff
182 DCHECK(view);
183 if (!view)
184 return CefSize();
185
186 // Execute
187 cef_size_t _retval = CefBrowserViewDelegateCppToC::Get(
188 reinterpret_cast<cef_browser_view_delegate_t*>(self))
189 ->GetPreferredSize(CefViewCToCpp::Wrap(view));
190
191 // Return type: simple
192 return _retval;
193 }
194
195 cef_size_t CEF_CALLBACK
browser_view_delegate_get_minimum_size(struct _cef_view_delegate_t * self,cef_view_t * view)196 browser_view_delegate_get_minimum_size(struct _cef_view_delegate_t* self,
197 cef_view_t* view) {
198 shutdown_checker::AssertNotShutdown();
199
200 // AUTO-GENERATED CONTENT - DELETE THIS COMMENT BEFORE MODIFYING
201
202 DCHECK(self);
203 if (!self)
204 return CefSize();
205 // Verify param: view; type: refptr_diff
206 DCHECK(view);
207 if (!view)
208 return CefSize();
209
210 // Execute
211 cef_size_t _retval = CefBrowserViewDelegateCppToC::Get(
212 reinterpret_cast<cef_browser_view_delegate_t*>(self))
213 ->GetMinimumSize(CefViewCToCpp::Wrap(view));
214
215 // Return type: simple
216 return _retval;
217 }
218
219 cef_size_t CEF_CALLBACK
browser_view_delegate_get_maximum_size(struct _cef_view_delegate_t * self,cef_view_t * view)220 browser_view_delegate_get_maximum_size(struct _cef_view_delegate_t* self,
221 cef_view_t* view) {
222 shutdown_checker::AssertNotShutdown();
223
224 // AUTO-GENERATED CONTENT - DELETE THIS COMMENT BEFORE MODIFYING
225
226 DCHECK(self);
227 if (!self)
228 return CefSize();
229 // Verify param: view; type: refptr_diff
230 DCHECK(view);
231 if (!view)
232 return CefSize();
233
234 // Execute
235 cef_size_t _retval = CefBrowserViewDelegateCppToC::Get(
236 reinterpret_cast<cef_browser_view_delegate_t*>(self))
237 ->GetMaximumSize(CefViewCToCpp::Wrap(view));
238
239 // Return type: simple
240 return _retval;
241 }
242
243 int CEF_CALLBACK
browser_view_delegate_get_height_for_width(struct _cef_view_delegate_t * self,cef_view_t * view,int width)244 browser_view_delegate_get_height_for_width(struct _cef_view_delegate_t* self,
245 cef_view_t* view,
246 int width) {
247 shutdown_checker::AssertNotShutdown();
248
249 // AUTO-GENERATED CONTENT - DELETE THIS COMMENT BEFORE MODIFYING
250
251 DCHECK(self);
252 if (!self)
253 return 0;
254 // Verify param: view; type: refptr_diff
255 DCHECK(view);
256 if (!view)
257 return 0;
258
259 // Execute
260 int _retval = CefBrowserViewDelegateCppToC::Get(
261 reinterpret_cast<cef_browser_view_delegate_t*>(self))
262 ->GetHeightForWidth(CefViewCToCpp::Wrap(view), width);
263
264 // Return type: simple
265 return _retval;
266 }
267
268 void CEF_CALLBACK
browser_view_delegate_on_parent_view_changed(struct _cef_view_delegate_t * self,cef_view_t * view,int added,cef_view_t * parent)269 browser_view_delegate_on_parent_view_changed(struct _cef_view_delegate_t* self,
270 cef_view_t* view,
271 int added,
272 cef_view_t* parent) {
273 shutdown_checker::AssertNotShutdown();
274
275 // AUTO-GENERATED CONTENT - DELETE THIS COMMENT BEFORE MODIFYING
276
277 DCHECK(self);
278 if (!self)
279 return;
280 // Verify param: view; type: refptr_diff
281 DCHECK(view);
282 if (!view)
283 return;
284 // Verify param: parent; type: refptr_diff
285 DCHECK(parent);
286 if (!parent)
287 return;
288
289 // Execute
290 CefBrowserViewDelegateCppToC::Get(
291 reinterpret_cast<cef_browser_view_delegate_t*>(self))
292 ->OnParentViewChanged(CefViewCToCpp::Wrap(view), added ? true : false,
293 CefViewCToCpp::Wrap(parent));
294 }
295
296 void CEF_CALLBACK
browser_view_delegate_on_child_view_changed(struct _cef_view_delegate_t * self,cef_view_t * view,int added,cef_view_t * child)297 browser_view_delegate_on_child_view_changed(struct _cef_view_delegate_t* self,
298 cef_view_t* view,
299 int added,
300 cef_view_t* child) {
301 shutdown_checker::AssertNotShutdown();
302
303 // AUTO-GENERATED CONTENT - DELETE THIS COMMENT BEFORE MODIFYING
304
305 DCHECK(self);
306 if (!self)
307 return;
308 // Verify param: view; type: refptr_diff
309 DCHECK(view);
310 if (!view)
311 return;
312 // Verify param: child; type: refptr_diff
313 DCHECK(child);
314 if (!child)
315 return;
316
317 // Execute
318 CefBrowserViewDelegateCppToC::Get(
319 reinterpret_cast<cef_browser_view_delegate_t*>(self))
320 ->OnChildViewChanged(CefViewCToCpp::Wrap(view), added ? true : false,
321 CefViewCToCpp::Wrap(child));
322 }
323
324 void CEF_CALLBACK
browser_view_delegate_on_window_changed(struct _cef_view_delegate_t * self,cef_view_t * view,int added)325 browser_view_delegate_on_window_changed(struct _cef_view_delegate_t* self,
326 cef_view_t* view,
327 int added) {
328 shutdown_checker::AssertNotShutdown();
329
330 // AUTO-GENERATED CONTENT - DELETE THIS COMMENT BEFORE MODIFYING
331
332 DCHECK(self);
333 if (!self)
334 return;
335 // Verify param: view; type: refptr_diff
336 DCHECK(view);
337 if (!view)
338 return;
339
340 // Execute
341 CefBrowserViewDelegateCppToC::Get(
342 reinterpret_cast<cef_browser_view_delegate_t*>(self))
343 ->OnWindowChanged(CefViewCToCpp::Wrap(view), added ? true : false);
344 }
345
346 void CEF_CALLBACK
browser_view_delegate_on_layout_changed(struct _cef_view_delegate_t * self,cef_view_t * view,const cef_rect_t * new_bounds)347 browser_view_delegate_on_layout_changed(struct _cef_view_delegate_t* self,
348 cef_view_t* view,
349 const cef_rect_t* new_bounds) {
350 shutdown_checker::AssertNotShutdown();
351
352 // AUTO-GENERATED CONTENT - DELETE THIS COMMENT BEFORE MODIFYING
353
354 DCHECK(self);
355 if (!self)
356 return;
357 // Verify param: view; type: refptr_diff
358 DCHECK(view);
359 if (!view)
360 return;
361 // Verify param: new_bounds; type: simple_byref_const
362 DCHECK(new_bounds);
363 if (!new_bounds)
364 return;
365
366 // Translate param: new_bounds; type: simple_byref_const
367 CefRect new_boundsVal = new_bounds ? *new_bounds : CefRect();
368
369 // Execute
370 CefBrowserViewDelegateCppToC::Get(
371 reinterpret_cast<cef_browser_view_delegate_t*>(self))
372 ->OnLayoutChanged(CefViewCToCpp::Wrap(view), new_boundsVal);
373 }
374
375 void CEF_CALLBACK
browser_view_delegate_on_focus(struct _cef_view_delegate_t * self,cef_view_t * view)376 browser_view_delegate_on_focus(struct _cef_view_delegate_t* self,
377 cef_view_t* view) {
378 shutdown_checker::AssertNotShutdown();
379
380 // AUTO-GENERATED CONTENT - DELETE THIS COMMENT BEFORE MODIFYING
381
382 DCHECK(self);
383 if (!self)
384 return;
385 // Verify param: view; type: refptr_diff
386 DCHECK(view);
387 if (!view)
388 return;
389
390 // Execute
391 CefBrowserViewDelegateCppToC::Get(
392 reinterpret_cast<cef_browser_view_delegate_t*>(self))
393 ->OnFocus(CefViewCToCpp::Wrap(view));
394 }
395
396 void CEF_CALLBACK
browser_view_delegate_on_blur(struct _cef_view_delegate_t * self,cef_view_t * view)397 browser_view_delegate_on_blur(struct _cef_view_delegate_t* self,
398 cef_view_t* view) {
399 shutdown_checker::AssertNotShutdown();
400
401 // AUTO-GENERATED CONTENT - DELETE THIS COMMENT BEFORE MODIFYING
402
403 DCHECK(self);
404 if (!self)
405 return;
406 // Verify param: view; type: refptr_diff
407 DCHECK(view);
408 if (!view)
409 return;
410
411 // Execute
412 CefBrowserViewDelegateCppToC::Get(
413 reinterpret_cast<cef_browser_view_delegate_t*>(self))
414 ->OnBlur(CefViewCToCpp::Wrap(view));
415 }
416
417 } // namespace
418
419 // CONSTRUCTOR - Do not edit by hand.
420
CefBrowserViewDelegateCppToC()421 CefBrowserViewDelegateCppToC::CefBrowserViewDelegateCppToC() {
422 GetStruct()->on_browser_created = browser_view_delegate_on_browser_created;
423 GetStruct()->on_browser_destroyed =
424 browser_view_delegate_on_browser_destroyed;
425 GetStruct()->get_delegate_for_popup_browser_view =
426 browser_view_delegate_get_delegate_for_popup_browser_view;
427 GetStruct()->on_popup_browser_view_created =
428 browser_view_delegate_on_popup_browser_view_created;
429 GetStruct()->get_chrome_toolbar_type =
430 browser_view_delegate_get_chrome_toolbar_type;
431 GetStruct()->base.get_preferred_size =
432 browser_view_delegate_get_preferred_size;
433 GetStruct()->base.get_minimum_size = browser_view_delegate_get_minimum_size;
434 GetStruct()->base.get_maximum_size = browser_view_delegate_get_maximum_size;
435 GetStruct()->base.get_height_for_width =
436 browser_view_delegate_get_height_for_width;
437 GetStruct()->base.on_parent_view_changed =
438 browser_view_delegate_on_parent_view_changed;
439 GetStruct()->base.on_child_view_changed =
440 browser_view_delegate_on_child_view_changed;
441 GetStruct()->base.on_window_changed = browser_view_delegate_on_window_changed;
442 GetStruct()->base.on_layout_changed = browser_view_delegate_on_layout_changed;
443 GetStruct()->base.on_focus = browser_view_delegate_on_focus;
444 GetStruct()->base.on_blur = browser_view_delegate_on_blur;
445 }
446
447 // DESTRUCTOR - Do not edit by hand.
448
~CefBrowserViewDelegateCppToC()449 CefBrowserViewDelegateCppToC::~CefBrowserViewDelegateCppToC() {
450 shutdown_checker::AssertNotShutdown();
451 }
452
453 template <>
454 CefRefPtr<CefBrowserViewDelegate> CefCppToCRefCounted<
455 CefBrowserViewDelegateCppToC,
456 CefBrowserViewDelegate,
UnwrapDerived(CefWrapperType type,cef_browser_view_delegate_t * s)457 cef_browser_view_delegate_t>::UnwrapDerived(CefWrapperType type,
458 cef_browser_view_delegate_t*
459 s) {
460 NOTREACHED() << "Unexpected class type: " << type;
461 return nullptr;
462 }
463
464 template <>
465 CefWrapperType CefCppToCRefCounted<CefBrowserViewDelegateCppToC,
466 CefBrowserViewDelegate,
467 cef_browser_view_delegate_t>::kWrapperType =
468 WT_BROWSER_VIEW_DELEGATE;
469