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=630f568e46925a195008194e61cde5339645ae8e$
13 //
14
15 #include "libcef_dll/cpptoc/cookie_manager_cpptoc.h"
16 #include "libcef_dll/ctocpp/completion_callback_ctocpp.h"
17 #include "libcef_dll/ctocpp/cookie_visitor_ctocpp.h"
18 #include "libcef_dll/ctocpp/delete_cookies_callback_ctocpp.h"
19 #include "libcef_dll/ctocpp/set_cookie_callback_ctocpp.h"
20
21 // GLOBAL FUNCTIONS - Body may be edited by hand.
22
cef_cookie_manager_get_global_manager(cef_completion_callback_t * callback)23 CEF_EXPORT cef_cookie_manager_t* cef_cookie_manager_get_global_manager(
24 cef_completion_callback_t* callback) {
25 // AUTO-GENERATED CONTENT - DELETE THIS COMMENT BEFORE MODIFYING
26
27 // Unverified params: callback
28
29 // Execute
30 CefRefPtr<CefCookieManager> _retval = CefCookieManager::GetGlobalManager(
31 CefCompletionCallbackCToCpp::Wrap(callback));
32
33 // Return type: refptr_same
34 return CefCookieManagerCppToC::Wrap(_retval);
35 }
36
37 namespace {
38
39 // MEMBER FUNCTIONS - Body may be edited by hand.
40
41 int CEF_CALLBACK
cookie_manager_visit_all_cookies(struct _cef_cookie_manager_t * self,struct _cef_cookie_visitor_t * visitor)42 cookie_manager_visit_all_cookies(struct _cef_cookie_manager_t* self,
43 struct _cef_cookie_visitor_t* visitor) {
44 // AUTO-GENERATED CONTENT - DELETE THIS COMMENT BEFORE MODIFYING
45
46 DCHECK(self);
47 if (!self)
48 return 0;
49 // Verify param: visitor; type: refptr_diff
50 DCHECK(visitor);
51 if (!visitor)
52 return 0;
53
54 // Execute
55 bool _retval = CefCookieManagerCppToC::Get(self)->VisitAllCookies(
56 CefCookieVisitorCToCpp::Wrap(visitor));
57
58 // Return type: bool
59 return _retval;
60 }
61
62 int CEF_CALLBACK
cookie_manager_visit_url_cookies(struct _cef_cookie_manager_t * self,const cef_string_t * url,int includeHttpOnly,struct _cef_cookie_visitor_t * visitor)63 cookie_manager_visit_url_cookies(struct _cef_cookie_manager_t* self,
64 const cef_string_t* url,
65 int includeHttpOnly,
66 struct _cef_cookie_visitor_t* visitor) {
67 // AUTO-GENERATED CONTENT - DELETE THIS COMMENT BEFORE MODIFYING
68
69 DCHECK(self);
70 if (!self)
71 return 0;
72 // Verify param: url; type: string_byref_const
73 DCHECK(url);
74 if (!url)
75 return 0;
76 // Verify param: visitor; type: refptr_diff
77 DCHECK(visitor);
78 if (!visitor)
79 return 0;
80
81 // Execute
82 bool _retval = CefCookieManagerCppToC::Get(self)->VisitUrlCookies(
83 CefString(url), includeHttpOnly ? true : false,
84 CefCookieVisitorCToCpp::Wrap(visitor));
85
86 // Return type: bool
87 return _retval;
88 }
89
90 int CEF_CALLBACK
cookie_manager_set_cookie(struct _cef_cookie_manager_t * self,const cef_string_t * url,const struct _cef_cookie_t * cookie,struct _cef_set_cookie_callback_t * callback)91 cookie_manager_set_cookie(struct _cef_cookie_manager_t* self,
92 const cef_string_t* url,
93 const struct _cef_cookie_t* cookie,
94 struct _cef_set_cookie_callback_t* callback) {
95 // AUTO-GENERATED CONTENT - DELETE THIS COMMENT BEFORE MODIFYING
96
97 DCHECK(self);
98 if (!self)
99 return 0;
100 // Verify param: url; type: string_byref_const
101 DCHECK(url);
102 if (!url)
103 return 0;
104 // Verify param: cookie; type: struct_byref_const
105 DCHECK(cookie);
106 if (!cookie)
107 return 0;
108 // Unverified params: callback
109
110 // Translate param: cookie; type: struct_byref_const
111 CefCookie cookieObj;
112 if (cookie)
113 cookieObj.Set(*cookie, false);
114
115 // Execute
116 bool _retval = CefCookieManagerCppToC::Get(self)->SetCookie(
117 CefString(url), cookieObj, CefSetCookieCallbackCToCpp::Wrap(callback));
118
119 // Return type: bool
120 return _retval;
121 }
122
123 int CEF_CALLBACK
cookie_manager_delete_cookies(struct _cef_cookie_manager_t * self,const cef_string_t * url,const cef_string_t * cookie_name,struct _cef_delete_cookies_callback_t * callback)124 cookie_manager_delete_cookies(struct _cef_cookie_manager_t* self,
125 const cef_string_t* url,
126 const cef_string_t* cookie_name,
127 struct _cef_delete_cookies_callback_t* callback) {
128 // AUTO-GENERATED CONTENT - DELETE THIS COMMENT BEFORE MODIFYING
129
130 DCHECK(self);
131 if (!self)
132 return 0;
133 // Unverified params: url, cookie_name, callback
134
135 // Execute
136 bool _retval = CefCookieManagerCppToC::Get(self)->DeleteCookies(
137 CefString(url), CefString(cookie_name),
138 CefDeleteCookiesCallbackCToCpp::Wrap(callback));
139
140 // Return type: bool
141 return _retval;
142 }
143
144 int CEF_CALLBACK
cookie_manager_flush_store(struct _cef_cookie_manager_t * self,cef_completion_callback_t * callback)145 cookie_manager_flush_store(struct _cef_cookie_manager_t* self,
146 cef_completion_callback_t* callback) {
147 // AUTO-GENERATED CONTENT - DELETE THIS COMMENT BEFORE MODIFYING
148
149 DCHECK(self);
150 if (!self)
151 return 0;
152 // Unverified params: callback
153
154 // Execute
155 bool _retval = CefCookieManagerCppToC::Get(self)->FlushStore(
156 CefCompletionCallbackCToCpp::Wrap(callback));
157
158 // Return type: bool
159 return _retval;
160 }
161
162 } // namespace
163
164 // CONSTRUCTOR - Do not edit by hand.
165
CefCookieManagerCppToC()166 CefCookieManagerCppToC::CefCookieManagerCppToC() {
167 GetStruct()->visit_all_cookies = cookie_manager_visit_all_cookies;
168 GetStruct()->visit_url_cookies = cookie_manager_visit_url_cookies;
169 GetStruct()->set_cookie = cookie_manager_set_cookie;
170 GetStruct()->delete_cookies = cookie_manager_delete_cookies;
171 GetStruct()->flush_store = cookie_manager_flush_store;
172 }
173
174 // DESTRUCTOR - Do not edit by hand.
175
~CefCookieManagerCppToC()176 CefCookieManagerCppToC::~CefCookieManagerCppToC() {}
177
178 template <>
179 CefRefPtr<CefCookieManager> CefCppToCRefCounted<
180 CefCookieManagerCppToC,
181 CefCookieManager,
UnwrapDerived(CefWrapperType type,cef_cookie_manager_t * s)182 cef_cookie_manager_t>::UnwrapDerived(CefWrapperType type,
183 cef_cookie_manager_t* s) {
184 NOTREACHED() << "Unexpected class type: " << type;
185 return nullptr;
186 }
187
188 template <>
189 CefWrapperType CefCppToCRefCounted<CefCookieManagerCppToC,
190 CefCookieManager,
191 cef_cookie_manager_t>::kWrapperType =
192 WT_COOKIE_MANAGER;
193