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