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=276f4b15ecef989b38c2a6dd9cac5be7df5cb844$
13 //
14
15 #include "libcef_dll/cpptoc/frame_handler_cpptoc.h"
16 #include "libcef_dll/ctocpp/browser_ctocpp.h"
17 #include "libcef_dll/ctocpp/frame_ctocpp.h"
18 #include "libcef_dll/shutdown_checker.h"
19
20 namespace {
21
22 // MEMBER FUNCTIONS - Body may be edited by hand.
23
24 void CEF_CALLBACK
frame_handler_on_frame_created(struct _cef_frame_handler_t * self,cef_browser_t * browser,cef_frame_t * frame)25 frame_handler_on_frame_created(struct _cef_frame_handler_t* self,
26 cef_browser_t* browser,
27 cef_frame_t* frame) {
28 shutdown_checker::AssertNotShutdown();
29
30 // AUTO-GENERATED CONTENT - DELETE THIS COMMENT BEFORE MODIFYING
31
32 DCHECK(self);
33 if (!self)
34 return;
35 // Verify param: browser; type: refptr_diff
36 DCHECK(browser);
37 if (!browser)
38 return;
39 // Verify param: frame; type: refptr_diff
40 DCHECK(frame);
41 if (!frame)
42 return;
43
44 // Execute
45 CefFrameHandlerCppToC::Get(self)->OnFrameCreated(
46 CefBrowserCToCpp::Wrap(browser), CefFrameCToCpp::Wrap(frame));
47 }
48
49 void CEF_CALLBACK
frame_handler_on_frame_attached(struct _cef_frame_handler_t * self,cef_browser_t * browser,cef_frame_t * frame,int reattached)50 frame_handler_on_frame_attached(struct _cef_frame_handler_t* self,
51 cef_browser_t* browser,
52 cef_frame_t* frame,
53 int reattached) {
54 shutdown_checker::AssertNotShutdown();
55
56 // AUTO-GENERATED CONTENT - DELETE THIS COMMENT BEFORE MODIFYING
57
58 DCHECK(self);
59 if (!self)
60 return;
61 // Verify param: browser; type: refptr_diff
62 DCHECK(browser);
63 if (!browser)
64 return;
65 // Verify param: frame; type: refptr_diff
66 DCHECK(frame);
67 if (!frame)
68 return;
69
70 // Execute
71 CefFrameHandlerCppToC::Get(self)->OnFrameAttached(
72 CefBrowserCToCpp::Wrap(browser), CefFrameCToCpp::Wrap(frame),
73 reattached ? true : false);
74 }
75
76 void CEF_CALLBACK
frame_handler_on_frame_detached(struct _cef_frame_handler_t * self,cef_browser_t * browser,cef_frame_t * frame)77 frame_handler_on_frame_detached(struct _cef_frame_handler_t* self,
78 cef_browser_t* browser,
79 cef_frame_t* frame) {
80 shutdown_checker::AssertNotShutdown();
81
82 // AUTO-GENERATED CONTENT - DELETE THIS COMMENT BEFORE MODIFYING
83
84 DCHECK(self);
85 if (!self)
86 return;
87 // Verify param: browser; type: refptr_diff
88 DCHECK(browser);
89 if (!browser)
90 return;
91 // Verify param: frame; type: refptr_diff
92 DCHECK(frame);
93 if (!frame)
94 return;
95
96 // Execute
97 CefFrameHandlerCppToC::Get(self)->OnFrameDetached(
98 CefBrowserCToCpp::Wrap(browser), CefFrameCToCpp::Wrap(frame));
99 }
100
101 void CEF_CALLBACK
frame_handler_on_main_frame_changed(struct _cef_frame_handler_t * self,cef_browser_t * browser,cef_frame_t * old_frame,cef_frame_t * new_frame)102 frame_handler_on_main_frame_changed(struct _cef_frame_handler_t* self,
103 cef_browser_t* browser,
104 cef_frame_t* old_frame,
105 cef_frame_t* new_frame) {
106 shutdown_checker::AssertNotShutdown();
107
108 // AUTO-GENERATED CONTENT - DELETE THIS COMMENT BEFORE MODIFYING
109
110 DCHECK(self);
111 if (!self)
112 return;
113 // Verify param: browser; type: refptr_diff
114 DCHECK(browser);
115 if (!browser)
116 return;
117 // Unverified params: old_frame, new_frame
118
119 // Execute
120 CefFrameHandlerCppToC::Get(self)->OnMainFrameChanged(
121 CefBrowserCToCpp::Wrap(browser), CefFrameCToCpp::Wrap(old_frame),
122 CefFrameCToCpp::Wrap(new_frame));
123 }
124
125 } // namespace
126
127 // CONSTRUCTOR - Do not edit by hand.
128
CefFrameHandlerCppToC()129 CefFrameHandlerCppToC::CefFrameHandlerCppToC() {
130 GetStruct()->on_frame_created = frame_handler_on_frame_created;
131 GetStruct()->on_frame_attached = frame_handler_on_frame_attached;
132 GetStruct()->on_frame_detached = frame_handler_on_frame_detached;
133 GetStruct()->on_main_frame_changed = frame_handler_on_main_frame_changed;
134 }
135
136 // DESTRUCTOR - Do not edit by hand.
137
~CefFrameHandlerCppToC()138 CefFrameHandlerCppToC::~CefFrameHandlerCppToC() {
139 shutdown_checker::AssertNotShutdown();
140 }
141
142 template <>
143 CefRefPtr<CefFrameHandler> CefCppToCRefCounted<
144 CefFrameHandlerCppToC,
145 CefFrameHandler,
UnwrapDerived(CefWrapperType type,cef_frame_handler_t * s)146 cef_frame_handler_t>::UnwrapDerived(CefWrapperType type,
147 cef_frame_handler_t* s) {
148 NOTREACHED() << "Unexpected class type: " << type;
149 return nullptr;
150 }
151
152 template <>
153 CefWrapperType CefCppToCRefCounted<CefFrameHandlerCppToC,
154 CefFrameHandler,
155 cef_frame_handler_t>::kWrapperType =
156 WT_FRAME_HANDLER;
157