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=96bad8e6efd216ede4ec354159598f3119f44ce0$
13 //
14
15 #include "libcef_dll/cpptoc/load_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
load_handler_on_loading_state_change(struct _cef_load_handler_t * self,cef_browser_t * browser,int isLoading,int canGoBack,int canGoForward)25 load_handler_on_loading_state_change(struct _cef_load_handler_t* self,
26 cef_browser_t* browser,
27 int isLoading,
28 int canGoBack,
29 int canGoForward) {
30 shutdown_checker::AssertNotShutdown();
31
32 // AUTO-GENERATED CONTENT - DELETE THIS COMMENT BEFORE MODIFYING
33
34 DCHECK(self);
35 if (!self)
36 return;
37 // Verify param: browser; type: refptr_diff
38 DCHECK(browser);
39 if (!browser)
40 return;
41
42 // Execute
43 CefLoadHandlerCppToC::Get(self)->OnLoadingStateChange(
44 CefBrowserCToCpp::Wrap(browser), isLoading ? true : false,
45 canGoBack ? true : false, canGoForward ? true : false);
46 }
47
48 void CEF_CALLBACK
load_handler_on_load_start(struct _cef_load_handler_t * self,cef_browser_t * browser,cef_frame_t * frame,cef_transition_type_t transition_type)49 load_handler_on_load_start(struct _cef_load_handler_t* self,
50 cef_browser_t* browser,
51 cef_frame_t* frame,
52 cef_transition_type_t transition_type) {
53 shutdown_checker::AssertNotShutdown();
54
55 // AUTO-GENERATED CONTENT - DELETE THIS COMMENT BEFORE MODIFYING
56
57 DCHECK(self);
58 if (!self)
59 return;
60 // Verify param: browser; type: refptr_diff
61 DCHECK(browser);
62 if (!browser)
63 return;
64 // Verify param: frame; type: refptr_diff
65 DCHECK(frame);
66 if (!frame)
67 return;
68
69 // Execute
70 CefLoadHandlerCppToC::Get(self)->OnLoadStart(CefBrowserCToCpp::Wrap(browser),
71 CefFrameCToCpp::Wrap(frame),
72 transition_type);
73 }
74
load_handler_on_load_end(struct _cef_load_handler_t * self,cef_browser_t * browser,cef_frame_t * frame,int httpStatusCode)75 void CEF_CALLBACK load_handler_on_load_end(struct _cef_load_handler_t* self,
76 cef_browser_t* browser,
77 cef_frame_t* frame,
78 int httpStatusCode) {
79 shutdown_checker::AssertNotShutdown();
80
81 // AUTO-GENERATED CONTENT - DELETE THIS COMMENT BEFORE MODIFYING
82
83 DCHECK(self);
84 if (!self)
85 return;
86 // Verify param: browser; type: refptr_diff
87 DCHECK(browser);
88 if (!browser)
89 return;
90 // Verify param: frame; type: refptr_diff
91 DCHECK(frame);
92 if (!frame)
93 return;
94
95 // Execute
96 CefLoadHandlerCppToC::Get(self)->OnLoadEnd(CefBrowserCToCpp::Wrap(browser),
97 CefFrameCToCpp::Wrap(frame),
98 httpStatusCode);
99 }
100
load_handler_on_load_error(struct _cef_load_handler_t * self,cef_browser_t * browser,cef_frame_t * frame,cef_errorcode_t errorCode,const cef_string_t * errorText,const cef_string_t * failedUrl)101 void CEF_CALLBACK load_handler_on_load_error(struct _cef_load_handler_t* self,
102 cef_browser_t* browser,
103 cef_frame_t* frame,
104 cef_errorcode_t errorCode,
105 const cef_string_t* errorText,
106 const cef_string_t* failedUrl) {
107 shutdown_checker::AssertNotShutdown();
108
109 // AUTO-GENERATED CONTENT - DELETE THIS COMMENT BEFORE MODIFYING
110
111 DCHECK(self);
112 if (!self)
113 return;
114 // Verify param: browser; type: refptr_diff
115 DCHECK(browser);
116 if (!browser)
117 return;
118 // Verify param: frame; type: refptr_diff
119 DCHECK(frame);
120 if (!frame)
121 return;
122 // Verify param: failedUrl; type: string_byref_const
123 DCHECK(failedUrl);
124 if (!failedUrl)
125 return;
126 // Unverified params: errorText
127
128 // Execute
129 CefLoadHandlerCppToC::Get(self)->OnLoadError(
130 CefBrowserCToCpp::Wrap(browser), CefFrameCToCpp::Wrap(frame), errorCode,
131 CefString(errorText), CefString(failedUrl));
132 }
133
134 } // namespace
135
136 // CONSTRUCTOR - Do not edit by hand.
137
CefLoadHandlerCppToC()138 CefLoadHandlerCppToC::CefLoadHandlerCppToC() {
139 GetStruct()->on_loading_state_change = load_handler_on_loading_state_change;
140 GetStruct()->on_load_start = load_handler_on_load_start;
141 GetStruct()->on_load_end = load_handler_on_load_end;
142 GetStruct()->on_load_error = load_handler_on_load_error;
143 }
144
145 // DESTRUCTOR - Do not edit by hand.
146
~CefLoadHandlerCppToC()147 CefLoadHandlerCppToC::~CefLoadHandlerCppToC() {
148 shutdown_checker::AssertNotShutdown();
149 }
150
151 template <>
152 CefRefPtr<CefLoadHandler>
153 CefCppToCRefCounted<CefLoadHandlerCppToC, CefLoadHandler, cef_load_handler_t>::
UnwrapDerived(CefWrapperType type,cef_load_handler_t * s)154 UnwrapDerived(CefWrapperType type, cef_load_handler_t* s) {
155 NOTREACHED() << "Unexpected class type: " << type;
156 return nullptr;
157 }
158
159 template <>
160 CefWrapperType CefCppToCRefCounted<CefLoadHandlerCppToC,
161 CefLoadHandler,
162 cef_load_handler_t>::kWrapperType =
163 WT_LOAD_HANDLER;
164