message_box.h 1.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566
  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)> MessageBoxCallback;
  27. int ShowMessageBox(NativeWindow* parent_window,
  28. MessageBoxType type,
  29. const std::vector<std::string>& buttons,
  30. int default_id,
  31. int cancel_id,
  32. int options,
  33. const std::string& title,
  34. const std::string& message,
  35. const std::string& detail,
  36. const gfx::ImageSkia& icon);
  37. void ShowMessageBox(NativeWindow* parent_window,
  38. MessageBoxType type,
  39. const std::vector<std::string>& buttons,
  40. int default_id,
  41. int cancel_id,
  42. int options,
  43. const std::string& title,
  44. const std::string& message,
  45. const std::string& detail,
  46. const gfx::ImageSkia& icon,
  47. const MessageBoxCallback& callback);
  48. // Like ShowMessageBox with simplest settings, but safe to call at very early
  49. // stage of application.
  50. void ShowErrorBox(const base::string16& title, const base::string16& content);
  51. } // namespace atom
  52. #endif // ATOM_BROWSER_UI_MESSAGE_BOX_H_