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=c4cad301694f35ea716d7c4376252140fcb0d78f$
13 //
14
15 #include "libcef_dll/cpptoc/domdocument_cpptoc.h"
16 #include "libcef_dll/cpptoc/domnode_cpptoc.h"
17 #include "libcef_dll/shutdown_checker.h"
18
19 namespace {
20
21 // MEMBER FUNCTIONS - Body may be edited by hand.
22
23 cef_dom_document_type_t CEF_CALLBACK
domdocument_get_type(struct _cef_domdocument_t * self)24 domdocument_get_type(struct _cef_domdocument_t* self) {
25 shutdown_checker::AssertNotShutdown();
26
27 // AUTO-GENERATED CONTENT - DELETE THIS COMMENT BEFORE MODIFYING
28
29 DCHECK(self);
30 if (!self)
31 return DOM_DOCUMENT_TYPE_UNKNOWN;
32
33 // Execute
34 cef_dom_document_type_t _retval = CefDOMDocumentCppToC::Get(self)->GetType();
35
36 // Return type: simple
37 return _retval;
38 }
39
40 struct _cef_domnode_t* CEF_CALLBACK
domdocument_get_document(struct _cef_domdocument_t * self)41 domdocument_get_document(struct _cef_domdocument_t* self) {
42 shutdown_checker::AssertNotShutdown();
43
44 // AUTO-GENERATED CONTENT - DELETE THIS COMMENT BEFORE MODIFYING
45
46 DCHECK(self);
47 if (!self)
48 return NULL;
49
50 // Execute
51 CefRefPtr<CefDOMNode> _retval =
52 CefDOMDocumentCppToC::Get(self)->GetDocument();
53
54 // Return type: refptr_same
55 return CefDOMNodeCppToC::Wrap(_retval);
56 }
57
58 struct _cef_domnode_t* CEF_CALLBACK
domdocument_get_body(struct _cef_domdocument_t * self)59 domdocument_get_body(struct _cef_domdocument_t* self) {
60 shutdown_checker::AssertNotShutdown();
61
62 // AUTO-GENERATED CONTENT - DELETE THIS COMMENT BEFORE MODIFYING
63
64 DCHECK(self);
65 if (!self)
66 return NULL;
67
68 // Execute
69 CefRefPtr<CefDOMNode> _retval = CefDOMDocumentCppToC::Get(self)->GetBody();
70
71 // Return type: refptr_same
72 return CefDOMNodeCppToC::Wrap(_retval);
73 }
74
75 struct _cef_domnode_t* CEF_CALLBACK
domdocument_get_head(struct _cef_domdocument_t * self)76 domdocument_get_head(struct _cef_domdocument_t* self) {
77 shutdown_checker::AssertNotShutdown();
78
79 // AUTO-GENERATED CONTENT - DELETE THIS COMMENT BEFORE MODIFYING
80
81 DCHECK(self);
82 if (!self)
83 return NULL;
84
85 // Execute
86 CefRefPtr<CefDOMNode> _retval = CefDOMDocumentCppToC::Get(self)->GetHead();
87
88 // Return type: refptr_same
89 return CefDOMNodeCppToC::Wrap(_retval);
90 }
91
92 cef_string_userfree_t CEF_CALLBACK
domdocument_get_title(struct _cef_domdocument_t * self)93 domdocument_get_title(struct _cef_domdocument_t* self) {
94 shutdown_checker::AssertNotShutdown();
95
96 // AUTO-GENERATED CONTENT - DELETE THIS COMMENT BEFORE MODIFYING
97
98 DCHECK(self);
99 if (!self)
100 return NULL;
101
102 // Execute
103 CefString _retval = CefDOMDocumentCppToC::Get(self)->GetTitle();
104
105 // Return type: string
106 return _retval.DetachToUserFree();
107 }
108
109 struct _cef_domnode_t* CEF_CALLBACK
domdocument_get_element_by_id(struct _cef_domdocument_t * self,const cef_string_t * id)110 domdocument_get_element_by_id(struct _cef_domdocument_t* self,
111 const cef_string_t* id) {
112 shutdown_checker::AssertNotShutdown();
113
114 // AUTO-GENERATED CONTENT - DELETE THIS COMMENT BEFORE MODIFYING
115
116 DCHECK(self);
117 if (!self)
118 return NULL;
119 // Verify param: id; type: string_byref_const
120 DCHECK(id);
121 if (!id)
122 return NULL;
123
124 // Execute
125 CefRefPtr<CefDOMNode> _retval =
126 CefDOMDocumentCppToC::Get(self)->GetElementById(CefString(id));
127
128 // Return type: refptr_same
129 return CefDOMNodeCppToC::Wrap(_retval);
130 }
131
132 struct _cef_domnode_t* CEF_CALLBACK
domdocument_get_focused_node(struct _cef_domdocument_t * self)133 domdocument_get_focused_node(struct _cef_domdocument_t* self) {
134 shutdown_checker::AssertNotShutdown();
135
136 // AUTO-GENERATED CONTENT - DELETE THIS COMMENT BEFORE MODIFYING
137
138 DCHECK(self);
139 if (!self)
140 return NULL;
141
142 // Execute
143 CefRefPtr<CefDOMNode> _retval =
144 CefDOMDocumentCppToC::Get(self)->GetFocusedNode();
145
146 // Return type: refptr_same
147 return CefDOMNodeCppToC::Wrap(_retval);
148 }
149
domdocument_has_selection(struct _cef_domdocument_t * self)150 int CEF_CALLBACK domdocument_has_selection(struct _cef_domdocument_t* self) {
151 shutdown_checker::AssertNotShutdown();
152
153 // AUTO-GENERATED CONTENT - DELETE THIS COMMENT BEFORE MODIFYING
154
155 DCHECK(self);
156 if (!self)
157 return 0;
158
159 // Execute
160 bool _retval = CefDOMDocumentCppToC::Get(self)->HasSelection();
161
162 // Return type: bool
163 return _retval;
164 }
165
166 int CEF_CALLBACK
domdocument_get_selection_start_offset(struct _cef_domdocument_t * self)167 domdocument_get_selection_start_offset(struct _cef_domdocument_t* self) {
168 shutdown_checker::AssertNotShutdown();
169
170 // AUTO-GENERATED CONTENT - DELETE THIS COMMENT BEFORE MODIFYING
171
172 DCHECK(self);
173 if (!self)
174 return 0;
175
176 // Execute
177 int _retval = CefDOMDocumentCppToC::Get(self)->GetSelectionStartOffset();
178
179 // Return type: simple
180 return _retval;
181 }
182
183 int CEF_CALLBACK
domdocument_get_selection_end_offset(struct _cef_domdocument_t * self)184 domdocument_get_selection_end_offset(struct _cef_domdocument_t* self) {
185 shutdown_checker::AssertNotShutdown();
186
187 // AUTO-GENERATED CONTENT - DELETE THIS COMMENT BEFORE MODIFYING
188
189 DCHECK(self);
190 if (!self)
191 return 0;
192
193 // Execute
194 int _retval = CefDOMDocumentCppToC::Get(self)->GetSelectionEndOffset();
195
196 // Return type: simple
197 return _retval;
198 }
199
200 cef_string_userfree_t CEF_CALLBACK
domdocument_get_selection_as_markup(struct _cef_domdocument_t * self)201 domdocument_get_selection_as_markup(struct _cef_domdocument_t* self) {
202 shutdown_checker::AssertNotShutdown();
203
204 // AUTO-GENERATED CONTENT - DELETE THIS COMMENT BEFORE MODIFYING
205
206 DCHECK(self);
207 if (!self)
208 return NULL;
209
210 // Execute
211 CefString _retval = CefDOMDocumentCppToC::Get(self)->GetSelectionAsMarkup();
212
213 // Return type: string
214 return _retval.DetachToUserFree();
215 }
216
217 cef_string_userfree_t CEF_CALLBACK
domdocument_get_selection_as_text(struct _cef_domdocument_t * self)218 domdocument_get_selection_as_text(struct _cef_domdocument_t* self) {
219 shutdown_checker::AssertNotShutdown();
220
221 // AUTO-GENERATED CONTENT - DELETE THIS COMMENT BEFORE MODIFYING
222
223 DCHECK(self);
224 if (!self)
225 return NULL;
226
227 // Execute
228 CefString _retval = CefDOMDocumentCppToC::Get(self)->GetSelectionAsText();
229
230 // Return type: string
231 return _retval.DetachToUserFree();
232 }
233
234 cef_string_userfree_t CEF_CALLBACK
domdocument_get_base_url(struct _cef_domdocument_t * self)235 domdocument_get_base_url(struct _cef_domdocument_t* self) {
236 shutdown_checker::AssertNotShutdown();
237
238 // AUTO-GENERATED CONTENT - DELETE THIS COMMENT BEFORE MODIFYING
239
240 DCHECK(self);
241 if (!self)
242 return NULL;
243
244 // Execute
245 CefString _retval = CefDOMDocumentCppToC::Get(self)->GetBaseURL();
246
247 // Return type: string
248 return _retval.DetachToUserFree();
249 }
250
251 cef_string_userfree_t CEF_CALLBACK
domdocument_get_complete_url(struct _cef_domdocument_t * self,const cef_string_t * partialURL)252 domdocument_get_complete_url(struct _cef_domdocument_t* self,
253 const cef_string_t* partialURL) {
254 shutdown_checker::AssertNotShutdown();
255
256 // AUTO-GENERATED CONTENT - DELETE THIS COMMENT BEFORE MODIFYING
257
258 DCHECK(self);
259 if (!self)
260 return NULL;
261 // Verify param: partialURL; type: string_byref_const
262 DCHECK(partialURL);
263 if (!partialURL)
264 return NULL;
265
266 // Execute
267 CefString _retval =
268 CefDOMDocumentCppToC::Get(self)->GetCompleteURL(CefString(partialURL));
269
270 // Return type: string
271 return _retval.DetachToUserFree();
272 }
273
274 } // namespace
275
276 // CONSTRUCTOR - Do not edit by hand.
277
CefDOMDocumentCppToC()278 CefDOMDocumentCppToC::CefDOMDocumentCppToC() {
279 GetStruct()->get_type = domdocument_get_type;
280 GetStruct()->get_document = domdocument_get_document;
281 GetStruct()->get_body = domdocument_get_body;
282 GetStruct()->get_head = domdocument_get_head;
283 GetStruct()->get_title = domdocument_get_title;
284 GetStruct()->get_element_by_id = domdocument_get_element_by_id;
285 GetStruct()->get_focused_node = domdocument_get_focused_node;
286 GetStruct()->has_selection = domdocument_has_selection;
287 GetStruct()->get_selection_start_offset =
288 domdocument_get_selection_start_offset;
289 GetStruct()->get_selection_end_offset = domdocument_get_selection_end_offset;
290 GetStruct()->get_selection_as_markup = domdocument_get_selection_as_markup;
291 GetStruct()->get_selection_as_text = domdocument_get_selection_as_text;
292 GetStruct()->get_base_url = domdocument_get_base_url;
293 GetStruct()->get_complete_url = domdocument_get_complete_url;
294 }
295
296 // DESTRUCTOR - Do not edit by hand.
297
~CefDOMDocumentCppToC()298 CefDOMDocumentCppToC::~CefDOMDocumentCppToC() {
299 shutdown_checker::AssertNotShutdown();
300 }
301
302 template <>
303 CefRefPtr<CefDOMDocument>
304 CefCppToCRefCounted<CefDOMDocumentCppToC, CefDOMDocument, cef_domdocument_t>::
UnwrapDerived(CefWrapperType type,cef_domdocument_t * s)305 UnwrapDerived(CefWrapperType type, cef_domdocument_t* s) {
306 NOTREACHED() << "Unexpected class type: " << type;
307 return nullptr;
308 }
309
310 template <>
311 CefWrapperType CefCppToCRefCounted<CefDOMDocumentCppToC,
312 CefDOMDocument,
313 cef_domdocument_t>::kWrapperType =
314 WT_DOMDOCUMENT;
315