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