• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1 // Copyright (c) 2022 Marshall A. Greenblatt. All rights reserved.
2 //
3 // Redistribution and use in source and binary forms, with or without
4 // modification, are permitted provided that the following conditions are
5 // met:
6 //
7 //    * Redistributions of source code must retain the above copyright
8 // notice, this list of conditions and the following disclaimer.
9 //    * Redistributions in binary form must reproduce the above
10 // copyright notice, this list of conditions and the following disclaimer
11 // in the documentation and/or other materials provided with the
12 // distribution.
13 //    * Neither the name of Google Inc. nor the name Chromium Embedded
14 // Framework nor the names of its contributors may be used to endorse
15 // or promote products derived from this software without specific prior
16 // written permission.
17 //
18 // THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
19 // "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
20 // LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
21 // A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
22 // OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
23 // SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
24 // LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
25 // DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
26 // THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
27 // (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
28 // OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
29 //
30 // ---------------------------------------------------------------------------
31 //
32 // This file was generated by the CEF translator tool and should not edited
33 // by hand. See the translator.README.txt file in the tools directory for
34 // more information.
35 //
36 // $hash=47b361878452f2a94e559782913d80beb0dba25a$
37 //
38 
39 #ifndef CEF_INCLUDE_CAPI_CEF_REQUEST_CAPI_H_
40 #define CEF_INCLUDE_CAPI_CEF_REQUEST_CAPI_H_
41 #pragma once
42 
43 #include "include/capi/cef_base_capi.h"
44 
45 #ifdef __cplusplus
46 extern "C" {
47 #endif
48 
49 struct _cef_post_data_element_t;
50 struct _cef_post_data_t;
51 
52 ///
53 // Structure used to represent a web request. The functions of this structure
54 // may be called on any thread.
55 ///
56 typedef struct _cef_request_t {
57   ///
58   // Base structure.
59   ///
60   cef_base_ref_counted_t base;
61 
62   ///
63   // Returns true (1) if this object is read-only.
64   ///
65   int(CEF_CALLBACK* is_read_only)(struct _cef_request_t* self);
66 
67   ///
68   // Get the fully qualified URL.
69   ///
70   // The resulting string must be freed by calling cef_string_userfree_free().
71   cef_string_userfree_t(CEF_CALLBACK* get_url)(struct _cef_request_t* self);
72 
73   ///
74   // Set the fully qualified URL.
75   ///
76   void(CEF_CALLBACK* set_url)(struct _cef_request_t* self,
77                               const cef_string_t* url);
78 
79   ///
80   // Get the request function type. The value will default to POST if post data
81   // is provided and GET otherwise.
82   ///
83   // The resulting string must be freed by calling cef_string_userfree_free().
84   cef_string_userfree_t(CEF_CALLBACK* get_method)(struct _cef_request_t* self);
85 
86   ///
87   // Set the request function type.
88   ///
89   void(CEF_CALLBACK* set_method)(struct _cef_request_t* self,
90                                  const cef_string_t* method);
91 
92   ///
93   // Set the referrer URL and policy. If non-NULL the referrer URL must be fully
94   // qualified with an HTTP or HTTPS scheme component. Any username, password or
95   // ref component will be removed.
96   ///
97   void(CEF_CALLBACK* set_referrer)(struct _cef_request_t* self,
98                                    const cef_string_t* referrer_url,
99                                    cef_referrer_policy_t policy);
100 
101   ///
102   // Get the referrer URL.
103   ///
104   // The resulting string must be freed by calling cef_string_userfree_free().
105   cef_string_userfree_t(CEF_CALLBACK* get_referrer_url)(
106       struct _cef_request_t* self);
107 
108   ///
109   // Get the referrer policy.
110   ///
111   cef_referrer_policy_t(CEF_CALLBACK* get_referrer_policy)(
112       struct _cef_request_t* self);
113 
114   ///
115   // Get the post data.
116   ///
117   struct _cef_post_data_t*(CEF_CALLBACK* get_post_data)(
118       struct _cef_request_t* self);
119 
120   ///
121   // Set the post data.
122   ///
123   void(CEF_CALLBACK* set_post_data)(struct _cef_request_t* self,
124                                     struct _cef_post_data_t* postData);
125 
126   ///
127   // Get the header values. Will not include the Referer value if any.
128   ///
129   void(CEF_CALLBACK* get_header_map)(struct _cef_request_t* self,
130                                      cef_string_multimap_t headerMap);
131 
132   ///
133   // Set the header values. If a Referer value exists in the header map it will
134   // be removed and ignored.
135   ///
136   void(CEF_CALLBACK* set_header_map)(struct _cef_request_t* self,
137                                      cef_string_multimap_t headerMap);
138 
139   ///
140   // Returns the first header value for |name| or an NULL string if not found.
141   // Will not return the Referer value if any. Use GetHeaderMap instead if
142   // |name| might have multiple values.
143   ///
144   // The resulting string must be freed by calling cef_string_userfree_free().
145   cef_string_userfree_t(CEF_CALLBACK* get_header_by_name)(
146       struct _cef_request_t* self,
147       const cef_string_t* name);
148 
149   ///
150   // Set the header |name| to |value|. If |overwrite| is true (1) any existing
151   // values will be replaced with the new value. If |overwrite| is false (0) any
152   // existing values will not be overwritten. The Referer value cannot be set
153   // using this function.
154   ///
155   void(CEF_CALLBACK* set_header_by_name)(struct _cef_request_t* self,
156                                          const cef_string_t* name,
157                                          const cef_string_t* value,
158                                          int overwrite);
159 
160   ///
161   // Set all values at one time.
162   ///
163   void(CEF_CALLBACK* set)(struct _cef_request_t* self,
164                           const cef_string_t* url,
165                           const cef_string_t* method,
166                           struct _cef_post_data_t* postData,
167                           cef_string_multimap_t headerMap);
168 
169   ///
170   // Get the flags used in combination with cef_urlrequest_t. See
171   // cef_urlrequest_flags_t for supported values.
172   ///
173   int(CEF_CALLBACK* get_flags)(struct _cef_request_t* self);
174 
175   ///
176   // Set the flags used in combination with cef_urlrequest_t.  See
177   // cef_urlrequest_flags_t for supported values.
178   ///
179   void(CEF_CALLBACK* set_flags)(struct _cef_request_t* self, int flags);
180 
181   ///
182   // Get the URL to the first party for cookies used in combination with
183   // cef_urlrequest_t.
184   ///
185   // The resulting string must be freed by calling cef_string_userfree_free().
186   cef_string_userfree_t(CEF_CALLBACK* get_first_party_for_cookies)(
187       struct _cef_request_t* self);
188 
189   ///
190   // Set the URL to the first party for cookies used in combination with
191   // cef_urlrequest_t.
192   ///
193   void(CEF_CALLBACK* set_first_party_for_cookies)(struct _cef_request_t* self,
194                                                   const cef_string_t* url);
195 
196   ///
197   // Get the resource type for this request. Only available in the browser
198   // process.
199   ///
200   cef_resource_type_t(CEF_CALLBACK* get_resource_type)(
201       struct _cef_request_t* self);
202 
203   ///
204   // Get the transition type for this request. Only available in the browser
205   // process and only applies to requests that represent a main frame or sub-
206   // frame navigation.
207   ///
208   cef_transition_type_t(CEF_CALLBACK* get_transition_type)(
209       struct _cef_request_t* self);
210 
211   ///
212   // Returns the globally unique identifier for this request or 0 if not
213   // specified. Can be used by cef_resource_request_handler_t implementations in
214   // the browser process to track a single request across multiple callbacks.
215   ///
216   uint64(CEF_CALLBACK* get_identifier)(struct _cef_request_t* self);
217 } cef_request_t;
218 
219 ///
220 // Create a new cef_request_t object.
221 ///
222 CEF_EXPORT cef_request_t* cef_request_create();
223 
224 ///
225 // Structure used to represent post data for a web request. The functions of
226 // this structure may be called on any thread.
227 ///
228 typedef struct _cef_post_data_t {
229   ///
230   // Base structure.
231   ///
232   cef_base_ref_counted_t base;
233 
234   ///
235   // Returns true (1) if this object is read-only.
236   ///
237   int(CEF_CALLBACK* is_read_only)(struct _cef_post_data_t* self);
238 
239   ///
240   // Returns true (1) if the underlying POST data includes elements that are not
241   // represented by this cef_post_data_t object (for example, multi-part file
242   // upload data). Modifying cef_post_data_t objects with excluded elements may
243   // result in the request failing.
244   ///
245   int(CEF_CALLBACK* has_excluded_elements)(struct _cef_post_data_t* self);
246 
247   ///
248   // Returns the number of existing post data elements.
249   ///
250   size_t(CEF_CALLBACK* get_element_count)(struct _cef_post_data_t* self);
251 
252   ///
253   // Retrieve the post data elements.
254   ///
255   void(CEF_CALLBACK* get_elements)(struct _cef_post_data_t* self,
256                                    size_t* elementsCount,
257                                    struct _cef_post_data_element_t** elements);
258 
259   ///
260   // Remove the specified post data element.  Returns true (1) if the removal
261   // succeeds.
262   ///
263   int(CEF_CALLBACK* remove_element)(struct _cef_post_data_t* self,
264                                     struct _cef_post_data_element_t* element);
265 
266   ///
267   // Add the specified post data element.  Returns true (1) if the add succeeds.
268   ///
269   int(CEF_CALLBACK* add_element)(struct _cef_post_data_t* self,
270                                  struct _cef_post_data_element_t* element);
271 
272   ///
273   // Remove all existing post data elements.
274   ///
275   void(CEF_CALLBACK* remove_elements)(struct _cef_post_data_t* self);
276 } cef_post_data_t;
277 
278 ///
279 // Create a new cef_post_data_t object.
280 ///
281 CEF_EXPORT cef_post_data_t* cef_post_data_create();
282 
283 ///
284 // Structure used to represent a single element in the request post data. The
285 // functions of this structure may be called on any thread.
286 ///
287 typedef struct _cef_post_data_element_t {
288   ///
289   // Base structure.
290   ///
291   cef_base_ref_counted_t base;
292 
293   ///
294   // Returns true (1) if this object is read-only.
295   ///
296   int(CEF_CALLBACK* is_read_only)(struct _cef_post_data_element_t* self);
297 
298   ///
299   // Remove all contents from the post data element.
300   ///
301   void(CEF_CALLBACK* set_to_empty)(struct _cef_post_data_element_t* self);
302 
303   ///
304   // The post data element will represent a file.
305   ///
306   void(CEF_CALLBACK* set_to_file)(struct _cef_post_data_element_t* self,
307                                   const cef_string_t* fileName);
308 
309   ///
310   // The post data element will represent bytes.  The bytes passed in will be
311   // copied.
312   ///
313   void(CEF_CALLBACK* set_to_bytes)(struct _cef_post_data_element_t* self,
314                                    size_t size,
315                                    const void* bytes);
316 
317   ///
318   // Return the type of this post data element.
319   ///
320   cef_postdataelement_type_t(CEF_CALLBACK* get_type)(
321       struct _cef_post_data_element_t* self);
322 
323   ///
324   // Return the file name.
325   ///
326   // The resulting string must be freed by calling cef_string_userfree_free().
327   cef_string_userfree_t(CEF_CALLBACK* get_file)(
328       struct _cef_post_data_element_t* self);
329 
330   ///
331   // Return the number of bytes.
332   ///
333   size_t(CEF_CALLBACK* get_bytes_count)(struct _cef_post_data_element_t* self);
334 
335   ///
336   // Read up to |size| bytes into |bytes| and return the number of bytes
337   // actually read.
338   ///
339   size_t(CEF_CALLBACK* get_bytes)(struct _cef_post_data_element_t* self,
340                                   size_t size,
341                                   void* bytes);
342 } cef_post_data_element_t;
343 
344 ///
345 // Create a new cef_post_data_element_t object.
346 ///
347 CEF_EXPORT cef_post_data_element_t* cef_post_data_element_create();
348 
349 #ifdef __cplusplus
350 }
351 #endif
352 
353 #endif  // CEF_INCLUDE_CAPI_CEF_REQUEST_CAPI_H_
354