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=53febc1355422739c9de942f67f52fb4de462571$
13 //
14
15 #include "libcef_dll/cpptoc/drag_handler_cpptoc.h"
16 #include "libcef_dll/ctocpp/browser_ctocpp.h"
17 #include "libcef_dll/ctocpp/drag_data_ctocpp.h"
18 #include "libcef_dll/ctocpp/frame_ctocpp.h"
19 #include "libcef_dll/shutdown_checker.h"
20
21 namespace {
22
23 // MEMBER FUNCTIONS - Body may be edited by hand.
24
drag_handler_on_drag_enter(struct _cef_drag_handler_t * self,cef_browser_t * browser,cef_drag_data_t * dragData,cef_drag_operations_mask_t mask)25 int CEF_CALLBACK drag_handler_on_drag_enter(struct _cef_drag_handler_t* self,
26 cef_browser_t* browser,
27 cef_drag_data_t* dragData,
28 cef_drag_operations_mask_t mask) {
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: dragData; type: refptr_diff
41 DCHECK(dragData);
42 if (!dragData)
43 return 0;
44
45 // Execute
46 bool _retval = CefDragHandlerCppToC::Get(self)->OnDragEnter(
47 CefBrowserCToCpp::Wrap(browser), CefDragDataCToCpp::Wrap(dragData), mask);
48
49 // Return type: bool
50 return _retval;
51 }
52
drag_handler_on_draggable_regions_changed(struct _cef_drag_handler_t * self,cef_browser_t * browser,struct _cef_frame_t * frame,size_t regionsCount,cef_draggable_region_t const * regions)53 void CEF_CALLBACK drag_handler_on_draggable_regions_changed(
54 struct _cef_drag_handler_t* self,
55 cef_browser_t* browser,
56 struct _cef_frame_t* frame,
57 size_t regionsCount,
58 cef_draggable_region_t const* regions) {
59 shutdown_checker::AssertNotShutdown();
60
61 // AUTO-GENERATED CONTENT - DELETE THIS COMMENT BEFORE MODIFYING
62
63 DCHECK(self);
64 if (!self)
65 return;
66 // Verify param: browser; type: refptr_diff
67 DCHECK(browser);
68 if (!browser)
69 return;
70 // Verify param: frame; type: refptr_diff
71 DCHECK(frame);
72 if (!frame)
73 return;
74 // Verify param: regions; type: simple_vec_byref_const
75 DCHECK(regionsCount == 0 || regions);
76 if (regionsCount > 0 && !regions)
77 return;
78
79 // Translate param: regions; type: simple_vec_byref_const
80 std::vector<CefDraggableRegion> regionsList;
81 if (regionsCount > 0) {
82 for (size_t i = 0; i < regionsCount; ++i) {
83 CefDraggableRegion regionsVal = regions[i];
84 regionsList.push_back(regionsVal);
85 }
86 }
87
88 // Execute
89 CefDragHandlerCppToC::Get(self)->OnDraggableRegionsChanged(
90 CefBrowserCToCpp::Wrap(browser), CefFrameCToCpp::Wrap(frame),
91 regionsList);
92 }
93
94 } // namespace
95
96 // CONSTRUCTOR - Do not edit by hand.
97
CefDragHandlerCppToC()98 CefDragHandlerCppToC::CefDragHandlerCppToC() {
99 GetStruct()->on_drag_enter = drag_handler_on_drag_enter;
100 GetStruct()->on_draggable_regions_changed =
101 drag_handler_on_draggable_regions_changed;
102 }
103
104 // DESTRUCTOR - Do not edit by hand.
105
~CefDragHandlerCppToC()106 CefDragHandlerCppToC::~CefDragHandlerCppToC() {
107 shutdown_checker::AssertNotShutdown();
108 }
109
110 template <>
111 CefRefPtr<CefDragHandler>
112 CefCppToCRefCounted<CefDragHandlerCppToC, CefDragHandler, cef_drag_handler_t>::
UnwrapDerived(CefWrapperType type,cef_drag_handler_t * s)113 UnwrapDerived(CefWrapperType type, cef_drag_handler_t* s) {
114 NOTREACHED() << "Unexpected class type: " << type;
115 return nullptr;
116 }
117
118 template <>
119 CefWrapperType CefCppToCRefCounted<CefDragHandlerCppToC,
120 CefDragHandler,
121 cef_drag_handler_t>::kWrapperType =
122 WT_DRAG_HANDLER;
123