/
message_box.h
63 lines (48 loc) · 1.52 KB
/
message_box.h
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
// Copyright (c) 2013 GitHub, Inc.
// Use of this source code is governed by the MIT license that can be
// found in the LICENSE file.
#ifndef SHELL_BROWSER_UI_MESSAGE_BOX_H_
#define SHELL_BROWSER_UI_MESSAGE_BOX_H_
#include <string>
#include <utility>
#include <vector>
#include "base/callback_forward.h"
#include "base/strings/string16.h"
#include "ui/gfx/image/image_skia.h"
namespace electron {
class NativeWindow;
enum class MessageBoxType {
kNone = 0,
kInformation,
kWarning,
kError,
kQuestion,
};
using DialogResult = std::pair<int, bool>;
struct MessageBoxSettings {
electron::NativeWindow* parent_window = nullptr;
MessageBoxType type = electron::MessageBoxType::kNone;
std::vector<std::string> buttons;
int default_id;
int cancel_id;
bool no_link = false;
std::string title;
std::string message;
std::string detail;
std::string checkbox_label;
bool checkbox_checked = false;
gfx::ImageSkia icon;
MessageBoxSettings();
MessageBoxSettings(const MessageBoxSettings&);
~MessageBoxSettings();
};
int ShowMessageBoxSync(const MessageBoxSettings& settings);
typedef base::OnceCallback<void(int code, bool checkbox_checked)>
MessageBoxCallback;
void ShowMessageBox(const MessageBoxSettings& settings,
MessageBoxCallback callback);
// Like ShowMessageBox with simplest settings, but safe to call at very early
// stage of application.
void ShowErrorBox(const base::string16& title, const base::string16& content);
} // namespace electron
#endif // SHELL_BROWSER_UI_MESSAGE_BOX_H_