message_box.h 2.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869
  1. // Copyright (c) 2013 GitHub, Inc.
  2. // Use of this source code is governed by the MIT license that can be
  3. // found in the LICENSE file.
  4. #ifndef ATOM_BROWSER_UI_MESSAGE_BOX_H_
  5. #define ATOM_BROWSER_UI_MESSAGE_BOX_H_
  6. #include <string>
  7. #include <vector>
  8. #include "base/callback_forward.h"
  9. #include "base/strings/string16.h"
  10. namespace gfx {
  11. class ImageSkia;
  12. }
  13. namespace atom {
  14. class NativeWindow;
  15. enum MessageBoxType {
  16. MESSAGE_BOX_TYPE_NONE = 0,
  17. MESSAGE_BOX_TYPE_INFORMATION,
  18. MESSAGE_BOX_TYPE_WARNING,
  19. MESSAGE_BOX_TYPE_ERROR,
  20. MESSAGE_BOX_TYPE_QUESTION,
  21. };
  22. enum MessageBoxOptions {
  23. MESSAGE_BOX_NONE = 0,
  24. MESSAGE_BOX_NO_LINK = 1 << 0,
  25. };
  26. int ShowMessageBoxSync(NativeWindow* parent_window,
  27. MessageBoxType type,
  28. const std::vector<std::string>& buttons,
  29. int default_id,
  30. int cancel_id,
  31. int options,
  32. const std::string& title,
  33. const std::string& message,
  34. const std::string& detail,
  35. const gfx::ImageSkia& icon);
  36. typedef base::OnceCallback<void(int code, bool checkbox_checked)>
  37. MessageBoxCallback;
  38. void ShowMessageBox(NativeWindow* parent_window,
  39. MessageBoxType type,
  40. const std::vector<std::string>& buttons,
  41. int default_id,
  42. int cancel_id,
  43. int options,
  44. const std::string& title,
  45. const std::string& message,
  46. const std::string& detail,
  47. const std::string& checkbox_label,
  48. bool checkbox_checked,
  49. const gfx::ImageSkia& icon,
  50. MessageBoxCallback callback);
  51. // Like ShowMessageBox with simplest settings, but safe to call at very early
  52. // stage of application.
  53. void ShowErrorBox(const base::string16& title, const base::string16& content);
  54. } // namespace atom
  55. #endif // ATOM_BROWSER_UI_MESSAGE_BOX_H_