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=374e065650a2c8fb36590542723d8e171f5de9ad$
13 //
14
15 #include "libcef_dll/ctocpp/life_span_handler_ctocpp.h"
16 #include "libcef_dll/cpptoc/browser_cpptoc.h"
17 #include "libcef_dll/cpptoc/dictionary_value_cpptoc.h"
18 #include "libcef_dll/cpptoc/frame_cpptoc.h"
19 #include "libcef_dll/ctocpp/client_ctocpp.h"
20 #include "libcef_dll/shutdown_checker.h"
21
22 // VIRTUAL METHODS - Body may be edited by hand.
23
24 NO_SANITIZE("cfi-icall")
OnBeforePopup(CefRefPtr<CefBrowser> browser,CefRefPtr<CefFrame> frame,const CefString & target_url,const CefString & target_frame_name,WindowOpenDisposition target_disposition,bool user_gesture,const CefPopupFeatures & popupFeatures,CefWindowInfo & windowInfo,CefRefPtr<CefClient> & client,CefBrowserSettings & settings,CefRefPtr<CefDictionaryValue> & extra_info,bool * no_javascript_access)25 bool CefLifeSpanHandlerCToCpp::OnBeforePopup(
26 CefRefPtr<CefBrowser> browser,
27 CefRefPtr<CefFrame> frame,
28 const CefString& target_url,
29 const CefString& target_frame_name,
30 WindowOpenDisposition target_disposition,
31 bool user_gesture,
32 const CefPopupFeatures& popupFeatures,
33 CefWindowInfo& windowInfo,
34 CefRefPtr<CefClient>& client,
35 CefBrowserSettings& settings,
36 CefRefPtr<CefDictionaryValue>& extra_info,
37 bool* no_javascript_access) {
38 shutdown_checker::AssertNotShutdown();
39
40 cef_life_span_handler_t* _struct = GetStruct();
41 if (CEF_MEMBER_MISSING(_struct, on_before_popup))
42 return false;
43
44 // AUTO-GENERATED CONTENT - DELETE THIS COMMENT BEFORE MODIFYING
45
46 // Verify param: browser; type: refptr_diff
47 DCHECK(browser.get());
48 if (!browser.get())
49 return false;
50 // Verify param: frame; type: refptr_diff
51 DCHECK(frame.get());
52 if (!frame.get())
53 return false;
54 // Verify param: no_javascript_access; type: bool_byaddr
55 DCHECK(no_javascript_access);
56 if (!no_javascript_access)
57 return false;
58 // Unverified params: target_url, target_frame_name
59
60 // Translate param: client; type: refptr_same_byref
61 cef_client_t* clientStruct = NULL;
62 if (client.get())
63 clientStruct = CefClientCToCpp::Unwrap(client);
64 cef_client_t* clientOrig = clientStruct;
65 // Translate param: extra_info; type: refptr_diff_byref
66 cef_dictionary_value_t* extra_infoStruct = NULL;
67 if (extra_info.get())
68 extra_infoStruct = CefDictionaryValueCppToC::Wrap(extra_info);
69 cef_dictionary_value_t* extra_infoOrig = extra_infoStruct;
70 // Translate param: no_javascript_access; type: bool_byaddr
71 int no_javascript_accessInt =
72 no_javascript_access ? *no_javascript_access : 0;
73
74 // Execute
75 int _retval = _struct->on_before_popup(
76 _struct, CefBrowserCppToC::Wrap(browser), CefFrameCppToC::Wrap(frame),
77 target_url.GetStruct(), target_frame_name.GetStruct(), target_disposition,
78 user_gesture, &popupFeatures, &windowInfo, &clientStruct, &settings,
79 &extra_infoStruct, &no_javascript_accessInt);
80
81 // Restore param:client; type: refptr_same_byref
82 if (clientStruct) {
83 if (clientStruct != clientOrig) {
84 client = CefClientCToCpp::Wrap(clientStruct);
85 }
86 } else {
87 client = nullptr;
88 }
89 // Restore param:extra_info; type: refptr_diff_byref
90 if (extra_infoStruct) {
91 if (extra_infoStruct != extra_infoOrig) {
92 extra_info = CefDictionaryValueCppToC::Unwrap(extra_infoStruct);
93 }
94 } else {
95 extra_info = nullptr;
96 }
97 // Restore param:no_javascript_access; type: bool_byaddr
98 if (no_javascript_access)
99 *no_javascript_access = no_javascript_accessInt ? true : false;
100
101 // Return type: bool
102 return _retval ? true : false;
103 }
104
105 NO_SANITIZE("cfi-icall")
OnAfterCreated(CefRefPtr<CefBrowser> browser)106 void CefLifeSpanHandlerCToCpp::OnAfterCreated(CefRefPtr<CefBrowser> browser) {
107 shutdown_checker::AssertNotShutdown();
108
109 cef_life_span_handler_t* _struct = GetStruct();
110 if (CEF_MEMBER_MISSING(_struct, on_after_created))
111 return;
112
113 // AUTO-GENERATED CONTENT - DELETE THIS COMMENT BEFORE MODIFYING
114
115 // Verify param: browser; type: refptr_diff
116 DCHECK(browser.get());
117 if (!browser.get())
118 return;
119
120 // Execute
121 _struct->on_after_created(_struct, CefBrowserCppToC::Wrap(browser));
122 }
123
124 NO_SANITIZE("cfi-icall")
DoClose(CefRefPtr<CefBrowser> browser)125 bool CefLifeSpanHandlerCToCpp::DoClose(CefRefPtr<CefBrowser> browser) {
126 shutdown_checker::AssertNotShutdown();
127
128 cef_life_span_handler_t* _struct = GetStruct();
129 if (CEF_MEMBER_MISSING(_struct, do_close))
130 return false;
131
132 // AUTO-GENERATED CONTENT - DELETE THIS COMMENT BEFORE MODIFYING
133
134 // Verify param: browser; type: refptr_diff
135 DCHECK(browser.get());
136 if (!browser.get())
137 return false;
138
139 // Execute
140 int _retval = _struct->do_close(_struct, CefBrowserCppToC::Wrap(browser));
141
142 // Return type: bool
143 return _retval ? true : false;
144 }
145
146 NO_SANITIZE("cfi-icall")
OnBeforeClose(CefRefPtr<CefBrowser> browser)147 void CefLifeSpanHandlerCToCpp::OnBeforeClose(CefRefPtr<CefBrowser> browser) {
148 shutdown_checker::AssertNotShutdown();
149
150 cef_life_span_handler_t* _struct = GetStruct();
151 if (CEF_MEMBER_MISSING(_struct, on_before_close))
152 return;
153
154 // AUTO-GENERATED CONTENT - DELETE THIS COMMENT BEFORE MODIFYING
155
156 // Verify param: browser; type: refptr_diff
157 DCHECK(browser.get());
158 if (!browser.get())
159 return;
160
161 // Execute
162 _struct->on_before_close(_struct, CefBrowserCppToC::Wrap(browser));
163 }
164
165 // CONSTRUCTOR - Do not edit by hand.
166
CefLifeSpanHandlerCToCpp()167 CefLifeSpanHandlerCToCpp::CefLifeSpanHandlerCToCpp() {}
168
169 // DESTRUCTOR - Do not edit by hand.
170
~CefLifeSpanHandlerCToCpp()171 CefLifeSpanHandlerCToCpp::~CefLifeSpanHandlerCToCpp() {
172 shutdown_checker::AssertNotShutdown();
173 }
174
175 template <>
176 cef_life_span_handler_t* CefCToCppRefCounted<
177 CefLifeSpanHandlerCToCpp,
178 CefLifeSpanHandler,
UnwrapDerived(CefWrapperType type,CefLifeSpanHandler * c)179 cef_life_span_handler_t>::UnwrapDerived(CefWrapperType type,
180 CefLifeSpanHandler* c) {
181 NOTREACHED() << "Unexpected class type: " << type;
182 return nullptr;
183 }
184
185 template <>
186 CefWrapperType CefCToCppRefCounted<CefLifeSpanHandlerCToCpp,
187 CefLifeSpanHandler,
188 cef_life_span_handler_t>::kWrapperType =
189 WT_LIFE_SPAN_HANDLER;
190