1 // Copyright (c) 2021 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=38ae668703b71d27d2bcd7cd9230817edd5b8f41$
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 void CEF_CALLBACK
request_context_purge_plugin_list_cache(struct _cef_request_context_t * self,int reload_pages)237 request_context_purge_plugin_list_cache(struct _cef_request_context_t* self,
238 int reload_pages) {
239 // AUTO-GENERATED CONTENT - DELETE THIS COMMENT BEFORE MODIFYING
240
241 DCHECK(self);
242 if (!self)
243 return;
244
245 // Execute
246 CefRequestContextCppToC::Get(self)->PurgePluginListCache(
247 reload_pages ? true : false);
248 }
249
250 int CEF_CALLBACK
request_context_has_preference(struct _cef_request_context_t * self,const cef_string_t * name)251 request_context_has_preference(struct _cef_request_context_t* self,
252 const cef_string_t* name) {
253 // AUTO-GENERATED CONTENT - DELETE THIS COMMENT BEFORE MODIFYING
254
255 DCHECK(self);
256 if (!self)
257 return 0;
258 // Verify param: name; type: string_byref_const
259 DCHECK(name);
260 if (!name)
261 return 0;
262
263 // Execute
264 bool _retval =
265 CefRequestContextCppToC::Get(self)->HasPreference(CefString(name));
266
267 // Return type: bool
268 return _retval;
269 }
270
271 struct _cef_value_t* CEF_CALLBACK
request_context_get_preference(struct _cef_request_context_t * self,const cef_string_t * name)272 request_context_get_preference(struct _cef_request_context_t* self,
273 const cef_string_t* name) {
274 // AUTO-GENERATED CONTENT - DELETE THIS COMMENT BEFORE MODIFYING
275
276 DCHECK(self);
277 if (!self)
278 return NULL;
279 // Verify param: name; type: string_byref_const
280 DCHECK(name);
281 if (!name)
282 return NULL;
283
284 // Execute
285 CefRefPtr<CefValue> _retval =
286 CefRequestContextCppToC::Get(self)->GetPreference(CefString(name));
287
288 // Return type: refptr_same
289 return CefValueCppToC::Wrap(_retval);
290 }
291
292 struct _cef_dictionary_value_t* CEF_CALLBACK
request_context_get_all_preferences(struct _cef_request_context_t * self,int include_defaults)293 request_context_get_all_preferences(struct _cef_request_context_t* self,
294 int include_defaults) {
295 // AUTO-GENERATED CONTENT - DELETE THIS COMMENT BEFORE MODIFYING
296
297 DCHECK(self);
298 if (!self)
299 return NULL;
300
301 // Execute
302 CefRefPtr<CefDictionaryValue> _retval =
303 CefRequestContextCppToC::Get(self)->GetAllPreferences(
304 include_defaults ? true : false);
305
306 // Return type: refptr_same
307 return CefDictionaryValueCppToC::Wrap(_retval);
308 }
309
310 int CEF_CALLBACK
request_context_can_set_preference(struct _cef_request_context_t * self,const cef_string_t * name)311 request_context_can_set_preference(struct _cef_request_context_t* self,
312 const cef_string_t* name) {
313 // AUTO-GENERATED CONTENT - DELETE THIS COMMENT BEFORE MODIFYING
314
315 DCHECK(self);
316 if (!self)
317 return 0;
318 // Verify param: name; type: string_byref_const
319 DCHECK(name);
320 if (!name)
321 return 0;
322
323 // Execute
324 bool _retval =
325 CefRequestContextCppToC::Get(self)->CanSetPreference(CefString(name));
326
327 // Return type: bool
328 return _retval;
329 }
330
331 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)332 request_context_set_preference(struct _cef_request_context_t* self,
333 const cef_string_t* name,
334 struct _cef_value_t* value,
335 cef_string_t* error) {
336 // AUTO-GENERATED CONTENT - DELETE THIS COMMENT BEFORE MODIFYING
337
338 DCHECK(self);
339 if (!self)
340 return 0;
341 // Verify param: name; type: string_byref_const
342 DCHECK(name);
343 if (!name)
344 return 0;
345 // Verify param: error; type: string_byref
346 DCHECK(error);
347 if (!error)
348 return 0;
349 // Unverified params: value
350
351 // Translate param: error; type: string_byref
352 CefString errorStr(error);
353
354 // Execute
355 bool _retval = CefRequestContextCppToC::Get(self)->SetPreference(
356 CefString(name), CefValueCppToC::Unwrap(value), errorStr);
357
358 // Return type: bool
359 return _retval;
360 }
361
request_context_clear_certificate_exceptions(struct _cef_request_context_t * self,cef_completion_callback_t * callback)362 void CEF_CALLBACK request_context_clear_certificate_exceptions(
363 struct _cef_request_context_t* self,
364 cef_completion_callback_t* callback) {
365 // AUTO-GENERATED CONTENT - DELETE THIS COMMENT BEFORE MODIFYING
366
367 DCHECK(self);
368 if (!self)
369 return;
370 // Unverified params: callback
371
372 // Execute
373 CefRequestContextCppToC::Get(self)->ClearCertificateExceptions(
374 CefCompletionCallbackCToCpp::Wrap(callback));
375 }
376
request_context_clear_http_auth_credentials(struct _cef_request_context_t * self,cef_completion_callback_t * callback)377 void CEF_CALLBACK request_context_clear_http_auth_credentials(
378 struct _cef_request_context_t* self,
379 cef_completion_callback_t* callback) {
380 // AUTO-GENERATED CONTENT - DELETE THIS COMMENT BEFORE MODIFYING
381
382 DCHECK(self);
383 if (!self)
384 return;
385 // Unverified params: callback
386
387 // Execute
388 CefRequestContextCppToC::Get(self)->ClearHttpAuthCredentials(
389 CefCompletionCallbackCToCpp::Wrap(callback));
390 }
391
392 void CEF_CALLBACK
request_context_close_all_connections(struct _cef_request_context_t * self,cef_completion_callback_t * callback)393 request_context_close_all_connections(struct _cef_request_context_t* self,
394 cef_completion_callback_t* callback) {
395 // AUTO-GENERATED CONTENT - DELETE THIS COMMENT BEFORE MODIFYING
396
397 DCHECK(self);
398 if (!self)
399 return;
400 // Unverified params: callback
401
402 // Execute
403 CefRequestContextCppToC::Get(self)->CloseAllConnections(
404 CefCompletionCallbackCToCpp::Wrap(callback));
405 }
406
407 void CEF_CALLBACK
request_context_resolve_host(struct _cef_request_context_t * self,const cef_string_t * origin,cef_resolve_callback_t * callback)408 request_context_resolve_host(struct _cef_request_context_t* self,
409 const cef_string_t* origin,
410 cef_resolve_callback_t* callback) {
411 // AUTO-GENERATED CONTENT - DELETE THIS COMMENT BEFORE MODIFYING
412
413 DCHECK(self);
414 if (!self)
415 return;
416 // Verify param: origin; type: string_byref_const
417 DCHECK(origin);
418 if (!origin)
419 return;
420 // Verify param: callback; type: refptr_diff
421 DCHECK(callback);
422 if (!callback)
423 return;
424
425 // Execute
426 CefRequestContextCppToC::Get(self)->ResolveHost(
427 CefString(origin), CefResolveCallbackCToCpp::Wrap(callback));
428 }
429
430 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)431 request_context_load_extension(struct _cef_request_context_t* self,
432 const cef_string_t* root_directory,
433 struct _cef_dictionary_value_t* manifest,
434 cef_extension_handler_t* handler) {
435 // AUTO-GENERATED CONTENT - DELETE THIS COMMENT BEFORE MODIFYING
436
437 DCHECK(self);
438 if (!self)
439 return;
440 // Verify param: root_directory; type: string_byref_const
441 DCHECK(root_directory);
442 if (!root_directory)
443 return;
444 // Unverified params: manifest, handler
445
446 // Execute
447 CefRequestContextCppToC::Get(self)->LoadExtension(
448 CefString(root_directory), CefDictionaryValueCppToC::Unwrap(manifest),
449 CefExtensionHandlerCToCpp::Wrap(handler));
450 }
451
452 int CEF_CALLBACK
request_context_did_load_extension(struct _cef_request_context_t * self,const cef_string_t * extension_id)453 request_context_did_load_extension(struct _cef_request_context_t* self,
454 const cef_string_t* extension_id) {
455 // AUTO-GENERATED CONTENT - DELETE THIS COMMENT BEFORE MODIFYING
456
457 DCHECK(self);
458 if (!self)
459 return 0;
460 // Verify param: extension_id; type: string_byref_const
461 DCHECK(extension_id);
462 if (!extension_id)
463 return 0;
464
465 // Execute
466 bool _retval = CefRequestContextCppToC::Get(self)->DidLoadExtension(
467 CefString(extension_id));
468
469 // Return type: bool
470 return _retval;
471 }
472
473 int CEF_CALLBACK
request_context_has_extension(struct _cef_request_context_t * self,const cef_string_t * extension_id)474 request_context_has_extension(struct _cef_request_context_t* self,
475 const cef_string_t* extension_id) {
476 // AUTO-GENERATED CONTENT - DELETE THIS COMMENT BEFORE MODIFYING
477
478 DCHECK(self);
479 if (!self)
480 return 0;
481 // Verify param: extension_id; type: string_byref_const
482 DCHECK(extension_id);
483 if (!extension_id)
484 return 0;
485
486 // Execute
487 bool _retval =
488 CefRequestContextCppToC::Get(self)->HasExtension(CefString(extension_id));
489
490 // Return type: bool
491 return _retval;
492 }
493
494 int CEF_CALLBACK
request_context_get_extensions(struct _cef_request_context_t * self,cef_string_list_t extension_ids)495 request_context_get_extensions(struct _cef_request_context_t* self,
496 cef_string_list_t extension_ids) {
497 // AUTO-GENERATED CONTENT - DELETE THIS COMMENT BEFORE MODIFYING
498
499 DCHECK(self);
500 if (!self)
501 return 0;
502 // Verify param: extension_ids; type: string_vec_byref
503 DCHECK(extension_ids);
504 if (!extension_ids)
505 return 0;
506
507 // Translate param: extension_ids; type: string_vec_byref
508 std::vector<CefString> extension_idsList;
509 transfer_string_list_contents(extension_ids, extension_idsList);
510
511 // Execute
512 bool _retval =
513 CefRequestContextCppToC::Get(self)->GetExtensions(extension_idsList);
514
515 // Restore param: extension_ids; type: string_vec_byref
516 cef_string_list_clear(extension_ids);
517 transfer_string_list_contents(extension_idsList, extension_ids);
518
519 // Return type: bool
520 return _retval;
521 }
522
523 cef_extension_t* CEF_CALLBACK
request_context_get_extension(struct _cef_request_context_t * self,const cef_string_t * extension_id)524 request_context_get_extension(struct _cef_request_context_t* self,
525 const cef_string_t* extension_id) {
526 // AUTO-GENERATED CONTENT - DELETE THIS COMMENT BEFORE MODIFYING
527
528 DCHECK(self);
529 if (!self)
530 return NULL;
531 // Verify param: extension_id; type: string_byref_const
532 DCHECK(extension_id);
533 if (!extension_id)
534 return NULL;
535
536 // Execute
537 CefRefPtr<CefExtension> _retval =
538 CefRequestContextCppToC::Get(self)->GetExtension(CefString(extension_id));
539
540 // Return type: refptr_same
541 return CefExtensionCppToC::Wrap(_retval);
542 }
543
544 cef_media_router_t* CEF_CALLBACK
request_context_get_media_router(struct _cef_request_context_t * self,cef_completion_callback_t * callback)545 request_context_get_media_router(struct _cef_request_context_t* self,
546 cef_completion_callback_t* callback) {
547 // AUTO-GENERATED CONTENT - DELETE THIS COMMENT BEFORE MODIFYING
548
549 DCHECK(self);
550 if (!self)
551 return NULL;
552 // Unverified params: callback
553
554 // Execute
555 CefRefPtr<CefMediaRouter> _retval =
556 CefRequestContextCppToC::Get(self)->GetMediaRouter(
557 CefCompletionCallbackCToCpp::Wrap(callback));
558
559 // Return type: refptr_same
560 return CefMediaRouterCppToC::Wrap(_retval);
561 }
562
563 } // namespace
564
565 // CONSTRUCTOR - Do not edit by hand.
566
CefRequestContextCppToC()567 CefRequestContextCppToC::CefRequestContextCppToC() {
568 GetStruct()->is_same = request_context_is_same;
569 GetStruct()->is_sharing_with = request_context_is_sharing_with;
570 GetStruct()->is_global = request_context_is_global;
571 GetStruct()->get_handler = request_context_get_handler;
572 GetStruct()->get_cache_path = request_context_get_cache_path;
573 GetStruct()->get_cookie_manager = request_context_get_cookie_manager;
574 GetStruct()->register_scheme_handler_factory =
575 request_context_register_scheme_handler_factory;
576 GetStruct()->clear_scheme_handler_factories =
577 request_context_clear_scheme_handler_factories;
578 GetStruct()->purge_plugin_list_cache =
579 request_context_purge_plugin_list_cache;
580 GetStruct()->has_preference = request_context_has_preference;
581 GetStruct()->get_preference = request_context_get_preference;
582 GetStruct()->get_all_preferences = request_context_get_all_preferences;
583 GetStruct()->can_set_preference = request_context_can_set_preference;
584 GetStruct()->set_preference = request_context_set_preference;
585 GetStruct()->clear_certificate_exceptions =
586 request_context_clear_certificate_exceptions;
587 GetStruct()->clear_http_auth_credentials =
588 request_context_clear_http_auth_credentials;
589 GetStruct()->close_all_connections = request_context_close_all_connections;
590 GetStruct()->resolve_host = request_context_resolve_host;
591 GetStruct()->load_extension = request_context_load_extension;
592 GetStruct()->did_load_extension = request_context_did_load_extension;
593 GetStruct()->has_extension = request_context_has_extension;
594 GetStruct()->get_extensions = request_context_get_extensions;
595 GetStruct()->get_extension = request_context_get_extension;
596 GetStruct()->get_media_router = request_context_get_media_router;
597 }
598
599 // DESTRUCTOR - Do not edit by hand.
600
~CefRequestContextCppToC()601 CefRequestContextCppToC::~CefRequestContextCppToC() {}
602
603 template <>
604 CefRefPtr<CefRequestContext> CefCppToCRefCounted<
605 CefRequestContextCppToC,
606 CefRequestContext,
UnwrapDerived(CefWrapperType type,cef_request_context_t * s)607 cef_request_context_t>::UnwrapDerived(CefWrapperType type,
608 cef_request_context_t* s) {
609 NOTREACHED() << "Unexpected class type: " << type;
610 return nullptr;
611 }
612
613 template <>
614 CefWrapperType CefCppToCRefCounted<CefRequestContextCppToC,
615 CefRequestContext,
616 cef_request_context_t>::kWrapperType =
617 WT_REQUEST_CONTEXT;
618