select_file_dialog.mojom 1.5 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647
  1. // Copyright 2019 The Chromium Authors. All rights reserved.
  2. // Use of this source code is governed by a BSD-style license that can be
  3. // found in the LICENSE file.
  4. module remote_cocoa.mojom;
  5. import "mojo/public/mojom/base/file_path.mojom";
  6. import "mojo/public/mojom/base/string16.mojom";
  7. // The type of dialog to open. This corresponds to the subset of
  8. // ui::SelectFileDialog::Type that is used on macOS.
  9. enum SelectFileDialogType {
  10. kFolder,
  11. kUploadFolder,
  12. kExistingFolder,
  13. kOpenFile,
  14. kOpenMultiFile,
  15. kSaveAsFile
  16. };
  17. // Information about the file extensions to be shown in the dialog.
  18. struct SelectFileTypeInfo {
  19. // The list of allowed extensions.
  20. array<array<string>> extensions;
  21. // Override of system descriptions of specified extensions.
  22. array<mojo_base.mojom.String16> extension_description_overrides;
  23. // Specifies whether or not there is be a filter added for all files.
  24. bool include_all_files;
  25. // Specifies whether the (save) file dialog should keep the extension visible.
  26. bool keep_extension_visible;
  27. };
  28. // The interface to a file selection (Save As, Upload, etc) dialog.
  29. interface SelectFileDialog {
  30. // Show the dialog, and issue a callback when it has completed.
  31. Show(SelectFileDialogType type,
  32. mojo_base.mojom.String16 title,
  33. mojo_base.mojom.FilePath file_path,
  34. SelectFileTypeInfo? file_types,
  35. int32 file_type_index,
  36. string default_extension) => (bool was_cancelled,
  37. array<mojo_base.mojom.FilePath> files,
  38. int32 index);
  39. };