• 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=8963e8fd758fe86d0f35a5fd81e3f56a0b7aa3cd$
13 //
14 
15 #include "libcef_dll/cpptoc/display_handler_cpptoc.h"
16 #include "libcef_dll/ctocpp/browser_ctocpp.h"
17 #include "libcef_dll/ctocpp/frame_ctocpp.h"
18 #include "libcef_dll/shutdown_checker.h"
19 #include "libcef_dll/transfer_util.h"
20 
21 namespace {
22 
23 // MEMBER FUNCTIONS - Body may be edited by hand.
24 
25 void CEF_CALLBACK
display_handler_on_address_change(struct _cef_display_handler_t * self,cef_browser_t * browser,struct _cef_frame_t * frame,const cef_string_t * url)26 display_handler_on_address_change(struct _cef_display_handler_t* self,
27                                   cef_browser_t* browser,
28                                   struct _cef_frame_t* frame,
29                                   const cef_string_t* url) {
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; type: refptr_diff
38   DCHECK(browser);
39   if (!browser)
40     return;
41   // Verify param: frame; type: refptr_diff
42   DCHECK(frame);
43   if (!frame)
44     return;
45   // Verify param: url; type: string_byref_const
46   DCHECK(url);
47   if (!url)
48     return;
49 
50   // Execute
51   CefDisplayHandlerCppToC::Get(self)->OnAddressChange(
52       CefBrowserCToCpp::Wrap(browser), CefFrameCToCpp::Wrap(frame),
53       CefString(url));
54 }
55 
56 void CEF_CALLBACK
display_handler_on_title_change(struct _cef_display_handler_t * self,cef_browser_t * browser,const cef_string_t * title)57 display_handler_on_title_change(struct _cef_display_handler_t* self,
58                                 cef_browser_t* browser,
59                                 const cef_string_t* title) {
60   shutdown_checker::AssertNotShutdown();
61 
62   // AUTO-GENERATED CONTENT - DELETE THIS COMMENT BEFORE MODIFYING
63 
64   DCHECK(self);
65   if (!self)
66     return;
67   // Verify param: browser; type: refptr_diff
68   DCHECK(browser);
69   if (!browser)
70     return;
71   // Unverified params: title
72 
73   // Execute
74   CefDisplayHandlerCppToC::Get(self)->OnTitleChange(
75       CefBrowserCToCpp::Wrap(browser), CefString(title));
76 }
77 
78 void CEF_CALLBACK
display_handler_on_favicon_urlchange(struct _cef_display_handler_t * self,cef_browser_t * browser,cef_string_list_t icon_urls)79 display_handler_on_favicon_urlchange(struct _cef_display_handler_t* self,
80                                      cef_browser_t* browser,
81                                      cef_string_list_t icon_urls) {
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   // Unverified params: icon_urls
94 
95   // Translate param: icon_urls; type: string_vec_byref_const
96   std::vector<CefString> icon_urlsList;
97   transfer_string_list_contents(icon_urls, icon_urlsList);
98 
99   // Execute
100   CefDisplayHandlerCppToC::Get(self)->OnFaviconURLChange(
101       CefBrowserCToCpp::Wrap(browser), icon_urlsList);
102 }
103 
104 void CEF_CALLBACK
display_handler_on_fullscreen_mode_change(struct _cef_display_handler_t * self,cef_browser_t * browser,int fullscreen)105 display_handler_on_fullscreen_mode_change(struct _cef_display_handler_t* self,
106                                           cef_browser_t* browser,
107                                           int fullscreen) {
108   shutdown_checker::AssertNotShutdown();
109 
110   // AUTO-GENERATED CONTENT - DELETE THIS COMMENT BEFORE MODIFYING
111 
112   DCHECK(self);
113   if (!self)
114     return;
115   // Verify param: browser; type: refptr_diff
116   DCHECK(browser);
117   if (!browser)
118     return;
119 
120   // Execute
121   CefDisplayHandlerCppToC::Get(self)->OnFullscreenModeChange(
122       CefBrowserCToCpp::Wrap(browser), fullscreen ? true : false);
123 }
124 
display_handler_on_tooltip(struct _cef_display_handler_t * self,cef_browser_t * browser,cef_string_t * text)125 int CEF_CALLBACK display_handler_on_tooltip(struct _cef_display_handler_t* self,
126                                             cef_browser_t* browser,
127                                             cef_string_t* text) {
128   shutdown_checker::AssertNotShutdown();
129 
130   // AUTO-GENERATED CONTENT - DELETE THIS COMMENT BEFORE MODIFYING
131 
132   DCHECK(self);
133   if (!self)
134     return 0;
135   // Verify param: browser; type: refptr_diff
136   DCHECK(browser);
137   if (!browser)
138     return 0;
139   // Unverified params: text
140 
141   // Translate param: text; type: string_byref
142   CefString textStr(text);
143 
144   // Execute
145   bool _retval = CefDisplayHandlerCppToC::Get(self)->OnTooltip(
146       CefBrowserCToCpp::Wrap(browser), textStr);
147 
148   // Return type: bool
149   return _retval;
150 }
151 
152 void CEF_CALLBACK
display_handler_on_status_message(struct _cef_display_handler_t * self,cef_browser_t * browser,const cef_string_t * value)153 display_handler_on_status_message(struct _cef_display_handler_t* self,
154                                   cef_browser_t* browser,
155                                   const cef_string_t* value) {
156   shutdown_checker::AssertNotShutdown();
157 
158   // AUTO-GENERATED CONTENT - DELETE THIS COMMENT BEFORE MODIFYING
159 
160   DCHECK(self);
161   if (!self)
162     return;
163   // Verify param: browser; type: refptr_diff
164   DCHECK(browser);
165   if (!browser)
166     return;
167   // Unverified params: value
168 
169   // Execute
170   CefDisplayHandlerCppToC::Get(self)->OnStatusMessage(
171       CefBrowserCToCpp::Wrap(browser), CefString(value));
172 }
173 
174 int CEF_CALLBACK
display_handler_on_console_message(struct _cef_display_handler_t * self,cef_browser_t * browser,cef_log_severity_t level,const cef_string_t * message,const cef_string_t * source,int line)175 display_handler_on_console_message(struct _cef_display_handler_t* self,
176                                    cef_browser_t* browser,
177                                    cef_log_severity_t level,
178                                    const cef_string_t* message,
179                                    const cef_string_t* source,
180                                    int line) {
181   shutdown_checker::AssertNotShutdown();
182 
183   // AUTO-GENERATED CONTENT - DELETE THIS COMMENT BEFORE MODIFYING
184 
185   DCHECK(self);
186   if (!self)
187     return 0;
188   // Verify param: browser; type: refptr_diff
189   DCHECK(browser);
190   if (!browser)
191     return 0;
192   // Unverified params: message, source
193 
194   // Execute
195   bool _retval = CefDisplayHandlerCppToC::Get(self)->OnConsoleMessage(
196       CefBrowserCToCpp::Wrap(browser), level, CefString(message),
197       CefString(source), line);
198 
199   // Return type: bool
200   return _retval;
201 }
202 
203 int CEF_CALLBACK
display_handler_on_auto_resize(struct _cef_display_handler_t * self,cef_browser_t * browser,const cef_size_t * new_size)204 display_handler_on_auto_resize(struct _cef_display_handler_t* self,
205                                cef_browser_t* browser,
206                                const cef_size_t* new_size) {
207   shutdown_checker::AssertNotShutdown();
208 
209   // AUTO-GENERATED CONTENT - DELETE THIS COMMENT BEFORE MODIFYING
210 
211   DCHECK(self);
212   if (!self)
213     return 0;
214   // Verify param: browser; type: refptr_diff
215   DCHECK(browser);
216   if (!browser)
217     return 0;
218   // Verify param: new_size; type: simple_byref_const
219   DCHECK(new_size);
220   if (!new_size)
221     return 0;
222 
223   // Translate param: new_size; type: simple_byref_const
224   CefSize new_sizeVal = new_size ? *new_size : CefSize();
225 
226   // Execute
227   bool _retval = CefDisplayHandlerCppToC::Get(self)->OnAutoResize(
228       CefBrowserCToCpp::Wrap(browser), new_sizeVal);
229 
230   // Return type: bool
231   return _retval;
232 }
233 
234 void CEF_CALLBACK
display_handler_on_loading_progress_change(struct _cef_display_handler_t * self,cef_browser_t * browser,double progress)235 display_handler_on_loading_progress_change(struct _cef_display_handler_t* self,
236                                            cef_browser_t* browser,
237                                            double progress) {
238   shutdown_checker::AssertNotShutdown();
239 
240   // AUTO-GENERATED CONTENT - DELETE THIS COMMENT BEFORE MODIFYING
241 
242   DCHECK(self);
243   if (!self)
244     return;
245   // Verify param: browser; type: refptr_diff
246   DCHECK(browser);
247   if (!browser)
248     return;
249 
250   // Execute
251   CefDisplayHandlerCppToC::Get(self)->OnLoadingProgressChange(
252       CefBrowserCToCpp::Wrap(browser), progress);
253 }
254 
display_handler_on_cursor_change(struct _cef_display_handler_t * self,cef_browser_t * browser,cef_cursor_handle_t cursor,cef_cursor_type_t type,const struct _cef_cursor_info_t * custom_cursor_info)255 int CEF_CALLBACK display_handler_on_cursor_change(
256     struct _cef_display_handler_t* self,
257     cef_browser_t* browser,
258     cef_cursor_handle_t cursor,
259     cef_cursor_type_t type,
260     const struct _cef_cursor_info_t* custom_cursor_info) {
261   shutdown_checker::AssertNotShutdown();
262 
263   // AUTO-GENERATED CONTENT - DELETE THIS COMMENT BEFORE MODIFYING
264 
265   DCHECK(self);
266   if (!self)
267     return 0;
268   // Verify param: browser; type: refptr_diff
269   DCHECK(browser);
270   if (!browser)
271     return 0;
272   // Verify param: custom_cursor_info; type: struct_byref_const
273   DCHECK(custom_cursor_info);
274   if (!custom_cursor_info)
275     return 0;
276 
277   // Translate param: custom_cursor_info; type: struct_byref_const
278   CefCursorInfo custom_cursor_infoObj;
279   if (custom_cursor_info)
280     custom_cursor_infoObj.Set(*custom_cursor_info, false);
281 
282   // Execute
283   bool _retval = CefDisplayHandlerCppToC::Get(self)->OnCursorChange(
284       CefBrowserCToCpp::Wrap(browser), cursor, type, custom_cursor_infoObj);
285 
286   // Return type: bool
287   return _retval;
288 }
289 
290 }  // namespace
291 
292 // CONSTRUCTOR - Do not edit by hand.
293 
CefDisplayHandlerCppToC()294 CefDisplayHandlerCppToC::CefDisplayHandlerCppToC() {
295   GetStruct()->on_address_change = display_handler_on_address_change;
296   GetStruct()->on_title_change = display_handler_on_title_change;
297   GetStruct()->on_favicon_urlchange = display_handler_on_favicon_urlchange;
298   GetStruct()->on_fullscreen_mode_change =
299       display_handler_on_fullscreen_mode_change;
300   GetStruct()->on_tooltip = display_handler_on_tooltip;
301   GetStruct()->on_status_message = display_handler_on_status_message;
302   GetStruct()->on_console_message = display_handler_on_console_message;
303   GetStruct()->on_auto_resize = display_handler_on_auto_resize;
304   GetStruct()->on_loading_progress_change =
305       display_handler_on_loading_progress_change;
306   GetStruct()->on_cursor_change = display_handler_on_cursor_change;
307 }
308 
309 // DESTRUCTOR - Do not edit by hand.
310 
~CefDisplayHandlerCppToC()311 CefDisplayHandlerCppToC::~CefDisplayHandlerCppToC() {
312   shutdown_checker::AssertNotShutdown();
313 }
314 
315 template <>
316 CefRefPtr<CefDisplayHandler> CefCppToCRefCounted<
317     CefDisplayHandlerCppToC,
318     CefDisplayHandler,
UnwrapDerived(CefWrapperType type,cef_display_handler_t * s)319     cef_display_handler_t>::UnwrapDerived(CefWrapperType type,
320                                           cef_display_handler_t* s) {
321   NOTREACHED() << "Unexpected class type: " << type;
322   return nullptr;
323 }
324 
325 template <>
326 CefWrapperType CefCppToCRefCounted<CefDisplayHandlerCppToC,
327                                    CefDisplayHandler,
328                                    cef_display_handler_t>::kWrapperType =
329     WT_DISPLAY_HANDLER;
330