Add header for asynchronous version of ShowMessageBox.
This commit is contained in:
parent
68bdad9a23
commit
bfe59480e3
3 changed files with 36 additions and 0 deletions
|
@ -8,6 +8,8 @@
|
||||||
#include <string>
|
#include <string>
|
||||||
#include <vector>
|
#include <vector>
|
||||||
|
|
||||||
|
#include "base/callback_forward.h"
|
||||||
|
|
||||||
namespace atom {
|
namespace atom {
|
||||||
|
|
||||||
class NativeWindow;
|
class NativeWindow;
|
||||||
|
@ -18,6 +20,8 @@ enum MessageBoxType {
|
||||||
MESSAGE_BOX_TYPE_WARNING
|
MESSAGE_BOX_TYPE_WARNING
|
||||||
};
|
};
|
||||||
|
|
||||||
|
typedef base::Callback<void(int)> MessageBoxCallback;
|
||||||
|
|
||||||
int ShowMessageBox(NativeWindow* parent_window,
|
int ShowMessageBox(NativeWindow* parent_window,
|
||||||
MessageBoxType type,
|
MessageBoxType type,
|
||||||
const std::vector<std::string>& buttons,
|
const std::vector<std::string>& buttons,
|
||||||
|
@ -25,6 +29,14 @@ int ShowMessageBox(NativeWindow* parent_window,
|
||||||
const std::string& message,
|
const std::string& message,
|
||||||
const std::string& detail);
|
const std::string& detail);
|
||||||
|
|
||||||
|
void ShowMessageBox(NativeWindow* parent_window,
|
||||||
|
MessageBoxType type,
|
||||||
|
const std::vector<std::string>& buttons,
|
||||||
|
const std::string& title,
|
||||||
|
const std::string& message,
|
||||||
|
const std::string& detail,
|
||||||
|
const MessageBoxCallback& callback);
|
||||||
|
|
||||||
} // namespace atom
|
} // namespace atom
|
||||||
|
|
||||||
#endif // BROWSER_UI_MESSAGE_BOX_H_
|
#endif // BROWSER_UI_MESSAGE_BOX_H_
|
||||||
|
|
|
@ -6,6 +6,7 @@
|
||||||
|
|
||||||
#import <Cocoa/Cocoa.h>
|
#import <Cocoa/Cocoa.h>
|
||||||
|
|
||||||
|
#include "base/callback.h"
|
||||||
#include "base/strings/sys_string_conversions.h"
|
#include "base/strings/sys_string_conversions.h"
|
||||||
#include "browser/native_window.h"
|
#include "browser/native_window.h"
|
||||||
#include "browser/ui/nsalert_synchronous_sheet_mac.h"
|
#include "browser/ui/nsalert_synchronous_sheet_mac.h"
|
||||||
|
@ -46,4 +47,15 @@ int ShowMessageBox(NativeWindow* parent_window,
|
||||||
return [alert runModal];
|
return [alert runModal];
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void ShowMessageBox(NativeWindow* parent_window,
|
||||||
|
MessageBoxType type,
|
||||||
|
const std::vector<std::string>& buttons,
|
||||||
|
const std::string& title,
|
||||||
|
const std::string& message,
|
||||||
|
const std::string& detail,
|
||||||
|
const MessageBoxCallback& callback) {
|
||||||
|
callback.Run(ShowMessageBox(
|
||||||
|
parent_window, type, buttons, title, message, detail));
|
||||||
|
}
|
||||||
|
|
||||||
} // namespace atom
|
} // namespace atom
|
||||||
|
|
|
@ -4,6 +4,7 @@
|
||||||
|
|
||||||
#include "browser/ui/message_box.h"
|
#include "browser/ui/message_box.h"
|
||||||
|
|
||||||
|
#include "base/callback.h"
|
||||||
#include "base/message_loop.h"
|
#include "base/message_loop.h"
|
||||||
#include "base/run_loop.h"
|
#include "base/run_loop.h"
|
||||||
#include "base/string_util.h"
|
#include "base/string_util.h"
|
||||||
|
@ -253,4 +254,15 @@ int ShowMessageBox(NativeWindow* parent_window,
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void ShowMessageBox(NativeWindow* parent_window,
|
||||||
|
MessageBoxType type,
|
||||||
|
const std::vector<std::string>& buttons,
|
||||||
|
const std::string& title,
|
||||||
|
const std::string& message,
|
||||||
|
const std::string& detail,
|
||||||
|
const MessageBoxCallback& callback) {
|
||||||
|
callback.Run(ShowMessageBox(
|
||||||
|
parent_window, type, buttons, title, message, detail));
|
||||||
|
}
|
||||||
|
|
||||||
} // namespace atom
|
} // namespace atom
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue