8991c0056e
* feat: promisify dialog.showMessageBox() * address feedback from review
69 lines
2 KiB
C++
69 lines
2 KiB
C++
// 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 ATOM_BROWSER_UI_MESSAGE_BOX_H_
|
|
#define ATOM_BROWSER_UI_MESSAGE_BOX_H_
|
|
|
|
#include <string>
|
|
#include <vector>
|
|
|
|
#include "base/callback_forward.h"
|
|
#include "base/strings/string16.h"
|
|
|
|
namespace gfx {
|
|
class ImageSkia;
|
|
}
|
|
|
|
namespace atom {
|
|
|
|
class NativeWindow;
|
|
|
|
enum MessageBoxType {
|
|
MESSAGE_BOX_TYPE_NONE = 0,
|
|
MESSAGE_BOX_TYPE_INFORMATION,
|
|
MESSAGE_BOX_TYPE_WARNING,
|
|
MESSAGE_BOX_TYPE_ERROR,
|
|
MESSAGE_BOX_TYPE_QUESTION,
|
|
};
|
|
|
|
enum MessageBoxOptions {
|
|
MESSAGE_BOX_NONE = 0,
|
|
MESSAGE_BOX_NO_LINK = 1 << 0,
|
|
};
|
|
|
|
int ShowMessageBoxSync(NativeWindow* parent_window,
|
|
MessageBoxType type,
|
|
const std::vector<std::string>& buttons,
|
|
int default_id,
|
|
int cancel_id,
|
|
int options,
|
|
const std::string& title,
|
|
const std::string& message,
|
|
const std::string& detail,
|
|
const gfx::ImageSkia& icon);
|
|
|
|
typedef base::OnceCallback<void(int code, bool checkbox_checked)>
|
|
MessageBoxCallback;
|
|
|
|
void ShowMessageBox(NativeWindow* parent_window,
|
|
MessageBoxType type,
|
|
const std::vector<std::string>& buttons,
|
|
int default_id,
|
|
int cancel_id,
|
|
int options,
|
|
const std::string& title,
|
|
const std::string& message,
|
|
const std::string& detail,
|
|
const std::string& checkbox_label,
|
|
bool checkbox_checked,
|
|
const gfx::ImageSkia& icon,
|
|
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 atom
|
|
|
|
#endif // ATOM_BROWSER_UI_MESSAGE_BOX_H_
|