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=4a9f8a50b70bb46729c6d808f825d174ccc0f15e$
13 //
14
15 #include "libcef_dll/ctocpp/load_handler_ctocpp.h"
16 #include "libcef_dll/cpptoc/browser_cpptoc.h"
17 #include "libcef_dll/cpptoc/frame_cpptoc.h"
18 #include "libcef_dll/shutdown_checker.h"
19
20 // VIRTUAL METHODS - Body may be edited by hand.
21
22 NO_SANITIZE("cfi-icall")
OnLoadingStateChange(CefRefPtr<CefBrowser> browser,bool isLoading,bool canGoBack,bool canGoForward)23 void CefLoadHandlerCToCpp::OnLoadingStateChange(CefRefPtr<CefBrowser> browser,
24 bool isLoading,
25 bool canGoBack,
26 bool canGoForward) {
27 shutdown_checker::AssertNotShutdown();
28
29 cef_load_handler_t* _struct = GetStruct();
30 if (CEF_MEMBER_MISSING(_struct, on_loading_state_change))
31 return;
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;
39
40 // Execute
41 _struct->on_loading_state_change(_struct, CefBrowserCppToC::Wrap(browser),
42 isLoading, canGoBack, canGoForward);
43 }
44
45 NO_SANITIZE("cfi-icall")
OnLoadStart(CefRefPtr<CefBrowser> browser,CefRefPtr<CefFrame> frame,TransitionType transition_type)46 void CefLoadHandlerCToCpp::OnLoadStart(CefRefPtr<CefBrowser> browser,
47 CefRefPtr<CefFrame> frame,
48 TransitionType transition_type) {
49 shutdown_checker::AssertNotShutdown();
50
51 cef_load_handler_t* _struct = GetStruct();
52 if (CEF_MEMBER_MISSING(_struct, on_load_start))
53 return;
54
55 // AUTO-GENERATED CONTENT - DELETE THIS COMMENT BEFORE MODIFYING
56
57 // Verify param: browser; type: refptr_diff
58 DCHECK(browser.get());
59 if (!browser.get())
60 return;
61 // Verify param: frame; type: refptr_diff
62 DCHECK(frame.get());
63 if (!frame.get())
64 return;
65
66 // Execute
67 _struct->on_load_start(_struct, CefBrowserCppToC::Wrap(browser),
68 CefFrameCppToC::Wrap(frame), transition_type);
69 }
70
71 NO_SANITIZE("cfi-icall")
OnLoadEnd(CefRefPtr<CefBrowser> browser,CefRefPtr<CefFrame> frame,int httpStatusCode)72 void CefLoadHandlerCToCpp::OnLoadEnd(CefRefPtr<CefBrowser> browser,
73 CefRefPtr<CefFrame> frame,
74 int httpStatusCode) {
75 shutdown_checker::AssertNotShutdown();
76
77 cef_load_handler_t* _struct = GetStruct();
78 if (CEF_MEMBER_MISSING(_struct, on_load_end))
79 return;
80
81 // AUTO-GENERATED CONTENT - DELETE THIS COMMENT BEFORE MODIFYING
82
83 // Verify param: browser; type: refptr_diff
84 DCHECK(browser.get());
85 if (!browser.get())
86 return;
87 // Verify param: frame; type: refptr_diff
88 DCHECK(frame.get());
89 if (!frame.get())
90 return;
91
92 // Execute
93 _struct->on_load_end(_struct, CefBrowserCppToC::Wrap(browser),
94 CefFrameCppToC::Wrap(frame), httpStatusCode);
95 }
96
97 NO_SANITIZE("cfi-icall")
OnLoadError(CefRefPtr<CefBrowser> browser,CefRefPtr<CefFrame> frame,ErrorCode errorCode,const CefString & errorText,const CefString & failedUrl)98 void CefLoadHandlerCToCpp::OnLoadError(CefRefPtr<CefBrowser> browser,
99 CefRefPtr<CefFrame> frame,
100 ErrorCode errorCode,
101 const CefString& errorText,
102 const CefString& failedUrl) {
103 shutdown_checker::AssertNotShutdown();
104
105 cef_load_handler_t* _struct = GetStruct();
106 if (CEF_MEMBER_MISSING(_struct, on_load_error))
107 return;
108
109 // AUTO-GENERATED CONTENT - DELETE THIS COMMENT BEFORE MODIFYING
110
111 // Verify param: browser; type: refptr_diff
112 DCHECK(browser.get());
113 if (!browser.get())
114 return;
115 // Verify param: frame; type: refptr_diff
116 DCHECK(frame.get());
117 if (!frame.get())
118 return;
119 // Verify param: failedUrl; type: string_byref_const
120 DCHECK(!failedUrl.empty());
121 if (failedUrl.empty())
122 return;
123 // Unverified params: errorText
124
125 // Execute
126 _struct->on_load_error(_struct, CefBrowserCppToC::Wrap(browser),
127 CefFrameCppToC::Wrap(frame), errorCode,
128 errorText.GetStruct(), failedUrl.GetStruct());
129 }
130
131 // CONSTRUCTOR - Do not edit by hand.
132
CefLoadHandlerCToCpp()133 CefLoadHandlerCToCpp::CefLoadHandlerCToCpp() {}
134
135 // DESTRUCTOR - Do not edit by hand.
136
~CefLoadHandlerCToCpp()137 CefLoadHandlerCToCpp::~CefLoadHandlerCToCpp() {
138 shutdown_checker::AssertNotShutdown();
139 }
140
141 template <>
142 cef_load_handler_t*
143 CefCToCppRefCounted<CefLoadHandlerCToCpp, CefLoadHandler, cef_load_handler_t>::
UnwrapDerived(CefWrapperType type,CefLoadHandler * c)144 UnwrapDerived(CefWrapperType type, CefLoadHandler* c) {
145 NOTREACHED() << "Unexpected class type: " << type;
146 return nullptr;
147 }
148
149 template <>
150 CefWrapperType CefCToCppRefCounted<CefLoadHandlerCToCpp,
151 CefLoadHandler,
152 cef_load_handler_t>::kWrapperType =
153 WT_LOAD_HANDLER;
154