• 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=57f1a169f2b2efb6ff3f1ca71aa390fb1d82ed2d$
13 //
14 
15 #include "libcef_dll/cpptoc/resource_request_handler_cpptoc.h"
16 #include "libcef_dll/cpptoc/cookie_access_filter_cpptoc.h"
17 #include "libcef_dll/cpptoc/resource_handler_cpptoc.h"
18 #include "libcef_dll/cpptoc/response_filter_cpptoc.h"
19 #include "libcef_dll/ctocpp/browser_ctocpp.h"
20 #include "libcef_dll/ctocpp/callback_ctocpp.h"
21 #include "libcef_dll/ctocpp/frame_ctocpp.h"
22 #include "libcef_dll/ctocpp/request_ctocpp.h"
23 #include "libcef_dll/ctocpp/response_ctocpp.h"
24 
25 namespace {
26 
27 // MEMBER FUNCTIONS - Body may be edited by hand.
28 
29 struct _cef_cookie_access_filter_t* CEF_CALLBACK
resource_request_handler_get_cookie_access_filter(struct _cef_resource_request_handler_t * self,cef_browser_t * browser,cef_frame_t * frame,cef_request_t * request)30 resource_request_handler_get_cookie_access_filter(
31     struct _cef_resource_request_handler_t* self,
32     cef_browser_t* browser,
33     cef_frame_t* frame,
34     cef_request_t* request) {
35   // AUTO-GENERATED CONTENT - DELETE THIS COMMENT BEFORE MODIFYING
36 
37   DCHECK(self);
38   if (!self)
39     return NULL;
40   // Verify param: request; type: refptr_diff
41   DCHECK(request);
42   if (!request)
43     return NULL;
44   // Unverified params: browser, frame
45 
46   // Execute
47   CefRefPtr<CefCookieAccessFilter> _retval =
48       CefResourceRequestHandlerCppToC::Get(self)->GetCookieAccessFilter(
49           CefBrowserCToCpp::Wrap(browser), CefFrameCToCpp::Wrap(frame),
50           CefRequestCToCpp::Wrap(request));
51 
52   // Return type: refptr_same
53   return CefCookieAccessFilterCppToC::Wrap(_retval);
54 }
55 
56 cef_return_value_t CEF_CALLBACK
resource_request_handler_on_before_resource_load(struct _cef_resource_request_handler_t * self,cef_browser_t * browser,cef_frame_t * frame,cef_request_t * request,cef_callback_t * callback)57 resource_request_handler_on_before_resource_load(
58     struct _cef_resource_request_handler_t* self,
59     cef_browser_t* browser,
60     cef_frame_t* frame,
61     cef_request_t* request,
62     cef_callback_t* callback) {
63   // AUTO-GENERATED CONTENT - DELETE THIS COMMENT BEFORE MODIFYING
64 
65   DCHECK(self);
66   if (!self)
67     return RV_CONTINUE;
68   // Verify param: request; type: refptr_diff
69   DCHECK(request);
70   if (!request)
71     return RV_CONTINUE;
72   // Verify param: callback; type: refptr_diff
73   DCHECK(callback);
74   if (!callback)
75     return RV_CONTINUE;
76   // Unverified params: browser, frame
77 
78   // Execute
79   cef_return_value_t _retval =
80       CefResourceRequestHandlerCppToC::Get(self)->OnBeforeResourceLoad(
81           CefBrowserCToCpp::Wrap(browser), CefFrameCToCpp::Wrap(frame),
82           CefRequestCToCpp::Wrap(request), CefCallbackCToCpp::Wrap(callback));
83 
84   // Return type: simple
85   return _retval;
86 }
87 
88 cef_resource_handler_t* CEF_CALLBACK
resource_request_handler_get_resource_handler(struct _cef_resource_request_handler_t * self,cef_browser_t * browser,cef_frame_t * frame,cef_request_t * request)89 resource_request_handler_get_resource_handler(
90     struct _cef_resource_request_handler_t* self,
91     cef_browser_t* browser,
92     cef_frame_t* frame,
93     cef_request_t* request) {
94   // AUTO-GENERATED CONTENT - DELETE THIS COMMENT BEFORE MODIFYING
95 
96   DCHECK(self);
97   if (!self)
98     return NULL;
99   // Verify param: request; type: refptr_diff
100   DCHECK(request);
101   if (!request)
102     return NULL;
103   // Unverified params: browser, frame
104 
105   // Execute
106   CefRefPtr<CefResourceHandler> _retval =
107       CefResourceRequestHandlerCppToC::Get(self)->GetResourceHandler(
108           CefBrowserCToCpp::Wrap(browser), CefFrameCToCpp::Wrap(frame),
109           CefRequestCToCpp::Wrap(request));
110 
111   // Return type: refptr_same
112   return CefResourceHandlerCppToC::Wrap(_retval);
113 }
114 
resource_request_handler_on_resource_redirect(struct _cef_resource_request_handler_t * self,cef_browser_t * browser,cef_frame_t * frame,cef_request_t * request,struct _cef_response_t * response,cef_string_t * new_url)115 void CEF_CALLBACK resource_request_handler_on_resource_redirect(
116     struct _cef_resource_request_handler_t* self,
117     cef_browser_t* browser,
118     cef_frame_t* frame,
119     cef_request_t* request,
120     struct _cef_response_t* response,
121     cef_string_t* new_url) {
122   // AUTO-GENERATED CONTENT - DELETE THIS COMMENT BEFORE MODIFYING
123 
124   DCHECK(self);
125   if (!self)
126     return;
127   // Verify param: request; type: refptr_diff
128   DCHECK(request);
129   if (!request)
130     return;
131   // Verify param: response; type: refptr_diff
132   DCHECK(response);
133   if (!response)
134     return;
135   // Verify param: new_url; type: string_byref
136   DCHECK(new_url);
137   if (!new_url)
138     return;
139   // Unverified params: browser, frame
140 
141   // Translate param: new_url; type: string_byref
142   CefString new_urlStr(new_url);
143 
144   // Execute
145   CefResourceRequestHandlerCppToC::Get(self)->OnResourceRedirect(
146       CefBrowserCToCpp::Wrap(browser), CefFrameCToCpp::Wrap(frame),
147       CefRequestCToCpp::Wrap(request), CefResponseCToCpp::Wrap(response),
148       new_urlStr);
149 }
150 
resource_request_handler_on_resource_response(struct _cef_resource_request_handler_t * self,cef_browser_t * browser,cef_frame_t * frame,cef_request_t * request,struct _cef_response_t * response)151 int CEF_CALLBACK resource_request_handler_on_resource_response(
152     struct _cef_resource_request_handler_t* self,
153     cef_browser_t* browser,
154     cef_frame_t* frame,
155     cef_request_t* request,
156     struct _cef_response_t* response) {
157   // AUTO-GENERATED CONTENT - DELETE THIS COMMENT BEFORE MODIFYING
158 
159   DCHECK(self);
160   if (!self)
161     return 0;
162   // Verify param: request; type: refptr_diff
163   DCHECK(request);
164   if (!request)
165     return 0;
166   // Verify param: response; type: refptr_diff
167   DCHECK(response);
168   if (!response)
169     return 0;
170   // Unverified params: browser, frame
171 
172   // Execute
173   bool _retval = CefResourceRequestHandlerCppToC::Get(self)->OnResourceResponse(
174       CefBrowserCToCpp::Wrap(browser), CefFrameCToCpp::Wrap(frame),
175       CefRequestCToCpp::Wrap(request), CefResponseCToCpp::Wrap(response));
176 
177   // Return type: bool
178   return _retval;
179 }
180 
181 struct _cef_response_filter_t* CEF_CALLBACK
resource_request_handler_get_resource_response_filter(struct _cef_resource_request_handler_t * self,cef_browser_t * browser,cef_frame_t * frame,cef_request_t * request,struct _cef_response_t * response)182 resource_request_handler_get_resource_response_filter(
183     struct _cef_resource_request_handler_t* self,
184     cef_browser_t* browser,
185     cef_frame_t* frame,
186     cef_request_t* request,
187     struct _cef_response_t* response) {
188   // AUTO-GENERATED CONTENT - DELETE THIS COMMENT BEFORE MODIFYING
189 
190   DCHECK(self);
191   if (!self)
192     return NULL;
193   // Verify param: request; type: refptr_diff
194   DCHECK(request);
195   if (!request)
196     return NULL;
197   // Verify param: response; type: refptr_diff
198   DCHECK(response);
199   if (!response)
200     return NULL;
201   // Unverified params: browser, frame
202 
203   // Execute
204   CefRefPtr<CefResponseFilter> _retval =
205       CefResourceRequestHandlerCppToC::Get(self)->GetResourceResponseFilter(
206           CefBrowserCToCpp::Wrap(browser), CefFrameCToCpp::Wrap(frame),
207           CefRequestCToCpp::Wrap(request), CefResponseCToCpp::Wrap(response));
208 
209   // Return type: refptr_same
210   return CefResponseFilterCppToC::Wrap(_retval);
211 }
212 
resource_request_handler_on_resource_load_complete(struct _cef_resource_request_handler_t * self,cef_browser_t * browser,cef_frame_t * frame,cef_request_t * request,struct _cef_response_t * response,cef_urlrequest_status_t status,int64 received_content_length)213 void CEF_CALLBACK resource_request_handler_on_resource_load_complete(
214     struct _cef_resource_request_handler_t* self,
215     cef_browser_t* browser,
216     cef_frame_t* frame,
217     cef_request_t* request,
218     struct _cef_response_t* response,
219     cef_urlrequest_status_t status,
220     int64 received_content_length) {
221   // AUTO-GENERATED CONTENT - DELETE THIS COMMENT BEFORE MODIFYING
222 
223   DCHECK(self);
224   if (!self)
225     return;
226   // Verify param: request; type: refptr_diff
227   DCHECK(request);
228   if (!request)
229     return;
230   // Verify param: response; type: refptr_diff
231   DCHECK(response);
232   if (!response)
233     return;
234   // Unverified params: browser, frame
235 
236   // Execute
237   CefResourceRequestHandlerCppToC::Get(self)->OnResourceLoadComplete(
238       CefBrowserCToCpp::Wrap(browser), CefFrameCToCpp::Wrap(frame),
239       CefRequestCToCpp::Wrap(request), CefResponseCToCpp::Wrap(response),
240       status, received_content_length);
241 }
242 
resource_request_handler_on_protocol_execution(struct _cef_resource_request_handler_t * self,cef_browser_t * browser,cef_frame_t * frame,cef_request_t * request,int * allow_os_execution)243 void CEF_CALLBACK resource_request_handler_on_protocol_execution(
244     struct _cef_resource_request_handler_t* self,
245     cef_browser_t* browser,
246     cef_frame_t* frame,
247     cef_request_t* request,
248     int* allow_os_execution) {
249   // AUTO-GENERATED CONTENT - DELETE THIS COMMENT BEFORE MODIFYING
250 
251   DCHECK(self);
252   if (!self)
253     return;
254   // Verify param: request; type: refptr_diff
255   DCHECK(request);
256   if (!request)
257     return;
258   // Verify param: allow_os_execution; type: bool_byref
259   DCHECK(allow_os_execution);
260   if (!allow_os_execution)
261     return;
262   // Unverified params: browser, frame
263 
264   // Translate param: allow_os_execution; type: bool_byref
265   bool allow_os_executionBool =
266       (allow_os_execution && *allow_os_execution) ? true : false;
267 
268   // Execute
269   CefResourceRequestHandlerCppToC::Get(self)->OnProtocolExecution(
270       CefBrowserCToCpp::Wrap(browser), CefFrameCToCpp::Wrap(frame),
271       CefRequestCToCpp::Wrap(request), allow_os_executionBool);
272 
273   // Restore param: allow_os_execution; type: bool_byref
274   if (allow_os_execution)
275     *allow_os_execution = allow_os_executionBool ? true : false;
276 }
277 
278 }  // namespace
279 
280 // CONSTRUCTOR - Do not edit by hand.
281 
CefResourceRequestHandlerCppToC()282 CefResourceRequestHandlerCppToC::CefResourceRequestHandlerCppToC() {
283   GetStruct()->get_cookie_access_filter =
284       resource_request_handler_get_cookie_access_filter;
285   GetStruct()->on_before_resource_load =
286       resource_request_handler_on_before_resource_load;
287   GetStruct()->get_resource_handler =
288       resource_request_handler_get_resource_handler;
289   GetStruct()->on_resource_redirect =
290       resource_request_handler_on_resource_redirect;
291   GetStruct()->on_resource_response =
292       resource_request_handler_on_resource_response;
293   GetStruct()->get_resource_response_filter =
294       resource_request_handler_get_resource_response_filter;
295   GetStruct()->on_resource_load_complete =
296       resource_request_handler_on_resource_load_complete;
297   GetStruct()->on_protocol_execution =
298       resource_request_handler_on_protocol_execution;
299 }
300 
301 // DESTRUCTOR - Do not edit by hand.
302 
~CefResourceRequestHandlerCppToC()303 CefResourceRequestHandlerCppToC::~CefResourceRequestHandlerCppToC() {}
304 
305 template <>
306 CefRefPtr<CefResourceRequestHandler>
307 CefCppToCRefCounted<CefResourceRequestHandlerCppToC,
308                     CefResourceRequestHandler,
309                     cef_resource_request_handler_t>::
UnwrapDerived(CefWrapperType type,cef_resource_request_handler_t * s)310     UnwrapDerived(CefWrapperType type, cef_resource_request_handler_t* s) {
311   NOTREACHED() << "Unexpected class type: " << type;
312   return nullptr;
313 }
314 
315 template <>
316 CefWrapperType
317     CefCppToCRefCounted<CefResourceRequestHandlerCppToC,
318                         CefResourceRequestHandler,
319                         cef_resource_request_handler_t>::kWrapperType =
320         WT_RESOURCE_REQUEST_HANDLER;
321