summaryrefslogtreecommitdiffstats
path: root/chrome/browser
diff options
context:
space:
mode:
Diffstat (limited to 'chrome/browser')
-rw-r--r--chrome/browser/app_modal_dialog.h7
-rw-r--r--chrome/browser/app_modal_dialog_mac.mm13
2 files changed, 18 insertions, 2 deletions
diff --git a/chrome/browser/app_modal_dialog.h b/chrome/browser/app_modal_dialog.h
index b3885c3..31b637b 100644
--- a/chrome/browser/app_modal_dialog.h
+++ b/chrome/browser/app_modal_dialog.h
@@ -18,7 +18,12 @@ typedef JavascriptMessageBoxDialog* NativeDialog;
typedef struct _GtkWidget GtkWidget;
typedef GtkWidget* NativeDialog;
#elif defined(OS_MACOSX)
-typedef void* NativeDialog;
+#if __OBJC__
+@class NSAlert;
+#else
+class NSAlert;
+#endif
+typedef NSAlert* NativeDialog;
#endif
class ExtensionHost;
diff --git a/chrome/browser/app_modal_dialog_mac.mm b/chrome/browser/app_modal_dialog_mac.mm
index c0343be..3b64a87 100644
--- a/chrome/browser/app_modal_dialog_mac.mm
+++ b/chrome/browser/app_modal_dialog_mac.mm
@@ -70,6 +70,13 @@
bridge->OnCancel();
break;
}
+ case NSRunStoppedResponse: { // Window was closed underneath us
+ // Need to call OnCancel() because there is some cleanup that needs
+ // to be done. It won't call back to the javascript since the
+ // AppModalDialog knows that the TabContents was destroyed.
+ bridge->OnCancel();
+ break;
+ }
default: {
NOTREACHED();
}
@@ -117,6 +124,7 @@ void AppModalDialog::CreateAndShowDialog() {
// Show the modal dialog.
NSAlert* alert = [helper alert];
+ dialog_ = alert;
NSTextField* field = nil;
if (text_field) {
field = [helper textField];
@@ -149,7 +157,10 @@ void AppModalDialog::ActivateModalDialog() {
}
void AppModalDialog::CloseModalDialog() {
- NOTIMPLEMENTED();
+ NSAlert* alert = dialog_;
+ DCHECK([alert isKindOfClass:[NSAlert class]]);
+ [NSApp endSheet:[alert window]];
+ dialog_ = nil;
}
int AppModalDialog::GetDialogButtons() {