// Copyright © 2014 The CefSharp Authors. All rights reserved. // // Use of this source code is governed by a BSD-style license that can be found in the LICENSE file. using System.Collections.Generic; namespace CefSharp { /// /// Implement this interface to handle dialog events. The methods of this class will be called on the CEF UI thread. /// public interface IDialogHandler { /// /// Runs a file chooser dialog. /// /// /// To test assign something like TempFileDialogHandler (from CefSharp.Example) to DialogHandler e.g. /// /// browser.DialogHandler = new TempFileDialogHandler(); /// /// Example URL to use for file browsing http://www.cs.tut.fi/~jkorpela/forms/file.html#example /// Simply click browse, the space next to the browse button should be populated with a randomly generated filename. /// /// the ChromiumWebBrowser control /// the browser object /// represents the type of dialog to display /// the title to be used for the dialog. It may be empty to show the default title ("Open" or "Save" /// depending on the mode). /// is the path with optional directory and/or file name component that /// should be initially selected in the dialog. /// are used to restrict the selectable file types and may any combination of /// (a) valid lower-cased MIME types (e.g. "text/*" or "image/*"), /// (b) individual file extensions (e.g. ".txt" or ".png"), /// (c) combined description and file extension delimited using "|" and ";" (e.g. "Image Types|.png;.gif;.jpg"). /// provides the semicolon-delimited expansion of MIME /// types to file extensions (if known, or empty string otherwise). /// /// Provides the descriptions for MIME types (if known, or empty string otherwise). /// For example, the 'image/*' mime type might have extensions ".png;.jpg;.bmp;..." and description 'Image Files' /// /// Callback interface for asynchronous continuation of file dialog requests. /// To display a custom dialog return true. To display the default dialog return false. bool OnFileDialog( IWebBrowser chromiumWebBrowser, IBrowser browser, CefFileDialogMode mode, string title, string defaultFilePath, IReadOnlyCollection acceptFilters, IReadOnlyCollection acceptExtensions, IReadOnlyCollection acceptDescriptions, IFileDialogCallback callback); } }