| OLD | NEW |
| 1 // Copyright (c) 2010 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2010 The Chromium Authors. All rights reserved. |
| 2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
| 3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
| 4 | 4 |
| 5 #include "chrome/browser/js_modal_dialog.h" | 5 #include "chrome/browser/js_modal_dialog.h" |
| 6 | 6 |
| 7 #import <Cocoa/Cocoa.h> | 7 #import <Cocoa/Cocoa.h> |
| 8 | 8 |
| 9 #include "app/l10n_util_mac.h" | 9 #include "app/l10n_util_mac.h" |
| 10 #include "app/message_box_flags.h" | 10 #include "app/message_box_flags.h" |
| (...skipping 121 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 132 dialog_ = alert; | 132 dialog_ = alert; |
| 133 NSTextField* field = nil; | 133 NSTextField* field = nil; |
| 134 if (text_field) { | 134 if (text_field) { |
| 135 field = [helper textField]; | 135 field = [helper textField]; |
| 136 [field setStringValue:base::SysWideToNSString(default_prompt_text_)]; | 136 [field setStringValue:base::SysWideToNSString(default_prompt_text_)]; |
| 137 } | 137 } |
| 138 [alert setDelegate:helper]; | 138 [alert setDelegate:helper]; |
| 139 [alert setInformativeText:base::SysWideToNSString(message_text_)]; | 139 [alert setInformativeText:base::SysWideToNSString(message_text_)]; |
| 140 [alert setMessageText:base::SysWideToNSString(title_)]; | 140 [alert setMessageText:base::SysWideToNSString(title_)]; |
| 141 [alert addButtonWithTitle:default_button]; | 141 [alert addButtonWithTitle:default_button]; |
| 142 if (!one_button) | 142 if (!one_button) { |
| 143 [alert addButtonWithTitle:other_button]; | 143 NSButton* other = [alert addButtonWithTitle:other_button]; |
| 144 [other setKeyEquivalent:@"\e"]; |
| 145 } |
| 144 if (display_suppress_checkbox_) { | 146 if (display_suppress_checkbox_) { |
| 145 [alert setShowsSuppressionButton:YES]; | 147 [alert setShowsSuppressionButton:YES]; |
| 146 NSString* suppression_title = l10n_util::GetNSStringWithFixup( | 148 NSString* suppression_title = l10n_util::GetNSStringWithFixup( |
| 147 IDS_JAVASCRIPT_MESSAGEBOX_SUPPRESS_OPTION); | 149 IDS_JAVASCRIPT_MESSAGEBOX_SUPPRESS_OPTION); |
| 148 [[alert suppressionButton] setTitle:suppression_title]; | 150 [[alert suppressionButton] setTitle:suppression_title]; |
| 149 } | 151 } |
| 150 | 152 |
| 151 [alert beginSheetModalForWindow:nil // nil here makes it app-modal | 153 [alert beginSheetModalForWindow:nil // nil here makes it app-modal |
| 152 modalDelegate:helper | 154 modalDelegate:helper |
| 153 didEndSelector:@selector(alertDidEnd:returnCode:contextInfo:) | 155 didEndSelector:@selector(alertDidEnd:returnCode:contextInfo:) |
| (...skipping 24 matching lines...) Expand all Loading... |
| 178 NOTIMPLEMENTED(); | 180 NOTIMPLEMENTED(); |
| 179 return nil; | 181 return nil; |
| 180 } | 182 } |
| 181 | 183 |
| 182 void JavaScriptAppModalDialog::CloseModalDialog() { | 184 void JavaScriptAppModalDialog::CloseModalDialog() { |
| 183 NSAlert* alert = dialog_; | 185 NSAlert* alert = dialog_; |
| 184 DCHECK([alert isKindOfClass:[NSAlert class]]); | 186 DCHECK([alert isKindOfClass:[NSAlert class]]); |
| 185 [NSApp endSheet:[alert window]]; | 187 [NSApp endSheet:[alert window]]; |
| 186 dialog_ = nil; | 188 dialog_ = nil; |
| 187 } | 189 } |
| OLD | NEW |