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