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=e4497fd62570371469c3b8d242005add2099e463$
13 //
14
15 #include "libcef_dll/ctocpp/browser_ctocpp.h"
16 #include <algorithm>
17 #include "libcef_dll/ctocpp/browser_host_ctocpp.h"
18 #include "libcef_dll/ctocpp/frame_ctocpp.h"
19 #include "libcef_dll/shutdown_checker.h"
20 #include "libcef_dll/transfer_util.h"
21
22 // VIRTUAL METHODS - Body may be edited by hand.
23
IsValid()24 NO_SANITIZE("cfi-icall") bool CefBrowserCToCpp::IsValid() {
25 shutdown_checker::AssertNotShutdown();
26
27 cef_browser_t* _struct = GetStruct();
28 if (CEF_MEMBER_MISSING(_struct, is_valid))
29 return false;
30
31 // AUTO-GENERATED CONTENT - DELETE THIS COMMENT BEFORE MODIFYING
32
33 // Execute
34 int _retval = _struct->is_valid(_struct);
35
36 // Return type: bool
37 return _retval ? true : false;
38 }
39
GetHost()40 NO_SANITIZE("cfi-icall") CefRefPtr<CefBrowserHost> CefBrowserCToCpp::GetHost() {
41 shutdown_checker::AssertNotShutdown();
42
43 cef_browser_t* _struct = GetStruct();
44 if (CEF_MEMBER_MISSING(_struct, get_host))
45 return nullptr;
46
47 // AUTO-GENERATED CONTENT - DELETE THIS COMMENT BEFORE MODIFYING
48
49 // Execute
50 cef_browser_host_t* _retval = _struct->get_host(_struct);
51
52 // Return type: refptr_same
53 return CefBrowserHostCToCpp::Wrap(_retval);
54 }
55
CanGoBack()56 NO_SANITIZE("cfi-icall") bool CefBrowserCToCpp::CanGoBack() {
57 shutdown_checker::AssertNotShutdown();
58
59 cef_browser_t* _struct = GetStruct();
60 if (CEF_MEMBER_MISSING(_struct, can_go_back))
61 return false;
62
63 // AUTO-GENERATED CONTENT - DELETE THIS COMMENT BEFORE MODIFYING
64
65 // Execute
66 int _retval = _struct->can_go_back(_struct);
67
68 // Return type: bool
69 return _retval ? true : false;
70 }
71
GoBack()72 NO_SANITIZE("cfi-icall") void CefBrowserCToCpp::GoBack() {
73 shutdown_checker::AssertNotShutdown();
74
75 cef_browser_t* _struct = GetStruct();
76 if (CEF_MEMBER_MISSING(_struct, go_back))
77 return;
78
79 // AUTO-GENERATED CONTENT - DELETE THIS COMMENT BEFORE MODIFYING
80
81 // Execute
82 _struct->go_back(_struct);
83 }
84
CanGoForward()85 NO_SANITIZE("cfi-icall") bool CefBrowserCToCpp::CanGoForward() {
86 shutdown_checker::AssertNotShutdown();
87
88 cef_browser_t* _struct = GetStruct();
89 if (CEF_MEMBER_MISSING(_struct, can_go_forward))
90 return false;
91
92 // AUTO-GENERATED CONTENT - DELETE THIS COMMENT BEFORE MODIFYING
93
94 // Execute
95 int _retval = _struct->can_go_forward(_struct);
96
97 // Return type: bool
98 return _retval ? true : false;
99 }
100
GoForward()101 NO_SANITIZE("cfi-icall") void CefBrowserCToCpp::GoForward() {
102 shutdown_checker::AssertNotShutdown();
103
104 cef_browser_t* _struct = GetStruct();
105 if (CEF_MEMBER_MISSING(_struct, go_forward))
106 return;
107
108 // AUTO-GENERATED CONTENT - DELETE THIS COMMENT BEFORE MODIFYING
109
110 // Execute
111 _struct->go_forward(_struct);
112 }
113
IsLoading()114 NO_SANITIZE("cfi-icall") bool CefBrowserCToCpp::IsLoading() {
115 shutdown_checker::AssertNotShutdown();
116
117 cef_browser_t* _struct = GetStruct();
118 if (CEF_MEMBER_MISSING(_struct, is_loading))
119 return false;
120
121 // AUTO-GENERATED CONTENT - DELETE THIS COMMENT BEFORE MODIFYING
122
123 // Execute
124 int _retval = _struct->is_loading(_struct);
125
126 // Return type: bool
127 return _retval ? true : false;
128 }
129
Reload()130 NO_SANITIZE("cfi-icall") void CefBrowserCToCpp::Reload() {
131 shutdown_checker::AssertNotShutdown();
132
133 cef_browser_t* _struct = GetStruct();
134 if (CEF_MEMBER_MISSING(_struct, reload))
135 return;
136
137 // AUTO-GENERATED CONTENT - DELETE THIS COMMENT BEFORE MODIFYING
138
139 // Execute
140 _struct->reload(_struct);
141 }
142
ReloadIgnoreCache()143 NO_SANITIZE("cfi-icall") void CefBrowserCToCpp::ReloadIgnoreCache() {
144 shutdown_checker::AssertNotShutdown();
145
146 cef_browser_t* _struct = GetStruct();
147 if (CEF_MEMBER_MISSING(_struct, reload_ignore_cache))
148 return;
149
150 // AUTO-GENERATED CONTENT - DELETE THIS COMMENT BEFORE MODIFYING
151
152 // Execute
153 _struct->reload_ignore_cache(_struct);
154 }
155
StopLoad()156 NO_SANITIZE("cfi-icall") void CefBrowserCToCpp::StopLoad() {
157 shutdown_checker::AssertNotShutdown();
158
159 cef_browser_t* _struct = GetStruct();
160 if (CEF_MEMBER_MISSING(_struct, stop_load))
161 return;
162
163 // AUTO-GENERATED CONTENT - DELETE THIS COMMENT BEFORE MODIFYING
164
165 // Execute
166 _struct->stop_load(_struct);
167 }
168
GetIdentifier()169 NO_SANITIZE("cfi-icall") int CefBrowserCToCpp::GetIdentifier() {
170 shutdown_checker::AssertNotShutdown();
171
172 cef_browser_t* _struct = GetStruct();
173 if (CEF_MEMBER_MISSING(_struct, get_identifier))
174 return 0;
175
176 // AUTO-GENERATED CONTENT - DELETE THIS COMMENT BEFORE MODIFYING
177
178 // Execute
179 int _retval = _struct->get_identifier(_struct);
180
181 // Return type: simple
182 return _retval;
183 }
184
185 NO_SANITIZE("cfi-icall")
IsSame(CefRefPtr<CefBrowser> that)186 bool CefBrowserCToCpp::IsSame(CefRefPtr<CefBrowser> that) {
187 shutdown_checker::AssertNotShutdown();
188
189 cef_browser_t* _struct = GetStruct();
190 if (CEF_MEMBER_MISSING(_struct, is_same))
191 return false;
192
193 // AUTO-GENERATED CONTENT - DELETE THIS COMMENT BEFORE MODIFYING
194
195 // Verify param: that; type: refptr_same
196 DCHECK(that.get());
197 if (!that.get())
198 return false;
199
200 // Execute
201 int _retval = _struct->is_same(_struct, CefBrowserCToCpp::Unwrap(that));
202
203 // Return type: bool
204 return _retval ? true : false;
205 }
206
IsPopup()207 NO_SANITIZE("cfi-icall") bool CefBrowserCToCpp::IsPopup() {
208 shutdown_checker::AssertNotShutdown();
209
210 cef_browser_t* _struct = GetStruct();
211 if (CEF_MEMBER_MISSING(_struct, is_popup))
212 return false;
213
214 // AUTO-GENERATED CONTENT - DELETE THIS COMMENT BEFORE MODIFYING
215
216 // Execute
217 int _retval = _struct->is_popup(_struct);
218
219 // Return type: bool
220 return _retval ? true : false;
221 }
222
HasDocument()223 NO_SANITIZE("cfi-icall") bool CefBrowserCToCpp::HasDocument() {
224 shutdown_checker::AssertNotShutdown();
225
226 cef_browser_t* _struct = GetStruct();
227 if (CEF_MEMBER_MISSING(_struct, has_document))
228 return false;
229
230 // AUTO-GENERATED CONTENT - DELETE THIS COMMENT BEFORE MODIFYING
231
232 // Execute
233 int _retval = _struct->has_document(_struct);
234
235 // Return type: bool
236 return _retval ? true : false;
237 }
238
GetMainFrame()239 NO_SANITIZE("cfi-icall") CefRefPtr<CefFrame> CefBrowserCToCpp::GetMainFrame() {
240 shutdown_checker::AssertNotShutdown();
241
242 cef_browser_t* _struct = GetStruct();
243 if (CEF_MEMBER_MISSING(_struct, get_main_frame))
244 return nullptr;
245
246 // AUTO-GENERATED CONTENT - DELETE THIS COMMENT BEFORE MODIFYING
247
248 // Execute
249 cef_frame_t* _retval = _struct->get_main_frame(_struct);
250
251 // Return type: refptr_same
252 return CefFrameCToCpp::Wrap(_retval);
253 }
254
255 NO_SANITIZE("cfi-icall")
GetFocusedFrame()256 CefRefPtr<CefFrame> CefBrowserCToCpp::GetFocusedFrame() {
257 shutdown_checker::AssertNotShutdown();
258
259 cef_browser_t* _struct = GetStruct();
260 if (CEF_MEMBER_MISSING(_struct, get_focused_frame))
261 return nullptr;
262
263 // AUTO-GENERATED CONTENT - DELETE THIS COMMENT BEFORE MODIFYING
264
265 // Execute
266 cef_frame_t* _retval = _struct->get_focused_frame(_struct);
267
268 // Return type: refptr_same
269 return CefFrameCToCpp::Wrap(_retval);
270 }
271
272 NO_SANITIZE("cfi-icall")
GetFrame(int64 identifier)273 CefRefPtr<CefFrame> CefBrowserCToCpp::GetFrame(int64 identifier) {
274 shutdown_checker::AssertNotShutdown();
275
276 cef_browser_t* _struct = GetStruct();
277 if (CEF_MEMBER_MISSING(_struct, get_frame_byident))
278 return nullptr;
279
280 // AUTO-GENERATED CONTENT - DELETE THIS COMMENT BEFORE MODIFYING
281
282 // Execute
283 cef_frame_t* _retval = _struct->get_frame_byident(_struct, identifier);
284
285 // Return type: refptr_same
286 return CefFrameCToCpp::Wrap(_retval);
287 }
288
289 NO_SANITIZE("cfi-icall")
GetFrame(const CefString & name)290 CefRefPtr<CefFrame> CefBrowserCToCpp::GetFrame(const CefString& name) {
291 shutdown_checker::AssertNotShutdown();
292
293 cef_browser_t* _struct = GetStruct();
294 if (CEF_MEMBER_MISSING(_struct, get_frame))
295 return nullptr;
296
297 // AUTO-GENERATED CONTENT - DELETE THIS COMMENT BEFORE MODIFYING
298
299 // Unverified params: name
300
301 // Execute
302 cef_frame_t* _retval = _struct->get_frame(_struct, name.GetStruct());
303
304 // Return type: refptr_same
305 return CefFrameCToCpp::Wrap(_retval);
306 }
307
GetFrameCount()308 NO_SANITIZE("cfi-icall") size_t CefBrowserCToCpp::GetFrameCount() {
309 shutdown_checker::AssertNotShutdown();
310
311 cef_browser_t* _struct = GetStruct();
312 if (CEF_MEMBER_MISSING(_struct, get_frame_count))
313 return 0;
314
315 // AUTO-GENERATED CONTENT - DELETE THIS COMMENT BEFORE MODIFYING
316
317 // Execute
318 size_t _retval = _struct->get_frame_count(_struct);
319
320 // Return type: simple
321 return _retval;
322 }
323
324 NO_SANITIZE("cfi-icall")
GetFrameIdentifiers(std::vector<int64> & identifiers)325 void CefBrowserCToCpp::GetFrameIdentifiers(std::vector<int64>& identifiers) {
326 shutdown_checker::AssertNotShutdown();
327
328 cef_browser_t* _struct = GetStruct();
329 if (CEF_MEMBER_MISSING(_struct, get_frame_identifiers))
330 return;
331
332 // AUTO-GENERATED CONTENT - DELETE THIS COMMENT BEFORE MODIFYING
333
334 // Translate param: identifiers; type: simple_vec_byref
335 size_t identifiersSize = identifiers.size();
336 size_t identifiersCount = std::max(GetFrameCount(), identifiersSize);
337 int64* identifiersList = NULL;
338 if (identifiersCount > 0) {
339 identifiersList = new int64[identifiersCount];
340 DCHECK(identifiersList);
341 if (identifiersList) {
342 memset(identifiersList, 0, sizeof(int64) * identifiersCount);
343 }
344 if (identifiersList && identifiersSize > 0) {
345 for (size_t i = 0; i < identifiersSize; ++i) {
346 identifiersList[i] = identifiers[i];
347 }
348 }
349 }
350
351 // Execute
352 _struct->get_frame_identifiers(_struct, &identifiersCount, identifiersList);
353
354 // Restore param:identifiers; type: simple_vec_byref
355 identifiers.clear();
356 if (identifiersCount > 0 && identifiersList) {
357 for (size_t i = 0; i < identifiersCount; ++i) {
358 identifiers.push_back(identifiersList[i]);
359 }
360 delete[] identifiersList;
361 }
362 }
363
364 NO_SANITIZE("cfi-icall")
GetFrameNames(std::vector<CefString> & names)365 void CefBrowserCToCpp::GetFrameNames(std::vector<CefString>& names) {
366 shutdown_checker::AssertNotShutdown();
367
368 cef_browser_t* _struct = GetStruct();
369 if (CEF_MEMBER_MISSING(_struct, get_frame_names))
370 return;
371
372 // AUTO-GENERATED CONTENT - DELETE THIS COMMENT BEFORE MODIFYING
373
374 // Translate param: names; type: string_vec_byref
375 cef_string_list_t namesList = cef_string_list_alloc();
376 DCHECK(namesList);
377 if (namesList)
378 transfer_string_list_contents(names, namesList);
379
380 // Execute
381 _struct->get_frame_names(_struct, namesList);
382
383 // Restore param:names; type: string_vec_byref
384 if (namesList) {
385 names.clear();
386 transfer_string_list_contents(namesList, names);
387 cef_string_list_free(namesList);
388 }
389 }
390
391 // CONSTRUCTOR - Do not edit by hand.
392
CefBrowserCToCpp()393 CefBrowserCToCpp::CefBrowserCToCpp() {}
394
395 // DESTRUCTOR - Do not edit by hand.
396
~CefBrowserCToCpp()397 CefBrowserCToCpp::~CefBrowserCToCpp() {
398 shutdown_checker::AssertNotShutdown();
399 }
400
401 template <>
402 cef_browser_t*
UnwrapDerived(CefWrapperType type,CefBrowser * c)403 CefCToCppRefCounted<CefBrowserCToCpp, CefBrowser, cef_browser_t>::UnwrapDerived(
404 CefWrapperType type,
405 CefBrowser* c) {
406 NOTREACHED() << "Unexpected class type: " << type;
407 return nullptr;
408 }
409
410 template <>
411 CefWrapperType CefCToCppRefCounted<CefBrowserCToCpp,
412 CefBrowser,
413 cef_browser_t>::kWrapperType = WT_BROWSER;
414