diff options
-rw-r--r-- | content/shell/shell_javascript_dialog.h | 3 | ||||
-rw-r--r-- | content/shell/shell_javascript_dialog_mac.mm | 18 |
2 files changed, 9 insertions, 12 deletions
diff --git a/content/shell/shell_javascript_dialog.h b/content/shell/shell_javascript_dialog.h index a64ba39..01e2a5d 100644 --- a/content/shell/shell_javascript_dialog.h +++ b/content/shell/shell_javascript_dialog.h @@ -10,10 +10,8 @@ #if defined(OS_MACOSX) #if __OBJC__ -@class NSAlert; @class ShellJavaScriptDialogHelper; #else -class NSAlert; class ShellJavaScriptDialogHelper; #endif // __OBJC__ #endif // defined(OS_MACOSX) @@ -41,7 +39,6 @@ class ShellJavaScriptDialog { #if defined(OS_MACOSX) ShellJavaScriptDialogHelper* helper_; // owned - NSAlert* alert_; // weak, owned by |helper_|. #elif defined(OS_WIN) ui::JavascriptMessageType message_type_; HWND dialog_win_; diff --git a/content/shell/shell_javascript_dialog_mac.mm b/content/shell/shell_javascript_dialog_mac.mm index 543bb55..90ad82e 100644 --- a/content/shell/shell_javascript_dialog_mac.mm +++ b/content/shell/shell_javascript_dialog_mac.mm @@ -104,29 +104,29 @@ ShellJavaScriptDialog::ShellJavaScriptDialog( andCallback:callback]; // Show the modal dialog. - alert_ = [helper_ alert]; + NSAlert* alert = [helper_ alert]; NSTextField* field = nil; if (text_field) { field = [helper_ textField]; [field setStringValue:base::SysUTF16ToNSString(default_prompt_text)]; } - [alert_ setDelegate:helper_]; - [alert_ setInformativeText:base::SysUTF16ToNSString(message_text)]; - [alert_ setMessageText:@"Javascript alert"]; - [alert_ addButtonWithTitle:@"OK"]; + [alert setDelegate:helper_]; + [alert setInformativeText:base::SysUTF16ToNSString(message_text)]; + [alert setMessageText:@"Javascript alert"]; + [alert addButtonWithTitle:@"OK"]; if (!one_button) { - NSButton* other = [alert_ addButtonWithTitle:@"Cancel"]; + NSButton* other = [alert addButtonWithTitle:@"Cancel"]; [other setKeyEquivalent:@"\e"]; } - [alert_ + [alert beginSheetModalForWindow:nil // nil here makes it app-modal modalDelegate:helper_ didEndSelector:@selector(alertDidEnd:returnCode:contextInfo:) contextInfo:this]; - if ([alert_ accessoryView]) - [[alert_ window] makeFirstResponder:[alert_ accessoryView]]; + if ([alert accessoryView]) + [[alert window] makeFirstResponder:[alert accessoryView]]; } ShellJavaScriptDialog::~ShellJavaScriptDialog() { |