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=83bbaf05bb87f369d819d4202110581c3bbe60a1$
13 //
14
15 #include "libcef_dll/ctocpp/drag_handler_ctocpp.h"
16 #include "libcef_dll/cpptoc/browser_cpptoc.h"
17 #include "libcef_dll/cpptoc/drag_data_cpptoc.h"
18 #include "libcef_dll/cpptoc/frame_cpptoc.h"
19 #include "libcef_dll/shutdown_checker.h"
20
21 // VIRTUAL METHODS - Body may be edited by hand.
22
23 NO_SANITIZE("cfi-icall")
OnDragEnter(CefRefPtr<CefBrowser> browser,CefRefPtr<CefDragData> dragData,DragOperationsMask mask)24 bool CefDragHandlerCToCpp::OnDragEnter(CefRefPtr<CefBrowser> browser,
25 CefRefPtr<CefDragData> dragData,
26 DragOperationsMask mask) {
27 shutdown_checker::AssertNotShutdown();
28
29 cef_drag_handler_t* _struct = GetStruct();
30 if (CEF_MEMBER_MISSING(_struct, on_drag_enter))
31 return false;
32
33 // AUTO-GENERATED CONTENT - DELETE THIS COMMENT BEFORE MODIFYING
34
35 // Verify param: browser; type: refptr_diff
36 DCHECK(browser.get());
37 if (!browser.get())
38 return false;
39 // Verify param: dragData; type: refptr_diff
40 DCHECK(dragData.get());
41 if (!dragData.get())
42 return false;
43
44 // Execute
45 int _retval = _struct->on_drag_enter(_struct, CefBrowserCppToC::Wrap(browser),
46 CefDragDataCppToC::Wrap(dragData), mask);
47
48 // Return type: bool
49 return _retval ? true : false;
50 }
51
52 NO_SANITIZE("cfi-icall")
OnDraggableRegionsChanged(CefRefPtr<CefBrowser> browser,CefRefPtr<CefFrame> frame,const std::vector<CefDraggableRegion> & regions)53 void CefDragHandlerCToCpp::OnDraggableRegionsChanged(
54 CefRefPtr<CefBrowser> browser,
55 CefRefPtr<CefFrame> frame,
56 const std::vector<CefDraggableRegion>& regions) {
57 shutdown_checker::AssertNotShutdown();
58
59 cef_drag_handler_t* _struct = GetStruct();
60 if (CEF_MEMBER_MISSING(_struct, on_draggable_regions_changed))
61 return;
62
63 // AUTO-GENERATED CONTENT - DELETE THIS COMMENT BEFORE MODIFYING
64
65 // Verify param: browser; type: refptr_diff
66 DCHECK(browser.get());
67 if (!browser.get())
68 return;
69 // Verify param: frame; type: refptr_diff
70 DCHECK(frame.get());
71 if (!frame.get())
72 return;
73
74 // Translate param: regions; type: simple_vec_byref_const
75 const size_t regionsCount = regions.size();
76 cef_draggable_region_t* regionsList = NULL;
77 if (regionsCount > 0) {
78 regionsList = new cef_draggable_region_t[regionsCount];
79 DCHECK(regionsList);
80 if (regionsList) {
81 for (size_t i = 0; i < regionsCount; ++i) {
82 regionsList[i] = regions[i];
83 }
84 }
85 }
86
87 // Execute
88 _struct->on_draggable_regions_changed(
89 _struct, CefBrowserCppToC::Wrap(browser), CefFrameCppToC::Wrap(frame),
90 regionsCount, regionsList);
91
92 // Restore param:regions; type: simple_vec_byref_const
93 if (regionsList)
94 delete[] regionsList;
95 }
96
97 // CONSTRUCTOR - Do not edit by hand.
98
CefDragHandlerCToCpp()99 CefDragHandlerCToCpp::CefDragHandlerCToCpp() {}
100
101 // DESTRUCTOR - Do not edit by hand.
102
~CefDragHandlerCToCpp()103 CefDragHandlerCToCpp::~CefDragHandlerCToCpp() {
104 shutdown_checker::AssertNotShutdown();
105 }
106
107 template <>
108 cef_drag_handler_t*
109 CefCToCppRefCounted<CefDragHandlerCToCpp, CefDragHandler, cef_drag_handler_t>::
UnwrapDerived(CefWrapperType type,CefDragHandler * c)110 UnwrapDerived(CefWrapperType type, CefDragHandler* c) {
111 NOTREACHED() << "Unexpected class type: " << type;
112 return nullptr;
113 }
114
115 template <>
116 CefWrapperType CefCToCppRefCounted<CefDragHandlerCToCpp,
117 CefDragHandler,
118 cef_drag_handler_t>::kWrapperType =
119 WT_DRAG_HANDLER;
120