• 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=639576c610ca3898809cdee6d19c45253e9ea4d2$
13  //
14  
15  #include "libcef_dll/cpptoc/dialog_handler_cpptoc.h"
16  #include "libcef_dll/ctocpp/browser_ctocpp.h"
17  #include "libcef_dll/ctocpp/file_dialog_callback_ctocpp.h"
18  #include "libcef_dll/shutdown_checker.h"
19  #include "libcef_dll/transfer_util.h"
20  
21  namespace {
22  
23  // MEMBER FUNCTIONS - Body may be edited by hand.
24  
25  int CEF_CALLBACK
dialog_handler_on_file_dialog(struct _cef_dialog_handler_t * self,cef_browser_t * browser,cef_file_dialog_mode_t mode,const cef_string_t * title,const cef_string_t * default_file_path,cef_string_list_t accept_filters,int selected_accept_filter,cef_file_dialog_callback_t * callback)26  dialog_handler_on_file_dialog(struct _cef_dialog_handler_t* self,
27                                cef_browser_t* browser,
28                                cef_file_dialog_mode_t mode,
29                                const cef_string_t* title,
30                                const cef_string_t* default_file_path,
31                                cef_string_list_t accept_filters,
32                                int selected_accept_filter,
33                                cef_file_dialog_callback_t* callback) {
34    shutdown_checker::AssertNotShutdown();
35  
36    // AUTO-GENERATED CONTENT - DELETE THIS COMMENT BEFORE MODIFYING
37  
38    DCHECK(self);
39    if (!self)
40      return 0;
41    // Verify param: browser; type: refptr_diff
42    DCHECK(browser);
43    if (!browser)
44      return 0;
45    // Verify param: selected_accept_filter; type: simple_byval
46    DCHECK_GE(selected_accept_filter, 0);
47    if (selected_accept_filter < 0)
48      return 0;
49    // Verify param: callback; type: refptr_diff
50    DCHECK(callback);
51    if (!callback)
52      return 0;
53    // Unverified params: title, default_file_path, accept_filters
54  
55    // Translate param: accept_filters; type: string_vec_byref_const
56    std::vector<CefString> accept_filtersList;
57    transfer_string_list_contents(accept_filters, accept_filtersList);
58  
59    // Execute
60    bool _retval = CefDialogHandlerCppToC::Get(self)->OnFileDialog(
61        CefBrowserCToCpp::Wrap(browser), mode, CefString(title),
62        CefString(default_file_path), accept_filtersList, selected_accept_filter,
63        CefFileDialogCallbackCToCpp::Wrap(callback));
64  
65    // Return type: bool
66    return _retval;
67  }
68  
69  }  // namespace
70  
71  // CONSTRUCTOR - Do not edit by hand.
72  
CefDialogHandlerCppToC()73  CefDialogHandlerCppToC::CefDialogHandlerCppToC() {
74    GetStruct()->on_file_dialog = dialog_handler_on_file_dialog;
75  }
76  
77  // DESTRUCTOR - Do not edit by hand.
78  
~CefDialogHandlerCppToC()79  CefDialogHandlerCppToC::~CefDialogHandlerCppToC() {
80    shutdown_checker::AssertNotShutdown();
81  }
82  
83  template <>
84  CefRefPtr<CefDialogHandler> CefCppToCRefCounted<
85      CefDialogHandlerCppToC,
86      CefDialogHandler,
UnwrapDerived(CefWrapperType type,cef_dialog_handler_t * s)87      cef_dialog_handler_t>::UnwrapDerived(CefWrapperType type,
88                                           cef_dialog_handler_t* s) {
89    NOTREACHED() << "Unexpected class type: " << type;
90    return nullptr;
91  }
92  
93  template <>
94  CefWrapperType CefCppToCRefCounted<CefDialogHandlerCppToC,
95                                     CefDialogHandler,
96                                     cef_dialog_handler_t>::kWrapperType =
97      WT_DIALOG_HANDLER;
98