mirror of
https://bitbucket.org/chromiumembedded/cef
synced 2025-06-05 21:39:12 +02:00
- Provide default implementations of the file chooser dialogs (open, open multiple, save) on all platforms (issue #761).
- Add a new CefBrowserHost::RunFileDialog method that displays the specified file chooser dialog and returns the results asynchronously (issue #761). - Add a new CefDialogHandler::OnFileDialog callback that allows the application to provide custom UI for file chooser dialogs (issue #761). git-svn-id: https://chromiumembedded.googlecode.com/svn/trunk@862 5089003a-bbd8-11dd-ad1f-f1f9622dbc98
This commit is contained in:
@@ -11,8 +11,10 @@
|
||||
//
|
||||
|
||||
#include "libcef_dll/cpptoc/client_cpptoc.h"
|
||||
#include "libcef_dll/cpptoc/run_file_dialog_callback_cpptoc.h"
|
||||
#include "libcef_dll/ctocpp/browser_ctocpp.h"
|
||||
#include "libcef_dll/ctocpp/browser_host_ctocpp.h"
|
||||
#include "libcef_dll/transfer_util.h"
|
||||
|
||||
|
||||
// STATIC METHODS - Body may be edited by hand.
|
||||
@@ -187,6 +189,40 @@ void CefBrowserHostCToCpp::SetZoomLevel(double zoomLevel) {
|
||||
zoomLevel);
|
||||
}
|
||||
|
||||
void CefBrowserHostCToCpp::RunFileDialog(FileDialogMode mode,
|
||||
const CefString& title, const CefString& default_file_name,
|
||||
const std::vector<CefString>& accept_types,
|
||||
CefRefPtr<CefRunFileDialogCallback> callback) {
|
||||
if (CEF_MEMBER_MISSING(struct_, run_file_dialog))
|
||||
return;
|
||||
|
||||
// AUTO-GENERATED CONTENT - DELETE THIS COMMENT BEFORE MODIFYING
|
||||
|
||||
// Verify param: callback; type: refptr_diff
|
||||
DCHECK(callback.get());
|
||||
if (!callback.get())
|
||||
return;
|
||||
// Unverified params: title, default_file_name, accept_types
|
||||
|
||||
// Translate param: accept_types; type: string_vec_byref_const
|
||||
cef_string_list_t accept_typesList = cef_string_list_alloc();
|
||||
DCHECK(accept_typesList);
|
||||
if (accept_typesList)
|
||||
transfer_string_list_contents(accept_types, accept_typesList);
|
||||
|
||||
// Execute
|
||||
struct_->run_file_dialog(struct_,
|
||||
mode,
|
||||
title.GetStruct(),
|
||||
default_file_name.GetStruct(),
|
||||
accept_typesList,
|
||||
CefRunFileDialogCallbackCppToC::Wrap(callback));
|
||||
|
||||
// Restore param:accept_types; type: string_vec_byref_const
|
||||
if (accept_typesList)
|
||||
cef_string_list_free(accept_typesList);
|
||||
}
|
||||
|
||||
|
||||
#ifndef NDEBUG
|
||||
template<> long CefCToCpp<CefBrowserHostCToCpp, CefBrowserHost,
|
||||
|
Reference in New Issue
Block a user