• 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=b1a7f857e453a625325a1a2847e60990eecc61ea$
13 //
14 
15 #include "libcef_dll/cpptoc/request_cpptoc.h"
16 #include "libcef_dll/cpptoc/post_data_cpptoc.h"
17 #include "libcef_dll/transfer_util.h"
18 
19 // GLOBAL FUNCTIONS - Body may be edited by hand.
20 
cef_request_create()21 CEF_EXPORT cef_request_t* cef_request_create() {
22   // AUTO-GENERATED CONTENT - DELETE THIS COMMENT BEFORE MODIFYING
23 
24   // Execute
25   CefRefPtr<CefRequest> _retval = CefRequest::Create();
26 
27   // Return type: refptr_same
28   return CefRequestCppToC::Wrap(_retval);
29 }
30 
31 namespace {
32 
33 // MEMBER FUNCTIONS - Body may be edited by hand.
34 
request_is_read_only(struct _cef_request_t * self)35 int CEF_CALLBACK request_is_read_only(struct _cef_request_t* self) {
36   // AUTO-GENERATED CONTENT - DELETE THIS COMMENT BEFORE MODIFYING
37 
38   DCHECK(self);
39   if (!self)
40     return 0;
41 
42   // Execute
43   bool _retval = CefRequestCppToC::Get(self)->IsReadOnly();
44 
45   // Return type: bool
46   return _retval;
47 }
48 
49 cef_string_userfree_t CEF_CALLBACK
request_get_url(struct _cef_request_t * self)50 request_get_url(struct _cef_request_t* self) {
51   // AUTO-GENERATED CONTENT - DELETE THIS COMMENT BEFORE MODIFYING
52 
53   DCHECK(self);
54   if (!self)
55     return NULL;
56 
57   // Execute
58   CefString _retval = CefRequestCppToC::Get(self)->GetURL();
59 
60   // Return type: string
61   return _retval.DetachToUserFree();
62 }
63 
request_set_url(struct _cef_request_t * self,const cef_string_t * url)64 void CEF_CALLBACK request_set_url(struct _cef_request_t* self,
65                                   const cef_string_t* url) {
66   // AUTO-GENERATED CONTENT - DELETE THIS COMMENT BEFORE MODIFYING
67 
68   DCHECK(self);
69   if (!self)
70     return;
71   // Verify param: url; type: string_byref_const
72   DCHECK(url);
73   if (!url)
74     return;
75 
76   // Execute
77   CefRequestCppToC::Get(self)->SetURL(CefString(url));
78 }
79 
80 cef_string_userfree_t CEF_CALLBACK
request_get_method(struct _cef_request_t * self)81 request_get_method(struct _cef_request_t* self) {
82   // AUTO-GENERATED CONTENT - DELETE THIS COMMENT BEFORE MODIFYING
83 
84   DCHECK(self);
85   if (!self)
86     return NULL;
87 
88   // Execute
89   CefString _retval = CefRequestCppToC::Get(self)->GetMethod();
90 
91   // Return type: string
92   return _retval.DetachToUserFree();
93 }
94 
request_set_method(struct _cef_request_t * self,const cef_string_t * method)95 void CEF_CALLBACK request_set_method(struct _cef_request_t* self,
96                                      const cef_string_t* method) {
97   // AUTO-GENERATED CONTENT - DELETE THIS COMMENT BEFORE MODIFYING
98 
99   DCHECK(self);
100   if (!self)
101     return;
102   // Verify param: method; type: string_byref_const
103   DCHECK(method);
104   if (!method)
105     return;
106 
107   // Execute
108   CefRequestCppToC::Get(self)->SetMethod(CefString(method));
109 }
110 
request_set_referrer(struct _cef_request_t * self,const cef_string_t * referrer_url,cef_referrer_policy_t policy)111 void CEF_CALLBACK request_set_referrer(struct _cef_request_t* self,
112                                        const cef_string_t* referrer_url,
113                                        cef_referrer_policy_t policy) {
114   // AUTO-GENERATED CONTENT - DELETE THIS COMMENT BEFORE MODIFYING
115 
116   DCHECK(self);
117   if (!self)
118     return;
119   // Unverified params: referrer_url
120 
121   // Execute
122   CefRequestCppToC::Get(self)->SetReferrer(CefString(referrer_url), policy);
123 }
124 
125 cef_string_userfree_t CEF_CALLBACK
request_get_referrer_url(struct _cef_request_t * self)126 request_get_referrer_url(struct _cef_request_t* self) {
127   // AUTO-GENERATED CONTENT - DELETE THIS COMMENT BEFORE MODIFYING
128 
129   DCHECK(self);
130   if (!self)
131     return NULL;
132 
133   // Execute
134   CefString _retval = CefRequestCppToC::Get(self)->GetReferrerURL();
135 
136   // Return type: string
137   return _retval.DetachToUserFree();
138 }
139 
140 cef_referrer_policy_t CEF_CALLBACK
request_get_referrer_policy(struct _cef_request_t * self)141 request_get_referrer_policy(struct _cef_request_t* self) {
142   // AUTO-GENERATED CONTENT - DELETE THIS COMMENT BEFORE MODIFYING
143 
144   DCHECK(self);
145   if (!self)
146     return REFERRER_POLICY_DEFAULT;
147 
148   // Execute
149   cef_referrer_policy_t _retval =
150       CefRequestCppToC::Get(self)->GetReferrerPolicy();
151 
152   // Return type: simple
153   return _retval;
154 }
155 
156 struct _cef_post_data_t* CEF_CALLBACK
request_get_post_data(struct _cef_request_t * self)157 request_get_post_data(struct _cef_request_t* self) {
158   // AUTO-GENERATED CONTENT - DELETE THIS COMMENT BEFORE MODIFYING
159 
160   DCHECK(self);
161   if (!self)
162     return NULL;
163 
164   // Execute
165   CefRefPtr<CefPostData> _retval = CefRequestCppToC::Get(self)->GetPostData();
166 
167   // Return type: refptr_same
168   return CefPostDataCppToC::Wrap(_retval);
169 }
170 
request_set_post_data(struct _cef_request_t * self,struct _cef_post_data_t * postData)171 void CEF_CALLBACK request_set_post_data(struct _cef_request_t* self,
172                                         struct _cef_post_data_t* postData) {
173   // AUTO-GENERATED CONTENT - DELETE THIS COMMENT BEFORE MODIFYING
174 
175   DCHECK(self);
176   if (!self)
177     return;
178   // Verify param: postData; type: refptr_same
179   DCHECK(postData);
180   if (!postData)
181     return;
182 
183   // Execute
184   CefRequestCppToC::Get(self)->SetPostData(CefPostDataCppToC::Unwrap(postData));
185 }
186 
request_get_header_map(struct _cef_request_t * self,cef_string_multimap_t headerMap)187 void CEF_CALLBACK request_get_header_map(struct _cef_request_t* self,
188                                          cef_string_multimap_t headerMap) {
189   // AUTO-GENERATED CONTENT - DELETE THIS COMMENT BEFORE MODIFYING
190 
191   DCHECK(self);
192   if (!self)
193     return;
194   // Verify param: headerMap; type: string_map_multi_byref
195   DCHECK(headerMap);
196   if (!headerMap)
197     return;
198 
199   // Translate param: headerMap; type: string_map_multi_byref
200   std::multimap<CefString, CefString> headerMapMultimap;
201   transfer_string_multimap_contents(headerMap, headerMapMultimap);
202 
203   // Execute
204   CefRequestCppToC::Get(self)->GetHeaderMap(headerMapMultimap);
205 
206   // Restore param: headerMap; type: string_map_multi_byref
207   cef_string_multimap_clear(headerMap);
208   transfer_string_multimap_contents(headerMapMultimap, headerMap);
209 }
210 
request_set_header_map(struct _cef_request_t * self,cef_string_multimap_t headerMap)211 void CEF_CALLBACK request_set_header_map(struct _cef_request_t* self,
212                                          cef_string_multimap_t headerMap) {
213   // AUTO-GENERATED CONTENT - DELETE THIS COMMENT BEFORE MODIFYING
214 
215   DCHECK(self);
216   if (!self)
217     return;
218   // Verify param: headerMap; type: string_map_multi_byref_const
219   DCHECK(headerMap);
220   if (!headerMap)
221     return;
222 
223   // Translate param: headerMap; type: string_map_multi_byref_const
224   std::multimap<CefString, CefString> headerMapMultimap;
225   transfer_string_multimap_contents(headerMap, headerMapMultimap);
226 
227   // Execute
228   CefRequestCppToC::Get(self)->SetHeaderMap(headerMapMultimap);
229 }
230 
231 cef_string_userfree_t CEF_CALLBACK
request_get_header_by_name(struct _cef_request_t * self,const cef_string_t * name)232 request_get_header_by_name(struct _cef_request_t* self,
233                            const cef_string_t* name) {
234   // AUTO-GENERATED CONTENT - DELETE THIS COMMENT BEFORE MODIFYING
235 
236   DCHECK(self);
237   if (!self)
238     return NULL;
239   // Verify param: name; type: string_byref_const
240   DCHECK(name);
241   if (!name)
242     return NULL;
243 
244   // Execute
245   CefString _retval =
246       CefRequestCppToC::Get(self)->GetHeaderByName(CefString(name));
247 
248   // Return type: string
249   return _retval.DetachToUserFree();
250 }
251 
request_set_header_by_name(struct _cef_request_t * self,const cef_string_t * name,const cef_string_t * value,int overwrite)252 void CEF_CALLBACK request_set_header_by_name(struct _cef_request_t* self,
253                                              const cef_string_t* name,
254                                              const cef_string_t* value,
255                                              int overwrite) {
256   // AUTO-GENERATED CONTENT - DELETE THIS COMMENT BEFORE MODIFYING
257 
258   DCHECK(self);
259   if (!self)
260     return;
261   // Verify param: name; type: string_byref_const
262   DCHECK(name);
263   if (!name)
264     return;
265   // Unverified params: value
266 
267   // Execute
268   CefRequestCppToC::Get(self)->SetHeaderByName(
269       CefString(name), CefString(value), overwrite ? true : false);
270 }
271 
request_set(struct _cef_request_t * self,const cef_string_t * url,const cef_string_t * method,struct _cef_post_data_t * postData,cef_string_multimap_t headerMap)272 void CEF_CALLBACK request_set(struct _cef_request_t* self,
273                               const cef_string_t* url,
274                               const cef_string_t* method,
275                               struct _cef_post_data_t* postData,
276                               cef_string_multimap_t headerMap) {
277   // AUTO-GENERATED CONTENT - DELETE THIS COMMENT BEFORE MODIFYING
278 
279   DCHECK(self);
280   if (!self)
281     return;
282   // Verify param: url; type: string_byref_const
283   DCHECK(url);
284   if (!url)
285     return;
286   // Verify param: method; type: string_byref_const
287   DCHECK(method);
288   if (!method)
289     return;
290   // Verify param: headerMap; type: string_map_multi_byref_const
291   DCHECK(headerMap);
292   if (!headerMap)
293     return;
294   // Unverified params: postData
295 
296   // Translate param: headerMap; type: string_map_multi_byref_const
297   std::multimap<CefString, CefString> headerMapMultimap;
298   transfer_string_multimap_contents(headerMap, headerMapMultimap);
299 
300   // Execute
301   CefRequestCppToC::Get(self)->Set(CefString(url), CefString(method),
302                                    CefPostDataCppToC::Unwrap(postData),
303                                    headerMapMultimap);
304 }
305 
request_get_flags(struct _cef_request_t * self)306 int CEF_CALLBACK request_get_flags(struct _cef_request_t* self) {
307   // AUTO-GENERATED CONTENT - DELETE THIS COMMENT BEFORE MODIFYING
308 
309   DCHECK(self);
310   if (!self)
311     return UR_FLAG_NONE;
312 
313   // Execute
314   int _retval = CefRequestCppToC::Get(self)->GetFlags();
315 
316   // Return type: simple
317   return _retval;
318 }
319 
request_set_flags(struct _cef_request_t * self,int flags)320 void CEF_CALLBACK request_set_flags(struct _cef_request_t* self, int flags) {
321   // AUTO-GENERATED CONTENT - DELETE THIS COMMENT BEFORE MODIFYING
322 
323   DCHECK(self);
324   if (!self)
325     return;
326 
327   // Execute
328   CefRequestCppToC::Get(self)->SetFlags(flags);
329 }
330 
331 cef_string_userfree_t CEF_CALLBACK
request_get_first_party_for_cookies(struct _cef_request_t * self)332 request_get_first_party_for_cookies(struct _cef_request_t* self) {
333   // AUTO-GENERATED CONTENT - DELETE THIS COMMENT BEFORE MODIFYING
334 
335   DCHECK(self);
336   if (!self)
337     return NULL;
338 
339   // Execute
340   CefString _retval = CefRequestCppToC::Get(self)->GetFirstPartyForCookies();
341 
342   // Return type: string
343   return _retval.DetachToUserFree();
344 }
345 
346 void CEF_CALLBACK
request_set_first_party_for_cookies(struct _cef_request_t * self,const cef_string_t * url)347 request_set_first_party_for_cookies(struct _cef_request_t* self,
348                                     const cef_string_t* url) {
349   // AUTO-GENERATED CONTENT - DELETE THIS COMMENT BEFORE MODIFYING
350 
351   DCHECK(self);
352   if (!self)
353     return;
354   // Unverified params: url
355 
356   // Execute
357   CefRequestCppToC::Get(self)->SetFirstPartyForCookies(CefString(url));
358 }
359 
360 cef_resource_type_t CEF_CALLBACK
request_get_resource_type(struct _cef_request_t * self)361 request_get_resource_type(struct _cef_request_t* self) {
362   // AUTO-GENERATED CONTENT - DELETE THIS COMMENT BEFORE MODIFYING
363 
364   DCHECK(self);
365   if (!self)
366     return RT_SUB_RESOURCE;
367 
368   // Execute
369   cef_resource_type_t _retval = CefRequestCppToC::Get(self)->GetResourceType();
370 
371   // Return type: simple
372   return _retval;
373 }
374 
375 cef_transition_type_t CEF_CALLBACK
request_get_transition_type(struct _cef_request_t * self)376 request_get_transition_type(struct _cef_request_t* self) {
377   // AUTO-GENERATED CONTENT - DELETE THIS COMMENT BEFORE MODIFYING
378 
379   DCHECK(self);
380   if (!self)
381     return TT_EXPLICIT;
382 
383   // Execute
384   cef_transition_type_t _retval =
385       CefRequestCppToC::Get(self)->GetTransitionType();
386 
387   // Return type: simple
388   return _retval;
389 }
390 
request_get_identifier(struct _cef_request_t * self)391 uint64 CEF_CALLBACK request_get_identifier(struct _cef_request_t* self) {
392   // AUTO-GENERATED CONTENT - DELETE THIS COMMENT BEFORE MODIFYING
393 
394   DCHECK(self);
395   if (!self)
396     return 0;
397 
398   // Execute
399   uint64 _retval = CefRequestCppToC::Get(self)->GetIdentifier();
400 
401   // Return type: simple
402   return _retval;
403 }
404 
405 }  // namespace
406 
407 // CONSTRUCTOR - Do not edit by hand.
408 
CefRequestCppToC()409 CefRequestCppToC::CefRequestCppToC() {
410   GetStruct()->is_read_only = request_is_read_only;
411   GetStruct()->get_url = request_get_url;
412   GetStruct()->set_url = request_set_url;
413   GetStruct()->get_method = request_get_method;
414   GetStruct()->set_method = request_set_method;
415   GetStruct()->set_referrer = request_set_referrer;
416   GetStruct()->get_referrer_url = request_get_referrer_url;
417   GetStruct()->get_referrer_policy = request_get_referrer_policy;
418   GetStruct()->get_post_data = request_get_post_data;
419   GetStruct()->set_post_data = request_set_post_data;
420   GetStruct()->get_header_map = request_get_header_map;
421   GetStruct()->set_header_map = request_set_header_map;
422   GetStruct()->get_header_by_name = request_get_header_by_name;
423   GetStruct()->set_header_by_name = request_set_header_by_name;
424   GetStruct()->set = request_set;
425   GetStruct()->get_flags = request_get_flags;
426   GetStruct()->set_flags = request_set_flags;
427   GetStruct()->get_first_party_for_cookies =
428       request_get_first_party_for_cookies;
429   GetStruct()->set_first_party_for_cookies =
430       request_set_first_party_for_cookies;
431   GetStruct()->get_resource_type = request_get_resource_type;
432   GetStruct()->get_transition_type = request_get_transition_type;
433   GetStruct()->get_identifier = request_get_identifier;
434 }
435 
436 // DESTRUCTOR - Do not edit by hand.
437 
~CefRequestCppToC()438 CefRequestCppToC::~CefRequestCppToC() {}
439 
440 template <>
441 CefRefPtr<CefRequest>
UnwrapDerived(CefWrapperType type,cef_request_t * s)442 CefCppToCRefCounted<CefRequestCppToC, CefRequest, cef_request_t>::UnwrapDerived(
443     CefWrapperType type,
444     cef_request_t* s) {
445   NOTREACHED() << "Unexpected class type: " << type;
446   return nullptr;
447 }
448 
449 template <>
450 CefWrapperType CefCppToCRefCounted<CefRequestCppToC,
451                                    CefRequest,
452                                    cef_request_t>::kWrapperType = WT_REQUEST;
453