don't show osr dummy window when dialog is shown on mac
This commit is contained in:
parent
35dc6d03b9
commit
13b86598e8
3 changed files with 29 additions and 13 deletions
|
@ -41,7 +41,8 @@ void AtomJavaScriptDialogManager::RunJavaScriptDialog(
|
|||
buttons.push_back("Cancel");
|
||||
}
|
||||
|
||||
atom::ShowMessageBox(NativeWindow::FromWebContents(web_contents),
|
||||
atom::ShowMessageBox(api_web_contents_->IsOffScreen() ? nullptr :
|
||||
NativeWindow::FromWebContents(web_contents),
|
||||
atom::MessageBoxType::MESSAGE_BOX_TYPE_NONE, buttons, -1,
|
||||
0, atom::MessageBoxOptions::MESSAGE_BOX_NONE, "",
|
||||
base::UTF16ToUTF8(message_text), "", "", false,
|
||||
|
|
|
@ -181,15 +181,22 @@ void ShowMessageBox(NativeWindow* parent_window,
|
|||
NSAlert* alert =
|
||||
CreateNSAlert(parent_window, type, buttons, default_id, cancel_id, title,
|
||||
message, detail, checkbox_label, checkbox_checked, icon);
|
||||
ModalDelegate* delegate = [[ModalDelegate alloc] initWithCallback:callback
|
||||
andAlert:alert
|
||||
callEndModal:false];
|
||||
|
||||
NSWindow* window = parent_window ? parent_window->GetNativeWindow() : nil;
|
||||
[alert beginSheetModalForWindow:window
|
||||
modalDelegate:delegate
|
||||
didEndSelector:@selector(alertDidEnd:returnCode:contextInfo:)
|
||||
contextInfo:nil];
|
||||
// Use runModal for synchronous alert without parent, since we don't have a
|
||||
// window to wait for.
|
||||
if (!parent_window || !parent_window->GetNativeWindow()) {
|
||||
[[alert autorelease] runModal];
|
||||
} else {
|
||||
ModalDelegate* delegate = [[ModalDelegate alloc] initWithCallback:callback
|
||||
andAlert:alert
|
||||
callEndModal:false];
|
||||
|
||||
NSWindow* window = parent_window ? parent_window->GetNativeWindow() : nil;
|
||||
[alert beginSheetModalForWindow:window
|
||||
modalDelegate:delegate
|
||||
didEndSelector:@selector(alertDidEnd:returnCode:contextInfo:)
|
||||
contextInfo:nil];
|
||||
}
|
||||
}
|
||||
|
||||
void ShowErrorBox(const base::string16& title, const base::string16& content) {
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue