1 // Copyright 2021 The Chromium Embedded Framework Authors. All rights reserved. 2 // Use of this source code is governed by a BSD-style license that can be found 3 // in the LICENSE file. 4 5 #ifndef CEF_LIBCEF_BROWSER_ALLOY_ALLOY_DIALOG_UTIL_H_ 6 #define CEF_LIBCEF_BROWSER_ALLOY_ALLOY_DIALOG_UTIL_H_ 7 #pragma once 8 9 #include <string> 10 #include <vector> 11 12 #include "base/callback.h" 13 #include "base/files/file_path.h" 14 #include "third_party/blink/public/mojom/choosers/file_chooser.mojom.h" 15 16 namespace content { 17 class WebContents; 18 } 19 20 namespace alloy { 21 22 // The argument vector will be empty if the dialog was canceled. 23 using RunFileChooserCallback = 24 base::OnceCallback<void(int /*selected_accept_filter*/, 25 const std::vector<base::FilePath>& /*file_paths*/)>; 26 27 // Display the file chooser dialog. Execute |callback| on completion. 28 // Called from patched chrome/ files. 29 void RunFileChooser(content::WebContents* web_contents, 30 const blink::mojom::FileChooserParams& params, 31 RunFileChooserCallback callback); 32 33 std::u16string FilePathTypeToString16(const base::FilePath::StringType& str); 34 35 } // namespace alloy 36 37 #endif // CEF_LIBCEF_BROWSER_ALLOY_ALLOY_DIALOG_UTIL_H_ 38