• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
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=546b8f890852fb4df26a85aec6b83effe1bdc6e6$
13 //
14 
15 #include "libcef_dll/cpptoc/views/display_cpptoc.h"
16 #include <algorithm>
17 #include "libcef_dll/shutdown_checker.h"
18 
19 // GLOBAL FUNCTIONS - Body may be edited by hand.
20 
cef_display_get_primary()21 CEF_EXPORT cef_display_t* cef_display_get_primary() {
22   shutdown_checker::AssertNotShutdown();
23 
24   // AUTO-GENERATED CONTENT - DELETE THIS COMMENT BEFORE MODIFYING
25 
26   // Execute
27   CefRefPtr<CefDisplay> _retval = CefDisplay::GetPrimaryDisplay();
28 
29   // Return type: refptr_same
30   return CefDisplayCppToC::Wrap(_retval);
31 }
32 
cef_display_get_nearest_point(const cef_point_t * point,int input_pixel_coords)33 CEF_EXPORT cef_display_t* cef_display_get_nearest_point(
34     const cef_point_t* point,
35     int input_pixel_coords) {
36   shutdown_checker::AssertNotShutdown();
37 
38   // AUTO-GENERATED CONTENT - DELETE THIS COMMENT BEFORE MODIFYING
39 
40   // Verify param: point; type: simple_byref_const
41   DCHECK(point);
42   if (!point)
43     return NULL;
44 
45   // Translate param: point; type: simple_byref_const
46   CefPoint pointVal = point ? *point : CefPoint();
47 
48   // Execute
49   CefRefPtr<CefDisplay> _retval = CefDisplay::GetDisplayNearestPoint(
50       pointVal, input_pixel_coords ? true : false);
51 
52   // Return type: refptr_same
53   return CefDisplayCppToC::Wrap(_retval);
54 }
55 
cef_display_get_matching_bounds(const cef_rect_t * bounds,int input_pixel_coords)56 CEF_EXPORT cef_display_t* cef_display_get_matching_bounds(
57     const cef_rect_t* bounds,
58     int input_pixel_coords) {
59   shutdown_checker::AssertNotShutdown();
60 
61   // AUTO-GENERATED CONTENT - DELETE THIS COMMENT BEFORE MODIFYING
62 
63   // Verify param: bounds; type: simple_byref_const
64   DCHECK(bounds);
65   if (!bounds)
66     return NULL;
67 
68   // Translate param: bounds; type: simple_byref_const
69   CefRect boundsVal = bounds ? *bounds : CefRect();
70 
71   // Execute
72   CefRefPtr<CefDisplay> _retval = CefDisplay::GetDisplayMatchingBounds(
73       boundsVal, input_pixel_coords ? true : false);
74 
75   // Return type: refptr_same
76   return CefDisplayCppToC::Wrap(_retval);
77 }
78 
cef_display_get_count()79 CEF_EXPORT size_t cef_display_get_count() {
80   shutdown_checker::AssertNotShutdown();
81 
82   // AUTO-GENERATED CONTENT - DELETE THIS COMMENT BEFORE MODIFYING
83 
84   // Execute
85   size_t _retval = CefDisplay::GetDisplayCount();
86 
87   // Return type: simple
88   return _retval;
89 }
90 
cef_display_get_alls(size_t * displaysCount,cef_display_t ** displays)91 CEF_EXPORT void cef_display_get_alls(size_t* displaysCount,
92                                      cef_display_t** displays) {
93   shutdown_checker::AssertNotShutdown();
94 
95   // AUTO-GENERATED CONTENT - DELETE THIS COMMENT BEFORE MODIFYING
96 
97   // Verify param: displays; type: refptr_vec_same_byref
98   DCHECK(displaysCount && (*displaysCount == 0 || displays));
99   if (!displaysCount || (*displaysCount > 0 && !displays))
100     return;
101 
102   // Translate param: displays; type: refptr_vec_same_byref
103   std::vector<CefRefPtr<CefDisplay>> displaysList;
104   if (displaysCount && *displaysCount > 0 && displays) {
105     for (size_t i = 0; i < *displaysCount; ++i) {
106       displaysList.push_back(CefDisplayCppToC::Unwrap(displays[i]));
107     }
108   }
109 
110   // Execute
111   CefDisplay::GetAllDisplays(displaysList);
112 
113   // Restore param: displays; type: refptr_vec_same_byref
114   if (displaysCount && displays) {
115     *displaysCount = std::min(displaysList.size(), *displaysCount);
116     if (*displaysCount > 0) {
117       for (size_t i = 0; i < *displaysCount; ++i) {
118         displays[i] = CefDisplayCppToC::Wrap(displaysList[i]);
119       }
120     }
121   }
122 }
123 
124 namespace {
125 
126 // MEMBER FUNCTIONS - Body may be edited by hand.
127 
display_get_id(struct _cef_display_t * self)128 int64 CEF_CALLBACK display_get_id(struct _cef_display_t* self) {
129   shutdown_checker::AssertNotShutdown();
130 
131   // AUTO-GENERATED CONTENT - DELETE THIS COMMENT BEFORE MODIFYING
132 
133   DCHECK(self);
134   if (!self)
135     return 0;
136 
137   // Execute
138   int64 _retval = CefDisplayCppToC::Get(self)->GetID();
139 
140   // Return type: simple
141   return _retval;
142 }
143 
144 float CEF_CALLBACK
display_get_device_scale_factor(struct _cef_display_t * self)145 display_get_device_scale_factor(struct _cef_display_t* self) {
146   shutdown_checker::AssertNotShutdown();
147 
148   // AUTO-GENERATED CONTENT - DELETE THIS COMMENT BEFORE MODIFYING
149 
150   DCHECK(self);
151   if (!self)
152     return 0;
153 
154   // Execute
155   float _retval = CefDisplayCppToC::Get(self)->GetDeviceScaleFactor();
156 
157   // Return type: simple
158   return _retval;
159 }
160 
display_convert_point_to_pixels(struct _cef_display_t * self,cef_point_t * point)161 void CEF_CALLBACK display_convert_point_to_pixels(struct _cef_display_t* self,
162                                                   cef_point_t* point) {
163   shutdown_checker::AssertNotShutdown();
164 
165   // AUTO-GENERATED CONTENT - DELETE THIS COMMENT BEFORE MODIFYING
166 
167   DCHECK(self);
168   if (!self)
169     return;
170   // Verify param: point; type: simple_byref
171   DCHECK(point);
172   if (!point)
173     return;
174 
175   // Translate param: point; type: simple_byref
176   CefPoint pointVal = point ? *point : CefPoint();
177 
178   // Execute
179   CefDisplayCppToC::Get(self)->ConvertPointToPixels(pointVal);
180 
181   // Restore param: point; type: simple_byref
182   if (point)
183     *point = pointVal;
184 }
185 
display_convert_point_from_pixels(struct _cef_display_t * self,cef_point_t * point)186 void CEF_CALLBACK display_convert_point_from_pixels(struct _cef_display_t* self,
187                                                     cef_point_t* point) {
188   shutdown_checker::AssertNotShutdown();
189 
190   // AUTO-GENERATED CONTENT - DELETE THIS COMMENT BEFORE MODIFYING
191 
192   DCHECK(self);
193   if (!self)
194     return;
195   // Verify param: point; type: simple_byref
196   DCHECK(point);
197   if (!point)
198     return;
199 
200   // Translate param: point; type: simple_byref
201   CefPoint pointVal = point ? *point : CefPoint();
202 
203   // Execute
204   CefDisplayCppToC::Get(self)->ConvertPointFromPixels(pointVal);
205 
206   // Restore param: point; type: simple_byref
207   if (point)
208     *point = pointVal;
209 }
210 
display_get_bounds(struct _cef_display_t * self)211 cef_rect_t CEF_CALLBACK display_get_bounds(struct _cef_display_t* self) {
212   shutdown_checker::AssertNotShutdown();
213 
214   // AUTO-GENERATED CONTENT - DELETE THIS COMMENT BEFORE MODIFYING
215 
216   DCHECK(self);
217   if (!self)
218     return CefRect();
219 
220   // Execute
221   cef_rect_t _retval = CefDisplayCppToC::Get(self)->GetBounds();
222 
223   // Return type: simple
224   return _retval;
225 }
226 
display_get_work_area(struct _cef_display_t * self)227 cef_rect_t CEF_CALLBACK display_get_work_area(struct _cef_display_t* self) {
228   shutdown_checker::AssertNotShutdown();
229 
230   // AUTO-GENERATED CONTENT - DELETE THIS COMMENT BEFORE MODIFYING
231 
232   DCHECK(self);
233   if (!self)
234     return CefRect();
235 
236   // Execute
237   cef_rect_t _retval = CefDisplayCppToC::Get(self)->GetWorkArea();
238 
239   // Return type: simple
240   return _retval;
241 }
242 
display_get_rotation(struct _cef_display_t * self)243 int CEF_CALLBACK display_get_rotation(struct _cef_display_t* self) {
244   shutdown_checker::AssertNotShutdown();
245 
246   // AUTO-GENERATED CONTENT - DELETE THIS COMMENT BEFORE MODIFYING
247 
248   DCHECK(self);
249   if (!self)
250     return 0;
251 
252   // Execute
253   int _retval = CefDisplayCppToC::Get(self)->GetRotation();
254 
255   // Return type: simple
256   return _retval;
257 }
258 
259 }  // namespace
260 
261 // CONSTRUCTOR - Do not edit by hand.
262 
CefDisplayCppToC()263 CefDisplayCppToC::CefDisplayCppToC() {
264   GetStruct()->get_id = display_get_id;
265   GetStruct()->get_device_scale_factor = display_get_device_scale_factor;
266   GetStruct()->convert_point_to_pixels = display_convert_point_to_pixels;
267   GetStruct()->convert_point_from_pixels = display_convert_point_from_pixels;
268   GetStruct()->get_bounds = display_get_bounds;
269   GetStruct()->get_work_area = display_get_work_area;
270   GetStruct()->get_rotation = display_get_rotation;
271 }
272 
273 // DESTRUCTOR - Do not edit by hand.
274 
~CefDisplayCppToC()275 CefDisplayCppToC::~CefDisplayCppToC() {
276   shutdown_checker::AssertNotShutdown();
277 }
278 
279 template <>
280 CefRefPtr<CefDisplay>
UnwrapDerived(CefWrapperType type,cef_display_t * s)281 CefCppToCRefCounted<CefDisplayCppToC, CefDisplay, cef_display_t>::UnwrapDerived(
282     CefWrapperType type,
283     cef_display_t* s) {
284   NOTREACHED() << "Unexpected class type: " << type;
285   return nullptr;
286 }
287 
288 template <>
289 CefWrapperType CefCppToCRefCounted<CefDisplayCppToC,
290                                    CefDisplay,
291                                    cef_display_t>::kWrapperType = WT_DISPLAY;
292