• 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=a689271e9c27cfd0d6f6fadb8bb624898f165934$
13 //
14 
15 #include "libcef_dll/cpptoc/context_menu_handler_cpptoc.h"
16 #include "libcef_dll/ctocpp/browser_ctocpp.h"
17 #include "libcef_dll/ctocpp/context_menu_params_ctocpp.h"
18 #include "libcef_dll/ctocpp/frame_ctocpp.h"
19 #include "libcef_dll/ctocpp/menu_model_ctocpp.h"
20 #include "libcef_dll/ctocpp/run_context_menu_callback_ctocpp.h"
21 #include "libcef_dll/shutdown_checker.h"
22 
23 namespace {
24 
25 // MEMBER FUNCTIONS - Body may be edited by hand.
26 
context_menu_handler_on_before_context_menu(struct _cef_context_menu_handler_t * self,cef_browser_t * browser,struct _cef_frame_t * frame,struct _cef_context_menu_params_t * params,struct _cef_menu_model_t * model)27 void CEF_CALLBACK context_menu_handler_on_before_context_menu(
28     struct _cef_context_menu_handler_t* self,
29     cef_browser_t* browser,
30     struct _cef_frame_t* frame,
31     struct _cef_context_menu_params_t* params,
32     struct _cef_menu_model_t* model) {
33   shutdown_checker::AssertNotShutdown();
34 
35   // AUTO-GENERATED CONTENT - DELETE THIS COMMENT BEFORE MODIFYING
36 
37   DCHECK(self);
38   if (!self)
39     return;
40   // Verify param: browser; type: refptr_diff
41   DCHECK(browser);
42   if (!browser)
43     return;
44   // Verify param: frame; type: refptr_diff
45   DCHECK(frame);
46   if (!frame)
47     return;
48   // Verify param: params; type: refptr_diff
49   DCHECK(params);
50   if (!params)
51     return;
52   // Verify param: model; type: refptr_diff
53   DCHECK(model);
54   if (!model)
55     return;
56 
57   // Execute
58   CefContextMenuHandlerCppToC::Get(self)->OnBeforeContextMenu(
59       CefBrowserCToCpp::Wrap(browser), CefFrameCToCpp::Wrap(frame),
60       CefContextMenuParamsCToCpp::Wrap(params),
61       CefMenuModelCToCpp::Wrap(model));
62 }
63 
context_menu_handler_run_context_menu(struct _cef_context_menu_handler_t * self,cef_browser_t * browser,struct _cef_frame_t * frame,struct _cef_context_menu_params_t * params,struct _cef_menu_model_t * model,cef_run_context_menu_callback_t * callback)64 int CEF_CALLBACK context_menu_handler_run_context_menu(
65     struct _cef_context_menu_handler_t* self,
66     cef_browser_t* browser,
67     struct _cef_frame_t* frame,
68     struct _cef_context_menu_params_t* params,
69     struct _cef_menu_model_t* model,
70     cef_run_context_menu_callback_t* callback) {
71   shutdown_checker::AssertNotShutdown();
72 
73   // AUTO-GENERATED CONTENT - DELETE THIS COMMENT BEFORE MODIFYING
74 
75   DCHECK(self);
76   if (!self)
77     return 0;
78   // Verify param: browser; type: refptr_diff
79   DCHECK(browser);
80   if (!browser)
81     return 0;
82   // Verify param: frame; type: refptr_diff
83   DCHECK(frame);
84   if (!frame)
85     return 0;
86   // Verify param: params; type: refptr_diff
87   DCHECK(params);
88   if (!params)
89     return 0;
90   // Verify param: model; type: refptr_diff
91   DCHECK(model);
92   if (!model)
93     return 0;
94   // Verify param: callback; type: refptr_diff
95   DCHECK(callback);
96   if (!callback)
97     return 0;
98 
99   // Execute
100   bool _retval = CefContextMenuHandlerCppToC::Get(self)->RunContextMenu(
101       CefBrowserCToCpp::Wrap(browser), CefFrameCToCpp::Wrap(frame),
102       CefContextMenuParamsCToCpp::Wrap(params), CefMenuModelCToCpp::Wrap(model),
103       CefRunContextMenuCallbackCToCpp::Wrap(callback));
104 
105   // Return type: bool
106   return _retval;
107 }
108 
context_menu_handler_on_context_menu_command(struct _cef_context_menu_handler_t * self,cef_browser_t * browser,struct _cef_frame_t * frame,struct _cef_context_menu_params_t * params,int command_id,cef_event_flags_t event_flags)109 int CEF_CALLBACK context_menu_handler_on_context_menu_command(
110     struct _cef_context_menu_handler_t* self,
111     cef_browser_t* browser,
112     struct _cef_frame_t* frame,
113     struct _cef_context_menu_params_t* params,
114     int command_id,
115     cef_event_flags_t event_flags) {
116   shutdown_checker::AssertNotShutdown();
117 
118   // AUTO-GENERATED CONTENT - DELETE THIS COMMENT BEFORE MODIFYING
119 
120   DCHECK(self);
121   if (!self)
122     return 0;
123   // Verify param: browser; type: refptr_diff
124   DCHECK(browser);
125   if (!browser)
126     return 0;
127   // Verify param: frame; type: refptr_diff
128   DCHECK(frame);
129   if (!frame)
130     return 0;
131   // Verify param: params; type: refptr_diff
132   DCHECK(params);
133   if (!params)
134     return 0;
135 
136   // Execute
137   bool _retval = CefContextMenuHandlerCppToC::Get(self)->OnContextMenuCommand(
138       CefBrowserCToCpp::Wrap(browser), CefFrameCToCpp::Wrap(frame),
139       CefContextMenuParamsCToCpp::Wrap(params), command_id, event_flags);
140 
141   // Return type: bool
142   return _retval;
143 }
144 
context_menu_handler_on_context_menu_dismissed(struct _cef_context_menu_handler_t * self,cef_browser_t * browser,struct _cef_frame_t * frame)145 void CEF_CALLBACK context_menu_handler_on_context_menu_dismissed(
146     struct _cef_context_menu_handler_t* self,
147     cef_browser_t* browser,
148     struct _cef_frame_t* frame) {
149   shutdown_checker::AssertNotShutdown();
150 
151   // AUTO-GENERATED CONTENT - DELETE THIS COMMENT BEFORE MODIFYING
152 
153   DCHECK(self);
154   if (!self)
155     return;
156   // Verify param: browser; type: refptr_diff
157   DCHECK(browser);
158   if (!browser)
159     return;
160   // Verify param: frame; type: refptr_diff
161   DCHECK(frame);
162   if (!frame)
163     return;
164 
165   // Execute
166   CefContextMenuHandlerCppToC::Get(self)->OnContextMenuDismissed(
167       CefBrowserCToCpp::Wrap(browser), CefFrameCToCpp::Wrap(frame));
168 }
169 
170 }  // namespace
171 
172 // CONSTRUCTOR - Do not edit by hand.
173 
CefContextMenuHandlerCppToC()174 CefContextMenuHandlerCppToC::CefContextMenuHandlerCppToC() {
175   GetStruct()->on_before_context_menu =
176       context_menu_handler_on_before_context_menu;
177   GetStruct()->run_context_menu = context_menu_handler_run_context_menu;
178   GetStruct()->on_context_menu_command =
179       context_menu_handler_on_context_menu_command;
180   GetStruct()->on_context_menu_dismissed =
181       context_menu_handler_on_context_menu_dismissed;
182 }
183 
184 // DESTRUCTOR - Do not edit by hand.
185 
~CefContextMenuHandlerCppToC()186 CefContextMenuHandlerCppToC::~CefContextMenuHandlerCppToC() {
187   shutdown_checker::AssertNotShutdown();
188 }
189 
190 template <>
191 CefRefPtr<CefContextMenuHandler> CefCppToCRefCounted<
192     CefContextMenuHandlerCppToC,
193     CefContextMenuHandler,
UnwrapDerived(CefWrapperType type,cef_context_menu_handler_t * s)194     cef_context_menu_handler_t>::UnwrapDerived(CefWrapperType type,
195                                                cef_context_menu_handler_t* s) {
196   NOTREACHED() << "Unexpected class type: " << type;
197   return nullptr;
198 }
199 
200 template <>
201 CefWrapperType CefCppToCRefCounted<CefContextMenuHandlerCppToC,
202                                    CefContextMenuHandler,
203                                    cef_context_menu_handler_t>::kWrapperType =
204     WT_CONTEXT_MENU_HANDLER;
205