• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
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=8d30c4f8cf47bac2f9f728de876abb759b38041f$
13 //
14 
15 #include "libcef_dll/ctocpp/render_handler_ctocpp.h"
16 #include "libcef_dll/cpptoc/browser_cpptoc.h"
17 #include "libcef_dll/cpptoc/drag_data_cpptoc.h"
18 #include "libcef_dll/ctocpp/accessibility_handler_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")
24 CefRefPtr<CefAccessibilityHandler>
GetAccessibilityHandler()25 CefRenderHandlerCToCpp::GetAccessibilityHandler() {
26   shutdown_checker::AssertNotShutdown();
27 
28   cef_render_handler_t* _struct = GetStruct();
29   if (CEF_MEMBER_MISSING(_struct, get_accessibility_handler))
30     return nullptr;
31 
32   // AUTO-GENERATED CONTENT - DELETE THIS COMMENT BEFORE MODIFYING
33 
34   // Execute
35   cef_accessibility_handler_t* _retval =
36       _struct->get_accessibility_handler(_struct);
37 
38   // Return type: refptr_same
39   return CefAccessibilityHandlerCToCpp::Wrap(_retval);
40 }
41 
42 NO_SANITIZE("cfi-icall")
GetRootScreenRect(CefRefPtr<CefBrowser> browser,CefRect & rect)43 bool CefRenderHandlerCToCpp::GetRootScreenRect(CefRefPtr<CefBrowser> browser,
44                                                CefRect& rect) {
45   shutdown_checker::AssertNotShutdown();
46 
47   cef_render_handler_t* _struct = GetStruct();
48   if (CEF_MEMBER_MISSING(_struct, get_root_screen_rect))
49     return false;
50 
51   // AUTO-GENERATED CONTENT - DELETE THIS COMMENT BEFORE MODIFYING
52 
53   // Verify param: browser; type: refptr_diff
54   DCHECK(browser.get());
55   if (!browser.get())
56     return false;
57 
58   // Execute
59   int _retval = _struct->get_root_screen_rect(
60       _struct, CefBrowserCppToC::Wrap(browser), &rect);
61 
62   // Return type: bool
63   return _retval ? true : false;
64 }
65 
66 NO_SANITIZE("cfi-icall")
GetViewRect(CefRefPtr<CefBrowser> browser,CefRect & rect)67 void CefRenderHandlerCToCpp::GetViewRect(CefRefPtr<CefBrowser> browser,
68                                          CefRect& rect) {
69   shutdown_checker::AssertNotShutdown();
70 
71   cef_render_handler_t* _struct = GetStruct();
72   if (CEF_MEMBER_MISSING(_struct, get_view_rect))
73     return;
74 
75   // AUTO-GENERATED CONTENT - DELETE THIS COMMENT BEFORE MODIFYING
76 
77   // Verify param: browser; type: refptr_diff
78   DCHECK(browser.get());
79   if (!browser.get())
80     return;
81 
82   // Execute
83   _struct->get_view_rect(_struct, CefBrowserCppToC::Wrap(browser), &rect);
84 }
85 
86 NO_SANITIZE("cfi-icall")
GetScreenPoint(CefRefPtr<CefBrowser> browser,int viewX,int viewY,int & screenX,int & screenY)87 bool CefRenderHandlerCToCpp::GetScreenPoint(CefRefPtr<CefBrowser> browser,
88                                             int viewX,
89                                             int viewY,
90                                             int& screenX,
91                                             int& screenY) {
92   shutdown_checker::AssertNotShutdown();
93 
94   cef_render_handler_t* _struct = GetStruct();
95   if (CEF_MEMBER_MISSING(_struct, get_screen_point))
96     return false;
97 
98   // AUTO-GENERATED CONTENT - DELETE THIS COMMENT BEFORE MODIFYING
99 
100   // Verify param: browser; type: refptr_diff
101   DCHECK(browser.get());
102   if (!browser.get())
103     return false;
104 
105   // Execute
106   int _retval =
107       _struct->get_screen_point(_struct, CefBrowserCppToC::Wrap(browser), viewX,
108                                 viewY, &screenX, &screenY);
109 
110   // Return type: bool
111   return _retval ? true : false;
112 }
113 
114 NO_SANITIZE("cfi-icall")
GetScreenInfo(CefRefPtr<CefBrowser> browser,CefScreenInfo & screen_info)115 bool CefRenderHandlerCToCpp::GetScreenInfo(CefRefPtr<CefBrowser> browser,
116                                            CefScreenInfo& screen_info) {
117   shutdown_checker::AssertNotShutdown();
118 
119   cef_render_handler_t* _struct = GetStruct();
120   if (CEF_MEMBER_MISSING(_struct, get_screen_info))
121     return false;
122 
123   // AUTO-GENERATED CONTENT - DELETE THIS COMMENT BEFORE MODIFYING
124 
125   // Verify param: browser; type: refptr_diff
126   DCHECK(browser.get());
127   if (!browser.get())
128     return false;
129 
130   // Execute
131   int _retval = _struct->get_screen_info(
132       _struct, CefBrowserCppToC::Wrap(browser), &screen_info);
133 
134   // Return type: bool
135   return _retval ? true : false;
136 }
137 
138 NO_SANITIZE("cfi-icall")
OnPopupShow(CefRefPtr<CefBrowser> browser,bool show)139 void CefRenderHandlerCToCpp::OnPopupShow(CefRefPtr<CefBrowser> browser,
140                                          bool show) {
141   shutdown_checker::AssertNotShutdown();
142 
143   cef_render_handler_t* _struct = GetStruct();
144   if (CEF_MEMBER_MISSING(_struct, on_popup_show))
145     return;
146 
147   // AUTO-GENERATED CONTENT - DELETE THIS COMMENT BEFORE MODIFYING
148 
149   // Verify param: browser; type: refptr_diff
150   DCHECK(browser.get());
151   if (!browser.get())
152     return;
153 
154   // Execute
155   _struct->on_popup_show(_struct, CefBrowserCppToC::Wrap(browser), show);
156 }
157 
158 NO_SANITIZE("cfi-icall")
OnPopupSize(CefRefPtr<CefBrowser> browser,const CefRect & rect)159 void CefRenderHandlerCToCpp::OnPopupSize(CefRefPtr<CefBrowser> browser,
160                                          const CefRect& rect) {
161   shutdown_checker::AssertNotShutdown();
162 
163   cef_render_handler_t* _struct = GetStruct();
164   if (CEF_MEMBER_MISSING(_struct, on_popup_size))
165     return;
166 
167   // AUTO-GENERATED CONTENT - DELETE THIS COMMENT BEFORE MODIFYING
168 
169   // Verify param: browser; type: refptr_diff
170   DCHECK(browser.get());
171   if (!browser.get())
172     return;
173 
174   // Execute
175   _struct->on_popup_size(_struct, CefBrowserCppToC::Wrap(browser), &rect);
176 }
177 
178 NO_SANITIZE("cfi-icall")
OnPaint(CefRefPtr<CefBrowser> browser,PaintElementType type,const RectList & dirtyRects,const void * buffer,int width,int height)179 void CefRenderHandlerCToCpp::OnPaint(CefRefPtr<CefBrowser> browser,
180                                      PaintElementType type,
181                                      const RectList& dirtyRects,
182                                      const void* buffer,
183                                      int width,
184                                      int height) {
185   shutdown_checker::AssertNotShutdown();
186 
187   cef_render_handler_t* _struct = GetStruct();
188   if (CEF_MEMBER_MISSING(_struct, on_paint))
189     return;
190 
191   // AUTO-GENERATED CONTENT - DELETE THIS COMMENT BEFORE MODIFYING
192 
193   // Verify param: browser; type: refptr_diff
194   DCHECK(browser.get());
195   if (!browser.get())
196     return;
197   // Verify param: buffer; type: simple_byaddr
198   DCHECK(buffer);
199   if (!buffer)
200     return;
201 
202   // Translate param: dirtyRects; type: simple_vec_byref_const
203   const size_t dirtyRectsCount = dirtyRects.size();
204   cef_rect_t* dirtyRectsList = NULL;
205   if (dirtyRectsCount > 0) {
206     dirtyRectsList = new cef_rect_t[dirtyRectsCount];
207     DCHECK(dirtyRectsList);
208     if (dirtyRectsList) {
209       for (size_t i = 0; i < dirtyRectsCount; ++i) {
210         dirtyRectsList[i] = dirtyRects[i];
211       }
212     }
213   }
214 
215   // Execute
216   _struct->on_paint(_struct, CefBrowserCppToC::Wrap(browser), type,
217                     dirtyRectsCount, dirtyRectsList, buffer, width, height);
218 
219   // Restore param:dirtyRects; type: simple_vec_byref_const
220   if (dirtyRectsList)
221     delete[] dirtyRectsList;
222 }
223 
224 NO_SANITIZE("cfi-icall")
OnAcceleratedPaint(CefRefPtr<CefBrowser> browser,PaintElementType type,const RectList & dirtyRects,void * shared_handle)225 void CefRenderHandlerCToCpp::OnAcceleratedPaint(CefRefPtr<CefBrowser> browser,
226                                                 PaintElementType type,
227                                                 const RectList& dirtyRects,
228                                                 void* shared_handle) {
229   shutdown_checker::AssertNotShutdown();
230 
231   cef_render_handler_t* _struct = GetStruct();
232   if (CEF_MEMBER_MISSING(_struct, on_accelerated_paint))
233     return;
234 
235   // AUTO-GENERATED CONTENT - DELETE THIS COMMENT BEFORE MODIFYING
236 
237   // Verify param: browser; type: refptr_diff
238   DCHECK(browser.get());
239   if (!browser.get())
240     return;
241   // Verify param: shared_handle; type: simple_byaddr
242   DCHECK(shared_handle);
243   if (!shared_handle)
244     return;
245 
246   // Translate param: dirtyRects; type: simple_vec_byref_const
247   const size_t dirtyRectsCount = dirtyRects.size();
248   cef_rect_t* dirtyRectsList = NULL;
249   if (dirtyRectsCount > 0) {
250     dirtyRectsList = new cef_rect_t[dirtyRectsCount];
251     DCHECK(dirtyRectsList);
252     if (dirtyRectsList) {
253       for (size_t i = 0; i < dirtyRectsCount; ++i) {
254         dirtyRectsList[i] = dirtyRects[i];
255       }
256     }
257   }
258 
259   // Execute
260   _struct->on_accelerated_paint(_struct, CefBrowserCppToC::Wrap(browser), type,
261                                 dirtyRectsCount, dirtyRectsList, shared_handle);
262 
263   // Restore param:dirtyRects; type: simple_vec_byref_const
264   if (dirtyRectsList)
265     delete[] dirtyRectsList;
266 }
267 
268 NO_SANITIZE("cfi-icall")
StartDragging(CefRefPtr<CefBrowser> browser,CefRefPtr<CefDragData> drag_data,DragOperationsMask allowed_ops,int x,int y)269 bool CefRenderHandlerCToCpp::StartDragging(CefRefPtr<CefBrowser> browser,
270                                            CefRefPtr<CefDragData> drag_data,
271                                            DragOperationsMask allowed_ops,
272                                            int x,
273                                            int y) {
274   shutdown_checker::AssertNotShutdown();
275 
276   cef_render_handler_t* _struct = GetStruct();
277   if (CEF_MEMBER_MISSING(_struct, start_dragging))
278     return false;
279 
280   // AUTO-GENERATED CONTENT - DELETE THIS COMMENT BEFORE MODIFYING
281 
282   // Verify param: browser; type: refptr_diff
283   DCHECK(browser.get());
284   if (!browser.get())
285     return false;
286   // Verify param: drag_data; type: refptr_diff
287   DCHECK(drag_data.get());
288   if (!drag_data.get())
289     return false;
290 
291   // Execute
292   int _retval = _struct->start_dragging(
293       _struct, CefBrowserCppToC::Wrap(browser),
294       CefDragDataCppToC::Wrap(drag_data), allowed_ops, x, y);
295 
296   // Return type: bool
297   return _retval ? true : false;
298 }
299 
300 NO_SANITIZE("cfi-icall")
UpdateDragCursor(CefRefPtr<CefBrowser> browser,DragOperation operation)301 void CefRenderHandlerCToCpp::UpdateDragCursor(CefRefPtr<CefBrowser> browser,
302                                               DragOperation operation) {
303   shutdown_checker::AssertNotShutdown();
304 
305   cef_render_handler_t* _struct = GetStruct();
306   if (CEF_MEMBER_MISSING(_struct, update_drag_cursor))
307     return;
308 
309   // AUTO-GENERATED CONTENT - DELETE THIS COMMENT BEFORE MODIFYING
310 
311   // Verify param: browser; type: refptr_diff
312   DCHECK(browser.get());
313   if (!browser.get())
314     return;
315 
316   // Execute
317   _struct->update_drag_cursor(_struct, CefBrowserCppToC::Wrap(browser),
318                               operation);
319 }
320 
321 NO_SANITIZE("cfi-icall")
OnScrollOffsetChanged(CefRefPtr<CefBrowser> browser,double x,double y)322 void CefRenderHandlerCToCpp::OnScrollOffsetChanged(
323     CefRefPtr<CefBrowser> browser,
324     double x,
325     double y) {
326   shutdown_checker::AssertNotShutdown();
327 
328   cef_render_handler_t* _struct = GetStruct();
329   if (CEF_MEMBER_MISSING(_struct, on_scroll_offset_changed))
330     return;
331 
332   // AUTO-GENERATED CONTENT - DELETE THIS COMMENT BEFORE MODIFYING
333 
334   // Verify param: browser; type: refptr_diff
335   DCHECK(browser.get());
336   if (!browser.get())
337     return;
338 
339   // Execute
340   _struct->on_scroll_offset_changed(_struct, CefBrowserCppToC::Wrap(browser), x,
341                                     y);
342 }
343 
344 NO_SANITIZE("cfi-icall")
OnImeCompositionRangeChanged(CefRefPtr<CefBrowser> browser,const CefRange & selected_range,const RectList & character_bounds)345 void CefRenderHandlerCToCpp::OnImeCompositionRangeChanged(
346     CefRefPtr<CefBrowser> browser,
347     const CefRange& selected_range,
348     const RectList& character_bounds) {
349   shutdown_checker::AssertNotShutdown();
350 
351   cef_render_handler_t* _struct = GetStruct();
352   if (CEF_MEMBER_MISSING(_struct, on_ime_composition_range_changed))
353     return;
354 
355   // AUTO-GENERATED CONTENT - DELETE THIS COMMENT BEFORE MODIFYING
356 
357   // Verify param: browser; type: refptr_diff
358   DCHECK(browser.get());
359   if (!browser.get())
360     return;
361 
362   // Translate param: character_bounds; type: simple_vec_byref_const
363   const size_t character_boundsCount = character_bounds.size();
364   cef_rect_t* character_boundsList = NULL;
365   if (character_boundsCount > 0) {
366     character_boundsList = new cef_rect_t[character_boundsCount];
367     DCHECK(character_boundsList);
368     if (character_boundsList) {
369       for (size_t i = 0; i < character_boundsCount; ++i) {
370         character_boundsList[i] = character_bounds[i];
371       }
372     }
373   }
374 
375   // Execute
376   _struct->on_ime_composition_range_changed(
377       _struct, CefBrowserCppToC::Wrap(browser), &selected_range,
378       character_boundsCount, character_boundsList);
379 
380   // Restore param:character_bounds; type: simple_vec_byref_const
381   if (character_boundsList)
382     delete[] character_boundsList;
383 }
384 
385 NO_SANITIZE("cfi-icall")
OnTextSelectionChanged(CefRefPtr<CefBrowser> browser,const CefString & selected_text,const CefRange & selected_range)386 void CefRenderHandlerCToCpp::OnTextSelectionChanged(
387     CefRefPtr<CefBrowser> browser,
388     const CefString& selected_text,
389     const CefRange& selected_range) {
390   shutdown_checker::AssertNotShutdown();
391 
392   cef_render_handler_t* _struct = GetStruct();
393   if (CEF_MEMBER_MISSING(_struct, on_text_selection_changed))
394     return;
395 
396   // AUTO-GENERATED CONTENT - DELETE THIS COMMENT BEFORE MODIFYING
397 
398   // Verify param: browser; type: refptr_diff
399   DCHECK(browser.get());
400   if (!browser.get())
401     return;
402   // Unverified params: selected_text, selected_range
403 
404   // Execute
405   _struct->on_text_selection_changed(_struct, CefBrowserCppToC::Wrap(browser),
406                                      selected_text.GetStruct(),
407                                      &selected_range);
408 }
409 
410 NO_SANITIZE("cfi-icall")
OnVirtualKeyboardRequested(CefRefPtr<CefBrowser> browser,TextInputMode input_mode)411 void CefRenderHandlerCToCpp::OnVirtualKeyboardRequested(
412     CefRefPtr<CefBrowser> browser,
413     TextInputMode input_mode) {
414   shutdown_checker::AssertNotShutdown();
415 
416   cef_render_handler_t* _struct = GetStruct();
417   if (CEF_MEMBER_MISSING(_struct, on_virtual_keyboard_requested))
418     return;
419 
420   // AUTO-GENERATED CONTENT - DELETE THIS COMMENT BEFORE MODIFYING
421 
422   // Verify param: browser; type: refptr_diff
423   DCHECK(browser.get());
424   if (!browser.get())
425     return;
426 
427   // Execute
428   _struct->on_virtual_keyboard_requested(
429       _struct, CefBrowserCppToC::Wrap(browser), input_mode);
430 }
431 
432 // CONSTRUCTOR - Do not edit by hand.
433 
CefRenderHandlerCToCpp()434 CefRenderHandlerCToCpp::CefRenderHandlerCToCpp() {}
435 
436 // DESTRUCTOR - Do not edit by hand.
437 
~CefRenderHandlerCToCpp()438 CefRenderHandlerCToCpp::~CefRenderHandlerCToCpp() {
439   shutdown_checker::AssertNotShutdown();
440 }
441 
442 template <>
443 cef_render_handler_t*
444 CefCToCppRefCounted<CefRenderHandlerCToCpp,
445                     CefRenderHandler,
UnwrapDerived(CefWrapperType type,CefRenderHandler * c)446                     cef_render_handler_t>::UnwrapDerived(CefWrapperType type,
447                                                          CefRenderHandler* c) {
448   NOTREACHED() << "Unexpected class type: " << type;
449   return nullptr;
450 }
451 
452 template <>
453 CefWrapperType CefCToCppRefCounted<CefRenderHandlerCToCpp,
454                                    CefRenderHandler,
455                                    cef_render_handler_t>::kWrapperType =
456     WT_RENDER_HANDLER;
457