void ShowMessageBox(int type,
const std::vector<std::string>& buttons,
- int default_button_index,
+ int default_id,
int cancel_id,
int options,
const std::string& title,
peek,
&callback)) {
atom::ShowMessageBox(window, (atom::MessageBoxType)type, buttons,
- default_button_index, cancel_id, options, title,
+ default_id, cancel_id, options, title,
message, detail, icon, callback);
} else {
int chosen = atom::ShowMessageBox(window, (atom::MessageBoxType)type,
- buttons, default_button_index, cancel_id,
+ buttons, default_id, cancel_id,
options, title, message, detail, icon);
args->Return(chosen);
}
options.message ?= ''
options.detail ?= ''
options.icon ?= null
- options.defaultButtonIndex ?= -1
+ options.defaultId ?= -1
# Choose a default button to get selected when dialog is cancelled.
unless options.cancelId?
binding.showMessageBox messageBoxType,
options.buttons,
- options.defaultButtonIndex,
+ options.defaultId,
options.cancelId,
flags,
options.title,
MessageBoxType type,
const std::vector<std::string>& buttons,
int cancel_id,
- int default_button_index,
+ int default_id,
int options,
const std::string& title,
const std::string& message,
void ShowMessageBox(NativeWindow* parent_window,
MessageBoxType type,
const std::vector<std::string>& buttons,
- int default_button_index,
+ int default_id,
int cancel_id,
int options,
const std::string& title,
GtkMessageBox(NativeWindow* parent_window,
MessageBoxType type,
const std::vector<std::string>& buttons,
- int default_button_index,
+ int default_id,
int cancel_id,
const std::string& title,
const std::string& message,
// Add buttons.
for (size_t i = 0; i < buttons.size(); ++i) {
- if (i == (size_t)default_button_index) {
+ if (i == (size_t)default_id) {
GtkWidget* button = gtk_dialog_add_button(GTK_DIALOG(dialog_),
TranslateToStock(i, buttons[i]),
i);
int ShowMessageBox(NativeWindow* parent,
MessageBoxType type,
const std::vector<std::string>& buttons,
- int default_button_index,
+ int default_id,
int cancel_id,
int options,
const std::string& title,
const std::string& message,
const std::string& detail,
const gfx::ImageSkia& icon) {
- return GtkMessageBox(parent, type, buttons, default_button_index, cancel_id,
+ return GtkMessageBox(parent, type, buttons, default_id, cancel_id,
title, message, detail, icon).RunSynchronous();
}
void ShowMessageBox(NativeWindow* parent,
MessageBoxType type,
const std::vector<std::string>& buttons,
- int default_button_index,
+ int default_id,
int cancel_id,
int options,
const std::string& title,
const std::string& detail,
const gfx::ImageSkia& icon,
const MessageBoxCallback& callback) {
- (new GtkMessageBox(parent, type, buttons, default_button_index, cancel_id,
+ (new GtkMessageBox(parent, type, buttons, default_id, cancel_id,
title, message, detail, icon))->RunAsynchronous(callback);
}
NSAlert* CreateNSAlert(NativeWindow* parent_window,
MessageBoxType type,
const std::vector<std::string>& buttons,
- int default_button_index,
+ int default_id,
const std::string& title,
const std::string& message,
const std::string& detail) {
NSButton* button = [alert addButtonWithTitle:title];
[button setTag:i];
- if (i == (size_t)default_button_index) {
- // focus the button at default_button_index if the user opted to do so.
+ if (i == (size_t)default_id) {
+ // focus the button at default_id if the user opted to do so.
// The first button added gets set as the default selected.
// So remove that default, and make the requested button the default
[[[alert buttons] objectAtIndex:0] setKeyEquivalent:@""];
int ShowMessageBox(NativeWindow* parent_window,
MessageBoxType type,
const std::vector<std::string>& buttons,
- int default_button_index,
+ int default_id,
int cancel_id,
int options,
const std::string& title,
const std::string& detail,
const gfx::ImageSkia& icon) {
NSAlert* alert = CreateNSAlert(
- parent_window, type, buttons, default_button_index, title, message,
+ parent_window, type, buttons, default_id, title, message,
detail);
// Use runModal for synchronous alert without parent, since we don't have a
void ShowMessageBox(NativeWindow* parent_window,
MessageBoxType type,
const std::vector<std::string>& buttons,
- int default_button_index,
+ int default_id,
int cancel_id,
int options,
const std::string& title,
const gfx::ImageSkia& icon,
const MessageBoxCallback& callback) {
NSAlert* alert = CreateNSAlert(
- parent_window, type, buttons, default_button_index, title, message,
+ parent_window, type, buttons, default_id, title, message,
detail);
ModalDelegate* delegate = [[ModalDelegate alloc] initWithCallback:callback
andAlert:alert
int ShowMessageBoxUTF16(HWND parent,
MessageBoxType type,
const std::vector<base::string16>& buttons,
- int default_button_index,
+ int default_id,
int cancel_id,
int options,
const base::string16& title,
NativeWindow* parent,
MessageBoxType type,
const std::vector<std::string>& buttons,
- int default_button_index,
+ int default_id,
int cancel_id,
int options,
const std::string& title,
const std::string& detail,
const gfx::ImageSkia& icon,
const MessageBoxCallback& callback) {
- int result = ShowMessageBox(parent, type, buttons, default_button_index,
+ int result = ShowMessageBox(parent, type, buttons, default_id,
cancel_id, options, title, message, detail, icon);
content::BrowserThread::PostTask(
content::BrowserThread::UI, FROM_HERE, base::Bind(callback, result));
int ShowMessageBox(NativeWindow* parent,
MessageBoxType type,
const std::vector<std::string>& buttons,
- int default_button_index,
+ int default_id,
int cancel_id,
int options,
const std::string& title,
return ShowMessageBoxUTF16(hwnd_parent,
type,
utf16_buttons,
- default_button_index,
+ default_id,
cancel_id,
options,
base::UTF8ToUTF16(title),
void ShowMessageBox(NativeWindow* parent,
MessageBoxType type,
const std::vector<std::string>& buttons,
- int default_button_index,
+ int default_id,
int cancel_id,
int options,
const std::string& title,
unretained->message_loop()->PostTask(
FROM_HERE,
base::Bind(&RunMessageBoxInNewThread, base::Unretained(unretained),
- parent, type, buttons, default_button_index,
+ parent, type, buttons, default_id,
cancel_id, options, title, message, detail, icon, callback));
}
`"warning"`. On Windows, "question" displays the same icon as "info", unless
you set an icon using the "icon" option.
* `buttons` Array - Array of texts for buttons.
- * `defaultButtonIndex` Integer - Index of the button in the buttons array which will be selected by default when the message box opens.
+ * `defaultId` Integer - Index of the button in the buttons array which will be selected by default when the message box opens.
* `title` String - Title of the message box, some platforms will not show it.
* `message` String - Content of the message box.
* `detail` String - Extra information of the message.