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=d3d0a83754df9a39d8f951ea488dd5417d20e9b2$
13 //
14
15 #include "libcef_dll/ctocpp/urlrequest_ctocpp.h"
16 #include "libcef_dll/cpptoc/urlrequest_client_cpptoc.h"
17 #include "libcef_dll/ctocpp/request_context_ctocpp.h"
18 #include "libcef_dll/ctocpp/request_ctocpp.h"
19 #include "libcef_dll/ctocpp/response_ctocpp.h"
20 #include "libcef_dll/shutdown_checker.h"
21
22 // STATIC METHODS - Body may be edited by hand.
23
24 NO_SANITIZE("cfi-icall")
Create(CefRefPtr<CefRequest> request,CefRefPtr<CefURLRequestClient> client,CefRefPtr<CefRequestContext> request_context)25 CefRefPtr<CefURLRequest> CefURLRequest::Create(
26 CefRefPtr<CefRequest> request,
27 CefRefPtr<CefURLRequestClient> client,
28 CefRefPtr<CefRequestContext> request_context) {
29 shutdown_checker::AssertNotShutdown();
30
31 // AUTO-GENERATED CONTENT - DELETE THIS COMMENT BEFORE MODIFYING
32
33 // Verify param: request; type: refptr_same
34 DCHECK(request.get());
35 if (!request.get())
36 return nullptr;
37 // Verify param: client; type: refptr_diff
38 DCHECK(client.get());
39 if (!client.get())
40 return nullptr;
41 // Unverified params: request_context
42
43 // Execute
44 cef_urlrequest_t* _retval =
45 cef_urlrequest_create(CefRequestCToCpp::Unwrap(request),
46 CefURLRequestClientCppToC::Wrap(client),
47 CefRequestContextCToCpp::Unwrap(request_context));
48
49 // Return type: refptr_same
50 return CefURLRequestCToCpp::Wrap(_retval);
51 }
52
53 // VIRTUAL METHODS - Body may be edited by hand.
54
55 NO_SANITIZE("cfi-icall")
GetRequest()56 CefRefPtr<CefRequest> CefURLRequestCToCpp::GetRequest() {
57 shutdown_checker::AssertNotShutdown();
58
59 cef_urlrequest_t* _struct = GetStruct();
60 if (CEF_MEMBER_MISSING(_struct, get_request))
61 return nullptr;
62
63 // AUTO-GENERATED CONTENT - DELETE THIS COMMENT BEFORE MODIFYING
64
65 // Execute
66 cef_request_t* _retval = _struct->get_request(_struct);
67
68 // Return type: refptr_same
69 return CefRequestCToCpp::Wrap(_retval);
70 }
71
72 NO_SANITIZE("cfi-icall")
GetClient()73 CefRefPtr<CefURLRequestClient> CefURLRequestCToCpp::GetClient() {
74 shutdown_checker::AssertNotShutdown();
75
76 cef_urlrequest_t* _struct = GetStruct();
77 if (CEF_MEMBER_MISSING(_struct, get_client))
78 return nullptr;
79
80 // AUTO-GENERATED CONTENT - DELETE THIS COMMENT BEFORE MODIFYING
81
82 // Execute
83 cef_urlrequest_client_t* _retval = _struct->get_client(_struct);
84
85 // Return type: refptr_diff
86 return CefURLRequestClientCppToC::Unwrap(_retval);
87 }
88
89 NO_SANITIZE("cfi-icall")
GetRequestStatus()90 CefURLRequest::Status CefURLRequestCToCpp::GetRequestStatus() {
91 shutdown_checker::AssertNotShutdown();
92
93 cef_urlrequest_t* _struct = GetStruct();
94 if (CEF_MEMBER_MISSING(_struct, get_request_status))
95 return UR_UNKNOWN;
96
97 // AUTO-GENERATED CONTENT - DELETE THIS COMMENT BEFORE MODIFYING
98
99 // Execute
100 cef_urlrequest_status_t _retval = _struct->get_request_status(_struct);
101
102 // Return type: simple
103 return _retval;
104 }
105
106 NO_SANITIZE("cfi-icall")
GetRequestError()107 CefURLRequest::ErrorCode CefURLRequestCToCpp::GetRequestError() {
108 shutdown_checker::AssertNotShutdown();
109
110 cef_urlrequest_t* _struct = GetStruct();
111 if (CEF_MEMBER_MISSING(_struct, get_request_error))
112 return ERR_NONE;
113
114 // AUTO-GENERATED CONTENT - DELETE THIS COMMENT BEFORE MODIFYING
115
116 // Execute
117 cef_errorcode_t _retval = _struct->get_request_error(_struct);
118
119 // Return type: simple
120 return _retval;
121 }
122
123 NO_SANITIZE("cfi-icall")
GetResponse()124 CefRefPtr<CefResponse> CefURLRequestCToCpp::GetResponse() {
125 shutdown_checker::AssertNotShutdown();
126
127 cef_urlrequest_t* _struct = GetStruct();
128 if (CEF_MEMBER_MISSING(_struct, get_response))
129 return nullptr;
130
131 // AUTO-GENERATED CONTENT - DELETE THIS COMMENT BEFORE MODIFYING
132
133 // Execute
134 cef_response_t* _retval = _struct->get_response(_struct);
135
136 // Return type: refptr_same
137 return CefResponseCToCpp::Wrap(_retval);
138 }
139
ResponseWasCached()140 NO_SANITIZE("cfi-icall") bool CefURLRequestCToCpp::ResponseWasCached() {
141 shutdown_checker::AssertNotShutdown();
142
143 cef_urlrequest_t* _struct = GetStruct();
144 if (CEF_MEMBER_MISSING(_struct, response_was_cached))
145 return false;
146
147 // AUTO-GENERATED CONTENT - DELETE THIS COMMENT BEFORE MODIFYING
148
149 // Execute
150 int _retval = _struct->response_was_cached(_struct);
151
152 // Return type: bool
153 return _retval ? true : false;
154 }
155
Cancel()156 NO_SANITIZE("cfi-icall") void CefURLRequestCToCpp::Cancel() {
157 shutdown_checker::AssertNotShutdown();
158
159 cef_urlrequest_t* _struct = GetStruct();
160 if (CEF_MEMBER_MISSING(_struct, cancel))
161 return;
162
163 // AUTO-GENERATED CONTENT - DELETE THIS COMMENT BEFORE MODIFYING
164
165 // Execute
166 _struct->cancel(_struct);
167 }
168
169 // CONSTRUCTOR - Do not edit by hand.
170
CefURLRequestCToCpp()171 CefURLRequestCToCpp::CefURLRequestCToCpp() {}
172
173 // DESTRUCTOR - Do not edit by hand.
174
~CefURLRequestCToCpp()175 CefURLRequestCToCpp::~CefURLRequestCToCpp() {
176 shutdown_checker::AssertNotShutdown();
177 }
178
179 template <>
180 cef_urlrequest_t*
181 CefCToCppRefCounted<CefURLRequestCToCpp, CefURLRequest, cef_urlrequest_t>::
UnwrapDerived(CefWrapperType type,CefURLRequest * c)182 UnwrapDerived(CefWrapperType type, CefURLRequest* c) {
183 NOTREACHED() << "Unexpected class type: " << type;
184 return nullptr;
185 }
186
187 template <>
188 CefWrapperType CefCToCppRefCounted<CefURLRequestCToCpp,
189 CefURLRequest,
190 cef_urlrequest_t>::kWrapperType =
191 WT_URLREQUEST;
192