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=2ef239c7779477feb8808f2198e7d2063ab74156$
13 //
14
15 #include "libcef_dll/cpptoc/server_handler_cpptoc.h"
16 #include "libcef_dll/ctocpp/callback_ctocpp.h"
17 #include "libcef_dll/ctocpp/request_ctocpp.h"
18 #include "libcef_dll/ctocpp/server_ctocpp.h"
19 #include "libcef_dll/shutdown_checker.h"
20
21 namespace {
22
23 // MEMBER FUNCTIONS - Body may be edited by hand.
24
25 void CEF_CALLBACK
server_handler_on_server_created(struct _cef_server_handler_t * self,cef_server_t * server)26 server_handler_on_server_created(struct _cef_server_handler_t* self,
27 cef_server_t* server) {
28 shutdown_checker::AssertNotShutdown();
29
30 // AUTO-GENERATED CONTENT - DELETE THIS COMMENT BEFORE MODIFYING
31
32 DCHECK(self);
33 if (!self)
34 return;
35 // Verify param: server; type: refptr_diff
36 DCHECK(server);
37 if (!server)
38 return;
39
40 // Execute
41 CefServerHandlerCppToC::Get(self)->OnServerCreated(
42 CefServerCToCpp::Wrap(server));
43 }
44
45 void CEF_CALLBACK
server_handler_on_server_destroyed(struct _cef_server_handler_t * self,cef_server_t * server)46 server_handler_on_server_destroyed(struct _cef_server_handler_t* self,
47 cef_server_t* server) {
48 shutdown_checker::AssertNotShutdown();
49
50 // AUTO-GENERATED CONTENT - DELETE THIS COMMENT BEFORE MODIFYING
51
52 DCHECK(self);
53 if (!self)
54 return;
55 // Verify param: server; type: refptr_diff
56 DCHECK(server);
57 if (!server)
58 return;
59
60 // Execute
61 CefServerHandlerCppToC::Get(self)->OnServerDestroyed(
62 CefServerCToCpp::Wrap(server));
63 }
64
65 void CEF_CALLBACK
server_handler_on_client_connected(struct _cef_server_handler_t * self,cef_server_t * server,int connection_id)66 server_handler_on_client_connected(struct _cef_server_handler_t* self,
67 cef_server_t* server,
68 int connection_id) {
69 shutdown_checker::AssertNotShutdown();
70
71 // AUTO-GENERATED CONTENT - DELETE THIS COMMENT BEFORE MODIFYING
72
73 DCHECK(self);
74 if (!self)
75 return;
76 // Verify param: server; type: refptr_diff
77 DCHECK(server);
78 if (!server)
79 return;
80
81 // Execute
82 CefServerHandlerCppToC::Get(self)->OnClientConnected(
83 CefServerCToCpp::Wrap(server), connection_id);
84 }
85
86 void CEF_CALLBACK
server_handler_on_client_disconnected(struct _cef_server_handler_t * self,cef_server_t * server,int connection_id)87 server_handler_on_client_disconnected(struct _cef_server_handler_t* self,
88 cef_server_t* server,
89 int connection_id) {
90 shutdown_checker::AssertNotShutdown();
91
92 // AUTO-GENERATED CONTENT - DELETE THIS COMMENT BEFORE MODIFYING
93
94 DCHECK(self);
95 if (!self)
96 return;
97 // Verify param: server; type: refptr_diff
98 DCHECK(server);
99 if (!server)
100 return;
101
102 // Execute
103 CefServerHandlerCppToC::Get(self)->OnClientDisconnected(
104 CefServerCToCpp::Wrap(server), connection_id);
105 }
106
107 void CEF_CALLBACK
server_handler_on_http_request(struct _cef_server_handler_t * self,cef_server_t * server,int connection_id,const cef_string_t * client_address,cef_request_t * request)108 server_handler_on_http_request(struct _cef_server_handler_t* self,
109 cef_server_t* server,
110 int connection_id,
111 const cef_string_t* client_address,
112 cef_request_t* request) {
113 shutdown_checker::AssertNotShutdown();
114
115 // AUTO-GENERATED CONTENT - DELETE THIS COMMENT BEFORE MODIFYING
116
117 DCHECK(self);
118 if (!self)
119 return;
120 // Verify param: server; type: refptr_diff
121 DCHECK(server);
122 if (!server)
123 return;
124 // Verify param: client_address; type: string_byref_const
125 DCHECK(client_address);
126 if (!client_address)
127 return;
128 // Verify param: request; type: refptr_diff
129 DCHECK(request);
130 if (!request)
131 return;
132
133 // Execute
134 CefServerHandlerCppToC::Get(self)->OnHttpRequest(
135 CefServerCToCpp::Wrap(server), connection_id, CefString(client_address),
136 CefRequestCToCpp::Wrap(request));
137 }
138
139 void CEF_CALLBACK
server_handler_on_web_socket_request(struct _cef_server_handler_t * self,cef_server_t * server,int connection_id,const cef_string_t * client_address,cef_request_t * request,cef_callback_t * callback)140 server_handler_on_web_socket_request(struct _cef_server_handler_t* self,
141 cef_server_t* server,
142 int connection_id,
143 const cef_string_t* client_address,
144 cef_request_t* request,
145 cef_callback_t* callback) {
146 shutdown_checker::AssertNotShutdown();
147
148 // AUTO-GENERATED CONTENT - DELETE THIS COMMENT BEFORE MODIFYING
149
150 DCHECK(self);
151 if (!self)
152 return;
153 // Verify param: server; type: refptr_diff
154 DCHECK(server);
155 if (!server)
156 return;
157 // Verify param: client_address; type: string_byref_const
158 DCHECK(client_address);
159 if (!client_address)
160 return;
161 // Verify param: request; type: refptr_diff
162 DCHECK(request);
163 if (!request)
164 return;
165 // Verify param: callback; type: refptr_diff
166 DCHECK(callback);
167 if (!callback)
168 return;
169
170 // Execute
171 CefServerHandlerCppToC::Get(self)->OnWebSocketRequest(
172 CefServerCToCpp::Wrap(server), connection_id, CefString(client_address),
173 CefRequestCToCpp::Wrap(request), CefCallbackCToCpp::Wrap(callback));
174 }
175
176 void CEF_CALLBACK
server_handler_on_web_socket_connected(struct _cef_server_handler_t * self,cef_server_t * server,int connection_id)177 server_handler_on_web_socket_connected(struct _cef_server_handler_t* self,
178 cef_server_t* server,
179 int connection_id) {
180 shutdown_checker::AssertNotShutdown();
181
182 // AUTO-GENERATED CONTENT - DELETE THIS COMMENT BEFORE MODIFYING
183
184 DCHECK(self);
185 if (!self)
186 return;
187 // Verify param: server; type: refptr_diff
188 DCHECK(server);
189 if (!server)
190 return;
191
192 // Execute
193 CefServerHandlerCppToC::Get(self)->OnWebSocketConnected(
194 CefServerCToCpp::Wrap(server), connection_id);
195 }
196
197 void CEF_CALLBACK
server_handler_on_web_socket_message(struct _cef_server_handler_t * self,cef_server_t * server,int connection_id,const void * data,size_t data_size)198 server_handler_on_web_socket_message(struct _cef_server_handler_t* self,
199 cef_server_t* server,
200 int connection_id,
201 const void* data,
202 size_t data_size) {
203 shutdown_checker::AssertNotShutdown();
204
205 // AUTO-GENERATED CONTENT - DELETE THIS COMMENT BEFORE MODIFYING
206
207 DCHECK(self);
208 if (!self)
209 return;
210 // Verify param: server; type: refptr_diff
211 DCHECK(server);
212 if (!server)
213 return;
214 // Verify param: data; type: simple_byaddr
215 DCHECK(data);
216 if (!data)
217 return;
218
219 // Execute
220 CefServerHandlerCppToC::Get(self)->OnWebSocketMessage(
221 CefServerCToCpp::Wrap(server), connection_id, data, data_size);
222 }
223
224 } // namespace
225
226 // CONSTRUCTOR - Do not edit by hand.
227
CefServerHandlerCppToC()228 CefServerHandlerCppToC::CefServerHandlerCppToC() {
229 GetStruct()->on_server_created = server_handler_on_server_created;
230 GetStruct()->on_server_destroyed = server_handler_on_server_destroyed;
231 GetStruct()->on_client_connected = server_handler_on_client_connected;
232 GetStruct()->on_client_disconnected = server_handler_on_client_disconnected;
233 GetStruct()->on_http_request = server_handler_on_http_request;
234 GetStruct()->on_web_socket_request = server_handler_on_web_socket_request;
235 GetStruct()->on_web_socket_connected = server_handler_on_web_socket_connected;
236 GetStruct()->on_web_socket_message = server_handler_on_web_socket_message;
237 }
238
239 // DESTRUCTOR - Do not edit by hand.
240
~CefServerHandlerCppToC()241 CefServerHandlerCppToC::~CefServerHandlerCppToC() {
242 shutdown_checker::AssertNotShutdown();
243 }
244
245 template <>
246 CefRefPtr<CefServerHandler> CefCppToCRefCounted<
247 CefServerHandlerCppToC,
248 CefServerHandler,
UnwrapDerived(CefWrapperType type,cef_server_handler_t * s)249 cef_server_handler_t>::UnwrapDerived(CefWrapperType type,
250 cef_server_handler_t* s) {
251 NOTREACHED() << "Unexpected class type: " << type;
252 return nullptr;
253 }
254
255 template <>
256 CefWrapperType CefCppToCRefCounted<CefServerHandlerCppToC,
257 CefServerHandler,
258 cef_server_handler_t>::kWrapperType =
259 WT_SERVER_HANDLER;
260