alert.mojom 1.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051
  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/string16.mojom";
  6. struct AlertBridgeInitParams {
  7. // The dialog title and text.
  8. mojo_base.mojom.String16 title;
  9. mojo_base.mojom.String16 message_text;
  10. // Set if the application icon should be hidden.
  11. bool hide_application_icon;
  12. // Text for the primary button (which is also the default button).
  13. mojo_base.mojom.String16 primary_button_text;
  14. // Text for the secondary (non-default) button. If not set, then there is only
  15. // one button for this alert.
  16. mojo_base.mojom.String16? secondary_button_text;
  17. // Default text for the text field. If not set, then there is no text field
  18. // for this alert.
  19. mojo_base.mojom.String16? text_field_text;
  20. // The text for the checkbox. If not set, then there is no checkbox for this
  21. // alert.
  22. mojo_base.mojom.String16? check_box_text;
  23. };
  24. // Disposition of alert window.
  25. enum AlertDisposition {
  26. // Default button was pressed.
  27. PRIMARY_BUTTON,
  28. // Secondary button was pressed.
  29. SECONDARY_BUTTON,
  30. // The window was closed without a selection being made.
  31. CLOSE,
  32. };
  33. interface AlertBridge {
  34. // Initialize and show the alert. Return in |disposition| is how the window
  35. // was dismissed. Return in |text_field_value| the value of the text field
  36. // shown in the alert (if any). Return true in |check_box_value| only if the
  37. // alert had a checkbox and it was checked.
  38. Show(AlertBridgeInitParams params) =>
  39. (AlertDisposition disposition, mojo_base.mojom.String16 text_field_value,
  40. bool check_box_value);
  41. };