message_box.h 2.0 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970
  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. typedef base::Callback<void(int code, bool checkbox_checked)>
  27. MessageBoxCallback;
  28. int ShowMessageBox(NativeWindow* parent_window,
  29. MessageBoxType type,
  30. const std::vector<std::string>& buttons,
  31. int default_id,
  32. int cancel_id,
  33. int options,
  34. const std::string& title,
  35. const std::string& message,
  36. const std::string& detail,
  37. const gfx::ImageSkia& icon);
  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. const 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_