• 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=6ebf7adcdaee57772810c1528b27140ae95966d0$
37 //
38 
39 #ifndef CEF_INCLUDE_CAPI_CEF_RESPONSE_CAPI_H_
40 #define CEF_INCLUDE_CAPI_CEF_RESPONSE_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 ///
50 // Structure used to represent a web response. The functions of this structure
51 // may be called on any thread.
52 ///
53 typedef struct _cef_response_t {
54   ///
55   // Base structure.
56   ///
57   cef_base_ref_counted_t base;
58 
59   ///
60   // Returns true (1) if this object is read-only.
61   ///
62   int(CEF_CALLBACK* is_read_only)(struct _cef_response_t* self);
63 
64   ///
65   // Get the response error code. Returns ERR_NONE if there was no error.
66   ///
67   cef_errorcode_t(CEF_CALLBACK* get_error)(struct _cef_response_t* self);
68 
69   ///
70   // Set the response error code. This can be used by custom scheme handlers to
71   // return errors during initial request processing.
72   ///
73   void(CEF_CALLBACK* set_error)(struct _cef_response_t* self,
74                                 cef_errorcode_t error);
75 
76   ///
77   // Get the response status code.
78   ///
79   int(CEF_CALLBACK* get_status)(struct _cef_response_t* self);
80 
81   ///
82   // Set the response status code.
83   ///
84   void(CEF_CALLBACK* set_status)(struct _cef_response_t* self, int status);
85 
86   ///
87   // Get the response status text.
88   ///
89   // The resulting string must be freed by calling cef_string_userfree_free().
90   cef_string_userfree_t(CEF_CALLBACK* get_status_text)(
91       struct _cef_response_t* self);
92 
93   ///
94   // Set the response status text.
95   ///
96   void(CEF_CALLBACK* set_status_text)(struct _cef_response_t* self,
97                                       const cef_string_t* statusText);
98 
99   ///
100   // Get the response mime type.
101   ///
102   // The resulting string must be freed by calling cef_string_userfree_free().
103   cef_string_userfree_t(CEF_CALLBACK* get_mime_type)(
104       struct _cef_response_t* self);
105 
106   ///
107   // Set the response mime type.
108   ///
109   void(CEF_CALLBACK* set_mime_type)(struct _cef_response_t* self,
110                                     const cef_string_t* mimeType);
111 
112   ///
113   // Get the response charset.
114   ///
115   // The resulting string must be freed by calling cef_string_userfree_free().
116   cef_string_userfree_t(CEF_CALLBACK* get_charset)(
117       struct _cef_response_t* self);
118 
119   ///
120   // Set the response charset.
121   ///
122   void(CEF_CALLBACK* set_charset)(struct _cef_response_t* self,
123                                   const cef_string_t* charset);
124 
125   ///
126   // Get the value for the specified response header field.
127   ///
128   // The resulting string must be freed by calling cef_string_userfree_free().
129   cef_string_userfree_t(CEF_CALLBACK* get_header_by_name)(
130       struct _cef_response_t* self,
131       const cef_string_t* name);
132 
133   ///
134   // Set the header |name| to |value|. If |overwrite| is true (1) any existing
135   // values will be replaced with the new value. If |overwrite| is false (0) any
136   // existing values will not be overwritten.
137   ///
138   void(CEF_CALLBACK* set_header_by_name)(struct _cef_response_t* self,
139                                          const cef_string_t* name,
140                                          const cef_string_t* value,
141                                          int overwrite);
142 
143   ///
144   // Get all response header fields.
145   ///
146   void(CEF_CALLBACK* get_header_map)(struct _cef_response_t* self,
147                                      cef_string_multimap_t headerMap);
148 
149   ///
150   // Set all response header fields.
151   ///
152   void(CEF_CALLBACK* set_header_map)(struct _cef_response_t* self,
153                                      cef_string_multimap_t headerMap);
154 
155   ///
156   // Get the resolved URL after redirects or changed as a result of HSTS.
157   ///
158   // The resulting string must be freed by calling cef_string_userfree_free().
159   cef_string_userfree_t(CEF_CALLBACK* get_url)(struct _cef_response_t* self);
160 
161   ///
162   // Set the resolved URL after redirects or changed as a result of HSTS.
163   ///
164   void(CEF_CALLBACK* set_url)(struct _cef_response_t* self,
165                               const cef_string_t* url);
166 } cef_response_t;
167 
168 ///
169 // Create a new cef_response_t object.
170 ///
171 CEF_EXPORT cef_response_t* cef_response_create();
172 
173 #ifdef __cplusplus
174 }
175 #endif
176 
177 #endif  // CEF_INCLUDE_CAPI_CEF_RESPONSE_CAPI_H_
178