• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
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=7b91234844f040546245a09f4724142efdf929ff$
13 //
14 
15 #include "libcef_dll/ctocpp/context_menu_handler_ctocpp.h"
16 #include "libcef_dll/cpptoc/browser_cpptoc.h"
17 #include "libcef_dll/cpptoc/context_menu_params_cpptoc.h"
18 #include "libcef_dll/cpptoc/frame_cpptoc.h"
19 #include "libcef_dll/cpptoc/menu_model_cpptoc.h"
20 #include "libcef_dll/cpptoc/run_context_menu_callback_cpptoc.h"
21 #include "libcef_dll/shutdown_checker.h"
22 
23 // VIRTUAL METHODS - Body may be edited by hand.
24 
25 NO_SANITIZE("cfi-icall")
OnBeforeContextMenu(CefRefPtr<CefBrowser> browser,CefRefPtr<CefFrame> frame,CefRefPtr<CefContextMenuParams> params,CefRefPtr<CefMenuModel> model)26 void CefContextMenuHandlerCToCpp::OnBeforeContextMenu(
27     CefRefPtr<CefBrowser> browser,
28     CefRefPtr<CefFrame> frame,
29     CefRefPtr<CefContextMenuParams> params,
30     CefRefPtr<CefMenuModel> model) {
31   shutdown_checker::AssertNotShutdown();
32 
33   cef_context_menu_handler_t* _struct = GetStruct();
34   if (CEF_MEMBER_MISSING(_struct, on_before_context_menu))
35     return;
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;
43   // Verify param: frame; type: refptr_diff
44   DCHECK(frame.get());
45   if (!frame.get())
46     return;
47   // Verify param: params; type: refptr_diff
48   DCHECK(params.get());
49   if (!params.get())
50     return;
51   // Verify param: model; type: refptr_diff
52   DCHECK(model.get());
53   if (!model.get())
54     return;
55 
56   // Execute
57   _struct->on_before_context_menu(_struct, CefBrowserCppToC::Wrap(browser),
58                                   CefFrameCppToC::Wrap(frame),
59                                   CefContextMenuParamsCppToC::Wrap(params),
60                                   CefMenuModelCppToC::Wrap(model));
61 }
62 
63 NO_SANITIZE("cfi-icall")
RunContextMenu(CefRefPtr<CefBrowser> browser,CefRefPtr<CefFrame> frame,CefRefPtr<CefContextMenuParams> params,CefRefPtr<CefMenuModel> model,CefRefPtr<CefRunContextMenuCallback> callback)64 bool CefContextMenuHandlerCToCpp::RunContextMenu(
65     CefRefPtr<CefBrowser> browser,
66     CefRefPtr<CefFrame> frame,
67     CefRefPtr<CefContextMenuParams> params,
68     CefRefPtr<CefMenuModel> model,
69     CefRefPtr<CefRunContextMenuCallback> callback) {
70   shutdown_checker::AssertNotShutdown();
71 
72   cef_context_menu_handler_t* _struct = GetStruct();
73   if (CEF_MEMBER_MISSING(_struct, run_context_menu))
74     return false;
75 
76   // AUTO-GENERATED CONTENT - DELETE THIS COMMENT BEFORE MODIFYING
77 
78   // Verify param: browser; type: refptr_diff
79   DCHECK(browser.get());
80   if (!browser.get())
81     return false;
82   // Verify param: frame; type: refptr_diff
83   DCHECK(frame.get());
84   if (!frame.get())
85     return false;
86   // Verify param: params; type: refptr_diff
87   DCHECK(params.get());
88   if (!params.get())
89     return false;
90   // Verify param: model; type: refptr_diff
91   DCHECK(model.get());
92   if (!model.get())
93     return false;
94   // Verify param: callback; type: refptr_diff
95   DCHECK(callback.get());
96   if (!callback.get())
97     return false;
98 
99   // Execute
100   int _retval = _struct->run_context_menu(
101       _struct, CefBrowserCppToC::Wrap(browser), CefFrameCppToC::Wrap(frame),
102       CefContextMenuParamsCppToC::Wrap(params), CefMenuModelCppToC::Wrap(model),
103       CefRunContextMenuCallbackCppToC::Wrap(callback));
104 
105   // Return type: bool
106   return _retval ? true : false;
107 }
108 
109 NO_SANITIZE("cfi-icall")
OnContextMenuCommand(CefRefPtr<CefBrowser> browser,CefRefPtr<CefFrame> frame,CefRefPtr<CefContextMenuParams> params,int command_id,EventFlags event_flags)110 bool CefContextMenuHandlerCToCpp::OnContextMenuCommand(
111     CefRefPtr<CefBrowser> browser,
112     CefRefPtr<CefFrame> frame,
113     CefRefPtr<CefContextMenuParams> params,
114     int command_id,
115     EventFlags event_flags) {
116   shutdown_checker::AssertNotShutdown();
117 
118   cef_context_menu_handler_t* _struct = GetStruct();
119   if (CEF_MEMBER_MISSING(_struct, on_context_menu_command))
120     return false;
121 
122   // AUTO-GENERATED CONTENT - DELETE THIS COMMENT BEFORE MODIFYING
123 
124   // Verify param: browser; type: refptr_diff
125   DCHECK(browser.get());
126   if (!browser.get())
127     return false;
128   // Verify param: frame; type: refptr_diff
129   DCHECK(frame.get());
130   if (!frame.get())
131     return false;
132   // Verify param: params; type: refptr_diff
133   DCHECK(params.get());
134   if (!params.get())
135     return false;
136 
137   // Execute
138   int _retval = _struct->on_context_menu_command(
139       _struct, CefBrowserCppToC::Wrap(browser), CefFrameCppToC::Wrap(frame),
140       CefContextMenuParamsCppToC::Wrap(params), command_id, event_flags);
141 
142   // Return type: bool
143   return _retval ? true : false;
144 }
145 
146 NO_SANITIZE("cfi-icall")
OnContextMenuDismissed(CefRefPtr<CefBrowser> browser,CefRefPtr<CefFrame> frame)147 void CefContextMenuHandlerCToCpp::OnContextMenuDismissed(
148     CefRefPtr<CefBrowser> browser,
149     CefRefPtr<CefFrame> frame) {
150   shutdown_checker::AssertNotShutdown();
151 
152   cef_context_menu_handler_t* _struct = GetStruct();
153   if (CEF_MEMBER_MISSING(_struct, on_context_menu_dismissed))
154     return;
155 
156   // AUTO-GENERATED CONTENT - DELETE THIS COMMENT BEFORE MODIFYING
157 
158   // Verify param: browser; type: refptr_diff
159   DCHECK(browser.get());
160   if (!browser.get())
161     return;
162   // Verify param: frame; type: refptr_diff
163   DCHECK(frame.get());
164   if (!frame.get())
165     return;
166 
167   // Execute
168   _struct->on_context_menu_dismissed(_struct, CefBrowserCppToC::Wrap(browser),
169                                      CefFrameCppToC::Wrap(frame));
170 }
171 
172 // CONSTRUCTOR - Do not edit by hand.
173 
CefContextMenuHandlerCToCpp()174 CefContextMenuHandlerCToCpp::CefContextMenuHandlerCToCpp() {}
175 
176 // DESTRUCTOR - Do not edit by hand.
177 
~CefContextMenuHandlerCToCpp()178 CefContextMenuHandlerCToCpp::~CefContextMenuHandlerCToCpp() {
179   shutdown_checker::AssertNotShutdown();
180 }
181 
182 template <>
183 cef_context_menu_handler_t* CefCToCppRefCounted<
184     CefContextMenuHandlerCToCpp,
185     CefContextMenuHandler,
UnwrapDerived(CefWrapperType type,CefContextMenuHandler * c)186     cef_context_menu_handler_t>::UnwrapDerived(CefWrapperType type,
187                                                CefContextMenuHandler* c) {
188   NOTREACHED() << "Unexpected class type: " << type;
189   return nullptr;
190 }
191 
192 template <>
193 CefWrapperType CefCToCppRefCounted<CefContextMenuHandlerCToCpp,
194                                    CefContextMenuHandler,
195                                    cef_context_menu_handler_t>::kWrapperType =
196     WT_CONTEXT_MENU_HANDLER;
197