void ShowMessageBox(int type,
const std::vector<std::string>& buttons,
+ int cancel_id,
const std::vector<std::string>& texts,
const gfx::ImageSkia& icon,
atom::NativeWindow* window,
if (mate::Converter<atom::MessageBoxCallback>::FromV8(args->isolate(),
peek,
&callback)) {
- atom::ShowMessageBox(window, (atom::MessageBoxType)type, buttons, title,
- message, detail, icon, callback);
+ atom::ShowMessageBox(window, (atom::MessageBoxType)type, buttons, cancel_id,
+ title, message, detail, icon, callback);
} else {
int chosen = atom::ShowMessageBox(window, (atom::MessageBoxType)type,
- buttons, title, message, detail, icon);
+ buttons, cancel_id, title, message,
+ detail, icon);
args->Return(chosen);
}
}
options.message ?= ''
options.detail ?= ''
options.icon ?= null
+ options.cancelId ?= 0
binding.showMessageBox messageBoxType,
options.buttons,
+ options.cancelId,
[options.title, options.message, options.detail],
options.icon,
window,
int ShowMessageBox(NativeWindow* parent_window,
MessageBoxType type,
const std::vector<std::string>& buttons,
+ int cancel_id,
const std::string& title,
const std::string& message,
const std::string& detail,
void ShowMessageBox(NativeWindow* parent_window,
MessageBoxType type,
const std::vector<std::string>& buttons,
+ int cancel_id,
const std::string& title,
const std::string& message,
const std::string& detail,
GtkMessageBox(NativeWindow* parent_window,
MessageBoxType type,
const std::vector<std::string>& buttons,
+ int cancel_id,
const std::string& title,
const std::string& message,
const std::string& detail,
const gfx::ImageSkia& icon)
: dialog_scope_(parent_window),
- cancel_id_(0) {
+ cancel_id_(cancel_id) {
// Create dialog.
dialog_ = gtk_message_dialog_new(
nullptr, // parent
int ShowMessageBox(NativeWindow* parent,
MessageBoxType type,
const std::vector<std::string>& buttons,
+ int cancel_id,
const std::string& title,
const std::string& message,
const std::string& detail,
const gfx::ImageSkia& icon) {
- return GtkMessageBox(parent, type, buttons, title, message, detail,
+ return GtkMessageBox(parent, type, buttons, cancel_id, title, message, detail,
icon).RunSynchronous();
}
void ShowMessageBox(NativeWindow* parent,
MessageBoxType type,
const std::vector<std::string>& buttons,
+ int cancel_id,
const std::string& title,
const std::string& message,
const std::string& detail,
const gfx::ImageSkia& icon,
const MessageBoxCallback& callback) {
- (new GtkMessageBox(parent, type, buttons, title, message, detail,
+ (new GtkMessageBox(parent, type, buttons, cancel_id, title, message, detail,
icon))->RunAsynchronous(callback);
}
void ShowErrorBox(const base::string16& title, const base::string16& content) {
if (Browser::Get()->is_ready()) {
- GtkMessageBox(nullptr, MESSAGE_BOX_TYPE_ERROR, { "OK" }, "Error",
+ GtkMessageBox(nullptr, MESSAGE_BOX_TYPE_ERROR, { "OK" }, 0, "Error",
base::UTF16ToUTF8(title).c_str(),
base::UTF16ToUTF8(content).c_str(),
gfx::ImageSkia()).RunSynchronous();
int ShowMessageBox(NativeWindow* parent_window,
MessageBoxType type,
const std::vector<std::string>& buttons,
+ int cancel_id,
const std::string& title,
const std::string& message,
const std::string& detail,
void ShowMessageBox(NativeWindow* parent_window,
MessageBoxType type,
const std::vector<std::string>& buttons,
+ int cancel_id,
const std::string& title,
const std::string& message,
const std::string& detail,
MessageDialog(NativeWindow* parent_window,
MessageBoxType type,
const std::vector<std::string>& buttons,
+ int cancel_id,
const std::string& title,
const std::string& message,
const std::string& detail,
gfx::ImageSkia icon_;
bool delete_on_close_;
+ int cancel_id_;
int result_;
base::string16 title_;
MessageDialog::MessageDialog(NativeWindow* parent_window,
MessageBoxType type,
const std::vector<std::string>& buttons,
+ int cancel_id,
const std::string& title,
const std::string& message,
const std::string& detail,
const gfx::ImageSkia& icon)
: icon_(icon),
delete_on_close_(false),
+ cancel_id_(cancel_id),
result_(-1),
title_(base::UTF8ToUTF16(title)),
parent_(parent_window),
return i;
}
- return 0;
+ return cancel_id_;
} else {
return result_;
}
int ShowMessageBox(NativeWindow* parent_window,
MessageBoxType type,
const std::vector<std::string>& buttons,
+ int cancel_id,
const std::string& title,
const std::string& message,
const std::string& detail,
const gfx::ImageSkia& icon) {
MessageDialog dialog(
- parent_window, type, buttons, title, message, detail, icon);
+ parent_window, type, buttons, cancel_id, title, message, detail, icon);
{
base::MessageLoop::ScopedNestableTaskAllower allow(
base::MessageLoopForUI::current());
void ShowMessageBox(NativeWindow* parent_window,
MessageBoxType type,
const std::vector<std::string>& buttons,
+ int cancel_id,
const std::string& title,
const std::string& message,
const std::string& detail,
const MessageBoxCallback& callback) {
// The dialog would be deleted when the dialog is closed.
MessageDialog* dialog = new MessageDialog(
- parent_window, type, buttons, title, message, detail, icon);
+ parent_window, type, buttons, cancel_id, title, message, detail, icon);
dialog->set_callback(callback);
dialog->Show();
}