• 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=496b226297ba7d5fa5e7e7bd4117c417e26fae59$
13 //
14 
15 #include "libcef_dll/cpptoc/download_handler_cpptoc.h"
16 #include "libcef_dll/ctocpp/before_download_callback_ctocpp.h"
17 #include "libcef_dll/ctocpp/browser_ctocpp.h"
18 #include "libcef_dll/ctocpp/download_item_callback_ctocpp.h"
19 #include "libcef_dll/ctocpp/download_item_ctocpp.h"
20 #include "libcef_dll/shutdown_checker.h"
21 
22 namespace {
23 
24 // MEMBER FUNCTIONS - Body may be edited by hand.
25 
26 void CEF_CALLBACK
download_handler_on_before_download(struct _cef_download_handler_t * self,cef_browser_t * browser,struct _cef_download_item_t * download_item,const cef_string_t * suggested_name,cef_before_download_callback_t * callback)27 download_handler_on_before_download(struct _cef_download_handler_t* self,
28                                     cef_browser_t* browser,
29                                     struct _cef_download_item_t* download_item,
30                                     const cef_string_t* suggested_name,
31                                     cef_before_download_callback_t* callback) {
32   shutdown_checker::AssertNotShutdown();
33 
34   // AUTO-GENERATED CONTENT - DELETE THIS COMMENT BEFORE MODIFYING
35 
36   DCHECK(self);
37   if (!self)
38     return;
39   // Verify param: browser; type: refptr_diff
40   DCHECK(browser);
41   if (!browser)
42     return;
43   // Verify param: download_item; type: refptr_diff
44   DCHECK(download_item);
45   if (!download_item)
46     return;
47   // Verify param: suggested_name; type: string_byref_const
48   DCHECK(suggested_name);
49   if (!suggested_name)
50     return;
51   // Verify param: callback; type: refptr_diff
52   DCHECK(callback);
53   if (!callback)
54     return;
55 
56   // Execute
57   CefDownloadHandlerCppToC::Get(self)->OnBeforeDownload(
58       CefBrowserCToCpp::Wrap(browser),
59       CefDownloadItemCToCpp::Wrap(download_item), CefString(suggested_name),
60       CefBeforeDownloadCallbackCToCpp::Wrap(callback));
61 }
62 
63 void CEF_CALLBACK
download_handler_on_download_updated(struct _cef_download_handler_t * self,cef_browser_t * browser,struct _cef_download_item_t * download_item,cef_download_item_callback_t * callback)64 download_handler_on_download_updated(struct _cef_download_handler_t* self,
65                                      cef_browser_t* browser,
66                                      struct _cef_download_item_t* download_item,
67                                      cef_download_item_callback_t* callback) {
68   shutdown_checker::AssertNotShutdown();
69 
70   // AUTO-GENERATED CONTENT - DELETE THIS COMMENT BEFORE MODIFYING
71 
72   DCHECK(self);
73   if (!self)
74     return;
75   // Verify param: browser; type: refptr_diff
76   DCHECK(browser);
77   if (!browser)
78     return;
79   // Verify param: download_item; type: refptr_diff
80   DCHECK(download_item);
81   if (!download_item)
82     return;
83   // Verify param: callback; type: refptr_diff
84   DCHECK(callback);
85   if (!callback)
86     return;
87 
88   // Execute
89   CefDownloadHandlerCppToC::Get(self)->OnDownloadUpdated(
90       CefBrowserCToCpp::Wrap(browser),
91       CefDownloadItemCToCpp::Wrap(download_item),
92       CefDownloadItemCallbackCToCpp::Wrap(callback));
93 }
94 
95 }  // namespace
96 
97 // CONSTRUCTOR - Do not edit by hand.
98 
CefDownloadHandlerCppToC()99 CefDownloadHandlerCppToC::CefDownloadHandlerCppToC() {
100   GetStruct()->on_before_download = download_handler_on_before_download;
101   GetStruct()->on_download_updated = download_handler_on_download_updated;
102 }
103 
104 // DESTRUCTOR - Do not edit by hand.
105 
~CefDownloadHandlerCppToC()106 CefDownloadHandlerCppToC::~CefDownloadHandlerCppToC() {
107   shutdown_checker::AssertNotShutdown();
108 }
109 
110 template <>
111 CefRefPtr<CefDownloadHandler> CefCppToCRefCounted<
112     CefDownloadHandlerCppToC,
113     CefDownloadHandler,
UnwrapDerived(CefWrapperType type,cef_download_handler_t * s)114     cef_download_handler_t>::UnwrapDerived(CefWrapperType type,
115                                            cef_download_handler_t* s) {
116   NOTREACHED() << "Unexpected class type: " << type;
117   return nullptr;
118 }
119 
120 template <>
121 CefWrapperType CefCppToCRefCounted<CefDownloadHandlerCppToC,
122                                    CefDownloadHandler,
123                                    cef_download_handler_t>::kWrapperType =
124     WT_DOWNLOAD_HANDLER;
125