• 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=34a53ca8c93eb3dd0999d9e34d3f86307995e82d$
13 //
14 
15 #include "libcef_dll/ctocpp/request_context_ctocpp.h"
16 #include "libcef_dll/cpptoc/completion_callback_cpptoc.h"
17 #include "libcef_dll/cpptoc/extension_handler_cpptoc.h"
18 #include "libcef_dll/cpptoc/request_context_handler_cpptoc.h"
19 #include "libcef_dll/cpptoc/resolve_callback_cpptoc.h"
20 #include "libcef_dll/cpptoc/scheme_handler_factory_cpptoc.h"
21 #include "libcef_dll/ctocpp/cookie_manager_ctocpp.h"
22 #include "libcef_dll/ctocpp/dictionary_value_ctocpp.h"
23 #include "libcef_dll/ctocpp/extension_ctocpp.h"
24 #include "libcef_dll/ctocpp/media_router_ctocpp.h"
25 #include "libcef_dll/ctocpp/value_ctocpp.h"
26 #include "libcef_dll/transfer_util.h"
27 
28 // STATIC METHODS - Body may be edited by hand.
29 
30 NO_SANITIZE("cfi-icall")
GetGlobalContext()31 CefRefPtr<CefRequestContext> CefRequestContext::GetGlobalContext() {
32   // AUTO-GENERATED CONTENT - DELETE THIS COMMENT BEFORE MODIFYING
33 
34   // Execute
35   cef_request_context_t* _retval = cef_request_context_get_global_context();
36 
37   // Return type: refptr_same
38   return CefRequestContextCToCpp::Wrap(_retval);
39 }
40 
41 NO_SANITIZE("cfi-icall")
CreateContext(const CefRequestContextSettings & settings,CefRefPtr<CefRequestContextHandler> handler)42 CefRefPtr<CefRequestContext> CefRequestContext::CreateContext(
43     const CefRequestContextSettings& settings,
44     CefRefPtr<CefRequestContextHandler> handler) {
45   // AUTO-GENERATED CONTENT - DELETE THIS COMMENT BEFORE MODIFYING
46 
47   // Unverified params: handler
48 
49   // Execute
50   cef_request_context_t* _retval = cef_request_context_create_context(
51       &settings, CefRequestContextHandlerCppToC::Wrap(handler));
52 
53   // Return type: refptr_same
54   return CefRequestContextCToCpp::Wrap(_retval);
55 }
56 
57 NO_SANITIZE("cfi-icall")
CreateContext(CefRefPtr<CefRequestContext> other,CefRefPtr<CefRequestContextHandler> handler)58 CefRefPtr<CefRequestContext> CefRequestContext::CreateContext(
59     CefRefPtr<CefRequestContext> other,
60     CefRefPtr<CefRequestContextHandler> handler) {
61   // AUTO-GENERATED CONTENT - DELETE THIS COMMENT BEFORE MODIFYING
62 
63   // Verify param: other; type: refptr_same
64   DCHECK(other.get());
65   if (!other.get())
66     return nullptr;
67   // Unverified params: handler
68 
69   // Execute
70   cef_request_context_t* _retval =
71       cef_create_context_shared(CefRequestContextCToCpp::Unwrap(other),
72                                 CefRequestContextHandlerCppToC::Wrap(handler));
73 
74   // Return type: refptr_same
75   return CefRequestContextCToCpp::Wrap(_retval);
76 }
77 
78 // VIRTUAL METHODS - Body may be edited by hand.
79 
80 NO_SANITIZE("cfi-icall")
IsSame(CefRefPtr<CefRequestContext> other)81 bool CefRequestContextCToCpp::IsSame(CefRefPtr<CefRequestContext> other) {
82   cef_request_context_t* _struct = GetStruct();
83   if (CEF_MEMBER_MISSING(_struct, is_same))
84     return false;
85 
86   // AUTO-GENERATED CONTENT - DELETE THIS COMMENT BEFORE MODIFYING
87 
88   // Verify param: other; type: refptr_same
89   DCHECK(other.get());
90   if (!other.get())
91     return false;
92 
93   // Execute
94   int _retval =
95       _struct->is_same(_struct, CefRequestContextCToCpp::Unwrap(other));
96 
97   // Return type: bool
98   return _retval ? true : false;
99 }
100 
101 NO_SANITIZE("cfi-icall")
IsSharingWith(CefRefPtr<CefRequestContext> other)102 bool CefRequestContextCToCpp::IsSharingWith(
103     CefRefPtr<CefRequestContext> other) {
104   cef_request_context_t* _struct = GetStruct();
105   if (CEF_MEMBER_MISSING(_struct, is_sharing_with))
106     return false;
107 
108   // AUTO-GENERATED CONTENT - DELETE THIS COMMENT BEFORE MODIFYING
109 
110   // Verify param: other; type: refptr_same
111   DCHECK(other.get());
112   if (!other.get())
113     return false;
114 
115   // Execute
116   int _retval =
117       _struct->is_sharing_with(_struct, CefRequestContextCToCpp::Unwrap(other));
118 
119   // Return type: bool
120   return _retval ? true : false;
121 }
122 
IsGlobal()123 NO_SANITIZE("cfi-icall") bool CefRequestContextCToCpp::IsGlobal() {
124   cef_request_context_t* _struct = GetStruct();
125   if (CEF_MEMBER_MISSING(_struct, is_global))
126     return false;
127 
128   // AUTO-GENERATED CONTENT - DELETE THIS COMMENT BEFORE MODIFYING
129 
130   // Execute
131   int _retval = _struct->is_global(_struct);
132 
133   // Return type: bool
134   return _retval ? true : false;
135 }
136 
137 NO_SANITIZE("cfi-icall")
GetHandler()138 CefRefPtr<CefRequestContextHandler> CefRequestContextCToCpp::GetHandler() {
139   cef_request_context_t* _struct = GetStruct();
140   if (CEF_MEMBER_MISSING(_struct, get_handler))
141     return nullptr;
142 
143   // AUTO-GENERATED CONTENT - DELETE THIS COMMENT BEFORE MODIFYING
144 
145   // Execute
146   cef_request_context_handler_t* _retval = _struct->get_handler(_struct);
147 
148   // Return type: refptr_diff
149   return CefRequestContextHandlerCppToC::Unwrap(_retval);
150 }
151 
GetCachePath()152 NO_SANITIZE("cfi-icall") CefString CefRequestContextCToCpp::GetCachePath() {
153   cef_request_context_t* _struct = GetStruct();
154   if (CEF_MEMBER_MISSING(_struct, get_cache_path))
155     return CefString();
156 
157   // AUTO-GENERATED CONTENT - DELETE THIS COMMENT BEFORE MODIFYING
158 
159   // Execute
160   cef_string_userfree_t _retval = _struct->get_cache_path(_struct);
161 
162   // Return type: string
163   CefString _retvalStr;
164   _retvalStr.AttachToUserFree(_retval);
165   return _retvalStr;
166 }
167 
168 NO_SANITIZE("cfi-icall")
GetCookieManager(CefRefPtr<CefCompletionCallback> callback)169 CefRefPtr<CefCookieManager> CefRequestContextCToCpp::GetCookieManager(
170     CefRefPtr<CefCompletionCallback> callback) {
171   cef_request_context_t* _struct = GetStruct();
172   if (CEF_MEMBER_MISSING(_struct, get_cookie_manager))
173     return nullptr;
174 
175   // AUTO-GENERATED CONTENT - DELETE THIS COMMENT BEFORE MODIFYING
176 
177   // Unverified params: callback
178 
179   // Execute
180   cef_cookie_manager_t* _retval = _struct->get_cookie_manager(
181       _struct, CefCompletionCallbackCppToC::Wrap(callback));
182 
183   // Return type: refptr_same
184   return CefCookieManagerCToCpp::Wrap(_retval);
185 }
186 
187 NO_SANITIZE("cfi-icall")
RegisterSchemeHandlerFactory(const CefString & scheme_name,const CefString & domain_name,CefRefPtr<CefSchemeHandlerFactory> factory)188 bool CefRequestContextCToCpp::RegisterSchemeHandlerFactory(
189     const CefString& scheme_name,
190     const CefString& domain_name,
191     CefRefPtr<CefSchemeHandlerFactory> factory) {
192   cef_request_context_t* _struct = GetStruct();
193   if (CEF_MEMBER_MISSING(_struct, register_scheme_handler_factory))
194     return false;
195 
196   // AUTO-GENERATED CONTENT - DELETE THIS COMMENT BEFORE MODIFYING
197 
198   // Verify param: scheme_name; type: string_byref_const
199   DCHECK(!scheme_name.empty());
200   if (scheme_name.empty())
201     return false;
202   // Unverified params: domain_name, factory
203 
204   // Execute
205   int _retval = _struct->register_scheme_handler_factory(
206       _struct, scheme_name.GetStruct(), domain_name.GetStruct(),
207       CefSchemeHandlerFactoryCppToC::Wrap(factory));
208 
209   // Return type: bool
210   return _retval ? true : false;
211 }
212 
213 NO_SANITIZE("cfi-icall")
ClearSchemeHandlerFactories()214 bool CefRequestContextCToCpp::ClearSchemeHandlerFactories() {
215   cef_request_context_t* _struct = GetStruct();
216   if (CEF_MEMBER_MISSING(_struct, clear_scheme_handler_factories))
217     return false;
218 
219   // AUTO-GENERATED CONTENT - DELETE THIS COMMENT BEFORE MODIFYING
220 
221   // Execute
222   int _retval = _struct->clear_scheme_handler_factories(_struct);
223 
224   // Return type: bool
225   return _retval ? true : false;
226 }
227 
228 NO_SANITIZE("cfi-icall")
HasPreference(const CefString & name)229 bool CefRequestContextCToCpp::HasPreference(const CefString& name) {
230   cef_request_context_t* _struct = GetStruct();
231   if (CEF_MEMBER_MISSING(_struct, has_preference))
232     return false;
233 
234   // AUTO-GENERATED CONTENT - DELETE THIS COMMENT BEFORE MODIFYING
235 
236   // Verify param: name; type: string_byref_const
237   DCHECK(!name.empty());
238   if (name.empty())
239     return false;
240 
241   // Execute
242   int _retval = _struct->has_preference(_struct, name.GetStruct());
243 
244   // Return type: bool
245   return _retval ? true : false;
246 }
247 
248 NO_SANITIZE("cfi-icall")
GetPreference(const CefString & name)249 CefRefPtr<CefValue> CefRequestContextCToCpp::GetPreference(
250     const CefString& name) {
251   cef_request_context_t* _struct = GetStruct();
252   if (CEF_MEMBER_MISSING(_struct, get_preference))
253     return nullptr;
254 
255   // AUTO-GENERATED CONTENT - DELETE THIS COMMENT BEFORE MODIFYING
256 
257   // Verify param: name; type: string_byref_const
258   DCHECK(!name.empty());
259   if (name.empty())
260     return nullptr;
261 
262   // Execute
263   cef_value_t* _retval = _struct->get_preference(_struct, name.GetStruct());
264 
265   // Return type: refptr_same
266   return CefValueCToCpp::Wrap(_retval);
267 }
268 
269 NO_SANITIZE("cfi-icall")
GetAllPreferences(bool include_defaults)270 CefRefPtr<CefDictionaryValue> CefRequestContextCToCpp::GetAllPreferences(
271     bool include_defaults) {
272   cef_request_context_t* _struct = GetStruct();
273   if (CEF_MEMBER_MISSING(_struct, get_all_preferences))
274     return nullptr;
275 
276   // AUTO-GENERATED CONTENT - DELETE THIS COMMENT BEFORE MODIFYING
277 
278   // Execute
279   cef_dictionary_value_t* _retval =
280       _struct->get_all_preferences(_struct, include_defaults);
281 
282   // Return type: refptr_same
283   return CefDictionaryValueCToCpp::Wrap(_retval);
284 }
285 
286 NO_SANITIZE("cfi-icall")
CanSetPreference(const CefString & name)287 bool CefRequestContextCToCpp::CanSetPreference(const CefString& name) {
288   cef_request_context_t* _struct = GetStruct();
289   if (CEF_MEMBER_MISSING(_struct, can_set_preference))
290     return false;
291 
292   // AUTO-GENERATED CONTENT - DELETE THIS COMMENT BEFORE MODIFYING
293 
294   // Verify param: name; type: string_byref_const
295   DCHECK(!name.empty());
296   if (name.empty())
297     return false;
298 
299   // Execute
300   int _retval = _struct->can_set_preference(_struct, name.GetStruct());
301 
302   // Return type: bool
303   return _retval ? true : false;
304 }
305 
306 NO_SANITIZE("cfi-icall")
SetPreference(const CefString & name,CefRefPtr<CefValue> value,CefString & error)307 bool CefRequestContextCToCpp::SetPreference(const CefString& name,
308                                             CefRefPtr<CefValue> value,
309                                             CefString& error) {
310   cef_request_context_t* _struct = GetStruct();
311   if (CEF_MEMBER_MISSING(_struct, set_preference))
312     return false;
313 
314   // AUTO-GENERATED CONTENT - DELETE THIS COMMENT BEFORE MODIFYING
315 
316   // Verify param: name; type: string_byref_const
317   DCHECK(!name.empty());
318   if (name.empty())
319     return false;
320   // Unverified params: value
321 
322   // Execute
323   int _retval = _struct->set_preference(_struct, name.GetStruct(),
324                                         CefValueCToCpp::Unwrap(value),
325                                         error.GetWritableStruct());
326 
327   // Return type: bool
328   return _retval ? true : false;
329 }
330 
331 NO_SANITIZE("cfi-icall")
ClearCertificateExceptions(CefRefPtr<CefCompletionCallback> callback)332 void CefRequestContextCToCpp::ClearCertificateExceptions(
333     CefRefPtr<CefCompletionCallback> callback) {
334   cef_request_context_t* _struct = GetStruct();
335   if (CEF_MEMBER_MISSING(_struct, clear_certificate_exceptions))
336     return;
337 
338   // AUTO-GENERATED CONTENT - DELETE THIS COMMENT BEFORE MODIFYING
339 
340   // Unverified params: callback
341 
342   // Execute
343   _struct->clear_certificate_exceptions(
344       _struct, CefCompletionCallbackCppToC::Wrap(callback));
345 }
346 
347 NO_SANITIZE("cfi-icall")
ClearHttpAuthCredentials(CefRefPtr<CefCompletionCallback> callback)348 void CefRequestContextCToCpp::ClearHttpAuthCredentials(
349     CefRefPtr<CefCompletionCallback> callback) {
350   cef_request_context_t* _struct = GetStruct();
351   if (CEF_MEMBER_MISSING(_struct, clear_http_auth_credentials))
352     return;
353 
354   // AUTO-GENERATED CONTENT - DELETE THIS COMMENT BEFORE MODIFYING
355 
356   // Unverified params: callback
357 
358   // Execute
359   _struct->clear_http_auth_credentials(
360       _struct, CefCompletionCallbackCppToC::Wrap(callback));
361 }
362 
363 NO_SANITIZE("cfi-icall")
CloseAllConnections(CefRefPtr<CefCompletionCallback> callback)364 void CefRequestContextCToCpp::CloseAllConnections(
365     CefRefPtr<CefCompletionCallback> callback) {
366   cef_request_context_t* _struct = GetStruct();
367   if (CEF_MEMBER_MISSING(_struct, close_all_connections))
368     return;
369 
370   // AUTO-GENERATED CONTENT - DELETE THIS COMMENT BEFORE MODIFYING
371 
372   // Unverified params: callback
373 
374   // Execute
375   _struct->close_all_connections(_struct,
376                                  CefCompletionCallbackCppToC::Wrap(callback));
377 }
378 
379 NO_SANITIZE("cfi-icall")
ResolveHost(const CefString & origin,CefRefPtr<CefResolveCallback> callback)380 void CefRequestContextCToCpp::ResolveHost(
381     const CefString& origin,
382     CefRefPtr<CefResolveCallback> callback) {
383   cef_request_context_t* _struct = GetStruct();
384   if (CEF_MEMBER_MISSING(_struct, resolve_host))
385     return;
386 
387   // AUTO-GENERATED CONTENT - DELETE THIS COMMENT BEFORE MODIFYING
388 
389   // Verify param: origin; type: string_byref_const
390   DCHECK(!origin.empty());
391   if (origin.empty())
392     return;
393   // Verify param: callback; type: refptr_diff
394   DCHECK(callback.get());
395   if (!callback.get())
396     return;
397 
398   // Execute
399   _struct->resolve_host(_struct, origin.GetStruct(),
400                         CefResolveCallbackCppToC::Wrap(callback));
401 }
402 
403 NO_SANITIZE("cfi-icall")
LoadExtension(const CefString & root_directory,CefRefPtr<CefDictionaryValue> manifest,CefRefPtr<CefExtensionHandler> handler)404 void CefRequestContextCToCpp::LoadExtension(
405     const CefString& root_directory,
406     CefRefPtr<CefDictionaryValue> manifest,
407     CefRefPtr<CefExtensionHandler> handler) {
408   cef_request_context_t* _struct = GetStruct();
409   if (CEF_MEMBER_MISSING(_struct, load_extension))
410     return;
411 
412   // AUTO-GENERATED CONTENT - DELETE THIS COMMENT BEFORE MODIFYING
413 
414   // Verify param: root_directory; type: string_byref_const
415   DCHECK(!root_directory.empty());
416   if (root_directory.empty())
417     return;
418   // Unverified params: manifest, handler
419 
420   // Execute
421   _struct->load_extension(_struct, root_directory.GetStruct(),
422                           CefDictionaryValueCToCpp::Unwrap(manifest),
423                           CefExtensionHandlerCppToC::Wrap(handler));
424 }
425 
426 NO_SANITIZE("cfi-icall")
DidLoadExtension(const CefString & extension_id)427 bool CefRequestContextCToCpp::DidLoadExtension(const CefString& extension_id) {
428   cef_request_context_t* _struct = GetStruct();
429   if (CEF_MEMBER_MISSING(_struct, did_load_extension))
430     return false;
431 
432   // AUTO-GENERATED CONTENT - DELETE THIS COMMENT BEFORE MODIFYING
433 
434   // Verify param: extension_id; type: string_byref_const
435   DCHECK(!extension_id.empty());
436   if (extension_id.empty())
437     return false;
438 
439   // Execute
440   int _retval = _struct->did_load_extension(_struct, extension_id.GetStruct());
441 
442   // Return type: bool
443   return _retval ? true : false;
444 }
445 
446 NO_SANITIZE("cfi-icall")
HasExtension(const CefString & extension_id)447 bool CefRequestContextCToCpp::HasExtension(const CefString& extension_id) {
448   cef_request_context_t* _struct = GetStruct();
449   if (CEF_MEMBER_MISSING(_struct, has_extension))
450     return false;
451 
452   // AUTO-GENERATED CONTENT - DELETE THIS COMMENT BEFORE MODIFYING
453 
454   // Verify param: extension_id; type: string_byref_const
455   DCHECK(!extension_id.empty());
456   if (extension_id.empty())
457     return false;
458 
459   // Execute
460   int _retval = _struct->has_extension(_struct, extension_id.GetStruct());
461 
462   // Return type: bool
463   return _retval ? true : false;
464 }
465 
466 NO_SANITIZE("cfi-icall")
GetExtensions(std::vector<CefString> & extension_ids)467 bool CefRequestContextCToCpp::GetExtensions(
468     std::vector<CefString>& extension_ids) {
469   cef_request_context_t* _struct = GetStruct();
470   if (CEF_MEMBER_MISSING(_struct, get_extensions))
471     return false;
472 
473   // AUTO-GENERATED CONTENT - DELETE THIS COMMENT BEFORE MODIFYING
474 
475   // Translate param: extension_ids; type: string_vec_byref
476   cef_string_list_t extension_idsList = cef_string_list_alloc();
477   DCHECK(extension_idsList);
478   if (extension_idsList)
479     transfer_string_list_contents(extension_ids, extension_idsList);
480 
481   // Execute
482   int _retval = _struct->get_extensions(_struct, extension_idsList);
483 
484   // Restore param:extension_ids; type: string_vec_byref
485   if (extension_idsList) {
486     extension_ids.clear();
487     transfer_string_list_contents(extension_idsList, extension_ids);
488     cef_string_list_free(extension_idsList);
489   }
490 
491   // Return type: bool
492   return _retval ? true : false;
493 }
494 
495 NO_SANITIZE("cfi-icall")
GetExtension(const CefString & extension_id)496 CefRefPtr<CefExtension> CefRequestContextCToCpp::GetExtension(
497     const CefString& extension_id) {
498   cef_request_context_t* _struct = GetStruct();
499   if (CEF_MEMBER_MISSING(_struct, get_extension))
500     return nullptr;
501 
502   // AUTO-GENERATED CONTENT - DELETE THIS COMMENT BEFORE MODIFYING
503 
504   // Verify param: extension_id; type: string_byref_const
505   DCHECK(!extension_id.empty());
506   if (extension_id.empty())
507     return nullptr;
508 
509   // Execute
510   cef_extension_t* _retval =
511       _struct->get_extension(_struct, extension_id.GetStruct());
512 
513   // Return type: refptr_same
514   return CefExtensionCToCpp::Wrap(_retval);
515 }
516 
517 NO_SANITIZE("cfi-icall")
GetMediaRouter(CefRefPtr<CefCompletionCallback> callback)518 CefRefPtr<CefMediaRouter> CefRequestContextCToCpp::GetMediaRouter(
519     CefRefPtr<CefCompletionCallback> callback) {
520   cef_request_context_t* _struct = GetStruct();
521   if (CEF_MEMBER_MISSING(_struct, get_media_router))
522     return nullptr;
523 
524   // AUTO-GENERATED CONTENT - DELETE THIS COMMENT BEFORE MODIFYING
525 
526   // Unverified params: callback
527 
528   // Execute
529   cef_media_router_t* _retval = _struct->get_media_router(
530       _struct, CefCompletionCallbackCppToC::Wrap(callback));
531 
532   // Return type: refptr_same
533   return CefMediaRouterCToCpp::Wrap(_retval);
534 }
535 
536 // CONSTRUCTOR - Do not edit by hand.
537 
CefRequestContextCToCpp()538 CefRequestContextCToCpp::CefRequestContextCToCpp() {}
539 
540 // DESTRUCTOR - Do not edit by hand.
541 
~CefRequestContextCToCpp()542 CefRequestContextCToCpp::~CefRequestContextCToCpp() {}
543 
544 template <>
545 cef_request_context_t* CefCToCppRefCounted<
546     CefRequestContextCToCpp,
547     CefRequestContext,
UnwrapDerived(CefWrapperType type,CefRequestContext * c)548     cef_request_context_t>::UnwrapDerived(CefWrapperType type,
549                                           CefRequestContext* c) {
550   NOTREACHED() << "Unexpected class type: " << type;
551   return nullptr;
552 }
553 
554 template <>
555 CefWrapperType CefCToCppRefCounted<CefRequestContextCToCpp,
556                                    CefRequestContext,
557                                    cef_request_context_t>::kWrapperType =
558     WT_REQUEST_CONTEXT;
559