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=41c06df7feb0288f02c644bd633cce3f1754beba$
13 //
14
15 #include "libcef_dll/cpptoc/jsdialog_handler_cpptoc.h"
16 #include "libcef_dll/ctocpp/browser_ctocpp.h"
17 #include "libcef_dll/ctocpp/jsdialog_callback_ctocpp.h"
18 #include "libcef_dll/shutdown_checker.h"
19
20 namespace {
21
22 // MEMBER FUNCTIONS - Body may be edited by hand.
23
24 int CEF_CALLBACK
jsdialog_handler_on_jsdialog(struct _cef_jsdialog_handler_t * self,cef_browser_t * browser,const cef_string_t * origin_url,cef_jsdialog_type_t dialog_type,const cef_string_t * message_text,const cef_string_t * default_prompt_text,cef_jsdialog_callback_t * callback,int * suppress_message)25 jsdialog_handler_on_jsdialog(struct _cef_jsdialog_handler_t* self,
26 cef_browser_t* browser,
27 const cef_string_t* origin_url,
28 cef_jsdialog_type_t dialog_type,
29 const cef_string_t* message_text,
30 const cef_string_t* default_prompt_text,
31 cef_jsdialog_callback_t* callback,
32 int* suppress_message) {
33 shutdown_checker::AssertNotShutdown();
34
35 // AUTO-GENERATED CONTENT - DELETE THIS COMMENT BEFORE MODIFYING
36
37 DCHECK(self);
38 if (!self)
39 return 0;
40 // Verify param: browser; type: refptr_diff
41 DCHECK(browser);
42 if (!browser)
43 return 0;
44 // Verify param: callback; type: refptr_diff
45 DCHECK(callback);
46 if (!callback)
47 return 0;
48 // Verify param: suppress_message; type: bool_byref
49 DCHECK(suppress_message);
50 if (!suppress_message)
51 return 0;
52 // Unverified params: origin_url, message_text, default_prompt_text
53
54 // Translate param: suppress_message; type: bool_byref
55 bool suppress_messageBool =
56 (suppress_message && *suppress_message) ? true : false;
57
58 // Execute
59 bool _retval = CefJSDialogHandlerCppToC::Get(self)->OnJSDialog(
60 CefBrowserCToCpp::Wrap(browser), CefString(origin_url), dialog_type,
61 CefString(message_text), CefString(default_prompt_text),
62 CefJSDialogCallbackCToCpp::Wrap(callback), suppress_messageBool);
63
64 // Restore param: suppress_message; type: bool_byref
65 if (suppress_message)
66 *suppress_message = suppress_messageBool ? true : false;
67
68 // Return type: bool
69 return _retval;
70 }
71
72 int CEF_CALLBACK
jsdialog_handler_on_before_unload_dialog(struct _cef_jsdialog_handler_t * self,cef_browser_t * browser,const cef_string_t * message_text,int is_reload,cef_jsdialog_callback_t * callback)73 jsdialog_handler_on_before_unload_dialog(struct _cef_jsdialog_handler_t* self,
74 cef_browser_t* browser,
75 const cef_string_t* message_text,
76 int is_reload,
77 cef_jsdialog_callback_t* callback) {
78 shutdown_checker::AssertNotShutdown();
79
80 // AUTO-GENERATED CONTENT - DELETE THIS COMMENT BEFORE MODIFYING
81
82 DCHECK(self);
83 if (!self)
84 return 0;
85 // Verify param: browser; type: refptr_diff
86 DCHECK(browser);
87 if (!browser)
88 return 0;
89 // Verify param: callback; type: refptr_diff
90 DCHECK(callback);
91 if (!callback)
92 return 0;
93 // Unverified params: message_text
94
95 // Execute
96 bool _retval = CefJSDialogHandlerCppToC::Get(self)->OnBeforeUnloadDialog(
97 CefBrowserCToCpp::Wrap(browser), CefString(message_text),
98 is_reload ? true : false, CefJSDialogCallbackCToCpp::Wrap(callback));
99
100 // Return type: bool
101 return _retval;
102 }
103
104 void CEF_CALLBACK
jsdialog_handler_on_reset_dialog_state(struct _cef_jsdialog_handler_t * self,cef_browser_t * browser)105 jsdialog_handler_on_reset_dialog_state(struct _cef_jsdialog_handler_t* self,
106 cef_browser_t* browser) {
107 shutdown_checker::AssertNotShutdown();
108
109 // AUTO-GENERATED CONTENT - DELETE THIS COMMENT BEFORE MODIFYING
110
111 DCHECK(self);
112 if (!self)
113 return;
114 // Verify param: browser; type: refptr_diff
115 DCHECK(browser);
116 if (!browser)
117 return;
118
119 // Execute
120 CefJSDialogHandlerCppToC::Get(self)->OnResetDialogState(
121 CefBrowserCToCpp::Wrap(browser));
122 }
123
124 void CEF_CALLBACK
jsdialog_handler_on_dialog_closed(struct _cef_jsdialog_handler_t * self,cef_browser_t * browser)125 jsdialog_handler_on_dialog_closed(struct _cef_jsdialog_handler_t* self,
126 cef_browser_t* browser) {
127 shutdown_checker::AssertNotShutdown();
128
129 // AUTO-GENERATED CONTENT - DELETE THIS COMMENT BEFORE MODIFYING
130
131 DCHECK(self);
132 if (!self)
133 return;
134 // Verify param: browser; type: refptr_diff
135 DCHECK(browser);
136 if (!browser)
137 return;
138
139 // Execute
140 CefJSDialogHandlerCppToC::Get(self)->OnDialogClosed(
141 CefBrowserCToCpp::Wrap(browser));
142 }
143
144 } // namespace
145
146 // CONSTRUCTOR - Do not edit by hand.
147
CefJSDialogHandlerCppToC()148 CefJSDialogHandlerCppToC::CefJSDialogHandlerCppToC() {
149 GetStruct()->on_jsdialog = jsdialog_handler_on_jsdialog;
150 GetStruct()->on_before_unload_dialog =
151 jsdialog_handler_on_before_unload_dialog;
152 GetStruct()->on_reset_dialog_state = jsdialog_handler_on_reset_dialog_state;
153 GetStruct()->on_dialog_closed = jsdialog_handler_on_dialog_closed;
154 }
155
156 // DESTRUCTOR - Do not edit by hand.
157
~CefJSDialogHandlerCppToC()158 CefJSDialogHandlerCppToC::~CefJSDialogHandlerCppToC() {
159 shutdown_checker::AssertNotShutdown();
160 }
161
162 template <>
163 CefRefPtr<CefJSDialogHandler> CefCppToCRefCounted<
164 CefJSDialogHandlerCppToC,
165 CefJSDialogHandler,
UnwrapDerived(CefWrapperType type,cef_jsdialog_handler_t * s)166 cef_jsdialog_handler_t>::UnwrapDerived(CefWrapperType type,
167 cef_jsdialog_handler_t* s) {
168 NOTREACHED() << "Unexpected class type: " << type;
169 return nullptr;
170 }
171
172 template <>
173 CefWrapperType CefCppToCRefCounted<CefJSDialogHandlerCppToC,
174 CefJSDialogHandler,
175 cef_jsdialog_handler_t>::kWrapperType =
176 WT_JSDIALOG_HANDLER;
177