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