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=b64fcfb34da785eccf9a1232b35f485fbc838bda$
13 //
14
15 #include "libcef_dll/cpptoc/render_handler_cpptoc.h"
16 #include "libcef_dll/cpptoc/accessibility_handler_cpptoc.h"
17 #include "libcef_dll/ctocpp/browser_ctocpp.h"
18 #include "libcef_dll/ctocpp/drag_data_ctocpp.h"
19 #include "libcef_dll/shutdown_checker.h"
20
21 namespace {
22
23 // MEMBER FUNCTIONS - Body may be edited by hand.
24
25 cef_accessibility_handler_t* CEF_CALLBACK
render_handler_get_accessibility_handler(struct _cef_render_handler_t * self)26 render_handler_get_accessibility_handler(struct _cef_render_handler_t* self) {
27 shutdown_checker::AssertNotShutdown();
28
29 // AUTO-GENERATED CONTENT - DELETE THIS COMMENT BEFORE MODIFYING
30
31 DCHECK(self);
32 if (!self)
33 return NULL;
34
35 // Execute
36 CefRefPtr<CefAccessibilityHandler> _retval =
37 CefRenderHandlerCppToC::Get(self)->GetAccessibilityHandler();
38
39 // Return type: refptr_same
40 return CefAccessibilityHandlerCppToC::Wrap(_retval);
41 }
42
43 int CEF_CALLBACK
render_handler_get_root_screen_rect(struct _cef_render_handler_t * self,cef_browser_t * browser,cef_rect_t * rect)44 render_handler_get_root_screen_rect(struct _cef_render_handler_t* self,
45 cef_browser_t* browser,
46 cef_rect_t* rect) {
47 shutdown_checker::AssertNotShutdown();
48
49 // AUTO-GENERATED CONTENT - DELETE THIS COMMENT BEFORE MODIFYING
50
51 DCHECK(self);
52 if (!self)
53 return 0;
54 // Verify param: browser; type: refptr_diff
55 DCHECK(browser);
56 if (!browser)
57 return 0;
58 // Verify param: rect; type: simple_byref
59 DCHECK(rect);
60 if (!rect)
61 return 0;
62
63 // Translate param: rect; type: simple_byref
64 CefRect rectVal = rect ? *rect : CefRect();
65
66 // Execute
67 bool _retval = CefRenderHandlerCppToC::Get(self)->GetRootScreenRect(
68 CefBrowserCToCpp::Wrap(browser), rectVal);
69
70 // Restore param: rect; type: simple_byref
71 if (rect)
72 *rect = rectVal;
73
74 // Return type: bool
75 return _retval;
76 }
77
78 void CEF_CALLBACK
render_handler_get_view_rect(struct _cef_render_handler_t * self,cef_browser_t * browser,cef_rect_t * rect)79 render_handler_get_view_rect(struct _cef_render_handler_t* self,
80 cef_browser_t* browser,
81 cef_rect_t* rect) {
82 shutdown_checker::AssertNotShutdown();
83
84 // AUTO-GENERATED CONTENT - DELETE THIS COMMENT BEFORE MODIFYING
85
86 DCHECK(self);
87 if (!self)
88 return;
89 // Verify param: browser; type: refptr_diff
90 DCHECK(browser);
91 if (!browser)
92 return;
93 // Verify param: rect; type: simple_byref
94 DCHECK(rect);
95 if (!rect)
96 return;
97
98 // Translate param: rect; type: simple_byref
99 CefRect rectVal = rect ? *rect : CefRect();
100
101 // Execute
102 CefRenderHandlerCppToC::Get(self)->GetViewRect(
103 CefBrowserCToCpp::Wrap(browser), rectVal);
104
105 // Restore param: rect; type: simple_byref
106 if (rect)
107 *rect = rectVal;
108 }
109
110 int CEF_CALLBACK
render_handler_get_screen_point(struct _cef_render_handler_t * self,cef_browser_t * browser,int viewX,int viewY,int * screenX,int * screenY)111 render_handler_get_screen_point(struct _cef_render_handler_t* self,
112 cef_browser_t* browser,
113 int viewX,
114 int viewY,
115 int* screenX,
116 int* screenY) {
117 shutdown_checker::AssertNotShutdown();
118
119 // AUTO-GENERATED CONTENT - DELETE THIS COMMENT BEFORE MODIFYING
120
121 DCHECK(self);
122 if (!self)
123 return 0;
124 // Verify param: browser; type: refptr_diff
125 DCHECK(browser);
126 if (!browser)
127 return 0;
128 // Verify param: screenX; type: simple_byref
129 DCHECK(screenX);
130 if (!screenX)
131 return 0;
132 // Verify param: screenY; type: simple_byref
133 DCHECK(screenY);
134 if (!screenY)
135 return 0;
136
137 // Translate param: screenX; type: simple_byref
138 int screenXVal = screenX ? *screenX : 0;
139 // Translate param: screenY; type: simple_byref
140 int screenYVal = screenY ? *screenY : 0;
141
142 // Execute
143 bool _retval = CefRenderHandlerCppToC::Get(self)->GetScreenPoint(
144 CefBrowserCToCpp::Wrap(browser), viewX, viewY, screenXVal, screenYVal);
145
146 // Restore param: screenX; type: simple_byref
147 if (screenX)
148 *screenX = screenXVal;
149 // Restore param: screenY; type: simple_byref
150 if (screenY)
151 *screenY = screenYVal;
152
153 // Return type: bool
154 return _retval;
155 }
156
157 int CEF_CALLBACK
render_handler_get_screen_info(struct _cef_render_handler_t * self,cef_browser_t * browser,struct _cef_screen_info_t * screen_info)158 render_handler_get_screen_info(struct _cef_render_handler_t* self,
159 cef_browser_t* browser,
160 struct _cef_screen_info_t* screen_info) {
161 shutdown_checker::AssertNotShutdown();
162
163 // AUTO-GENERATED CONTENT - DELETE THIS COMMENT BEFORE MODIFYING
164
165 DCHECK(self);
166 if (!self)
167 return 0;
168 // Verify param: browser; type: refptr_diff
169 DCHECK(browser);
170 if (!browser)
171 return 0;
172 // Verify param: screen_info; type: struct_byref
173 DCHECK(screen_info);
174 if (!screen_info)
175 return 0;
176
177 // Translate param: screen_info; type: struct_byref
178 CefScreenInfo screen_infoObj;
179 if (screen_info)
180 screen_infoObj.AttachTo(*screen_info);
181
182 // Execute
183 bool _retval = CefRenderHandlerCppToC::Get(self)->GetScreenInfo(
184 CefBrowserCToCpp::Wrap(browser), screen_infoObj);
185
186 // Restore param: screen_info; type: struct_byref
187 if (screen_info)
188 screen_infoObj.DetachTo(*screen_info);
189
190 // Return type: bool
191 return _retval;
192 }
193
194 void CEF_CALLBACK
render_handler_on_popup_show(struct _cef_render_handler_t * self,cef_browser_t * browser,int show)195 render_handler_on_popup_show(struct _cef_render_handler_t* self,
196 cef_browser_t* browser,
197 int show) {
198 shutdown_checker::AssertNotShutdown();
199
200 // AUTO-GENERATED CONTENT - DELETE THIS COMMENT BEFORE MODIFYING
201
202 DCHECK(self);
203 if (!self)
204 return;
205 // Verify param: browser; type: refptr_diff
206 DCHECK(browser);
207 if (!browser)
208 return;
209
210 // Execute
211 CefRenderHandlerCppToC::Get(self)->OnPopupShow(
212 CefBrowserCToCpp::Wrap(browser), show ? true : false);
213 }
214
215 void CEF_CALLBACK
render_handler_on_popup_size(struct _cef_render_handler_t * self,cef_browser_t * browser,const cef_rect_t * rect)216 render_handler_on_popup_size(struct _cef_render_handler_t* self,
217 cef_browser_t* browser,
218 const cef_rect_t* rect) {
219 shutdown_checker::AssertNotShutdown();
220
221 // AUTO-GENERATED CONTENT - DELETE THIS COMMENT BEFORE MODIFYING
222
223 DCHECK(self);
224 if (!self)
225 return;
226 // Verify param: browser; type: refptr_diff
227 DCHECK(browser);
228 if (!browser)
229 return;
230 // Verify param: rect; type: simple_byref_const
231 DCHECK(rect);
232 if (!rect)
233 return;
234
235 // Translate param: rect; type: simple_byref_const
236 CefRect rectVal = rect ? *rect : CefRect();
237
238 // Execute
239 CefRenderHandlerCppToC::Get(self)->OnPopupSize(
240 CefBrowserCToCpp::Wrap(browser), rectVal);
241 }
242
render_handler_on_paint(struct _cef_render_handler_t * self,cef_browser_t * browser,cef_paint_element_type_t type,size_t dirtyRectsCount,cef_rect_t const * dirtyRects,const void * buffer,int width,int height)243 void CEF_CALLBACK render_handler_on_paint(struct _cef_render_handler_t* self,
244 cef_browser_t* browser,
245 cef_paint_element_type_t type,
246 size_t dirtyRectsCount,
247 cef_rect_t const* dirtyRects,
248 const void* buffer,
249 int width,
250 int height) {
251 shutdown_checker::AssertNotShutdown();
252
253 // AUTO-GENERATED CONTENT - DELETE THIS COMMENT BEFORE MODIFYING
254
255 DCHECK(self);
256 if (!self)
257 return;
258 // Verify param: browser; type: refptr_diff
259 DCHECK(browser);
260 if (!browser)
261 return;
262 // Verify param: dirtyRects; type: simple_vec_byref_const
263 DCHECK(dirtyRectsCount == 0 || dirtyRects);
264 if (dirtyRectsCount > 0 && !dirtyRects)
265 return;
266 // Verify param: buffer; type: simple_byaddr
267 DCHECK(buffer);
268 if (!buffer)
269 return;
270
271 // Translate param: dirtyRects; type: simple_vec_byref_const
272 std::vector<CefRect> dirtyRectsList;
273 if (dirtyRectsCount > 0) {
274 for (size_t i = 0; i < dirtyRectsCount; ++i) {
275 CefRect dirtyRectsVal = dirtyRects[i];
276 dirtyRectsList.push_back(dirtyRectsVal);
277 }
278 }
279
280 // Execute
281 CefRenderHandlerCppToC::Get(self)->OnPaint(CefBrowserCToCpp::Wrap(browser),
282 type, dirtyRectsList, buffer,
283 width, height);
284 }
285
286 void CEF_CALLBACK
render_handler_on_accelerated_paint(struct _cef_render_handler_t * self,cef_browser_t * browser,cef_paint_element_type_t type,size_t dirtyRectsCount,cef_rect_t const * dirtyRects,void * shared_handle)287 render_handler_on_accelerated_paint(struct _cef_render_handler_t* self,
288 cef_browser_t* browser,
289 cef_paint_element_type_t type,
290 size_t dirtyRectsCount,
291 cef_rect_t const* dirtyRects,
292 void* shared_handle) {
293 shutdown_checker::AssertNotShutdown();
294
295 // AUTO-GENERATED CONTENT - DELETE THIS COMMENT BEFORE MODIFYING
296
297 DCHECK(self);
298 if (!self)
299 return;
300 // Verify param: browser; type: refptr_diff
301 DCHECK(browser);
302 if (!browser)
303 return;
304 // Verify param: dirtyRects; type: simple_vec_byref_const
305 DCHECK(dirtyRectsCount == 0 || dirtyRects);
306 if (dirtyRectsCount > 0 && !dirtyRects)
307 return;
308 // Verify param: shared_handle; type: simple_byaddr
309 DCHECK(shared_handle);
310 if (!shared_handle)
311 return;
312
313 // Translate param: dirtyRects; type: simple_vec_byref_const
314 std::vector<CefRect> dirtyRectsList;
315 if (dirtyRectsCount > 0) {
316 for (size_t i = 0; i < dirtyRectsCount; ++i) {
317 CefRect dirtyRectsVal = dirtyRects[i];
318 dirtyRectsList.push_back(dirtyRectsVal);
319 }
320 }
321
322 // Execute
323 CefRenderHandlerCppToC::Get(self)->OnAcceleratedPaint(
324 CefBrowserCToCpp::Wrap(browser), type, dirtyRectsList, shared_handle);
325 }
326
327 int CEF_CALLBACK
render_handler_start_dragging(struct _cef_render_handler_t * self,cef_browser_t * browser,cef_drag_data_t * drag_data,cef_drag_operations_mask_t allowed_ops,int x,int y)328 render_handler_start_dragging(struct _cef_render_handler_t* self,
329 cef_browser_t* browser,
330 cef_drag_data_t* drag_data,
331 cef_drag_operations_mask_t allowed_ops,
332 int x,
333 int y) {
334 shutdown_checker::AssertNotShutdown();
335
336 // AUTO-GENERATED CONTENT - DELETE THIS COMMENT BEFORE MODIFYING
337
338 DCHECK(self);
339 if (!self)
340 return 0;
341 // Verify param: browser; type: refptr_diff
342 DCHECK(browser);
343 if (!browser)
344 return 0;
345 // Verify param: drag_data; type: refptr_diff
346 DCHECK(drag_data);
347 if (!drag_data)
348 return 0;
349
350 // Execute
351 bool _retval = CefRenderHandlerCppToC::Get(self)->StartDragging(
352 CefBrowserCToCpp::Wrap(browser), CefDragDataCToCpp::Wrap(drag_data),
353 allowed_ops, x, y);
354
355 // Return type: bool
356 return _retval;
357 }
358
359 void CEF_CALLBACK
render_handler_update_drag_cursor(struct _cef_render_handler_t * self,cef_browser_t * browser,cef_drag_operations_mask_t operation)360 render_handler_update_drag_cursor(struct _cef_render_handler_t* self,
361 cef_browser_t* browser,
362 cef_drag_operations_mask_t operation) {
363 shutdown_checker::AssertNotShutdown();
364
365 // AUTO-GENERATED CONTENT - DELETE THIS COMMENT BEFORE MODIFYING
366
367 DCHECK(self);
368 if (!self)
369 return;
370 // Verify param: browser; type: refptr_diff
371 DCHECK(browser);
372 if (!browser)
373 return;
374
375 // Execute
376 CefRenderHandlerCppToC::Get(self)->UpdateDragCursor(
377 CefBrowserCToCpp::Wrap(browser), operation);
378 }
379
380 void CEF_CALLBACK
render_handler_on_scroll_offset_changed(struct _cef_render_handler_t * self,cef_browser_t * browser,double x,double y)381 render_handler_on_scroll_offset_changed(struct _cef_render_handler_t* self,
382 cef_browser_t* browser,
383 double x,
384 double y) {
385 shutdown_checker::AssertNotShutdown();
386
387 // AUTO-GENERATED CONTENT - DELETE THIS COMMENT BEFORE MODIFYING
388
389 DCHECK(self);
390 if (!self)
391 return;
392 // Verify param: browser; type: refptr_diff
393 DCHECK(browser);
394 if (!browser)
395 return;
396
397 // Execute
398 CefRenderHandlerCppToC::Get(self)->OnScrollOffsetChanged(
399 CefBrowserCToCpp::Wrap(browser), x, y);
400 }
401
render_handler_on_ime_composition_range_changed(struct _cef_render_handler_t * self,cef_browser_t * browser,const cef_range_t * selected_range,size_t character_boundsCount,cef_rect_t const * character_bounds)402 void CEF_CALLBACK render_handler_on_ime_composition_range_changed(
403 struct _cef_render_handler_t* self,
404 cef_browser_t* browser,
405 const cef_range_t* selected_range,
406 size_t character_boundsCount,
407 cef_rect_t const* character_bounds) {
408 shutdown_checker::AssertNotShutdown();
409
410 // AUTO-GENERATED CONTENT - DELETE THIS COMMENT BEFORE MODIFYING
411
412 DCHECK(self);
413 if (!self)
414 return;
415 // Verify param: browser; type: refptr_diff
416 DCHECK(browser);
417 if (!browser)
418 return;
419 // Verify param: selected_range; type: simple_byref_const
420 DCHECK(selected_range);
421 if (!selected_range)
422 return;
423 // Verify param: character_bounds; type: simple_vec_byref_const
424 DCHECK(character_boundsCount == 0 || character_bounds);
425 if (character_boundsCount > 0 && !character_bounds)
426 return;
427
428 // Translate param: selected_range; type: simple_byref_const
429 CefRange selected_rangeVal = selected_range ? *selected_range : CefRange();
430 // Translate param: character_bounds; type: simple_vec_byref_const
431 std::vector<CefRect> character_boundsList;
432 if (character_boundsCount > 0) {
433 for (size_t i = 0; i < character_boundsCount; ++i) {
434 CefRect character_boundsVal = character_bounds[i];
435 character_boundsList.push_back(character_boundsVal);
436 }
437 }
438
439 // Execute
440 CefRenderHandlerCppToC::Get(self)->OnImeCompositionRangeChanged(
441 CefBrowserCToCpp::Wrap(browser), selected_rangeVal, character_boundsList);
442 }
443
444 void CEF_CALLBACK
render_handler_on_text_selection_changed(struct _cef_render_handler_t * self,cef_browser_t * browser,const cef_string_t * selected_text,const cef_range_t * selected_range)445 render_handler_on_text_selection_changed(struct _cef_render_handler_t* self,
446 cef_browser_t* browser,
447 const cef_string_t* selected_text,
448 const cef_range_t* selected_range) {
449 shutdown_checker::AssertNotShutdown();
450
451 // AUTO-GENERATED CONTENT - DELETE THIS COMMENT BEFORE MODIFYING
452
453 DCHECK(self);
454 if (!self)
455 return;
456 // Verify param: browser; type: refptr_diff
457 DCHECK(browser);
458 if (!browser)
459 return;
460 // Unverified params: selected_text, selected_range
461
462 // Translate param: selected_range; type: simple_byref_const
463 CefRange selected_rangeVal = selected_range ? *selected_range : CefRange();
464
465 // Execute
466 CefRenderHandlerCppToC::Get(self)->OnTextSelectionChanged(
467 CefBrowserCToCpp::Wrap(browser), CefString(selected_text),
468 selected_rangeVal);
469 }
470
471 void CEF_CALLBACK
render_handler_on_virtual_keyboard_requested(struct _cef_render_handler_t * self,cef_browser_t * browser,cef_text_input_mode_t input_mode)472 render_handler_on_virtual_keyboard_requested(struct _cef_render_handler_t* self,
473 cef_browser_t* browser,
474 cef_text_input_mode_t input_mode) {
475 shutdown_checker::AssertNotShutdown();
476
477 // AUTO-GENERATED CONTENT - DELETE THIS COMMENT BEFORE MODIFYING
478
479 DCHECK(self);
480 if (!self)
481 return;
482 // Verify param: browser; type: refptr_diff
483 DCHECK(browser);
484 if (!browser)
485 return;
486
487 // Execute
488 CefRenderHandlerCppToC::Get(self)->OnVirtualKeyboardRequested(
489 CefBrowserCToCpp::Wrap(browser), input_mode);
490 }
491
492 } // namespace
493
494 // CONSTRUCTOR - Do not edit by hand.
495
CefRenderHandlerCppToC()496 CefRenderHandlerCppToC::CefRenderHandlerCppToC() {
497 GetStruct()->get_accessibility_handler =
498 render_handler_get_accessibility_handler;
499 GetStruct()->get_root_screen_rect = render_handler_get_root_screen_rect;
500 GetStruct()->get_view_rect = render_handler_get_view_rect;
501 GetStruct()->get_screen_point = render_handler_get_screen_point;
502 GetStruct()->get_screen_info = render_handler_get_screen_info;
503 GetStruct()->on_popup_show = render_handler_on_popup_show;
504 GetStruct()->on_popup_size = render_handler_on_popup_size;
505 GetStruct()->on_paint = render_handler_on_paint;
506 GetStruct()->on_accelerated_paint = render_handler_on_accelerated_paint;
507 GetStruct()->start_dragging = render_handler_start_dragging;
508 GetStruct()->update_drag_cursor = render_handler_update_drag_cursor;
509 GetStruct()->on_scroll_offset_changed =
510 render_handler_on_scroll_offset_changed;
511 GetStruct()->on_ime_composition_range_changed =
512 render_handler_on_ime_composition_range_changed;
513 GetStruct()->on_text_selection_changed =
514 render_handler_on_text_selection_changed;
515 GetStruct()->on_virtual_keyboard_requested =
516 render_handler_on_virtual_keyboard_requested;
517 }
518
519 // DESTRUCTOR - Do not edit by hand.
520
~CefRenderHandlerCppToC()521 CefRenderHandlerCppToC::~CefRenderHandlerCppToC() {
522 shutdown_checker::AssertNotShutdown();
523 }
524
525 template <>
526 CefRefPtr<CefRenderHandler> CefCppToCRefCounted<
527 CefRenderHandlerCppToC,
528 CefRenderHandler,
UnwrapDerived(CefWrapperType type,cef_render_handler_t * s)529 cef_render_handler_t>::UnwrapDerived(CefWrapperType type,
530 cef_render_handler_t* s) {
531 NOTREACHED() << "Unexpected class type: " << type;
532 return nullptr;
533 }
534
535 template <>
536 CefWrapperType CefCppToCRefCounted<CefRenderHandlerCppToC,
537 CefRenderHandler,
538 cef_render_handler_t>::kWrapperType =
539 WT_RENDER_HANDLER;
540