• 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=9f55775c0fcff5993efe9d8c9db75001d4335743$
13 //
14 
15 #include "libcef_dll/cpptoc/keyboard_handler_cpptoc.h"
16 #include "libcef_dll/ctocpp/browser_ctocpp.h"
17 #include "libcef_dll/shutdown_checker.h"
18 
19 namespace {
20 
21 // MEMBER FUNCTIONS - Body may be edited by hand.
22 
23 int CEF_CALLBACK
keyboard_handler_on_pre_key_event(struct _cef_keyboard_handler_t * self,cef_browser_t * browser,const struct _cef_key_event_t * event,cef_event_handle_t os_event,int * is_keyboard_shortcut)24 keyboard_handler_on_pre_key_event(struct _cef_keyboard_handler_t* self,
25                                   cef_browser_t* browser,
26                                   const struct _cef_key_event_t* event,
27                                   cef_event_handle_t os_event,
28                                   int* is_keyboard_shortcut) {
29   shutdown_checker::AssertNotShutdown();
30 
31   // AUTO-GENERATED CONTENT - DELETE THIS COMMENT BEFORE MODIFYING
32 
33   DCHECK(self);
34   if (!self)
35     return 0;
36   // Verify param: browser; type: refptr_diff
37   DCHECK(browser);
38   if (!browser)
39     return 0;
40   // Verify param: event; type: struct_byref_const
41   DCHECK(event);
42   if (!event)
43     return 0;
44   // Verify param: is_keyboard_shortcut; type: bool_byaddr
45   DCHECK(is_keyboard_shortcut);
46   if (!is_keyboard_shortcut)
47     return 0;
48 
49   // Translate param: event; type: struct_byref_const
50   CefKeyEvent eventObj;
51   if (event)
52     eventObj.Set(*event, false);
53   // Translate param: is_keyboard_shortcut; type: bool_byaddr
54   bool is_keyboard_shortcutBool =
55       (is_keyboard_shortcut && *is_keyboard_shortcut) ? true : false;
56 
57   // Execute
58   bool _retval = CefKeyboardHandlerCppToC::Get(self)->OnPreKeyEvent(
59       CefBrowserCToCpp::Wrap(browser), eventObj, os_event,
60       &is_keyboard_shortcutBool);
61 
62   // Restore param: is_keyboard_shortcut; type: bool_byaddr
63   if (is_keyboard_shortcut)
64     *is_keyboard_shortcut = is_keyboard_shortcutBool ? true : false;
65 
66   // Return type: bool
67   return _retval;
68 }
69 
70 int CEF_CALLBACK
keyboard_handler_on_key_event(struct _cef_keyboard_handler_t * self,cef_browser_t * browser,const struct _cef_key_event_t * event,cef_event_handle_t os_event)71 keyboard_handler_on_key_event(struct _cef_keyboard_handler_t* self,
72                               cef_browser_t* browser,
73                               const struct _cef_key_event_t* event,
74                               cef_event_handle_t os_event) {
75   shutdown_checker::AssertNotShutdown();
76 
77   // AUTO-GENERATED CONTENT - DELETE THIS COMMENT BEFORE MODIFYING
78 
79   DCHECK(self);
80   if (!self)
81     return 0;
82   // Verify param: browser; type: refptr_diff
83   DCHECK(browser);
84   if (!browser)
85     return 0;
86   // Verify param: event; type: struct_byref_const
87   DCHECK(event);
88   if (!event)
89     return 0;
90 
91   // Translate param: event; type: struct_byref_const
92   CefKeyEvent eventObj;
93   if (event)
94     eventObj.Set(*event, false);
95 
96   // Execute
97   bool _retval = CefKeyboardHandlerCppToC::Get(self)->OnKeyEvent(
98       CefBrowserCToCpp::Wrap(browser), eventObj, os_event);
99 
100   // Return type: bool
101   return _retval;
102 }
103 
104 }  // namespace
105 
106 // CONSTRUCTOR - Do not edit by hand.
107 
CefKeyboardHandlerCppToC()108 CefKeyboardHandlerCppToC::CefKeyboardHandlerCppToC() {
109   GetStruct()->on_pre_key_event = keyboard_handler_on_pre_key_event;
110   GetStruct()->on_key_event = keyboard_handler_on_key_event;
111 }
112 
113 // DESTRUCTOR - Do not edit by hand.
114 
~CefKeyboardHandlerCppToC()115 CefKeyboardHandlerCppToC::~CefKeyboardHandlerCppToC() {
116   shutdown_checker::AssertNotShutdown();
117 }
118 
119 template <>
120 CefRefPtr<CefKeyboardHandler> CefCppToCRefCounted<
121     CefKeyboardHandlerCppToC,
122     CefKeyboardHandler,
UnwrapDerived(CefWrapperType type,cef_keyboard_handler_t * s)123     cef_keyboard_handler_t>::UnwrapDerived(CefWrapperType type,
124                                            cef_keyboard_handler_t* s) {
125   NOTREACHED() << "Unexpected class type: " << type;
126   return nullptr;
127 }
128 
129 template <>
130 CefWrapperType CefCppToCRefCounted<CefKeyboardHandlerCppToC,
131                                    CefKeyboardHandler,
132                                    cef_keyboard_handler_t>::kWrapperType =
133     WT_KEYBOARD_HANDLER;
134