• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
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=c4e47ffd023b528b9c5b658126f4a1d9fd05cf98$
13 //
14 
15 #include "libcef_dll/ctocpp/download_handler_ctocpp.h"
16 #include "libcef_dll/cpptoc/before_download_callback_cpptoc.h"
17 #include "libcef_dll/cpptoc/browser_cpptoc.h"
18 #include "libcef_dll/cpptoc/download_item_callback_cpptoc.h"
19 #include "libcef_dll/cpptoc/download_item_cpptoc.h"
20 #include "libcef_dll/shutdown_checker.h"
21 
22 // VIRTUAL METHODS - Body may be edited by hand.
23 
24 NO_SANITIZE("cfi-icall")
OnBeforeDownload(CefRefPtr<CefBrowser> browser,CefRefPtr<CefDownloadItem> download_item,const CefString & suggested_name,CefRefPtr<CefBeforeDownloadCallback> callback)25 void CefDownloadHandlerCToCpp::OnBeforeDownload(
26     CefRefPtr<CefBrowser> browser,
27     CefRefPtr<CefDownloadItem> download_item,
28     const CefString& suggested_name,
29     CefRefPtr<CefBeforeDownloadCallback> callback) {
30   shutdown_checker::AssertNotShutdown();
31 
32   cef_download_handler_t* _struct = GetStruct();
33   if (CEF_MEMBER_MISSING(_struct, on_before_download))
34     return;
35 
36   // AUTO-GENERATED CONTENT - DELETE THIS COMMENT BEFORE MODIFYING
37 
38   // Verify param: browser; type: refptr_diff
39   DCHECK(browser.get());
40   if (!browser.get())
41     return;
42   // Verify param: download_item; type: refptr_diff
43   DCHECK(download_item.get());
44   if (!download_item.get())
45     return;
46   // Verify param: suggested_name; type: string_byref_const
47   DCHECK(!suggested_name.empty());
48   if (suggested_name.empty())
49     return;
50   // Verify param: callback; type: refptr_diff
51   DCHECK(callback.get());
52   if (!callback.get())
53     return;
54 
55   // Execute
56   _struct->on_before_download(_struct, CefBrowserCppToC::Wrap(browser),
57                               CefDownloadItemCppToC::Wrap(download_item),
58                               suggested_name.GetStruct(),
59                               CefBeforeDownloadCallbackCppToC::Wrap(callback));
60 }
61 
62 NO_SANITIZE("cfi-icall")
OnDownloadUpdated(CefRefPtr<CefBrowser> browser,CefRefPtr<CefDownloadItem> download_item,CefRefPtr<CefDownloadItemCallback> callback)63 void CefDownloadHandlerCToCpp::OnDownloadUpdated(
64     CefRefPtr<CefBrowser> browser,
65     CefRefPtr<CefDownloadItem> download_item,
66     CefRefPtr<CefDownloadItemCallback> callback) {
67   shutdown_checker::AssertNotShutdown();
68 
69   cef_download_handler_t* _struct = GetStruct();
70   if (CEF_MEMBER_MISSING(_struct, on_download_updated))
71     return;
72 
73   // AUTO-GENERATED CONTENT - DELETE THIS COMMENT BEFORE MODIFYING
74 
75   // Verify param: browser; type: refptr_diff
76   DCHECK(browser.get());
77   if (!browser.get())
78     return;
79   // Verify param: download_item; type: refptr_diff
80   DCHECK(download_item.get());
81   if (!download_item.get())
82     return;
83   // Verify param: callback; type: refptr_diff
84   DCHECK(callback.get());
85   if (!callback.get())
86     return;
87 
88   // Execute
89   _struct->on_download_updated(_struct, CefBrowserCppToC::Wrap(browser),
90                                CefDownloadItemCppToC::Wrap(download_item),
91                                CefDownloadItemCallbackCppToC::Wrap(callback));
92 }
93 
94 // CONSTRUCTOR - Do not edit by hand.
95 
CefDownloadHandlerCToCpp()96 CefDownloadHandlerCToCpp::CefDownloadHandlerCToCpp() {}
97 
98 // DESTRUCTOR - Do not edit by hand.
99 
~CefDownloadHandlerCToCpp()100 CefDownloadHandlerCToCpp::~CefDownloadHandlerCToCpp() {
101   shutdown_checker::AssertNotShutdown();
102 }
103 
104 template <>
105 cef_download_handler_t* CefCToCppRefCounted<
106     CefDownloadHandlerCToCpp,
107     CefDownloadHandler,
UnwrapDerived(CefWrapperType type,CefDownloadHandler * c)108     cef_download_handler_t>::UnwrapDerived(CefWrapperType type,
109                                            CefDownloadHandler* c) {
110   NOTREACHED() << "Unexpected class type: " << type;
111   return nullptr;
112 }
113 
114 template <>
115 CefWrapperType CefCToCppRefCounted<CefDownloadHandlerCToCpp,
116                                    CefDownloadHandler,
117                                    cef_download_handler_t>::kWrapperType =
118     WT_DOWNLOAD_HANDLER;
119