• 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=074dadfb1f84663a3efd6e8532257236b3c0634f$
13 //
14 
15 #include "libcef_dll/cpptoc/browser_cpptoc.h"
16 #include <algorithm>
17 #include "libcef_dll/cpptoc/browser_host_cpptoc.h"
18 #include "libcef_dll/cpptoc/frame_cpptoc.h"
19 #include "libcef_dll/shutdown_checker.h"
20 #include "libcef_dll/transfer_util.h"
21 
22 namespace {
23 
24 // MEMBER FUNCTIONS - Body may be edited by hand.
25 
browser_is_valid(struct _cef_browser_t * self)26 int CEF_CALLBACK browser_is_valid(struct _cef_browser_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 0;
34 
35   // Execute
36   bool _retval = CefBrowserCppToC::Get(self)->IsValid();
37 
38   // Return type: bool
39   return _retval;
40 }
41 
42 struct _cef_browser_host_t* CEF_CALLBACK
browser_get_host(struct _cef_browser_t * self)43 browser_get_host(struct _cef_browser_t* self) {
44   shutdown_checker::AssertNotShutdown();
45 
46   // AUTO-GENERATED CONTENT - DELETE THIS COMMENT BEFORE MODIFYING
47 
48   DCHECK(self);
49   if (!self)
50     return NULL;
51 
52   // Execute
53   CefRefPtr<CefBrowserHost> _retval = CefBrowserCppToC::Get(self)->GetHost();
54 
55   // Return type: refptr_same
56   return CefBrowserHostCppToC::Wrap(_retval);
57 }
58 
browser_can_go_back(struct _cef_browser_t * self)59 int CEF_CALLBACK browser_can_go_back(struct _cef_browser_t* self) {
60   shutdown_checker::AssertNotShutdown();
61 
62   // AUTO-GENERATED CONTENT - DELETE THIS COMMENT BEFORE MODIFYING
63 
64   DCHECK(self);
65   if (!self)
66     return 0;
67 
68   // Execute
69   bool _retval = CefBrowserCppToC::Get(self)->CanGoBack();
70 
71   // Return type: bool
72   return _retval;
73 }
74 
browser_go_back(struct _cef_browser_t * self)75 void CEF_CALLBACK browser_go_back(struct _cef_browser_t* self) {
76   shutdown_checker::AssertNotShutdown();
77 
78   // AUTO-GENERATED CONTENT - DELETE THIS COMMENT BEFORE MODIFYING
79 
80   DCHECK(self);
81   if (!self)
82     return;
83 
84   // Execute
85   CefBrowserCppToC::Get(self)->GoBack();
86 }
87 
browser_can_go_forward(struct _cef_browser_t * self)88 int CEF_CALLBACK browser_can_go_forward(struct _cef_browser_t* self) {
89   shutdown_checker::AssertNotShutdown();
90 
91   // AUTO-GENERATED CONTENT - DELETE THIS COMMENT BEFORE MODIFYING
92 
93   DCHECK(self);
94   if (!self)
95     return 0;
96 
97   // Execute
98   bool _retval = CefBrowserCppToC::Get(self)->CanGoForward();
99 
100   // Return type: bool
101   return _retval;
102 }
103 
browser_go_forward(struct _cef_browser_t * self)104 void CEF_CALLBACK browser_go_forward(struct _cef_browser_t* self) {
105   shutdown_checker::AssertNotShutdown();
106 
107   // AUTO-GENERATED CONTENT - DELETE THIS COMMENT BEFORE MODIFYING
108 
109   DCHECK(self);
110   if (!self)
111     return;
112 
113   // Execute
114   CefBrowserCppToC::Get(self)->GoForward();
115 }
116 
browser_is_loading(struct _cef_browser_t * self)117 int CEF_CALLBACK browser_is_loading(struct _cef_browser_t* self) {
118   shutdown_checker::AssertNotShutdown();
119 
120   // AUTO-GENERATED CONTENT - DELETE THIS COMMENT BEFORE MODIFYING
121 
122   DCHECK(self);
123   if (!self)
124     return 0;
125 
126   // Execute
127   bool _retval = CefBrowserCppToC::Get(self)->IsLoading();
128 
129   // Return type: bool
130   return _retval;
131 }
132 
browser_reload(struct _cef_browser_t * self)133 void CEF_CALLBACK browser_reload(struct _cef_browser_t* self) {
134   shutdown_checker::AssertNotShutdown();
135 
136   // AUTO-GENERATED CONTENT - DELETE THIS COMMENT BEFORE MODIFYING
137 
138   DCHECK(self);
139   if (!self)
140     return;
141 
142   // Execute
143   CefBrowserCppToC::Get(self)->Reload();
144 }
145 
browser_reload_ignore_cache(struct _cef_browser_t * self)146 void CEF_CALLBACK browser_reload_ignore_cache(struct _cef_browser_t* self) {
147   shutdown_checker::AssertNotShutdown();
148 
149   // AUTO-GENERATED CONTENT - DELETE THIS COMMENT BEFORE MODIFYING
150 
151   DCHECK(self);
152   if (!self)
153     return;
154 
155   // Execute
156   CefBrowserCppToC::Get(self)->ReloadIgnoreCache();
157 }
158 
browser_stop_load(struct _cef_browser_t * self)159 void CEF_CALLBACK browser_stop_load(struct _cef_browser_t* self) {
160   shutdown_checker::AssertNotShutdown();
161 
162   // AUTO-GENERATED CONTENT - DELETE THIS COMMENT BEFORE MODIFYING
163 
164   DCHECK(self);
165   if (!self)
166     return;
167 
168   // Execute
169   CefBrowserCppToC::Get(self)->StopLoad();
170 }
171 
browser_get_identifier(struct _cef_browser_t * self)172 int CEF_CALLBACK browser_get_identifier(struct _cef_browser_t* self) {
173   shutdown_checker::AssertNotShutdown();
174 
175   // AUTO-GENERATED CONTENT - DELETE THIS COMMENT BEFORE MODIFYING
176 
177   DCHECK(self);
178   if (!self)
179     return 0;
180 
181   // Execute
182   int _retval = CefBrowserCppToC::Get(self)->GetIdentifier();
183 
184   // Return type: simple
185   return _retval;
186 }
187 
browser_is_same(struct _cef_browser_t * self,struct _cef_browser_t * that)188 int CEF_CALLBACK browser_is_same(struct _cef_browser_t* self,
189                                  struct _cef_browser_t* that) {
190   shutdown_checker::AssertNotShutdown();
191 
192   // AUTO-GENERATED CONTENT - DELETE THIS COMMENT BEFORE MODIFYING
193 
194   DCHECK(self);
195   if (!self)
196     return 0;
197   // Verify param: that; type: refptr_same
198   DCHECK(that);
199   if (!that)
200     return 0;
201 
202   // Execute
203   bool _retval =
204       CefBrowserCppToC::Get(self)->IsSame(CefBrowserCppToC::Unwrap(that));
205 
206   // Return type: bool
207   return _retval;
208 }
209 
browser_is_popup(struct _cef_browser_t * self)210 int CEF_CALLBACK browser_is_popup(struct _cef_browser_t* self) {
211   shutdown_checker::AssertNotShutdown();
212 
213   // AUTO-GENERATED CONTENT - DELETE THIS COMMENT BEFORE MODIFYING
214 
215   DCHECK(self);
216   if (!self)
217     return 0;
218 
219   // Execute
220   bool _retval = CefBrowserCppToC::Get(self)->IsPopup();
221 
222   // Return type: bool
223   return _retval;
224 }
225 
browser_has_document(struct _cef_browser_t * self)226 int CEF_CALLBACK browser_has_document(struct _cef_browser_t* self) {
227   shutdown_checker::AssertNotShutdown();
228 
229   // AUTO-GENERATED CONTENT - DELETE THIS COMMENT BEFORE MODIFYING
230 
231   DCHECK(self);
232   if (!self)
233     return 0;
234 
235   // Execute
236   bool _retval = CefBrowserCppToC::Get(self)->HasDocument();
237 
238   // Return type: bool
239   return _retval;
240 }
241 
242 struct _cef_frame_t* CEF_CALLBACK
browser_get_main_frame(struct _cef_browser_t * self)243 browser_get_main_frame(struct _cef_browser_t* self) {
244   shutdown_checker::AssertNotShutdown();
245 
246   // AUTO-GENERATED CONTENT - DELETE THIS COMMENT BEFORE MODIFYING
247 
248   DCHECK(self);
249   if (!self)
250     return NULL;
251 
252   // Execute
253   CefRefPtr<CefFrame> _retval = CefBrowserCppToC::Get(self)->GetMainFrame();
254 
255   // Return type: refptr_same
256   return CefFrameCppToC::Wrap(_retval);
257 }
258 
259 struct _cef_frame_t* CEF_CALLBACK
browser_get_focused_frame(struct _cef_browser_t * self)260 browser_get_focused_frame(struct _cef_browser_t* self) {
261   shutdown_checker::AssertNotShutdown();
262 
263   // AUTO-GENERATED CONTENT - DELETE THIS COMMENT BEFORE MODIFYING
264 
265   DCHECK(self);
266   if (!self)
267     return NULL;
268 
269   // Execute
270   CefRefPtr<CefFrame> _retval = CefBrowserCppToC::Get(self)->GetFocusedFrame();
271 
272   // Return type: refptr_same
273   return CefFrameCppToC::Wrap(_retval);
274 }
275 
276 struct _cef_frame_t* CEF_CALLBACK
browser_get_frame_byident(struct _cef_browser_t * self,int64 identifier)277 browser_get_frame_byident(struct _cef_browser_t* self, int64 identifier) {
278   shutdown_checker::AssertNotShutdown();
279 
280   // AUTO-GENERATED CONTENT - DELETE THIS COMMENT BEFORE MODIFYING
281 
282   DCHECK(self);
283   if (!self)
284     return NULL;
285 
286   // Execute
287   CefRefPtr<CefFrame> _retval =
288       CefBrowserCppToC::Get(self)->GetFrame(identifier);
289 
290   // Return type: refptr_same
291   return CefFrameCppToC::Wrap(_retval);
292 }
293 
browser_get_frame(struct _cef_browser_t * self,const cef_string_t * name)294 struct _cef_frame_t* CEF_CALLBACK browser_get_frame(struct _cef_browser_t* self,
295                                                     const cef_string_t* name) {
296   shutdown_checker::AssertNotShutdown();
297 
298   // AUTO-GENERATED CONTENT - DELETE THIS COMMENT BEFORE MODIFYING
299 
300   DCHECK(self);
301   if (!self)
302     return NULL;
303   // Unverified params: name
304 
305   // Execute
306   CefRefPtr<CefFrame> _retval =
307       CefBrowserCppToC::Get(self)->GetFrame(CefString(name));
308 
309   // Return type: refptr_same
310   return CefFrameCppToC::Wrap(_retval);
311 }
312 
browser_get_frame_count(struct _cef_browser_t * self)313 size_t CEF_CALLBACK browser_get_frame_count(struct _cef_browser_t* self) {
314   shutdown_checker::AssertNotShutdown();
315 
316   // AUTO-GENERATED CONTENT - DELETE THIS COMMENT BEFORE MODIFYING
317 
318   DCHECK(self);
319   if (!self)
320     return 0;
321 
322   // Execute
323   size_t _retval = CefBrowserCppToC::Get(self)->GetFrameCount();
324 
325   // Return type: simple
326   return _retval;
327 }
328 
browser_get_frame_identifiers(struct _cef_browser_t * self,size_t * identifiersCount,int64 * identifiers)329 void CEF_CALLBACK browser_get_frame_identifiers(struct _cef_browser_t* self,
330                                                 size_t* identifiersCount,
331                                                 int64* identifiers) {
332   shutdown_checker::AssertNotShutdown();
333 
334   // AUTO-GENERATED CONTENT - DELETE THIS COMMENT BEFORE MODIFYING
335 
336   DCHECK(self);
337   if (!self)
338     return;
339   // Verify param: identifiers; type: simple_vec_byref
340   DCHECK(identifiersCount && (*identifiersCount == 0 || identifiers));
341   if (!identifiersCount || (*identifiersCount > 0 && !identifiers))
342     return;
343 
344   // Translate param: identifiers; type: simple_vec_byref
345   std::vector<int64> identifiersList;
346   if (identifiersCount && *identifiersCount > 0 && identifiers) {
347     for (size_t i = 0; i < *identifiersCount; ++i) {
348       identifiersList.push_back(identifiers[i]);
349     }
350   }
351 
352   // Execute
353   CefBrowserCppToC::Get(self)->GetFrameIdentifiers(identifiersList);
354 
355   // Restore param: identifiers; type: simple_vec_byref
356   if (identifiersCount && identifiers) {
357     *identifiersCount = std::min(identifiersList.size(), *identifiersCount);
358     if (*identifiersCount > 0) {
359       for (size_t i = 0; i < *identifiersCount; ++i) {
360         identifiers[i] = identifiersList[i];
361       }
362     }
363   }
364 }
365 
browser_get_frame_names(struct _cef_browser_t * self,cef_string_list_t names)366 void CEF_CALLBACK browser_get_frame_names(struct _cef_browser_t* self,
367                                           cef_string_list_t names) {
368   shutdown_checker::AssertNotShutdown();
369 
370   // AUTO-GENERATED CONTENT - DELETE THIS COMMENT BEFORE MODIFYING
371 
372   DCHECK(self);
373   if (!self)
374     return;
375   // Verify param: names; type: string_vec_byref
376   DCHECK(names);
377   if (!names)
378     return;
379 
380   // Translate param: names; type: string_vec_byref
381   std::vector<CefString> namesList;
382   transfer_string_list_contents(names, namesList);
383 
384   // Execute
385   CefBrowserCppToC::Get(self)->GetFrameNames(namesList);
386 
387   // Restore param: names; type: string_vec_byref
388   cef_string_list_clear(names);
389   transfer_string_list_contents(namesList, names);
390 }
391 
392 }  // namespace
393 
394 // CONSTRUCTOR - Do not edit by hand.
395 
CefBrowserCppToC()396 CefBrowserCppToC::CefBrowserCppToC() {
397   GetStruct()->is_valid = browser_is_valid;
398   GetStruct()->get_host = browser_get_host;
399   GetStruct()->can_go_back = browser_can_go_back;
400   GetStruct()->go_back = browser_go_back;
401   GetStruct()->can_go_forward = browser_can_go_forward;
402   GetStruct()->go_forward = browser_go_forward;
403   GetStruct()->is_loading = browser_is_loading;
404   GetStruct()->reload = browser_reload;
405   GetStruct()->reload_ignore_cache = browser_reload_ignore_cache;
406   GetStruct()->stop_load = browser_stop_load;
407   GetStruct()->get_identifier = browser_get_identifier;
408   GetStruct()->is_same = browser_is_same;
409   GetStruct()->is_popup = browser_is_popup;
410   GetStruct()->has_document = browser_has_document;
411   GetStruct()->get_main_frame = browser_get_main_frame;
412   GetStruct()->get_focused_frame = browser_get_focused_frame;
413   GetStruct()->get_frame_byident = browser_get_frame_byident;
414   GetStruct()->get_frame = browser_get_frame;
415   GetStruct()->get_frame_count = browser_get_frame_count;
416   GetStruct()->get_frame_identifiers = browser_get_frame_identifiers;
417   GetStruct()->get_frame_names = browser_get_frame_names;
418 }
419 
420 // DESTRUCTOR - Do not edit by hand.
421 
~CefBrowserCppToC()422 CefBrowserCppToC::~CefBrowserCppToC() {
423   shutdown_checker::AssertNotShutdown();
424 }
425 
426 template <>
427 CefRefPtr<CefBrowser>
UnwrapDerived(CefWrapperType type,cef_browser_t * s)428 CefCppToCRefCounted<CefBrowserCppToC, CefBrowser, cef_browser_t>::UnwrapDerived(
429     CefWrapperType type,
430     cef_browser_t* s) {
431   NOTREACHED() << "Unexpected class type: " << type;
432   return nullptr;
433 }
434 
435 template <>
436 CefWrapperType CefCppToCRefCounted<CefBrowserCppToC,
437                                    CefBrowser,
438                                    cef_browser_t>::kWrapperType = WT_BROWSER;
439