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=486d1b31ccfd53e10dec622d3ae024c23b50e2c2$
13 //
14
15 #include "libcef_dll/cpptoc/resource_bundle_handler_cpptoc.h"
16 #include "libcef_dll/shutdown_checker.h"
17
18 namespace {
19
20 // MEMBER FUNCTIONS - Body may be edited by hand.
21
resource_bundle_handler_get_localized_string(struct _cef_resource_bundle_handler_t * self,int string_id,cef_string_t * string)22 int CEF_CALLBACK resource_bundle_handler_get_localized_string(
23 struct _cef_resource_bundle_handler_t* self,
24 int string_id,
25 cef_string_t* string) {
26 shutdown_checker::AssertNotShutdown();
27
28 // AUTO-GENERATED CONTENT - DELETE THIS COMMENT BEFORE MODIFYING
29
30 DCHECK(self);
31 if (!self)
32 return 0;
33 // Verify param: string; type: string_byref
34 DCHECK(string);
35 if (!string)
36 return 0;
37
38 // Translate param: string; type: string_byref
39 CefString stringStr(string);
40
41 // Execute
42 bool _retval = CefResourceBundleHandlerCppToC::Get(self)->GetLocalizedString(
43 string_id, stringStr);
44
45 // Return type: bool
46 return _retval;
47 }
48
resource_bundle_handler_get_data_resource(struct _cef_resource_bundle_handler_t * self,int resource_id,void ** data,size_t * data_size)49 int CEF_CALLBACK resource_bundle_handler_get_data_resource(
50 struct _cef_resource_bundle_handler_t* self,
51 int resource_id,
52 void** data,
53 size_t* data_size) {
54 shutdown_checker::AssertNotShutdown();
55
56 // AUTO-GENERATED CONTENT - DELETE THIS COMMENT BEFORE MODIFYING
57
58 DCHECK(self);
59 if (!self)
60 return 0;
61 // Verify param: data; type: simple_byref
62 DCHECK(data);
63 if (!data)
64 return 0;
65 // Verify param: data_size; type: simple_byref
66 DCHECK(data_size);
67 if (!data_size)
68 return 0;
69
70 // Translate param: data; type: simple_byref
71 void* dataVal = data ? *data : NULL;
72 // Translate param: data_size; type: simple_byref
73 size_t data_sizeVal = data_size ? *data_size : 0;
74
75 // Execute
76 bool _retval = CefResourceBundleHandlerCppToC::Get(self)->GetDataResource(
77 resource_id, dataVal, data_sizeVal);
78
79 // Restore param: data; type: simple_byref
80 if (data)
81 *data = dataVal;
82 // Restore param: data_size; type: simple_byref
83 if (data_size)
84 *data_size = data_sizeVal;
85
86 // Return type: bool
87 return _retval;
88 }
89
resource_bundle_handler_get_data_resource_for_scale(struct _cef_resource_bundle_handler_t * self,int resource_id,cef_scale_factor_t scale_factor,void ** data,size_t * data_size)90 int CEF_CALLBACK resource_bundle_handler_get_data_resource_for_scale(
91 struct _cef_resource_bundle_handler_t* self,
92 int resource_id,
93 cef_scale_factor_t scale_factor,
94 void** data,
95 size_t* data_size) {
96 shutdown_checker::AssertNotShutdown();
97
98 // AUTO-GENERATED CONTENT - DELETE THIS COMMENT BEFORE MODIFYING
99
100 DCHECK(self);
101 if (!self)
102 return 0;
103 // Verify param: data; type: simple_byref
104 DCHECK(data);
105 if (!data)
106 return 0;
107 // Verify param: data_size; type: simple_byref
108 DCHECK(data_size);
109 if (!data_size)
110 return 0;
111
112 // Translate param: data; type: simple_byref
113 void* dataVal = data ? *data : NULL;
114 // Translate param: data_size; type: simple_byref
115 size_t data_sizeVal = data_size ? *data_size : 0;
116
117 // Execute
118 bool _retval =
119 CefResourceBundleHandlerCppToC::Get(self)->GetDataResourceForScale(
120 resource_id, scale_factor, dataVal, data_sizeVal);
121
122 // Restore param: data; type: simple_byref
123 if (data)
124 *data = dataVal;
125 // Restore param: data_size; type: simple_byref
126 if (data_size)
127 *data_size = data_sizeVal;
128
129 // Return type: bool
130 return _retval;
131 }
132
133 } // namespace
134
135 // CONSTRUCTOR - Do not edit by hand.
136
CefResourceBundleHandlerCppToC()137 CefResourceBundleHandlerCppToC::CefResourceBundleHandlerCppToC() {
138 GetStruct()->get_localized_string =
139 resource_bundle_handler_get_localized_string;
140 GetStruct()->get_data_resource = resource_bundle_handler_get_data_resource;
141 GetStruct()->get_data_resource_for_scale =
142 resource_bundle_handler_get_data_resource_for_scale;
143 }
144
145 // DESTRUCTOR - Do not edit by hand.
146
~CefResourceBundleHandlerCppToC()147 CefResourceBundleHandlerCppToC::~CefResourceBundleHandlerCppToC() {
148 shutdown_checker::AssertNotShutdown();
149 }
150
151 template <>
152 CefRefPtr<CefResourceBundleHandler> CefCppToCRefCounted<
153 CefResourceBundleHandlerCppToC,
154 CefResourceBundleHandler,
UnwrapDerived(CefWrapperType type,cef_resource_bundle_handler_t * s)155 cef_resource_bundle_handler_t>::UnwrapDerived(CefWrapperType type,
156 cef_resource_bundle_handler_t*
157 s) {
158 NOTREACHED() << "Unexpected class type: " << type;
159 return nullptr;
160 }
161
162 template <>
163 CefWrapperType
164 CefCppToCRefCounted<CefResourceBundleHandlerCppToC,
165 CefResourceBundleHandler,
166 cef_resource_bundle_handler_t>::kWrapperType =
167 WT_RESOURCE_BUNDLE_HANDLER;
168