From dc5fdaad9f80eba3da2aeb2010e4bef2731af916 Mon Sep 17 00:00:00 2001 From: amaitland Date: Fri, 6 Jun 2014 07:58:10 +1000 Subject: [PATCH] Add CefFileDialogMode enum to IDialogHandler.OnFileDialog --- CefSharp.Core/Internals/ClientAdapter.cpp | 2 +- CefSharp.Example/TempFileDialogHandler.cs | 2 +- CefSharp/CefFileDialogMode.cs | 20 ++++++++++++++++++++ CefSharp/CefSharp.csproj | 1 + CefSharp/IDialogHandler.cs | 2 +- 5 files changed, 24 insertions(+), 3 deletions(-) create mode 100644 CefSharp/CefFileDialogMode.cs diff --git a/CefSharp.Core/Internals/ClientAdapter.cpp b/CefSharp.Core/Internals/ClientAdapter.cpp index 39c1aa663..a72ee41b3 100644 --- a/CefSharp.Core/Internals/ClientAdapter.cpp +++ b/CefSharp.Core/Internals/ClientAdapter.cpp @@ -450,7 +450,7 @@ namespace CefSharp List^ resultString = nullptr; - result = handler->OnFileDialog(_browserControl, StringUtils::ToClr(title), StringUtils::ToClr(default_file_name), StringUtils::ToClr(accept_types), resultString); + result = handler->OnFileDialog(_browserControl, (CefFileDialogMode)mode, StringUtils::ToClr(title), StringUtils::ToClr(default_file_name), StringUtils::ToClr(accept_types), resultString); callback->Continue(StringUtils::ToNative(resultString)); return result; diff --git a/CefSharp.Example/TempFileDialogHandler.cs b/CefSharp.Example/TempFileDialogHandler.cs index 2f902d98c..75581a266 100644 --- a/CefSharp.Example/TempFileDialogHandler.cs +++ b/CefSharp.Example/TempFileDialogHandler.cs @@ -5,7 +5,7 @@ namespace CefSharp.Example { public class TempFileDialogHandler : IDialogHandler { - public bool OnFileDialog(IWebBrowser browser, string title, string defaultFileName, List acceptTypes, out List result) + public bool OnFileDialog(IWebBrowser browser, CefFileDialogMode mode, string title, string defaultFileName, List acceptTypes, out List result) { result = new List { Path.GetRandomFileName() }; return true; diff --git a/CefSharp/CefFileDialogMode.cs b/CefSharp/CefFileDialogMode.cs new file mode 100644 index 000000000..98c893d55 --- /dev/null +++ b/CefSharp/CefFileDialogMode.cs @@ -0,0 +1,20 @@ +namespace CefSharp +{ + public enum CefFileDialogMode + { + /// + /// Requires that the file exists before allowing the user to pick it. + /// + Open = 0, + + /// + /// Like Open, but allows picking multiple files to open. + /// + OpenMultiple, + + /// + /// Allows picking a nonexistent file, and prompts to overwrite if the file already exists. + /// + Save + } +} diff --git a/CefSharp/CefSharp.csproj b/CefSharp/CefSharp.csproj index d19c5138c..e8085026a 100644 --- a/CefSharp/CefSharp.csproj +++ b/CefSharp/CefSharp.csproj @@ -86,6 +86,7 @@ + diff --git a/CefSharp/IDialogHandler.cs b/CefSharp/IDialogHandler.cs index d54d847f8..6c673e260 100644 --- a/CefSharp/IDialogHandler.cs +++ b/CefSharp/IDialogHandler.cs @@ -3,6 +3,6 @@ namespace CefSharp { public interface IDialogHandler { - bool OnFileDialog(IWebBrowser browser, string title, string defaultFileName, List acceptTypes, out List result); + bool OnFileDialog(IWebBrowser browser, CefFileDialogMode mode, string title, string defaultFileName, List acceptTypes, out List result); } }