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=db92b5330f0b984051a202144f77b389501a260e$
13 //
14
15 #include "libcef_dll/cpptoc/urlrequest_client_cpptoc.h"
16 #include "libcef_dll/ctocpp/auth_callback_ctocpp.h"
17 #include "libcef_dll/ctocpp/urlrequest_ctocpp.h"
18 #include "libcef_dll/shutdown_checker.h"
19
20 namespace {
21
22 // MEMBER FUNCTIONS - Body may be edited by hand.
23
24 void CEF_CALLBACK
urlrequest_client_on_request_complete(struct _cef_urlrequest_client_t * self,cef_urlrequest_t * request)25 urlrequest_client_on_request_complete(struct _cef_urlrequest_client_t* self,
26 cef_urlrequest_t* request) {
27 shutdown_checker::AssertNotShutdown();
28
29 // AUTO-GENERATED CONTENT - DELETE THIS COMMENT BEFORE MODIFYING
30
31 DCHECK(self);
32 if (!self)
33 return;
34 // Verify param: request; type: refptr_diff
35 DCHECK(request);
36 if (!request)
37 return;
38
39 // Execute
40 CefURLRequestClientCppToC::Get(self)->OnRequestComplete(
41 CefURLRequestCToCpp::Wrap(request));
42 }
43
44 void CEF_CALLBACK
urlrequest_client_on_upload_progress(struct _cef_urlrequest_client_t * self,cef_urlrequest_t * request,int64 current,int64 total)45 urlrequest_client_on_upload_progress(struct _cef_urlrequest_client_t* self,
46 cef_urlrequest_t* request,
47 int64 current,
48 int64 total) {
49 shutdown_checker::AssertNotShutdown();
50
51 // AUTO-GENERATED CONTENT - DELETE THIS COMMENT BEFORE MODIFYING
52
53 DCHECK(self);
54 if (!self)
55 return;
56 // Verify param: request; type: refptr_diff
57 DCHECK(request);
58 if (!request)
59 return;
60
61 // Execute
62 CefURLRequestClientCppToC::Get(self)->OnUploadProgress(
63 CefURLRequestCToCpp::Wrap(request), current, total);
64 }
65
66 void CEF_CALLBACK
urlrequest_client_on_download_progress(struct _cef_urlrequest_client_t * self,cef_urlrequest_t * request,int64 current,int64 total)67 urlrequest_client_on_download_progress(struct _cef_urlrequest_client_t* self,
68 cef_urlrequest_t* request,
69 int64 current,
70 int64 total) {
71 shutdown_checker::AssertNotShutdown();
72
73 // AUTO-GENERATED CONTENT - DELETE THIS COMMENT BEFORE MODIFYING
74
75 DCHECK(self);
76 if (!self)
77 return;
78 // Verify param: request; type: refptr_diff
79 DCHECK(request);
80 if (!request)
81 return;
82
83 // Execute
84 CefURLRequestClientCppToC::Get(self)->OnDownloadProgress(
85 CefURLRequestCToCpp::Wrap(request), current, total);
86 }
87
88 void CEF_CALLBACK
urlrequest_client_on_download_data(struct _cef_urlrequest_client_t * self,cef_urlrequest_t * request,const void * data,size_t data_length)89 urlrequest_client_on_download_data(struct _cef_urlrequest_client_t* self,
90 cef_urlrequest_t* request,
91 const void* data,
92 size_t data_length) {
93 shutdown_checker::AssertNotShutdown();
94
95 // AUTO-GENERATED CONTENT - DELETE THIS COMMENT BEFORE MODIFYING
96
97 DCHECK(self);
98 if (!self)
99 return;
100 // Verify param: request; type: refptr_diff
101 DCHECK(request);
102 if (!request)
103 return;
104 // Verify param: data; type: simple_byaddr
105 DCHECK(data);
106 if (!data)
107 return;
108
109 // Execute
110 CefURLRequestClientCppToC::Get(self)->OnDownloadData(
111 CefURLRequestCToCpp::Wrap(request), data, data_length);
112 }
113
114 int CEF_CALLBACK
urlrequest_client_get_auth_credentials(struct _cef_urlrequest_client_t * self,int isProxy,const cef_string_t * host,int port,const cef_string_t * realm,const cef_string_t * scheme,cef_auth_callback_t * callback)115 urlrequest_client_get_auth_credentials(struct _cef_urlrequest_client_t* self,
116 int isProxy,
117 const cef_string_t* host,
118 int port,
119 const cef_string_t* realm,
120 const cef_string_t* scheme,
121 cef_auth_callback_t* callback) {
122 shutdown_checker::AssertNotShutdown();
123
124 // AUTO-GENERATED CONTENT - DELETE THIS COMMENT BEFORE MODIFYING
125
126 DCHECK(self);
127 if (!self)
128 return 0;
129 // Verify param: host; type: string_byref_const
130 DCHECK(host);
131 if (!host)
132 return 0;
133 // Verify param: scheme; type: string_byref_const
134 DCHECK(scheme);
135 if (!scheme)
136 return 0;
137 // Verify param: callback; type: refptr_diff
138 DCHECK(callback);
139 if (!callback)
140 return 0;
141 // Unverified params: realm
142
143 // Execute
144 bool _retval = CefURLRequestClientCppToC::Get(self)->GetAuthCredentials(
145 isProxy ? true : false, CefString(host), port, CefString(realm),
146 CefString(scheme), CefAuthCallbackCToCpp::Wrap(callback));
147
148 // Return type: bool
149 return _retval;
150 }
151
152 } // namespace
153
154 // CONSTRUCTOR - Do not edit by hand.
155
CefURLRequestClientCppToC()156 CefURLRequestClientCppToC::CefURLRequestClientCppToC() {
157 GetStruct()->on_request_complete = urlrequest_client_on_request_complete;
158 GetStruct()->on_upload_progress = urlrequest_client_on_upload_progress;
159 GetStruct()->on_download_progress = urlrequest_client_on_download_progress;
160 GetStruct()->on_download_data = urlrequest_client_on_download_data;
161 GetStruct()->get_auth_credentials = urlrequest_client_get_auth_credentials;
162 }
163
164 // DESTRUCTOR - Do not edit by hand.
165
~CefURLRequestClientCppToC()166 CefURLRequestClientCppToC::~CefURLRequestClientCppToC() {
167 shutdown_checker::AssertNotShutdown();
168 }
169
170 template <>
171 CefRefPtr<CefURLRequestClient> CefCppToCRefCounted<
172 CefURLRequestClientCppToC,
173 CefURLRequestClient,
UnwrapDerived(CefWrapperType type,cef_urlrequest_client_t * s)174 cef_urlrequest_client_t>::UnwrapDerived(CefWrapperType type,
175 cef_urlrequest_client_t* s) {
176 NOTREACHED() << "Unexpected class type: " << type;
177 return nullptr;
178 }
179
180 template <>
181 CefWrapperType CefCppToCRefCounted<CefURLRequestClientCppToC,
182 CefURLRequestClient,
183 cef_urlrequest_client_t>::kWrapperType =
184 WT_URLREQUEST_CLIENT;
185