• 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=cac933371fc47c864230d4537ef1da76cd7e4d8e$
13 //
14 
15 #include "libcef_dll/ctocpp/dialog_handler_ctocpp.h"
16 #include "libcef_dll/cpptoc/browser_cpptoc.h"
17 #include "libcef_dll/cpptoc/file_dialog_callback_cpptoc.h"
18 #include "libcef_dll/shutdown_checker.h"
19 #include "libcef_dll/transfer_util.h"
20 
21 // VIRTUAL METHODS - Body may be edited by hand.
22 
23 NO_SANITIZE("cfi-icall")
OnFileDialog(CefRefPtr<CefBrowser> browser,FileDialogMode mode,const CefString & title,const CefString & default_file_path,const std::vector<CefString> & accept_filters,int selected_accept_filter,CefRefPtr<CefFileDialogCallback> callback)24 bool CefDialogHandlerCToCpp::OnFileDialog(
25     CefRefPtr<CefBrowser> browser,
26     FileDialogMode mode,
27     const CefString& title,
28     const CefString& default_file_path,
29     const std::vector<CefString>& accept_filters,
30     int selected_accept_filter,
31     CefRefPtr<CefFileDialogCallback> callback) {
32   shutdown_checker::AssertNotShutdown();
33 
34   cef_dialog_handler_t* _struct = GetStruct();
35   if (CEF_MEMBER_MISSING(_struct, on_file_dialog))
36     return false;
37 
38   // AUTO-GENERATED CONTENT - DELETE THIS COMMENT BEFORE MODIFYING
39 
40   // Verify param: browser; type: refptr_diff
41   DCHECK(browser.get());
42   if (!browser.get())
43     return false;
44   // Verify param: selected_accept_filter; type: simple_byval
45   DCHECK_GE(selected_accept_filter, 0);
46   if (selected_accept_filter < 0)
47     return false;
48   // Verify param: callback; type: refptr_diff
49   DCHECK(callback.get());
50   if (!callback.get())
51     return false;
52   // Unverified params: title, default_file_path, accept_filters
53 
54   // Translate param: accept_filters; type: string_vec_byref_const
55   cef_string_list_t accept_filtersList = cef_string_list_alloc();
56   DCHECK(accept_filtersList);
57   if (accept_filtersList)
58     transfer_string_list_contents(accept_filters, accept_filtersList);
59 
60   // Execute
61   int _retval = _struct->on_file_dialog(
62       _struct, CefBrowserCppToC::Wrap(browser), mode, title.GetStruct(),
63       default_file_path.GetStruct(), accept_filtersList, selected_accept_filter,
64       CefFileDialogCallbackCppToC::Wrap(callback));
65 
66   // Restore param:accept_filters; type: string_vec_byref_const
67   if (accept_filtersList)
68     cef_string_list_free(accept_filtersList);
69 
70   // Return type: bool
71   return _retval ? true : false;
72 }
73 
74 // CONSTRUCTOR - Do not edit by hand.
75 
CefDialogHandlerCToCpp()76 CefDialogHandlerCToCpp::CefDialogHandlerCToCpp() {}
77 
78 // DESTRUCTOR - Do not edit by hand.
79 
~CefDialogHandlerCToCpp()80 CefDialogHandlerCToCpp::~CefDialogHandlerCToCpp() {
81   shutdown_checker::AssertNotShutdown();
82 }
83 
84 template <>
85 cef_dialog_handler_t*
86 CefCToCppRefCounted<CefDialogHandlerCToCpp,
87                     CefDialogHandler,
UnwrapDerived(CefWrapperType type,CefDialogHandler * c)88                     cef_dialog_handler_t>::UnwrapDerived(CefWrapperType type,
89                                                          CefDialogHandler* c) {
90   NOTREACHED() << "Unexpected class type: " << type;
91   return nullptr;
92 }
93 
94 template <>
95 CefWrapperType CefCToCppRefCounted<CefDialogHandlerCToCpp,
96                                    CefDialogHandler,
97                                    cef_dialog_handler_t>::kWrapperType =
98     WT_DIALOG_HANDLER;
99