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=16d3a6bd2555917b295d7dbb3ccd95ccfc35b111$
13 //
14
15 #include "libcef_dll/ctocpp/resource_handler_ctocpp.h"
16 #include "libcef_dll/cpptoc/callback_cpptoc.h"
17 #include "libcef_dll/cpptoc/request_cpptoc.h"
18 #include "libcef_dll/cpptoc/resource_read_callback_cpptoc.h"
19 #include "libcef_dll/cpptoc/resource_skip_callback_cpptoc.h"
20 #include "libcef_dll/cpptoc/response_cpptoc.h"
21 #include "libcef_dll/shutdown_checker.h"
22
23 // VIRTUAL METHODS - Body may be edited by hand.
24
25 NO_SANITIZE("cfi-icall")
Open(CefRefPtr<CefRequest> request,bool & handle_request,CefRefPtr<CefCallback> callback)26 bool CefResourceHandlerCToCpp::Open(CefRefPtr<CefRequest> request,
27 bool& handle_request,
28 CefRefPtr<CefCallback> callback) {
29 shutdown_checker::AssertNotShutdown();
30
31 cef_resource_handler_t* _struct = GetStruct();
32 if (CEF_MEMBER_MISSING(_struct, open))
33 return false;
34
35 // AUTO-GENERATED CONTENT - DELETE THIS COMMENT BEFORE MODIFYING
36
37 // Verify param: request; type: refptr_diff
38 DCHECK(request.get());
39 if (!request.get())
40 return false;
41 // Verify param: callback; type: refptr_diff
42 DCHECK(callback.get());
43 if (!callback.get())
44 return false;
45
46 // Translate param: handle_request; type: bool_byref
47 int handle_requestInt = handle_request;
48
49 // Execute
50 int _retval =
51 _struct->open(_struct, CefRequestCppToC::Wrap(request),
52 &handle_requestInt, CefCallbackCppToC::Wrap(callback));
53
54 // Restore param:handle_request; type: bool_byref
55 handle_request = handle_requestInt ? true : false;
56
57 // Return type: bool
58 return _retval ? true : false;
59 }
60
61 NO_SANITIZE("cfi-icall")
ProcessRequest(CefRefPtr<CefRequest> request,CefRefPtr<CefCallback> callback)62 bool CefResourceHandlerCToCpp::ProcessRequest(CefRefPtr<CefRequest> request,
63 CefRefPtr<CefCallback> callback) {
64 shutdown_checker::AssertNotShutdown();
65
66 cef_resource_handler_t* _struct = GetStruct();
67 if (CEF_MEMBER_MISSING(_struct, process_request))
68 return false;
69
70 // AUTO-GENERATED CONTENT - DELETE THIS COMMENT BEFORE MODIFYING
71
72 // Verify param: request; type: refptr_diff
73 DCHECK(request.get());
74 if (!request.get())
75 return false;
76 // Verify param: callback; type: refptr_diff
77 DCHECK(callback.get());
78 if (!callback.get())
79 return false;
80
81 // Execute
82 int _retval =
83 _struct->process_request(_struct, CefRequestCppToC::Wrap(request),
84 CefCallbackCppToC::Wrap(callback));
85
86 // Return type: bool
87 return _retval ? true : false;
88 }
89
90 NO_SANITIZE("cfi-icall")
GetResponseHeaders(CefRefPtr<CefResponse> response,int64 & response_length,CefString & redirectUrl)91 void CefResourceHandlerCToCpp::GetResponseHeaders(
92 CefRefPtr<CefResponse> response,
93 int64& response_length,
94 CefString& redirectUrl) {
95 shutdown_checker::AssertNotShutdown();
96
97 cef_resource_handler_t* _struct = GetStruct();
98 if (CEF_MEMBER_MISSING(_struct, get_response_headers))
99 return;
100
101 // AUTO-GENERATED CONTENT - DELETE THIS COMMENT BEFORE MODIFYING
102
103 // Verify param: response; type: refptr_diff
104 DCHECK(response.get());
105 if (!response.get())
106 return;
107
108 // Execute
109 _struct->get_response_headers(_struct, CefResponseCppToC::Wrap(response),
110 &response_length,
111 redirectUrl.GetWritableStruct());
112 }
113
114 NO_SANITIZE("cfi-icall")
Skip(int64 bytes_to_skip,int64 & bytes_skipped,CefRefPtr<CefResourceSkipCallback> callback)115 bool CefResourceHandlerCToCpp::Skip(
116 int64 bytes_to_skip,
117 int64& bytes_skipped,
118 CefRefPtr<CefResourceSkipCallback> callback) {
119 shutdown_checker::AssertNotShutdown();
120
121 cef_resource_handler_t* _struct = GetStruct();
122 if (CEF_MEMBER_MISSING(_struct, skip))
123 return false;
124
125 // AUTO-GENERATED CONTENT - DELETE THIS COMMENT BEFORE MODIFYING
126
127 // Verify param: callback; type: refptr_diff
128 DCHECK(callback.get());
129 if (!callback.get())
130 return false;
131
132 // Execute
133 int _retval = _struct->skip(_struct, bytes_to_skip, &bytes_skipped,
134 CefResourceSkipCallbackCppToC::Wrap(callback));
135
136 // Return type: bool
137 return _retval ? true : false;
138 }
139
140 NO_SANITIZE("cfi-icall")
Read(void * data_out,int bytes_to_read,int & bytes_read,CefRefPtr<CefResourceReadCallback> callback)141 bool CefResourceHandlerCToCpp::Read(
142 void* data_out,
143 int bytes_to_read,
144 int& bytes_read,
145 CefRefPtr<CefResourceReadCallback> callback) {
146 shutdown_checker::AssertNotShutdown();
147
148 cef_resource_handler_t* _struct = GetStruct();
149 if (CEF_MEMBER_MISSING(_struct, read))
150 return false;
151
152 // AUTO-GENERATED CONTENT - DELETE THIS COMMENT BEFORE MODIFYING
153
154 // Verify param: data_out; type: simple_byaddr
155 DCHECK(data_out);
156 if (!data_out)
157 return false;
158 // Verify param: callback; type: refptr_diff
159 DCHECK(callback.get());
160 if (!callback.get())
161 return false;
162
163 // Execute
164 int _retval = _struct->read(_struct, data_out, bytes_to_read, &bytes_read,
165 CefResourceReadCallbackCppToC::Wrap(callback));
166
167 // Return type: bool
168 return _retval ? true : false;
169 }
170
171 NO_SANITIZE("cfi-icall")
ReadResponse(void * data_out,int bytes_to_read,int & bytes_read,CefRefPtr<CefCallback> callback)172 bool CefResourceHandlerCToCpp::ReadResponse(void* data_out,
173 int bytes_to_read,
174 int& bytes_read,
175 CefRefPtr<CefCallback> callback) {
176 shutdown_checker::AssertNotShutdown();
177
178 cef_resource_handler_t* _struct = GetStruct();
179 if (CEF_MEMBER_MISSING(_struct, read_response))
180 return false;
181
182 // AUTO-GENERATED CONTENT - DELETE THIS COMMENT BEFORE MODIFYING
183
184 // Verify param: data_out; type: simple_byaddr
185 DCHECK(data_out);
186 if (!data_out)
187 return false;
188 // Verify param: callback; type: refptr_diff
189 DCHECK(callback.get());
190 if (!callback.get())
191 return false;
192
193 // Execute
194 int _retval =
195 _struct->read_response(_struct, data_out, bytes_to_read, &bytes_read,
196 CefCallbackCppToC::Wrap(callback));
197
198 // Return type: bool
199 return _retval ? true : false;
200 }
201
Cancel()202 NO_SANITIZE("cfi-icall") void CefResourceHandlerCToCpp::Cancel() {
203 shutdown_checker::AssertNotShutdown();
204
205 cef_resource_handler_t* _struct = GetStruct();
206 if (CEF_MEMBER_MISSING(_struct, cancel))
207 return;
208
209 // AUTO-GENERATED CONTENT - DELETE THIS COMMENT BEFORE MODIFYING
210
211 // Execute
212 _struct->cancel(_struct);
213 }
214
215 // CONSTRUCTOR - Do not edit by hand.
216
CefResourceHandlerCToCpp()217 CefResourceHandlerCToCpp::CefResourceHandlerCToCpp() {}
218
219 // DESTRUCTOR - Do not edit by hand.
220
~CefResourceHandlerCToCpp()221 CefResourceHandlerCToCpp::~CefResourceHandlerCToCpp() {
222 shutdown_checker::AssertNotShutdown();
223 }
224
225 template <>
226 cef_resource_handler_t* CefCToCppRefCounted<
227 CefResourceHandlerCToCpp,
228 CefResourceHandler,
UnwrapDerived(CefWrapperType type,CefResourceHandler * c)229 cef_resource_handler_t>::UnwrapDerived(CefWrapperType type,
230 CefResourceHandler* c) {
231 NOTREACHED() << "Unexpected class type: " << type;
232 return nullptr;
233 }
234
235 template <>
236 CefWrapperType CefCToCppRefCounted<CefResourceHandlerCToCpp,
237 CefResourceHandler,
238 cef_resource_handler_t>::kWrapperType =
239 WT_RESOURCE_HANDLER;
240