• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1 // Copyright (c) 2021 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=8e8daae6a8ed718582045ea42e16906813b77337$
13 //
14 
15 #include "libcef_dll/cpptoc/views/browser_view_delegate_cpptoc.h"
16 #include "libcef_dll/cpptoc/client_cpptoc.h"
17 #include "libcef_dll/ctocpp/browser_ctocpp.h"
18 #include "libcef_dll/ctocpp/views/browser_view_ctocpp.h"
19 #include "libcef_dll/ctocpp/views/view_ctocpp.h"
20 #include "libcef_dll/shutdown_checker.h"
21 
22 namespace {
23 
24 // MEMBER FUNCTIONS - Body may be edited by hand.
25 
browser_view_delegate_on_browser_created(struct _cef_browser_view_delegate_t * self,cef_browser_view_t * browser_view,cef_browser_t * browser)26 void CEF_CALLBACK browser_view_delegate_on_browser_created(
27     struct _cef_browser_view_delegate_t* self,
28     cef_browser_view_t* browser_view,
29     cef_browser_t* browser) {
30   shutdown_checker::AssertNotShutdown();
31 
32   // AUTO-GENERATED CONTENT - DELETE THIS COMMENT BEFORE MODIFYING
33 
34   DCHECK(self);
35   if (!self)
36     return;
37   // Verify param: browser_view; type: refptr_diff
38   DCHECK(browser_view);
39   if (!browser_view)
40     return;
41   // Verify param: browser; type: refptr_diff
42   DCHECK(browser);
43   if (!browser)
44     return;
45 
46   // Execute
47   CefBrowserViewDelegateCppToC::Get(self)->OnBrowserCreated(
48       CefBrowserViewCToCpp::Wrap(browser_view),
49       CefBrowserCToCpp::Wrap(browser));
50 }
51 
browser_view_delegate_on_browser_destroyed(struct _cef_browser_view_delegate_t * self,cef_browser_view_t * browser_view,cef_browser_t * browser)52 void CEF_CALLBACK browser_view_delegate_on_browser_destroyed(
53     struct _cef_browser_view_delegate_t* self,
54     cef_browser_view_t* browser_view,
55     cef_browser_t* browser) {
56   shutdown_checker::AssertNotShutdown();
57 
58   // AUTO-GENERATED CONTENT - DELETE THIS COMMENT BEFORE MODIFYING
59 
60   DCHECK(self);
61   if (!self)
62     return;
63   // Verify param: browser_view; type: refptr_diff
64   DCHECK(browser_view);
65   if (!browser_view)
66     return;
67   // Verify param: browser; type: refptr_diff
68   DCHECK(browser);
69   if (!browser)
70     return;
71 
72   // Execute
73   CefBrowserViewDelegateCppToC::Get(self)->OnBrowserDestroyed(
74       CefBrowserViewCToCpp::Wrap(browser_view),
75       CefBrowserCToCpp::Wrap(browser));
76 }
77 
78 cef_browser_view_delegate_t* CEF_CALLBACK
browser_view_delegate_get_delegate_for_popup_browser_view(struct _cef_browser_view_delegate_t * self,cef_browser_view_t * browser_view,const struct _cef_browser_settings_t * settings,cef_client_t * client,int is_devtools)79 browser_view_delegate_get_delegate_for_popup_browser_view(
80     struct _cef_browser_view_delegate_t* self,
81     cef_browser_view_t* browser_view,
82     const struct _cef_browser_settings_t* settings,
83     cef_client_t* client,
84     int is_devtools) {
85   shutdown_checker::AssertNotShutdown();
86 
87   // AUTO-GENERATED CONTENT - DELETE THIS COMMENT BEFORE MODIFYING
88 
89   DCHECK(self);
90   if (!self)
91     return NULL;
92   // Verify param: browser_view; type: refptr_diff
93   DCHECK(browser_view);
94   if (!browser_view)
95     return NULL;
96   // Verify param: settings; type: struct_byref_const
97   DCHECK(settings);
98   if (!settings)
99     return NULL;
100   // Verify param: client; type: refptr_same
101   DCHECK(client);
102   if (!client)
103     return NULL;
104 
105   // Translate param: settings; type: struct_byref_const
106   CefBrowserSettings settingsObj;
107   if (settings)
108     settingsObj.Set(*settings, false);
109 
110   // Execute
111   CefRefPtr<CefBrowserViewDelegate> _retval =
112       CefBrowserViewDelegateCppToC::Get(self)->GetDelegateForPopupBrowserView(
113           CefBrowserViewCToCpp::Wrap(browser_view), settingsObj,
114           CefClientCppToC::Unwrap(client), is_devtools ? true : false);
115 
116   // Return type: refptr_same
117   return CefBrowserViewDelegateCppToC::Wrap(_retval);
118 }
119 
browser_view_delegate_on_popup_browser_view_created(struct _cef_browser_view_delegate_t * self,cef_browser_view_t * browser_view,cef_browser_view_t * popup_browser_view,int is_devtools)120 int CEF_CALLBACK browser_view_delegate_on_popup_browser_view_created(
121     struct _cef_browser_view_delegate_t* self,
122     cef_browser_view_t* browser_view,
123     cef_browser_view_t* popup_browser_view,
124     int is_devtools) {
125   shutdown_checker::AssertNotShutdown();
126 
127   // AUTO-GENERATED CONTENT - DELETE THIS COMMENT BEFORE MODIFYING
128 
129   DCHECK(self);
130   if (!self)
131     return 0;
132   // Verify param: browser_view; type: refptr_diff
133   DCHECK(browser_view);
134   if (!browser_view)
135     return 0;
136   // Verify param: popup_browser_view; type: refptr_diff
137   DCHECK(popup_browser_view);
138   if (!popup_browser_view)
139     return 0;
140 
141   // Execute
142   bool _retval =
143       CefBrowserViewDelegateCppToC::Get(self)->OnPopupBrowserViewCreated(
144           CefBrowserViewCToCpp::Wrap(browser_view),
145           CefBrowserViewCToCpp::Wrap(popup_browser_view),
146           is_devtools ? true : false);
147 
148   // Return type: bool
149   return _retval;
150 }
151 
152 cef_chrome_toolbar_type_t CEF_CALLBACK
browser_view_delegate_get_chrome_toolbar_type(struct _cef_browser_view_delegate_t * self)153 browser_view_delegate_get_chrome_toolbar_type(
154     struct _cef_browser_view_delegate_t* self) {
155   shutdown_checker::AssertNotShutdown();
156 
157   // AUTO-GENERATED CONTENT - DELETE THIS COMMENT BEFORE MODIFYING
158 
159   DCHECK(self);
160   if (!self)
161     return CEF_CTT_NONE;
162 
163   // Execute
164   cef_chrome_toolbar_type_t _retval =
165       CefBrowserViewDelegateCppToC::Get(self)->GetChromeToolbarType();
166 
167   // Return type: simple
168   return _retval;
169 }
170 
171 cef_size_t CEF_CALLBACK
browser_view_delegate_get_preferred_size(struct _cef_view_delegate_t * self,cef_view_t * view)172 browser_view_delegate_get_preferred_size(struct _cef_view_delegate_t* self,
173                                          cef_view_t* view) {
174   shutdown_checker::AssertNotShutdown();
175 
176   // AUTO-GENERATED CONTENT - DELETE THIS COMMENT BEFORE MODIFYING
177 
178   DCHECK(self);
179   if (!self)
180     return CefSize();
181   // Verify param: view; type: refptr_diff
182   DCHECK(view);
183   if (!view)
184     return CefSize();
185 
186   // Execute
187   cef_size_t _retval = CefBrowserViewDelegateCppToC::Get(
188                            reinterpret_cast<cef_browser_view_delegate_t*>(self))
189                            ->GetPreferredSize(CefViewCToCpp::Wrap(view));
190 
191   // Return type: simple
192   return _retval;
193 }
194 
195 cef_size_t CEF_CALLBACK
browser_view_delegate_get_minimum_size(struct _cef_view_delegate_t * self,cef_view_t * view)196 browser_view_delegate_get_minimum_size(struct _cef_view_delegate_t* self,
197                                        cef_view_t* view) {
198   shutdown_checker::AssertNotShutdown();
199 
200   // AUTO-GENERATED CONTENT - DELETE THIS COMMENT BEFORE MODIFYING
201 
202   DCHECK(self);
203   if (!self)
204     return CefSize();
205   // Verify param: view; type: refptr_diff
206   DCHECK(view);
207   if (!view)
208     return CefSize();
209 
210   // Execute
211   cef_size_t _retval = CefBrowserViewDelegateCppToC::Get(
212                            reinterpret_cast<cef_browser_view_delegate_t*>(self))
213                            ->GetMinimumSize(CefViewCToCpp::Wrap(view));
214 
215   // Return type: simple
216   return _retval;
217 }
218 
219 cef_size_t CEF_CALLBACK
browser_view_delegate_get_maximum_size(struct _cef_view_delegate_t * self,cef_view_t * view)220 browser_view_delegate_get_maximum_size(struct _cef_view_delegate_t* self,
221                                        cef_view_t* view) {
222   shutdown_checker::AssertNotShutdown();
223 
224   // AUTO-GENERATED CONTENT - DELETE THIS COMMENT BEFORE MODIFYING
225 
226   DCHECK(self);
227   if (!self)
228     return CefSize();
229   // Verify param: view; type: refptr_diff
230   DCHECK(view);
231   if (!view)
232     return CefSize();
233 
234   // Execute
235   cef_size_t _retval = CefBrowserViewDelegateCppToC::Get(
236                            reinterpret_cast<cef_browser_view_delegate_t*>(self))
237                            ->GetMaximumSize(CefViewCToCpp::Wrap(view));
238 
239   // Return type: simple
240   return _retval;
241 }
242 
243 int CEF_CALLBACK
browser_view_delegate_get_height_for_width(struct _cef_view_delegate_t * self,cef_view_t * view,int width)244 browser_view_delegate_get_height_for_width(struct _cef_view_delegate_t* self,
245                                            cef_view_t* view,
246                                            int width) {
247   shutdown_checker::AssertNotShutdown();
248 
249   // AUTO-GENERATED CONTENT - DELETE THIS COMMENT BEFORE MODIFYING
250 
251   DCHECK(self);
252   if (!self)
253     return 0;
254   // Verify param: view; type: refptr_diff
255   DCHECK(view);
256   if (!view)
257     return 0;
258 
259   // Execute
260   int _retval = CefBrowserViewDelegateCppToC::Get(
261                     reinterpret_cast<cef_browser_view_delegate_t*>(self))
262                     ->GetHeightForWidth(CefViewCToCpp::Wrap(view), width);
263 
264   // Return type: simple
265   return _retval;
266 }
267 
268 void CEF_CALLBACK
browser_view_delegate_on_parent_view_changed(struct _cef_view_delegate_t * self,cef_view_t * view,int added,cef_view_t * parent)269 browser_view_delegate_on_parent_view_changed(struct _cef_view_delegate_t* self,
270                                              cef_view_t* view,
271                                              int added,
272                                              cef_view_t* parent) {
273   shutdown_checker::AssertNotShutdown();
274 
275   // AUTO-GENERATED CONTENT - DELETE THIS COMMENT BEFORE MODIFYING
276 
277   DCHECK(self);
278   if (!self)
279     return;
280   // Verify param: view; type: refptr_diff
281   DCHECK(view);
282   if (!view)
283     return;
284   // Verify param: parent; type: refptr_diff
285   DCHECK(parent);
286   if (!parent)
287     return;
288 
289   // Execute
290   CefBrowserViewDelegateCppToC::Get(
291       reinterpret_cast<cef_browser_view_delegate_t*>(self))
292       ->OnParentViewChanged(CefViewCToCpp::Wrap(view), added ? true : false,
293                             CefViewCToCpp::Wrap(parent));
294 }
295 
296 void CEF_CALLBACK
browser_view_delegate_on_child_view_changed(struct _cef_view_delegate_t * self,cef_view_t * view,int added,cef_view_t * child)297 browser_view_delegate_on_child_view_changed(struct _cef_view_delegate_t* self,
298                                             cef_view_t* view,
299                                             int added,
300                                             cef_view_t* child) {
301   shutdown_checker::AssertNotShutdown();
302 
303   // AUTO-GENERATED CONTENT - DELETE THIS COMMENT BEFORE MODIFYING
304 
305   DCHECK(self);
306   if (!self)
307     return;
308   // Verify param: view; type: refptr_diff
309   DCHECK(view);
310   if (!view)
311     return;
312   // Verify param: child; type: refptr_diff
313   DCHECK(child);
314   if (!child)
315     return;
316 
317   // Execute
318   CefBrowserViewDelegateCppToC::Get(
319       reinterpret_cast<cef_browser_view_delegate_t*>(self))
320       ->OnChildViewChanged(CefViewCToCpp::Wrap(view), added ? true : false,
321                            CefViewCToCpp::Wrap(child));
322 }
323 
324 void CEF_CALLBACK
browser_view_delegate_on_window_changed(struct _cef_view_delegate_t * self,cef_view_t * view,int added)325 browser_view_delegate_on_window_changed(struct _cef_view_delegate_t* self,
326                                         cef_view_t* view,
327                                         int added) {
328   shutdown_checker::AssertNotShutdown();
329 
330   // AUTO-GENERATED CONTENT - DELETE THIS COMMENT BEFORE MODIFYING
331 
332   DCHECK(self);
333   if (!self)
334     return;
335   // Verify param: view; type: refptr_diff
336   DCHECK(view);
337   if (!view)
338     return;
339 
340   // Execute
341   CefBrowserViewDelegateCppToC::Get(
342       reinterpret_cast<cef_browser_view_delegate_t*>(self))
343       ->OnWindowChanged(CefViewCToCpp::Wrap(view), added ? true : false);
344 }
345 
346 void CEF_CALLBACK
browser_view_delegate_on_focus(struct _cef_view_delegate_t * self,cef_view_t * view)347 browser_view_delegate_on_focus(struct _cef_view_delegate_t* self,
348                                cef_view_t* view) {
349   shutdown_checker::AssertNotShutdown();
350 
351   // AUTO-GENERATED CONTENT - DELETE THIS COMMENT BEFORE MODIFYING
352 
353   DCHECK(self);
354   if (!self)
355     return;
356   // Verify param: view; type: refptr_diff
357   DCHECK(view);
358   if (!view)
359     return;
360 
361   // Execute
362   CefBrowserViewDelegateCppToC::Get(
363       reinterpret_cast<cef_browser_view_delegate_t*>(self))
364       ->OnFocus(CefViewCToCpp::Wrap(view));
365 }
366 
367 void CEF_CALLBACK
browser_view_delegate_on_blur(struct _cef_view_delegate_t * self,cef_view_t * view)368 browser_view_delegate_on_blur(struct _cef_view_delegate_t* self,
369                               cef_view_t* view) {
370   shutdown_checker::AssertNotShutdown();
371 
372   // AUTO-GENERATED CONTENT - DELETE THIS COMMENT BEFORE MODIFYING
373 
374   DCHECK(self);
375   if (!self)
376     return;
377   // Verify param: view; type: refptr_diff
378   DCHECK(view);
379   if (!view)
380     return;
381 
382   // Execute
383   CefBrowserViewDelegateCppToC::Get(
384       reinterpret_cast<cef_browser_view_delegate_t*>(self))
385       ->OnBlur(CefViewCToCpp::Wrap(view));
386 }
387 
388 }  // namespace
389 
390 // CONSTRUCTOR - Do not edit by hand.
391 
CefBrowserViewDelegateCppToC()392 CefBrowserViewDelegateCppToC::CefBrowserViewDelegateCppToC() {
393   GetStruct()->on_browser_created = browser_view_delegate_on_browser_created;
394   GetStruct()->on_browser_destroyed =
395       browser_view_delegate_on_browser_destroyed;
396   GetStruct()->get_delegate_for_popup_browser_view =
397       browser_view_delegate_get_delegate_for_popup_browser_view;
398   GetStruct()->on_popup_browser_view_created =
399       browser_view_delegate_on_popup_browser_view_created;
400   GetStruct()->get_chrome_toolbar_type =
401       browser_view_delegate_get_chrome_toolbar_type;
402   GetStruct()->base.get_preferred_size =
403       browser_view_delegate_get_preferred_size;
404   GetStruct()->base.get_minimum_size = browser_view_delegate_get_minimum_size;
405   GetStruct()->base.get_maximum_size = browser_view_delegate_get_maximum_size;
406   GetStruct()->base.get_height_for_width =
407       browser_view_delegate_get_height_for_width;
408   GetStruct()->base.on_parent_view_changed =
409       browser_view_delegate_on_parent_view_changed;
410   GetStruct()->base.on_child_view_changed =
411       browser_view_delegate_on_child_view_changed;
412   GetStruct()->base.on_window_changed = browser_view_delegate_on_window_changed;
413   GetStruct()->base.on_focus = browser_view_delegate_on_focus;
414   GetStruct()->base.on_blur = browser_view_delegate_on_blur;
415 }
416 
417 // DESTRUCTOR - Do not edit by hand.
418 
~CefBrowserViewDelegateCppToC()419 CefBrowserViewDelegateCppToC::~CefBrowserViewDelegateCppToC() {
420   shutdown_checker::AssertNotShutdown();
421 }
422 
423 template <>
424 CefRefPtr<CefBrowserViewDelegate> CefCppToCRefCounted<
425     CefBrowserViewDelegateCppToC,
426     CefBrowserViewDelegate,
UnwrapDerived(CefWrapperType type,cef_browser_view_delegate_t * s)427     cef_browser_view_delegate_t>::UnwrapDerived(CefWrapperType type,
428                                                 cef_browser_view_delegate_t*
429                                                     s) {
430   NOTREACHED() << "Unexpected class type: " << type;
431   return nullptr;
432 }
433 
434 template <>
435 CefWrapperType CefCppToCRefCounted<CefBrowserViewDelegateCppToC,
436                                    CefBrowserViewDelegate,
437                                    cef_browser_view_delegate_t>::kWrapperType =
438     WT_BROWSER_VIEW_DELEGATE;
439