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=d5ba873aeb2b734e753d47420bbe10e290e8658d$
13 //
14
15 #include "libcef_dll/ctocpp/keyboard_handler_ctocpp.h"
16 #include "libcef_dll/cpptoc/browser_cpptoc.h"
17 #include "libcef_dll/shutdown_checker.h"
18
19 // VIRTUAL METHODS - Body may be edited by hand.
20
21 NO_SANITIZE("cfi-icall")
OnPreKeyEvent(CefRefPtr<CefBrowser> browser,const CefKeyEvent & event,CefEventHandle os_event,bool * is_keyboard_shortcut)22 bool CefKeyboardHandlerCToCpp::OnPreKeyEvent(CefRefPtr<CefBrowser> browser,
23 const CefKeyEvent& event,
24 CefEventHandle os_event,
25 bool* is_keyboard_shortcut) {
26 shutdown_checker::AssertNotShutdown();
27
28 cef_keyboard_handler_t* _struct = GetStruct();
29 if (CEF_MEMBER_MISSING(_struct, on_pre_key_event))
30 return false;
31
32 // AUTO-GENERATED CONTENT - DELETE THIS COMMENT BEFORE MODIFYING
33
34 // Verify param: browser; type: refptr_diff
35 DCHECK(browser.get());
36 if (!browser.get())
37 return false;
38 // Verify param: is_keyboard_shortcut; type: bool_byaddr
39 DCHECK(is_keyboard_shortcut);
40 if (!is_keyboard_shortcut)
41 return false;
42
43 // Translate param: is_keyboard_shortcut; type: bool_byaddr
44 int is_keyboard_shortcutInt =
45 is_keyboard_shortcut ? *is_keyboard_shortcut : 0;
46
47 // Execute
48 int _retval =
49 _struct->on_pre_key_event(_struct, CefBrowserCppToC::Wrap(browser),
50 &event, os_event, &is_keyboard_shortcutInt);
51
52 // Restore param:is_keyboard_shortcut; type: bool_byaddr
53 if (is_keyboard_shortcut)
54 *is_keyboard_shortcut = is_keyboard_shortcutInt ? true : false;
55
56 // Return type: bool
57 return _retval ? true : false;
58 }
59
60 NO_SANITIZE("cfi-icall")
OnKeyEvent(CefRefPtr<CefBrowser> browser,const CefKeyEvent & event,CefEventHandle os_event)61 bool CefKeyboardHandlerCToCpp::OnKeyEvent(CefRefPtr<CefBrowser> browser,
62 const CefKeyEvent& event,
63 CefEventHandle os_event) {
64 shutdown_checker::AssertNotShutdown();
65
66 cef_keyboard_handler_t* _struct = GetStruct();
67 if (CEF_MEMBER_MISSING(_struct, on_key_event))
68 return false;
69
70 // AUTO-GENERATED CONTENT - DELETE THIS COMMENT BEFORE MODIFYING
71
72 // Verify param: browser; type: refptr_diff
73 DCHECK(browser.get());
74 if (!browser.get())
75 return false;
76
77 // Execute
78 int _retval = _struct->on_key_event(_struct, CefBrowserCppToC::Wrap(browser),
79 &event, os_event);
80
81 // Return type: bool
82 return _retval ? true : false;
83 }
84
85 // CONSTRUCTOR - Do not edit by hand.
86
CefKeyboardHandlerCToCpp()87 CefKeyboardHandlerCToCpp::CefKeyboardHandlerCToCpp() {}
88
89 // DESTRUCTOR - Do not edit by hand.
90
~CefKeyboardHandlerCToCpp()91 CefKeyboardHandlerCToCpp::~CefKeyboardHandlerCToCpp() {
92 shutdown_checker::AssertNotShutdown();
93 }
94
95 template <>
96 cef_keyboard_handler_t* CefCToCppRefCounted<
97 CefKeyboardHandlerCToCpp,
98 CefKeyboardHandler,
UnwrapDerived(CefWrapperType type,CefKeyboardHandler * c)99 cef_keyboard_handler_t>::UnwrapDerived(CefWrapperType type,
100 CefKeyboardHandler* c) {
101 NOTREACHED() << "Unexpected class type: " << type;
102 return nullptr;
103 }
104
105 template <>
106 CefWrapperType CefCToCppRefCounted<CefKeyboardHandlerCToCpp,
107 CefKeyboardHandler,
108 cef_keyboard_handler_t>::kWrapperType =
109 WT_KEYBOARD_HANDLER;
110