feat: promisify dialog.showMessageBox() (#17298)

* feat: promisify dialog.showMessageBox()

* address feedback from review
This commit is contained in:
Shelley Vohr 2019-03-12 11:06:59 -07:00 committed by GitHub
parent ea6a926494
commit 8991c0056e
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
7 changed files with 234 additions and 191 deletions

View file

@ -32,19 +32,19 @@ enum MessageBoxOptions {
MESSAGE_BOX_NO_LINK = 1 << 0,
};
typedef base::Callback<void(int code, bool checkbox_checked)>
MessageBoxCallback;
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);
int 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 gfx::ImageSkia& icon);
typedef base::OnceCallback<void(int code, bool checkbox_checked)>
MessageBoxCallback;
void ShowMessageBox(NativeWindow* parent_window,
MessageBoxType type,
@ -58,7 +58,7 @@ void ShowMessageBox(NativeWindow* parent_window,
const std::string& checkbox_label,
bool checkbox_checked,
const gfx::ImageSkia& icon,
const MessageBoxCallback& callback);
MessageBoxCallback callback);
// Like ShowMessageBox with simplest settings, but safe to call at very early
// stage of application.