]> git.sesse.net Git - casparcg/blob - dependencies64/cef/include/cef_dialog_handler.h
* Merged html producer and updated to latest CEF version (does not have satisfactory...
[casparcg] / dependencies64 / cef / include / cef_dialog_handler.h
1 // Copyright (c) 2012 Marshall A. Greenblatt. All rights reserved.
2 //
3 // Redistribution and use in source and binary forms, with or without
4 // modification, are permitted provided that the following conditions are
5 // met:
6 //
7 //    * Redistributions of source code must retain the above copyright
8 // notice, this list of conditions and the following disclaimer.
9 //    * Redistributions in binary form must reproduce the above
10 // copyright notice, this list of conditions and the following disclaimer
11 // in the documentation and/or other materials provided with the
12 // distribution.
13 //    * Neither the name of Google Inc. nor the name Chromium Embedded
14 // Framework nor the names of its contributors may be used to endorse
15 // or promote products derived from this software without specific prior
16 // written permission.
17 //
18 // THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
19 // "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
20 // LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
21 // A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
22 // OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
23 // SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
24 // LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
25 // DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
26 // THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
27 // (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
28 // OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
29 //
30 // ---------------------------------------------------------------------------
31 //
32 // The contents of this file must follow a specific format in order to
33 // support the CEF translator tool. See the translator.README.txt file in the
34 // tools directory for more information.
35 //
36
37 #ifndef CEF_INCLUDE_CEF_DIALOG_HANDLER_H_
38 #define CEF_INCLUDE_CEF_DIALOG_HANDLER_H_
39 #pragma once
40
41 #include "include/cef_base.h"
42 #include "include/cef_browser.h"
43
44 ///
45 // Callback interface for asynchronous continuation of file dialog requests.
46 ///
47 /*--cef(source=library)--*/
48 class CefFileDialogCallback : public virtual CefBase {
49  public:
50   ///
51   // Continue the file selection. |selected_accept_filter| should be the 0-based
52   // index of the value selected from the accept filters array passed to
53   // CefDialogHandler::OnFileDialog. |file_paths| should be a single value or a
54   // list of values depending on the dialog mode. An empty |file_paths| value is
55   // treated the same as calling Cancel().
56   ///
57   /*--cef(capi_name=cont,index_param=selected_accept_filter,
58           optional_param=file_paths)--*/
59   virtual void Continue(int selected_accept_filter,
60                         const std::vector<CefString>& file_paths) =0;
61
62   ///
63   // Cancel the file selection.
64   ///
65   /*--cef()--*/
66   virtual void Cancel() =0;
67 };
68
69
70 ///
71 // Implement this interface to handle dialog events. The methods of this class
72 // will be called on the browser process UI thread.
73 ///
74 /*--cef(source=client)--*/
75 class CefDialogHandler : public virtual CefBase {
76  public:
77   typedef cef_file_dialog_mode_t FileDialogMode;
78
79   ///
80   // Called to run a file chooser dialog. |mode| represents the type of dialog
81   // to display. |title| to the title to be used for the dialog and may be empty
82   // to show the default title ("Open" or "Save" depending on the mode).
83   // |default_file_path| is the path with optional directory and/or file name
84   // component that should be initially selected in the dialog. |accept_filters|
85   // are used to restrict the selectable file types and may any combination of
86   // (a) valid lower-cased MIME types (e.g. "text/*" or "image/*"),
87   // (b) individual file extensions (e.g. ".txt" or ".png"), or (c) combined
88   // description and file extension delimited using "|" and ";" (e.g.
89   // "Image Types|.png;.gif;.jpg"). |selected_accept_filter| is the 0-based
90   // index of the filter that should be selected by default. To display a custom
91   // dialog return true and execute |callback| either inline or at a later time.
92   // To display the default dialog return false.
93   ///
94   /*--cef(optional_param=title,optional_param=default_file_path,
95           optional_param=accept_filters,index_param=selected_accept_filter)--*/
96   virtual bool OnFileDialog(CefRefPtr<CefBrowser> browser,
97                             FileDialogMode mode,
98                             const CefString& title,
99                             const CefString& default_file_path,
100                             const std::vector<CefString>& accept_filters,
101                             int selected_accept_filter,
102                             CefRefPtr<CefFileDialogCallback> callback) {
103     return false;
104   }
105 };
106
107 #endif  // CEF_INCLUDE_CEF_DIALOG_HANDLER_H_