• 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=6193670d2d0577eaf226bd1825cde7b3f70c0f68$
13 //
14 
15 #include "libcef_dll/cpptoc/urlrequest_cpptoc.h"
16 #include "libcef_dll/cpptoc/request_context_cpptoc.h"
17 #include "libcef_dll/cpptoc/request_cpptoc.h"
18 #include "libcef_dll/cpptoc/response_cpptoc.h"
19 #include "libcef_dll/ctocpp/urlrequest_client_ctocpp.h"
20 #include "libcef_dll/shutdown_checker.h"
21 
22 // GLOBAL FUNCTIONS - Body may be edited by hand.
23 
cef_urlrequest_create(cef_request_t * request,struct _cef_urlrequest_client_t * client,cef_request_context_t * request_context)24 CEF_EXPORT cef_urlrequest_t* cef_urlrequest_create(
25     cef_request_t* request,
26     struct _cef_urlrequest_client_t* client,
27     cef_request_context_t* request_context) {
28   shutdown_checker::AssertNotShutdown();
29 
30   // AUTO-GENERATED CONTENT - DELETE THIS COMMENT BEFORE MODIFYING
31 
32   // Verify param: request; type: refptr_same
33   DCHECK(request);
34   if (!request)
35     return NULL;
36   // Verify param: client; type: refptr_diff
37   DCHECK(client);
38   if (!client)
39     return NULL;
40   // Unverified params: request_context
41 
42   // Execute
43   CefRefPtr<CefURLRequest> _retval =
44       CefURLRequest::Create(CefRequestCppToC::Unwrap(request),
45                             CefURLRequestClientCToCpp::Wrap(client),
46                             CefRequestContextCppToC::Unwrap(request_context));
47 
48   // Return type: refptr_same
49   return CefURLRequestCppToC::Wrap(_retval);
50 }
51 
52 namespace {
53 
54 // MEMBER FUNCTIONS - Body may be edited by hand.
55 
56 cef_request_t* CEF_CALLBACK
urlrequest_get_request(struct _cef_urlrequest_t * self)57 urlrequest_get_request(struct _cef_urlrequest_t* self) {
58   shutdown_checker::AssertNotShutdown();
59 
60   // AUTO-GENERATED CONTENT - DELETE THIS COMMENT BEFORE MODIFYING
61 
62   DCHECK(self);
63   if (!self)
64     return NULL;
65 
66   // Execute
67   CefRefPtr<CefRequest> _retval = CefURLRequestCppToC::Get(self)->GetRequest();
68 
69   // Return type: refptr_same
70   return CefRequestCppToC::Wrap(_retval);
71 }
72 
73 struct _cef_urlrequest_client_t* CEF_CALLBACK
urlrequest_get_client(struct _cef_urlrequest_t * self)74 urlrequest_get_client(struct _cef_urlrequest_t* self) {
75   shutdown_checker::AssertNotShutdown();
76 
77   // AUTO-GENERATED CONTENT - DELETE THIS COMMENT BEFORE MODIFYING
78 
79   DCHECK(self);
80   if (!self)
81     return NULL;
82 
83   // Execute
84   CefRefPtr<CefURLRequestClient> _retval =
85       CefURLRequestCppToC::Get(self)->GetClient();
86 
87   // Return type: refptr_diff
88   return CefURLRequestClientCToCpp::Unwrap(_retval);
89 }
90 
91 cef_urlrequest_status_t CEF_CALLBACK
urlrequest_get_request_status(struct _cef_urlrequest_t * self)92 urlrequest_get_request_status(struct _cef_urlrequest_t* self) {
93   shutdown_checker::AssertNotShutdown();
94 
95   // AUTO-GENERATED CONTENT - DELETE THIS COMMENT BEFORE MODIFYING
96 
97   DCHECK(self);
98   if (!self)
99     return UR_UNKNOWN;
100 
101   // Execute
102   cef_urlrequest_status_t _retval =
103       CefURLRequestCppToC::Get(self)->GetRequestStatus();
104 
105   // Return type: simple
106   return _retval;
107 }
108 
109 cef_errorcode_t CEF_CALLBACK
urlrequest_get_request_error(struct _cef_urlrequest_t * self)110 urlrequest_get_request_error(struct _cef_urlrequest_t* self) {
111   shutdown_checker::AssertNotShutdown();
112 
113   // AUTO-GENERATED CONTENT - DELETE THIS COMMENT BEFORE MODIFYING
114 
115   DCHECK(self);
116   if (!self)
117     return ERR_NONE;
118 
119   // Execute
120   cef_errorcode_t _retval = CefURLRequestCppToC::Get(self)->GetRequestError();
121 
122   // Return type: simple
123   return _retval;
124 }
125 
126 cef_response_t* CEF_CALLBACK
urlrequest_get_response(struct _cef_urlrequest_t * self)127 urlrequest_get_response(struct _cef_urlrequest_t* self) {
128   shutdown_checker::AssertNotShutdown();
129 
130   // AUTO-GENERATED CONTENT - DELETE THIS COMMENT BEFORE MODIFYING
131 
132   DCHECK(self);
133   if (!self)
134     return NULL;
135 
136   // Execute
137   CefRefPtr<CefResponse> _retval =
138       CefURLRequestCppToC::Get(self)->GetResponse();
139 
140   // Return type: refptr_same
141   return CefResponseCppToC::Wrap(_retval);
142 }
143 
144 int CEF_CALLBACK
urlrequest_response_was_cached(struct _cef_urlrequest_t * self)145 urlrequest_response_was_cached(struct _cef_urlrequest_t* self) {
146   shutdown_checker::AssertNotShutdown();
147 
148   // AUTO-GENERATED CONTENT - DELETE THIS COMMENT BEFORE MODIFYING
149 
150   DCHECK(self);
151   if (!self)
152     return 0;
153 
154   // Execute
155   bool _retval = CefURLRequestCppToC::Get(self)->ResponseWasCached();
156 
157   // Return type: bool
158   return _retval;
159 }
160 
urlrequest_cancel(struct _cef_urlrequest_t * self)161 void CEF_CALLBACK urlrequest_cancel(struct _cef_urlrequest_t* self) {
162   shutdown_checker::AssertNotShutdown();
163 
164   // AUTO-GENERATED CONTENT - DELETE THIS COMMENT BEFORE MODIFYING
165 
166   DCHECK(self);
167   if (!self)
168     return;
169 
170   // Execute
171   CefURLRequestCppToC::Get(self)->Cancel();
172 }
173 
174 }  // namespace
175 
176 // CONSTRUCTOR - Do not edit by hand.
177 
CefURLRequestCppToC()178 CefURLRequestCppToC::CefURLRequestCppToC() {
179   GetStruct()->get_request = urlrequest_get_request;
180   GetStruct()->get_client = urlrequest_get_client;
181   GetStruct()->get_request_status = urlrequest_get_request_status;
182   GetStruct()->get_request_error = urlrequest_get_request_error;
183   GetStruct()->get_response = urlrequest_get_response;
184   GetStruct()->response_was_cached = urlrequest_response_was_cached;
185   GetStruct()->cancel = urlrequest_cancel;
186 }
187 
188 // DESTRUCTOR - Do not edit by hand.
189 
~CefURLRequestCppToC()190 CefURLRequestCppToC::~CefURLRequestCppToC() {
191   shutdown_checker::AssertNotShutdown();
192 }
193 
194 template <>
195 CefRefPtr<CefURLRequest>
196 CefCppToCRefCounted<CefURLRequestCppToC, CefURLRequest, cef_urlrequest_t>::
UnwrapDerived(CefWrapperType type,cef_urlrequest_t * s)197     UnwrapDerived(CefWrapperType type, cef_urlrequest_t* s) {
198   NOTREACHED() << "Unexpected class type: " << type;
199   return nullptr;
200 }
201 
202 template <>
203 CefWrapperType CefCppToCRefCounted<CefURLRequestCppToC,
204                                    CefURLRequest,
205                                    cef_urlrequest_t>::kWrapperType =
206     WT_URLREQUEST;
207