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