1 // Copyright (c) 2021 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=e857bba04c337c16c2ea4ebce2e99c00d10280e1$
13 //
14
15 #include "libcef_dll/ctocpp/request_context_handler_ctocpp.h"
16 #include "libcef_dll/cpptoc/browser_cpptoc.h"
17 #include "libcef_dll/cpptoc/frame_cpptoc.h"
18 #include "libcef_dll/cpptoc/request_context_cpptoc.h"
19 #include "libcef_dll/cpptoc/request_cpptoc.h"
20 #include "libcef_dll/cpptoc/web_plugin_info_cpptoc.h"
21 #include "libcef_dll/ctocpp/resource_request_handler_ctocpp.h"
22
23 // VIRTUAL METHODS - Body may be edited by hand.
24
25 NO_SANITIZE("cfi-icall")
OnRequestContextInitialized(CefRefPtr<CefRequestContext> request_context)26 void CefRequestContextHandlerCToCpp::OnRequestContextInitialized(
27 CefRefPtr<CefRequestContext> request_context) {
28 cef_request_context_handler_t* _struct = GetStruct();
29 if (CEF_MEMBER_MISSING(_struct, on_request_context_initialized))
30 return;
31
32 // AUTO-GENERATED CONTENT - DELETE THIS COMMENT BEFORE MODIFYING
33
34 // Verify param: request_context; type: refptr_diff
35 DCHECK(request_context.get());
36 if (!request_context.get())
37 return;
38
39 // Execute
40 _struct->on_request_context_initialized(
41 _struct, CefRequestContextCppToC::Wrap(request_context));
42 }
43
44 NO_SANITIZE("cfi-icall")
OnBeforePluginLoad(const CefString & mime_type,const CefString & plugin_url,bool is_main_frame,const CefString & top_origin_url,CefRefPtr<CefWebPluginInfo> plugin_info,PluginPolicy * plugin_policy)45 bool CefRequestContextHandlerCToCpp::OnBeforePluginLoad(
46 const CefString& mime_type,
47 const CefString& plugin_url,
48 bool is_main_frame,
49 const CefString& top_origin_url,
50 CefRefPtr<CefWebPluginInfo> plugin_info,
51 PluginPolicy* plugin_policy) {
52 cef_request_context_handler_t* _struct = GetStruct();
53 if (CEF_MEMBER_MISSING(_struct, on_before_plugin_load))
54 return false;
55
56 // AUTO-GENERATED CONTENT - DELETE THIS COMMENT BEFORE MODIFYING
57
58 // Verify param: mime_type; type: string_byref_const
59 DCHECK(!mime_type.empty());
60 if (mime_type.empty())
61 return false;
62 // Verify param: plugin_info; type: refptr_diff
63 DCHECK(plugin_info.get());
64 if (!plugin_info.get())
65 return false;
66 // Verify param: plugin_policy; type: simple_byaddr
67 DCHECK(plugin_policy);
68 if (!plugin_policy)
69 return false;
70 // Unverified params: plugin_url, top_origin_url
71
72 // Execute
73 int _retval = _struct->on_before_plugin_load(
74 _struct, mime_type.GetStruct(), plugin_url.GetStruct(), is_main_frame,
75 top_origin_url.GetStruct(), CefWebPluginInfoCppToC::Wrap(plugin_info),
76 plugin_policy);
77
78 // Return type: bool
79 return _retval ? true : false;
80 }
81
82 NO_SANITIZE("cfi-icall")
83 CefRefPtr<CefResourceRequestHandler> CefRequestContextHandlerCToCpp::
GetResourceRequestHandler(CefRefPtr<CefBrowser> browser,CefRefPtr<CefFrame> frame,CefRefPtr<CefRequest> request,bool is_navigation,bool is_download,const CefString & request_initiator,bool & disable_default_handling)84 GetResourceRequestHandler(CefRefPtr<CefBrowser> browser,
85 CefRefPtr<CefFrame> frame,
86 CefRefPtr<CefRequest> request,
87 bool is_navigation,
88 bool is_download,
89 const CefString& request_initiator,
90 bool& disable_default_handling) {
91 cef_request_context_handler_t* _struct = GetStruct();
92 if (CEF_MEMBER_MISSING(_struct, get_resource_request_handler))
93 return nullptr;
94
95 // AUTO-GENERATED CONTENT - DELETE THIS COMMENT BEFORE MODIFYING
96
97 // Verify param: request; type: refptr_diff
98 DCHECK(request.get());
99 if (!request.get())
100 return nullptr;
101 // Unverified params: browser, frame, request_initiator
102
103 // Translate param: disable_default_handling; type: bool_byref
104 int disable_default_handlingInt = disable_default_handling;
105
106 // Execute
107 cef_resource_request_handler_t* _retval =
108 _struct->get_resource_request_handler(
109 _struct, CefBrowserCppToC::Wrap(browser), CefFrameCppToC::Wrap(frame),
110 CefRequestCppToC::Wrap(request), is_navigation, is_download,
111 request_initiator.GetStruct(), &disable_default_handlingInt);
112
113 // Restore param:disable_default_handling; type: bool_byref
114 disable_default_handling = disable_default_handlingInt ? true : false;
115
116 // Return type: refptr_same
117 return CefResourceRequestHandlerCToCpp::Wrap(_retval);
118 }
119
120 // CONSTRUCTOR - Do not edit by hand.
121
CefRequestContextHandlerCToCpp()122 CefRequestContextHandlerCToCpp::CefRequestContextHandlerCToCpp() {}
123
124 // DESTRUCTOR - Do not edit by hand.
125
~CefRequestContextHandlerCToCpp()126 CefRequestContextHandlerCToCpp::~CefRequestContextHandlerCToCpp() {}
127
128 template <>
129 cef_request_context_handler_t* CefCToCppRefCounted<
130 CefRequestContextHandlerCToCpp,
131 CefRequestContextHandler,
UnwrapDerived(CefWrapperType type,CefRequestContextHandler * c)132 cef_request_context_handler_t>::UnwrapDerived(CefWrapperType type,
133 CefRequestContextHandler* c) {
134 NOTREACHED() << "Unexpected class type: " << type;
135 return nullptr;
136 }
137
138 template <>
139 CefWrapperType
140 CefCToCppRefCounted<CefRequestContextHandlerCToCpp,
141 CefRequestContextHandler,
142 cef_request_context_handler_t>::kWrapperType =
143 WT_REQUEST_CONTEXT_HANDLER;
144