🏁 update windows message_box function signatures to accept default_button_index....and do nothing with it

This commit is contained in:
leethomas 2016-01-07 22:34:16 -08:00
parent c4c145ef6a
commit dfce803045
3 changed files with 20 additions and 14 deletions

View file

@ -55,12 +55,13 @@ void ShowMessageBox(int type,
if (mate::Converter<atom::MessageBoxCallback>::FromV8(args->isolate(), if (mate::Converter<atom::MessageBoxCallback>::FromV8(args->isolate(),
peek, peek,
&callback)) { &callback)) {
atom::ShowMessageBox(window, (atom::MessageBoxType)type, buttons, default_button_index, atom::ShowMessageBox(window, (atom::MessageBoxType)type, buttons,
cancel_id, options, title, message, detail, icon, callback); default_button_index, cancel_id, options, title,
message, detail, icon, callback);
} else { } else {
int chosen = atom::ShowMessageBox(window, (atom::MessageBoxType)type, int chosen = atom::ShowMessageBox(window, (atom::MessageBoxType)type,
buttons, default_button_index, cancel_id, options, title, buttons, default_button_index, cancel_id,
message, detail, icon); options, title, message, detail, icon);
args->Return(chosen); args->Return(chosen);
} }
} }

View file

@ -176,8 +176,8 @@ int ShowMessageBox(NativeWindow* parent,
const std::string& message, const std::string& message,
const std::string& detail, const std::string& detail,
const gfx::ImageSkia& icon) { const gfx::ImageSkia& icon) {
return GtkMessageBox(parent, type, buttons, default_button_index, cancel_id, title, message, detail, return GtkMessageBox(parent, type, buttons, default_button_index, cancel_id,
icon).RunSynchronous(); title, message, detail, icon).RunSynchronous();
} }
void ShowMessageBox(NativeWindow* parent, void ShowMessageBox(NativeWindow* parent,
@ -191,8 +191,8 @@ void ShowMessageBox(NativeWindow* parent,
const std::string& detail, const std::string& detail,
const gfx::ImageSkia& icon, const gfx::ImageSkia& icon,
const MessageBoxCallback& callback) { const MessageBoxCallback& callback) {
(new GtkMessageBox(parent, type, buttons, default_button_index, cancel_id, title, message, detail, (new GtkMessageBox(parent, type, buttons, default_button_index, cancel_id,
icon))->RunAsynchronous(callback); title, message, detail, icon))->RunAsynchronous(callback);
} }
void ShowErrorBox(const base::string16& title, const base::string16& content) { void ShowErrorBox(const base::string16& title, const base::string16& content) {

View file

@ -72,6 +72,7 @@ void MapToCommonID(const std::vector<base::string16>& buttons,
int ShowMessageBoxUTF16(HWND parent, int ShowMessageBoxUTF16(HWND parent,
MessageBoxType type, MessageBoxType type,
const std::vector<base::string16>& buttons, const std::vector<base::string16>& buttons,
int default_button_index,
int cancel_id, int cancel_id,
int options, int options,
const base::string16& title, const base::string16& title,
@ -156,6 +157,7 @@ void RunMessageBoxInNewThread(base::Thread* thread,
NativeWindow* parent, NativeWindow* parent,
MessageBoxType type, MessageBoxType type,
const std::vector<std::string>& buttons, const std::vector<std::string>& buttons,
int default_button_index,
int cancel_id, int cancel_id,
int options, int options,
const std::string& title, const std::string& title,
@ -163,8 +165,8 @@ void RunMessageBoxInNewThread(base::Thread* thread,
const std::string& detail, const std::string& detail,
const gfx::ImageSkia& icon, const gfx::ImageSkia& icon,
const MessageBoxCallback& callback) { const MessageBoxCallback& callback) {
int result = ShowMessageBox(parent, type, buttons, cancel_id, options, title, int result = ShowMessageBox(parent, type, buttons, default_button_index,
message, detail, icon); cancel_id, options, title, message, detail, icon);
content::BrowserThread::PostTask( content::BrowserThread::PostTask(
content::BrowserThread::UI, FROM_HERE, base::Bind(callback, result)); content::BrowserThread::UI, FROM_HERE, base::Bind(callback, result));
content::BrowserThread::DeleteSoon( content::BrowserThread::DeleteSoon(
@ -176,6 +178,7 @@ void RunMessageBoxInNewThread(base::Thread* thread,
int ShowMessageBox(NativeWindow* parent, int ShowMessageBox(NativeWindow* parent,
MessageBoxType type, MessageBoxType type,
const std::vector<std::string>& buttons, const std::vector<std::string>& buttons,
int default_button_index,
int cancel_id, int cancel_id,
int options, int options,
const std::string& title, const std::string& title,
@ -194,6 +197,7 @@ int ShowMessageBox(NativeWindow* parent,
return ShowMessageBoxUTF16(hwnd_parent, return ShowMessageBoxUTF16(hwnd_parent,
type, type,
utf16_buttons, utf16_buttons,
default_button_index,
cancel_id, cancel_id,
options, options,
base::UTF8ToUTF16(title), base::UTF8ToUTF16(title),
@ -205,6 +209,7 @@ int ShowMessageBox(NativeWindow* parent,
void ShowMessageBox(NativeWindow* parent, void ShowMessageBox(NativeWindow* parent,
MessageBoxType type, MessageBoxType type,
const std::vector<std::string>& buttons, const std::vector<std::string>& buttons,
int default_button_index,
int cancel_id, int cancel_id,
int options, int options,
const std::string& title, const std::string& title,
@ -224,13 +229,13 @@ void ShowMessageBox(NativeWindow* parent,
unretained->message_loop()->PostTask( unretained->message_loop()->PostTask(
FROM_HERE, FROM_HERE,
base::Bind(&RunMessageBoxInNewThread, base::Unretained(unretained), base::Bind(&RunMessageBoxInNewThread, base::Unretained(unretained),
parent, type, buttons, cancel_id, options, title, message, parent, type, buttons, default_button_index,
detail, icon, callback)); cancel_id, options, title, message, detail, icon, callback));
} }
void ShowErrorBox(const base::string16& title, const base::string16& content) { void ShowErrorBox(const base::string16& title, const base::string16& content) {
ShowMessageBoxUTF16(NULL, MESSAGE_BOX_TYPE_ERROR, {}, 0, 0, L"Error", title, ShowMessageBoxUTF16(NULL, MESSAGE_BOX_TYPE_ERROR, {}, -1, 0, 0, L"Error",
content, gfx::ImageSkia()); title, content, gfx::ImageSkia());
} }
} // namespace atom } // namespace atom